From ff877bf0486c39399d160f70206e52fcd2ec4d56 Mon Sep 17 00:00:00 2001 From: Sarah Etter Date: Thu, 17 Sep 2015 16:21:29 -0600 Subject: [PATCH] Theme working --- .ftppass | 6 + .idea/ascribe.iml | 1 + Gruntfile.js | 153 ++++++++++++------------ assets/css/ascribe.css | 0 assets/css/ascribe.min.css | 0 assets/css/less/ascribe.less | 0 assets/css/sass/ascribe.scss | 7 -- assets/js/ascribe.js | 8 ++ assets/js/ascribe.min.js | 4 + package.json | 22 ++-- sftpCache.json | 1 + tests/phpunit/Core_Tests.php | 163 -------------------------- tests/phpunit/test-tools/TestCase.php | 75 ------------ tests/qunit/ascribe.html | 14 --- tests/qunit/tests/ascribe.js | 4 - 15 files changed, 108 insertions(+), 350 deletions(-) create mode 100644 .ftppass create mode 100644 assets/css/ascribe.css create mode 100644 assets/css/ascribe.min.css create mode 100644 assets/css/less/ascribe.less delete mode 100644 assets/css/sass/ascribe.scss create mode 100644 assets/js/ascribe.js create mode 100644 assets/js/ascribe.min.js create mode 100644 sftpCache.json delete mode 100644 tests/phpunit/Core_Tests.php delete mode 100644 tests/phpunit/test-tools/TestCase.php delete mode 100644 tests/qunit/ascribe.html delete mode 100644 tests/qunit/tests/ascribe.js diff --git a/.ftppass b/.ftppass new file mode 100644 index 0000000..9a30947 --- /dev/null +++ b/.ftppass @@ -0,0 +1,6 @@ +{ + "key1": { + "username": "ascribe", + "password": "zS!wfsBm9FK$" + } +} \ No newline at end of file diff --git a/.idea/ascribe.iml b/.idea/ascribe.iml index c956989..92f80f6 100644 --- a/.idea/ascribe.iml +++ b/.idea/ascribe.iml @@ -4,5 +4,6 @@ + \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js index 27b931a..82f552b 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -43,18 +43,17 @@ module.exports = function( grunt ) { } } }, - - sass: { - all: { - options: { - precision: 2, - sourceMap: true - }, - files: { - 'assets/css/ascribe.css': 'assets/css/sass/ascribe.scss' - } - } - }, + + less: { + all: { + options: { + sourceMap: false + }, + files: { + 'assets/css/ascribe.css': 'assets/css/less/ascribe.less' + } + } + }, postcss: { @@ -96,8 +95,8 @@ module.exports = function( grunt ) { } }, styles: { - files: ['assets/css/sass/**/*.scss'], - tasks: ['sass', 'autoprefixer', 'cssmin'], + files: ['assets/css/less/**/*.less'], + tasks: ['less', 'autoprefixer', 'cssmin'], options: { debounceDelay: 500 } @@ -110,62 +109,65 @@ module.exports = function( grunt ) { } } }, - clean: { - main: ['release/<%= pkg.version %>'] - }, - copy: { - // Copy the theme to a versioned release directory - main: { - src: [ - '**', - '!**/.*', - '!**/readme.md', - '!node_modules/**', - '!vendor/**', - '!tests/**', - '!release/**', - '!assets/css/sass/**', - '!assets/css/src/**', - '!assets/js/src/**', - '!images/src/**', - '!bootstrap.php', - '!bower.json', - '!composer.json', - '!composer.lock', - '!Gruntfile.js', - '!package.json', - '!phpunit.xml', - '!phpunit.xml.dist' - ], - dest: 'release/<%= pkg.version %>/' - } - }, - compress: { - main: { - options: { - mode: 'zip', - archive: './release/wptheme.<%= pkg.version %>.zip' - }, - expand: true, - cwd: 'release/<%= pkg.version %>/', - src: ['**/*'], - dest: 'wptheme/' - } - }, - phpunit: { - classes: { - dir: 'tests/phpunit/' - }, - options: { - bin: 'vendor/bin/phpunit', - bootstrap: 'bootstrap.php.dist', - colors: true, - testSuffix: 'Tests.php' - } - }, - qunit: { - all: ['tests/qunit/**/*.html'] - } + 'sftp-deploy': { + css: { + auth: { + host: 'server.territorial.ca', + port: 22, + authKey: 'key1' + }, + cache: 'sftpCache.json', + src: '/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/assets/css/', + dest: '/home/ascribe/public_html/wp-content/themes/ascribe/assets/css', + exclusions: ['/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/node_modules', + '/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/release', + '/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/vendor', + '/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/.git', + '/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/.idea', + '/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/**/.DS_Store'], + serverSep: '/', + concurrency: 4, + progress: true + }, + js: { + auth: { + host: 'server.territorial.ca', + port: 22, + authKey: 'key1' + }, + cache: 'sftpCache.json', + src: '/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/assets/js/', + dest: '/home/ascribe/public_html/wp-content/themes/ascribe/assets/js', + exclusions: ['/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/node_modules', + '/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/release', + '/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/vendor', + '/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/.git', + '/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/.idea', + '/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/**/.DS_Store'], + serverSep: '/', + concurrency: 4, + progress: true + }, + controller: { + auth: { + host: 'server.territorial.ca', + port: 22, + authKey: 'key1' + }, + cache: 'sftpCache.json', + src: '/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/controller/', + dest: '/home/ascribe/public_html/wp-content/themes/ascribe/controller/', + exclusions: ['/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/node_modules', + '/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/release', + '/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/vendor', + '/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/.git', + '/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/.idea', + '/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/**/.DS_Store'], + serverSep: '/', + concurrency: 4, + progress: true + } + } } ); // Load tasks @@ -173,16 +175,13 @@ module.exports = function( grunt ) { // Register tasks - grunt.registerTask( 'css', ['sass', 'postcss', 'cssmin'] ); - + grunt.registerTask( 'css', ['less', 'postcss', 'cssmin', 'sftp-deploy:css'] ); - grunt.registerTask( 'js', ['jshint', 'concat', 'uglify'] ); + grunt.registerTask( 'js', ['jshint', 'concat', 'uglify', 'sftp-deploy:js'] ); - grunt.registerTask( 'default', ['css', 'js'] ); + grunt.registerTask( 'controller', ['sftp-deploy:controller'] ); - grunt.registerTask( 'build', ['default', 'clean', 'copy', 'compress'] ); - - grunt.registerTask( 'test', ['phpunit', 'qunit'] ); + grunt.registerTask( 'default', ['css', 'js', 'controller'] ); grunt.util.linefeed = '\n'; }; diff --git a/assets/css/ascribe.css b/assets/css/ascribe.css new file mode 100644 index 0000000..e69de29 diff --git a/assets/css/ascribe.min.css b/assets/css/ascribe.min.css new file mode 100644 index 0000000..e69de29 diff --git a/assets/css/less/ascribe.less b/assets/css/less/ascribe.less new file mode 100644 index 0000000..e69de29 diff --git a/assets/css/sass/ascribe.scss b/assets/css/sass/ascribe.scss deleted file mode 100644 index 4ebfe77..0000000 --- a/assets/css/sass/ascribe.scss +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ascribe - * http://wordpress.org/themes - * - * Copyright (c) 2015 Territorial - * Licensed under the GPLv2+ license. - */ diff --git a/assets/js/ascribe.js b/assets/js/ascribe.js new file mode 100644 index 0000000..ccf7689 --- /dev/null +++ b/assets/js/ascribe.js @@ -0,0 +1,8 @@ +/*! ascribe - v0.0.1 + * http://wordpress.org/themes + * Copyright (c) 2015; * Licensed GPLv2+ */ +( function( window, undefined ) { + 'use strict'; + + +} )( this ); diff --git a/assets/js/ascribe.min.js b/assets/js/ascribe.min.js new file mode 100644 index 0000000..8ba2638 --- /dev/null +++ b/assets/js/ascribe.min.js @@ -0,0 +1,4 @@ +/*! ascribe - v0.0.1 + * http://wordpress.org/themes + * Copyright (c) 2015; * Licensed GPLv2+ */ +!function(a,b){"use strict"}(this); \ No newline at end of file diff --git a/package.json b/package.json index 40e62e7..35e66c3 100644 --- a/package.json +++ b/package.json @@ -14,20 +14,22 @@ "url": "http://territorial.ca" }, "devDependencies": { - "grunt": "^0.4.5", - "grunt-contrib-concat": "^0.5.1", - "grunt-contrib-uglify": "^0.9.1", - "grunt-sass": "^1.0.0", "autoprefixer-core": "^5.2.1", - "grunt-postcss": "^0.5.4", + "grunt": "^0.4.5", + "grunt-contrib-clean": "^0.6.0", + "grunt-contrib-compress": "^0.13.0", + "grunt-contrib-concat": "^0.5.1", + "grunt-contrib-copy": "^0.8.0", "grunt-contrib-cssmin": "^0.12.3", "grunt-contrib-jshint": "^0.11.2", - "grunt-contrib-watch": "^0.6.1", - "grunt-contrib-clean": "^0.6.0", - "grunt-contrib-copy": "^0.8.0", - "grunt-contrib-compress": "^0.13.0", - "grunt-phpunit": "^0.3.6", + "grunt-contrib-less": "^1.0.1", "grunt-contrib-qunit": "^0.7.0", + "grunt-contrib-uglify": "^0.9.1", + "grunt-contrib-watch": "^0.6.1", + "grunt-phpunit": "^0.3.6", + "grunt-postcss": "^0.5.4", + "grunt-sass": "^1.0.0", + "grunt-sftp-deploy": "^0.2.4", "load-grunt-tasks": "^3.2.0", "qunitjs": "~1.18.0" }, diff --git a/sftpCache.json b/sftpCache.json new file mode 100644 index 0000000..888b39a --- /dev/null +++ b/sftpCache.json @@ -0,0 +1 @@ +{"/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/assets/css//ascribe.css":"2015-09-17T22:20:29.000Z","/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/assets/css//ascribe.min.css":"2015-09-17T22:20:29.000Z","/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/assets/css//readme.md":"2015-09-16T23:52:34.000Z","/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/assets/css//less/ascribe.less":"2015-09-17T22:05:05.000Z","/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/assets/js//ascribe.js":"2015-09-17T22:20:36.000Z","/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/assets/js//ascribe.min.js":"2015-09-17T22:20:36.000Z","/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/assets/js//src/ascribe.js":"2015-09-16T23:52:34.000Z","/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/assets/js//vendor/readme.md":"2015-09-16T23:52:34.000Z"} \ No newline at end of file diff --git a/tests/phpunit/Core_Tests.php b/tests/phpunit/Core_Tests.php deleted file mode 100644 index 4e18b64..0000000 --- a/tests/phpunit/Core_Tests.php +++ /dev/null @@ -1,163 +0,0 @@ -assertConditionsMet(); - } - - /** - * Test internationalization integration. - */ - public function test_i18n() { - // Setup - \WP_Mock::wpFunction( 'load_theme_textdomain', array( - 'times' => 1, - 'args' => array( - 'wptheme', - WPTHEME_PATH . '/languages' - ), - ) ); - - // Act - i18n(); - - // Verify - $this->assertConditionsMet(); - } - - /** - * Test scripts enqueue. - */ - public function test_scripts() { - // Regular - \WP_Mock::wpFunction( 'wp_enqueue_script', array( - 'times' => 1, - 'args' => array( - 'wptheme', - 'template_url/assets/js/ascribe.min.js', - array(), - '0.0.1', - true, - ), - ) ); - - scripts(); - $this->assertConditionsMet(); - - // Debug Mode - \WP_Mock::wpFunction( 'wp_enqueue_script', array( - 'times' => 1, - 'args' => array( - 'wptheme', - 'template_url/assets/js/ascribe.js', - array(), - '0.0.1', - true, - ), - ) ); - - scripts( true ); - $this->assertConditionsMet(); - } - - /** - * Test style enqueue. - */ - public function test_styles() { - // Regular - \WP_Mock::wpFunction( 'wp_enqueue_style', array( - 'times' => 1, - 'args' => array( - 'wptheme', - 'url/assets/css/ascribe.min.css', - array(), - '0.0.1', - ), - ) ); - - styles(); - $this->assertConditionsMet(); - - // Debug Mode - \WP_Mock::wpFunction( 'wp_enqueue_style', array( - 'times' => 1, - 'args' => array( - 'wptheme', - 'url/assets/css/ascribe.css', - array(), - '0.0.1', - ), - ) ); - - styles( true ); - $this->assertConditionsMet(); - } - - /** - * Test header meta injection - */ - public function test_header_meta() { - // Setup - $meta = ''; - \WP_Mock::onFilter( 'wptheme_humans' )->with( $meta )->reply( $meta ); - - // Act - ob_start(); - header_meta(); - $result = ob_get_clean(); - - // Verify - $this->assertConditionsMet(); - $this->assertEquals( $meta, $result ); - } -} diff --git a/tests/phpunit/test-tools/TestCase.php b/tests/phpunit/test-tools/TestCase.php deleted file mode 100644 index 21b7613..0000000 --- a/tests/phpunit/test-tools/TestCase.php +++ /dev/null @@ -1,75 +0,0 @@ -setPreserveGlobalState( false ); - return parent::run( $result ); - } - - protected $testFiles = array(); - - public function setUp() { - if ( ! empty( $this->testFiles ) ) { - foreach ( $this->testFiles as $file ) { - if ( file_exists( PROJECT . $file ) ) { - require_once( PROJECT . $file ); - } - } - } - - parent::setUp(); - } - - public function assertActionsCalled() { - $actions_not_added = $expected_actions = 0; - try { - WP_Mock::assertActionsCalled(); - } catch ( \Exception $e ) { - $actions_not_added = 1; - $expected_actions = $e->getMessage(); - } - $this->assertEmpty( $actions_not_added, $expected_actions ); - } - - public function ns( $function ) { - if ( ! is_string( $function ) || false !== strpos( $function, '\\' ) ) { - return $function; - } - - $thisClassName = trim( get_class( $this ), '\\' ); - - if ( ! strpos( $thisClassName, '\\' ) ) { - return $function; - } - - // $thisNamespace is constructed by exploding the current class name on - // namespace separators, running array_slice on that array starting at 0 - // and ending one element from the end (chops the class name off) and - // imploding that using namespace separators as the glue. - $thisNamespace = implode( '\\', array_slice( explode( '\\', $thisClassName ), 0, - 1 ) ); - - return "$thisNamespace\\$function"; - } - - /** - * Define constants after requires/includes - * - * See http://kpayne.me/2012/07/02/phpunit-process-isolation-and-constant-already-defined/ - * for more details - * - * @param \Text_Template $template - */ - public function prepareTemplate( \Text_Template $template ) { - $template->setVar( [ - 'globals' => '$GLOBALS[\'__PHPUNIT_BOOTSTRAP\'] = \'' . $GLOBALS['__PHPUNIT_BOOTSTRAP'] . '\';', - ] ); - parent::prepareTemplate( $template ); - } -} \ No newline at end of file diff --git a/tests/qunit/ascribe.html b/tests/qunit/ascribe.html deleted file mode 100644 index 12810c3..0000000 --- a/tests/qunit/ascribe.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - - QUnit Example - - - -
-
- - - - diff --git a/tests/qunit/tests/ascribe.js b/tests/qunit/tests/ascribe.js deleted file mode 100644 index cb590c4..0000000 --- a/tests/qunit/tests/ascribe.js +++ /dev/null @@ -1,4 +0,0 @@ -// Qunit Tests -test( "hello test", function() { - ok( 1 == "1", "Passed!" ); -});