Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
johnstonphilip committed Oct 19, 2020
2 parents b8aa370 + 1288938 commit f45eb5c
Show file tree
Hide file tree
Showing 14 changed files with 175 additions and 167 deletions.
18 changes: 8 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,21 @@ commands:
description: "Set commonly used environment variables"
steps:
- run:
name: "Set Theme Slug"
command: |
echo "export THEME_SLUG=$(grep 'textdomain":' /tmp/theme/package.json | awk -F: '{print $2}' | sed -e 's/\s//g' -e 's/[\"\,]//g')" >> ${BASH_ENV}
- run:
name: "Set Theme Version"
name: "Set Theme Variables"
command: |
echo "export THEME_SLUG=genesis-sample" >> ${BASH_ENV}
echo "export THEME_VERSION=$(grep 'version":' /tmp/theme/package.json | awk -F: '{print $2}' | sed -e 's/\s//g' -e 's/[\"\,]//g')" >> ${BASH_ENV}
echo "export THEME_TEXT_DOMAIN=genesis-sample" >> ${BASH_ENV}
- run:
name: "Set Artifact Name"
command: |
echo "export VERSION_ARTIFACT_FILE=${THEME_SLUG}.${THEME_VERSION}.zip" >> ${BASH_ENV}
echo "export VERSION_DATA_FILE=${THEME_SLUG}.${THEME_VERSION}.json" >> ${BASH_ENV}
echo "export VERSION_ARTIFACT_FILE=${THEME_TEXT_DOMAIN}.${THEME_VERSION}.zip" >> ${BASH_ENV}
echo "export VERSION_DATA_FILE=${THEME_TEXT_DOMAIN}.${THEME_VERSION}.json" >> ${BASH_ENV}
- run:
name: "Set Latest Artifact Name"
command: |
echo "export LATEST_ARTIFACT_FILE=${THEME_SLUG}.latest.zip" >> ${BASH_ENV}
echo "export LATEST_DATA_FILE=${THEME_SLUG}.latest.json" >> ${BASH_ENV}
echo "export LATEST_ARTIFACT_FILE=${THEME_TEXT_DOMAIN}.latest.zip" >> ${BASH_ENV}
echo "export LATEST_DATA_FILE=${THEME_TEXT_DOMAIN}.latest.json" >> ${BASH_ENV}
executors:
base:
Expand Down Expand Up @@ -136,7 +134,7 @@ jobs:
cp /tmp/artifacts/${VERSION_DATA_FILE} /tmp/artifacts/${LATEST_DATA_FILE}
- aws-s3/sync:
from: "/tmp/artifacts/"
to: "s3://update.atomicblocks.com/<< parameters.environment >>/${THEME_SLUG}/"
to: "s3://update.atomicblocks.com/<< parameters.environment >>/${THEME_TEXT_DOMAIN}/"

workflows:
version: 2
Expand Down
24 changes: 14 additions & 10 deletions .scripts/makePIServiceData.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,39 @@
*
* @TODO Maybe convert "tags" value to an array?
*/
const fs = require('fs');
const fs = require("fs");

/**
* Run the script
*/
const runScript = function() {
const runScript = function () {
// Sanitize the destination path
const destPath = sanitizeDestPath(process.argv[2]);

// Declare empty data object
let data = {};

// Get array of "theme" keys from process.env.npm_package_theme_*
const keys = Object.keys(process.env).filter(key => key.match(/npm_package_theme_.+/));
const keys = Object.keys(process.env).filter((key) =>
key.match(/npm_package_theme_.+/)
);

// Iterate through keys and populate the data object
// Note: this isn't using a map because we want the output to be an object, not an array
keys.forEach(envKey => {
keys.forEach((envKey) => {
key = envKey.match(/npm_package_theme_(.+)/)[1]; // strip npm_package_theme_ from key
data[key] = process.env[envKey]; // Save to data object
});

// Write data object to a JSON file
const themeName = process.env.THEME_SLUG || data.textdomain;
const themeName = process.env.THEME_TEXT_DOMAIN || data.textdomain;
const themeVersion = process.env.THEME_VERSION || data.version;
const fileName = process.env.VERSION_DATA_FILE || `${themeName}.${themeVersion}.json`;
const fileName =
process.env.VERSION_DATA_FILE || `${themeName}.${themeVersion}.json`;
const filePath = `${destPath}/${fileName}`;

fs.writeFileSync(filePath, JSON.stringify(data));
}
};

/**
* Sanitize destination path
Expand All @@ -41,11 +45,11 @@ const runScript = function() {
*
* @return {string}
*/
const sanitizeDestPath = function(path) {
const sanitizeDestPath = function (path) {
const defaultPath = process.cwd();

// Return default if a path wasn't provided
if( ! path || ! path.length){
if (!path || !path.length) {
return defaultPath;
}

Expand All @@ -55,7 +59,7 @@ const sanitizeDestPath = function(path) {
}

return path;
}
};

// Run the script
runScript();
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Genesis Sample Theme Changelog

## [3.4.0] - 2020-10-20
Genesis Sample 3.4.0 requires the Genesis Blocks plugin.

* Changed: Install Genesis Blocks instead of Atomic Blocks during one-click theme setup.
* Changed: Updated one-click-theme-setup content to use Genesis Blocks.
* Changed: Updated Editor and front-end styles for Genesis Blocks compatibility.

## [3.3.1] - 2020-08-17

### Added
Expand Down
6 changes: 3 additions & 3 deletions config/import/content/about.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
<div class="wp-block-image"><figure class="aligncenter"><img src="$genesis_sample_about_image_url" alt="" class="wp-image-2141"/></figure></div>
<!-- /wp:image -->
<!-- wp:atomic-blocks/ab-spacer {"spacerHeight":29} -->
<div style="color:#ddd" class="wp-block-atomic-blocks-ab-spacer ab-block-spacer ab-divider-solid ab-divider-size-1"><hr style="height:29px"/></div>
<!-- /wp:atomic-blocks/ab-spacer -->
<!-- wp:genesis-blocks/gb-spacer {"spacerHeight":29} -->
<div style="color:#ddd" class="wp-block-genesis-blocks-gb-spacer gb-block-spacer gb-divider-solid gb-divider-size-1"><hr style="height:29px"/></div>
<!-- /wp:genesis-blocks/gb-spacer -->
<!-- wp:columns -->
<div class="wp-block-columns has-2-columns"><!-- wp:column -->
Expand Down
Loading

0 comments on commit f45eb5c

Please sign in to comment.