Skip to content
This repository has been archived by the owner on May 2, 2022. It is now read-only.

Commit

Permalink
Standardizing strings for replacement by the node script
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Ross committed Mar 16, 2018
1 parent 7fbbf26 commit 1411cbd
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 45 deletions.
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"name": "10up/tenup-plugin-scaffold",
"description": "Project Description",
"name": "10up/tenup-scaffold",
"description": "10up Scaffold",
"authors": [
{
"name": "Author",
"email": "email@10up.com"
"email": "info@10up.com"
}
],
"require": {
"php": ">=7.0"
},
"autoload": {
"psr-4": {
"TenUpThemeScaffold\\": "includes/classes/"
"TenUpScaffold\\": "includes/classes/"
}
},
"require-dev": {
Expand Down
10 changes: 5 additions & 5 deletions includes/functions/core.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function setup() {
add_action( 'init', $n( 'i18n' ) );
add_action( 'init', $n( 'init' ) );

do_action( '<%= funcPrefix %>_loaded' );
do_action( 'tenup_scaffold_loaded' );
}

/**
Expand All @@ -32,9 +32,9 @@ function setup() {
* @return void
*/
function i18n() {
$locale = apply_filters( 'plugin_locale', get_locale(), '<%= funcPrefix %>' );
load_textdomain( '<%= funcPrefix %>', WP_LANG_DIR . '/<%= funcPrefix %>/<%= funcPrefix %>-' . $locale . '.mo' );
load_plugin_textdomain( '<%= funcPrefix %>', false, plugin_basename( <%= funcPrefix.toUpperCase() %>_PATH ) . '/languages/' );
$locale = apply_filters( 'plugin_locale', get_locale(), 'tenup-scaffold' );
load_textdomain( 'tenup-scaffold', WP_LANG_DIR . '/tenup-scaffold/tenup-scaffold-' . $locale . '.mo' );
load_plugin_textdomain( 'tenup-scaffold', false, plugin_basename( TENUP_SCAFFOLD_PATH ) . '/languages/' );
}

/**
Expand All @@ -45,7 +45,7 @@ function i18n() {
* @return void
*/
function init() {
do_action( '<%= funcPrefix %>_init' );
do_action( 'tenup_scaffold_init' );
}

/**
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tenup-plugin-scaffold",
"name": "tenup-scaffold",
"version": "1.0.0",
"description": "Project Description",
"description": "10up Scaffold",
"main": "index.js",
"author": {
"name": "10up",
Expand Down
22 changes: 11 additions & 11 deletions plugin.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php
/**
* Plugin Name: <%= projectTitle %>
* Plugin URI: <%= projectHome %>
* Description: <%= description %>
* Plugin Name: TenUpScaffold
* Plugin URI:
* Description:
* Version: 0.1.0
* Author: <%= authorName %>
* Author URI: <%= authorUrl %>
* Text Domain: <%= funcPrefix %>
* Author: 10up
* Author URI: https://10up.com
* Text Domain: tenup-scaffold
* Domain Path: /languages
*/

Expand All @@ -17,13 +17,13 @@
*/

// Useful global constants
define( '<%= funcPrefix.toUpperCase() %>_VERSION', '0.1.0' );
define( '<%= funcPrefix.toUpperCase() %>_URL', plugin_dir_url( __FILE__ ) );
define( '<%= funcPrefix.toUpperCase() %>_PATH', dirname( __FILE__ ) . '/' );
define( '<%= funcPrefix.toUpperCase() %>_INC', <%= funcPrefix.toUpperCase() %>_PATH . 'includes/' );
define( 'TENUP_SCAFFOLD_VERSION', '0.1.0' );
define( 'TENUP_SCAFFOLD_URL', plugin_dir_url( __FILE__ ) );
define( 'TENUP_SCAFFOLD_PATH', dirname( __FILE__ ) . '/' );
define( 'TENUP_SCAFFOLD_INC', TENUP_SCAFFOLD_PATH . 'includes/' );

// Include files
require_once <%= funcPrefix.toUpperCase() %>_INC . 'functions/core.php';
require_once TENUP_SCAFFOLD_INC . 'functions/core.php';


// Activation/Deactivation
Expand Down
11 changes: 5 additions & 6 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
=== <%= projectTitle %> ===
Contributors: <%= authorName %>
Donate link: <%= authorUrl %>
=== 10up Scaffold ===
Contributors: 10up
Tags:
Requires at least: 4.9
Tested up to: 4.9
Stable tag: 0.1.0

<%= description %>
A brief description of the plugin.

== Description ==

Expand All @@ -16,8 +15,8 @@ Stable tag: 0.1.0

= Manual Installation =

1. Upload the entire `/<%= basename %>` directory to the `/wp-content/plugins/` directory.
2. Activate <%= projectTitle %> through the 'Plugins' menu in WordPress.
1. Upload the entire `/tenup-scaffold` directory to the `/wp-content/plugins/` directory.
2. Activate 10up Scaffold through the 'Plugins' menu in WordPress.

== Frequently Asked Questions ==

Expand Down
5 changes: 1 addition & 4 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/**
* <%= projectTitle %>
* <%= projectHome %>
*
* Copyright (c) <%= new Date().getFullYear() %> <%= authorName %>
* 10up Scaffold
*/
5 changes: 1 addition & 4 deletions style.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/**
* <%= projectTitle %>
* <%= projectHome %>
*
* Copyright (c) <%= new Date().getFullYear() %> <%= authorName %>
* 10up Scaffold
*/
8 changes: 4 additions & 4 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
define( 'PROJECT', __DIR__ . '/../includes/' );
}

if ( ! defined( '<%= funcPrefix.toUpperCase() %>_DIR' ) ) {
define( '<%= funcPrefix.toUpperCase() %>_DIR', __DIR__ . '/' );
if ( ! defined( 'TENUP_SCAFFOLD_DIR' ) ) {
define( 'TENUP_SCAFFOLD_DIR', __DIR__ . '/' );
}

// Place any additional bootstrapping requirements here for PHP Unit.
if ( ! defined( 'WP_LANG_DIR' ) ) {
define( 'WP_LANG_DIR', 'lang_dir' );
}
if ( ! defined( '<%= funcPrefix.toUpperCase() %>_PATH' ) ) {
define( '<%= funcPrefix.toUpperCase() %>_PATH', 'path' );
if ( ! defined( 'TENUP_SCAFFOLD_PATH' ) ) {
define( 'TENUP_SCAFFOLD_PATH', 'path' );
}

if ( ! file_exists( __DIR__ . '/../vendor/autoload.php' ) ) {
Expand Down
10 changes: 5 additions & 5 deletions tests/phpunit/test-tools/Core_Tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function test_setup() {
// Setup
\WP_Mock::expectActionAdded( 'init', 'TenUp\<%= namespace %>\Core\i18n' );
\WP_Mock::expectActionAdded( 'init', 'TenUp\<%= namespace %>\Core\init' );
\WP_Mock::expectAction( '<%= funcPrefix %>_loaded' );
\WP_Mock::expectAction( 'tenup_scaffold_loaded' );

// Act
setup();
Expand All @@ -47,10 +47,10 @@ public function test_i18n() {
'args' => array(),
'return' => 'en_US',
) );
\WP_Mock::onFilter( 'plugin_locale' )->with( 'en_US', '<%= funcPrefix %>' )->reply( 'en_US' );
\WP_Mock::onFilter( 'plugin_locale' )->with( 'en_US', 'tenup-scaffold' )->reply( 'en_US' );
\WP_Mock::wpFunction( 'load_textdomain', array(
'times' => 1,
'args' => array( '<%= funcPrefix %>', 'lang_dir/<%= funcPrefix %>/<%= funcPrefix %>-en_US.mo' ),
'args' => array( 'tenup-scaffold', 'lang_dir/tenup-scaffold/tenup-scaffold-en_US.mo' ),
) );
\WP_Mock::wpFunction( 'plugin_basename', array(
'times' => 1,
Expand All @@ -59,7 +59,7 @@ public function test_i18n() {
) );
\WP_Mock::wpFunction( 'load_plugin_textdomain', array(
'times' => 1,
'args' => array( '<%= funcPrefix %>', false, 'path/languages/' ),
'args' => array( 'tenup-scaffold', false, 'path/languages/' ),
) );

// Act
Expand All @@ -74,7 +74,7 @@ public function test_i18n() {
*/
public function test_init() {
// Setup
\WP_Mock::expectAction( '<%= funcPrefix %>_init' );
\WP_Mock::expectAction( 'tenup_scaffold_init' );

// Act
init();
Expand Down

0 comments on commit 1411cbd

Please sign in to comment.