wordless 1.1.6 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0f11a2ba0c5d10d8af4c042ad9c6b08f80b81991
4
- data.tar.gz: '09ce9688d20a69221cf9d680072f2d10375eecba'
3
+ metadata.gz: abc51947354d14e441766bd2a3795c60e171d049
4
+ data.tar.gz: 56f34355ea340cbe2a0dda9df2d67e5d6431aa85
5
5
  SHA512:
6
- metadata.gz: 75a20ba63da3f3638c824217f8601851e6c6c65287be923713572368dd578c530ddf9443781af41a533e52bd915c4c373bc2ca6f638d364eff4aa0c9770256e3
7
- data.tar.gz: 5d5fde0fa0093e4a0fceffb2d99042fd10ad4108583addfa2479d75944e3ddfd50340ef7f6f549aa9313eed10b5749aeba6894a327952478b5af7d6d93239623
6
+ metadata.gz: c5908ccfce224d730c70183fcc4b6329a464c262ce433c9b90a2767afc4384e51cedcbaef62dd0d52c1bf26c08c4dbed1f3ab8549b3de66b09ce148e0213ca96
7
+ data.tar.gz: ecb3d891f91c47e952fe648a75fdd11410ad387e40ba0e414fb02797eb2c262496209ecef57fabe2cec5e285179f17870281decee0c8d8c73c18febae223df86
data/.gitignore CHANGED
@@ -1,6 +1,5 @@
1
1
  /.bundle/
2
2
  /.yardoc
3
- /Gemfile.lock
4
3
  /_yardoc/
5
4
  /coverage/
6
5
  /doc/
@@ -0,0 +1,55 @@
1
+ Rails:
2
+ Enabled: false
3
+
4
+ Rails/Output:
5
+ Enabled: false
6
+
7
+ AllCops:
8
+ TargetRubyVersion: 2.4
9
+ DisplayCopNames: true
10
+ DisplayStyleGuide: true
11
+
12
+ Exclude:
13
+ - 'bin/*'
14
+ - 'spec/fixtures/**/*'
15
+
16
+ Metrics/LineLength:
17
+ Max: 100
18
+
19
+ Metrics/MethodLength:
20
+ Max: 20
21
+
22
+ Metrics/ClassLength:
23
+ Max: 200
24
+
25
+ Metrics/BlockLength:
26
+ Exclude:
27
+ - 'spec/**/*_spec.rb'
28
+ - 'spec/factories/*.rb'
29
+ - '*.gemspec'
30
+
31
+ Metrics/CyclomaticComplexity:
32
+ Max: 10
33
+
34
+ Metrics/PerceivedComplexity:
35
+ Max: 10
36
+
37
+ Style/StringLiterals:
38
+ Enabled: false
39
+ EnforcedStyle: double_quotes
40
+
41
+ Style/Documentation:
42
+ Enabled: false
43
+
44
+ Style/FrozenStringLiteralComment:
45
+ Enabled: false
46
+
47
+ Metrics/AbcSize:
48
+ Max: 40
49
+
50
+ Lint/HandleExceptions:
51
+ Enabled: false
52
+
53
+ Style/FormatStringToken:
54
+ Exclude:
55
+ - 'lib/wordless/wordless_cli.rb'
@@ -0,0 +1,120 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ wordless (2.0.0)
5
+ activesupport
6
+ coffee-script
7
+ compass
8
+ sprockets
9
+ thor (~> 0.19.1)
10
+ wordpress_tools (~> 1.4.1)
11
+ yui-compressor
12
+
13
+ GEM
14
+ remote: https://rubygems.org/
15
+ specs:
16
+ activesupport (5.1.4)
17
+ concurrent-ruby (~> 1.0, >= 1.0.2)
18
+ i18n (~> 0.7)
19
+ minitest (~> 5.1)
20
+ tzinfo (~> 1.1)
21
+ ast (2.3.0)
22
+ byebug (9.1.0)
23
+ chunky_png (1.3.8)
24
+ coderay (1.1.2)
25
+ coffee-script (2.4.1)
26
+ coffee-script-source
27
+ execjs
28
+ coffee-script-source (1.12.2)
29
+ colorize (0.8.1)
30
+ compass (1.0.3)
31
+ chunky_png (~> 1.2)
32
+ compass-core (~> 1.0.2)
33
+ compass-import-once (~> 1.0.5)
34
+ rb-fsevent (>= 0.9.3)
35
+ rb-inotify (>= 0.9)
36
+ sass (>= 3.3.13, < 3.5)
37
+ compass-core (1.0.3)
38
+ multi_json (~> 1.0)
39
+ sass (>= 3.3.0, < 3.5)
40
+ compass-import-once (1.0.5)
41
+ sass (>= 3.2, < 3.5)
42
+ concurrent-ruby (1.0.5)
43
+ diff-lcs (1.3)
44
+ execjs (2.7.0)
45
+ ffi (1.9.18)
46
+ gem-release (1.0.0)
47
+ i18n (0.9.1)
48
+ concurrent-ruby (~> 1.0)
49
+ method_source (0.9.0)
50
+ minitest (5.10.3)
51
+ multi_json (1.12.2)
52
+ parallel (1.12.1)
53
+ parser (2.4.0.2)
54
+ ast (~> 2.3)
55
+ powerpack (0.1.1)
56
+ priscilla (1.0.3)
57
+ colorize (~> 0.7)
58
+ rumoji (~> 0.3)
59
+ pry (0.11.3)
60
+ coderay (~> 1.1.0)
61
+ method_source (~> 0.9.0)
62
+ pry-byebug (3.5.1)
63
+ byebug (~> 9.1)
64
+ pry (~> 0.10)
65
+ rack (2.0.3)
66
+ rainbow (3.0.0)
67
+ rake (10.5.0)
68
+ rb-fsevent (0.10.2)
69
+ rb-inotify (0.9.10)
70
+ ffi (>= 0.5.0, < 2)
71
+ rspec (3.2.0)
72
+ rspec-core (~> 3.2.0)
73
+ rspec-expectations (~> 3.2.0)
74
+ rspec-mocks (~> 3.2.0)
75
+ rspec-core (3.2.3)
76
+ rspec-support (~> 3.2.0)
77
+ rspec-expectations (3.2.1)
78
+ diff-lcs (>= 1.2.0, < 2.0)
79
+ rspec-support (~> 3.2.0)
80
+ rspec-mocks (3.2.1)
81
+ diff-lcs (>= 1.2.0, < 2.0)
82
+ rspec-support (~> 3.2.0)
83
+ rspec-support (3.2.2)
84
+ rubocop (0.52.0)
85
+ parallel (~> 1.10)
86
+ parser (>= 2.4.0.2, < 3.0)
87
+ powerpack (~> 0.1)
88
+ rainbow (>= 2.2.2, < 4.0)
89
+ ruby-progressbar (~> 1.7)
90
+ unicode-display_width (~> 1.0, >= 1.0.1)
91
+ ruby-progressbar (1.9.0)
92
+ rumoji (0.5.0)
93
+ sass (3.4.25)
94
+ sprockets (3.7.1)
95
+ concurrent-ruby (~> 1.0)
96
+ rack (> 1, < 3)
97
+ thor (0.19.4)
98
+ thread_safe (0.3.6)
99
+ tzinfo (1.2.4)
100
+ thread_safe (~> 0.1)
101
+ unicode-display_width (1.3.0)
102
+ wordpress_tools (1.4.1)
103
+ activesupport (~> 5.0)
104
+ thor (~> 0.19.1)
105
+ yui-compressor (0.12.0)
106
+
107
+ PLATFORMS
108
+ ruby
109
+
110
+ DEPENDENCIES
111
+ gem-release
112
+ priscilla (~> 1.0)
113
+ pry-byebug (~> 3.0)
114
+ rake (~> 10.0)
115
+ rspec (~> 3.2.0)
116
+ rubocop
117
+ wordless!
118
+
119
+ BUNDLED WITH
120
+ 1.15.4
@@ -1,17 +1,14 @@
1
1
  ![Wordless logo](https://raw.githubusercontent.com/welaika/wordless_gem/master/assets/images/wordless_gem.png)
2
2
 
3
- A command line tool to help manage your [Wordless](http://welaika.github.com/wordless/)-based WordPress sites.
3
+ The quickest CLI tool to setup a new WordPress locally. [Wordless](https://github.com/welaika/wordless) ready.
4
4
 
5
- [![Build Status](https://semaphoreapp.com/api/v1/projects/1b1be0c0-b8aa-4778-a644-675ca3f7b9e4/303149/shields_badge.svg)](https://semaphoreapp.com/welaika/wordless_gem)
5
+ [![Build Status](https://semaphoreci.com/api/v1/welaika/wordless_gem/branches/master/badge.svg)](https://semaphoreci.com/welaika/wordless_gem)
6
6
 
7
7
  ## Premise
8
8
 
9
- This is a ruby-gem, so we expect you have already installed _ruby_; if it isn't
9
+ This is a ruby-gem, so we expect you have already installed _ruby_, since it is there by default on Mac and Linux; if it isn't
10
10
  the case, probably you'll like to take a look to [rbenv](https://github.com/sstephenson/rbenv).
11
11
 
12
- Wordless ~~can't~~ can recognize if you are inside a wordpress' dirtree if you ~~won't
13
- be in the root dir~~ are in any subdirectory, starting from [commit df5e408](https://github.com/welaika/wordless_gem/commit/df5e408fcdcb54cccdf2e08c9a0c1873fbc675c4). ~~so use it from the root dir.~~ Easy peasy.
14
-
15
12
  ## Installation
16
13
 
17
14
  gem install wordless
@@ -21,21 +18,20 @@ be in the root dir~~ are in any subdirectory, starting from [commit df5e408](htt
21
18
  wordless help
22
19
 
23
20
  Tasks:
24
- wordless clean # Clean static assets
25
- wordless compile # Compile static assets
26
- wordless deploy # Deploy your WordPress site using the deploy_command defined in your Wordfile
27
21
  wordless help [TASK] # Describe available tasks or one specific task
28
- wordless install # Install the Wordless plugin into an existing WordPress installation
29
- wordless new [NAME] # Download WordPress in specified directory, install the Wordless plugin and create a Wordless theme
30
- wordless theme [NAME] # Create a new Wordless theme NAME
22
+ wordless new <NAME> # Download WordPress in specified directory, install the Wordless plugin and create a Wordless theme
31
23
 
32
24
  #### new
33
25
 
34
- Create a new Wordless-enabled WordPress site in directory `mysite`. This downloads the latest stable release of WordPress (you can also specify a locale):
26
+ Create a new Wordless-enabled WordPress site in directory `NAME`. This downloads the latest stable release of WordPress (you can also specify a locale):
35
27
 
36
28
  wordless new mysite
37
29
 
38
30
  ```bash
31
+ > wordless help new
32
+ Usage:
33
+ wordless new <NAME>
34
+
39
35
  Options:
40
36
  [--force] # Overwrite existing WP-CLI / WP-CLI Server installation
41
37
  -l, [--locale=LOCALE] # WordPress locale
@@ -55,76 +51,44 @@ Options:
55
51
  # Default: http://localhost:8080
56
52
  ```
57
53
 
58
- ##### caveats
59
-
60
- - Default db-password is no password
61
-
62
- #### install
63
-
64
- If you already have WordPress installed, you can install the Wordless plugin (this currently installs from the master branch on GitHub):
65
-
66
- wordless install
67
-
68
- #### theme
69
-
70
- Once Wordless is installed, you can create a new Wordless theme:
71
-
72
- wordless theme mytheme
73
-
74
- Note: don't try at home to use `wordless theme .`: it won't work! So call it within
75
- the `wp-content/themes` dir and pass a theme name as argument.
76
-
77
- #### compile
78
-
79
- Note: if you have no idea why the need to compile assets, you should read the
80
- Wordless' README.
54
+ This command will:
81
55
 
82
- Compile your site's static assets:
56
+ * Check if nodejs and necessary global modules are installed
57
+ * Setup a new database
58
+ * Install WP-CLI (prompt if already installed)
59
+ * Download WordPress
60
+ * Configure WordPress
61
+ * Bootstrap and prepare a new Wordless theme
62
+ * Make you a happier developer
83
63
 
84
- wordless compile
64
+ A super **short video to understand** how much time a new development WordPress site should require to be up and running.
85
65
 
86
- #### clean
66
+ https://youtu.be/Tu1xMtMoahk
87
67
 
88
- Clean your compiled static assets:
68
+ ## Notes
89
69
 
90
- wordless clean
91
-
92
- #### deploy
93
-
94
- Deploy your wordless installation using the `deploy_command` specified in your Wordfile:
95
-
96
- wordless deploy
97
-
98
- You can also use the refresh option `-r` to compile your assets before deploying and clean your assets after:
99
-
100
- wordless deploy -r
70
+ - Be sure to have MySQL running before start the installation process: we have to create a database
71
+ - Default db-password is no password. Use the `--db-password=` option if you have one
72
+ - If a DB with the same name is already present, we will give up. Sorry.
73
+ - If you attempt to download a WordPress localization that's outdated, the latest English version will be downloaded instead.
74
+ - Not tested on Windows
101
75
 
102
- ## Configuration
76
+ ## Wordless < 2 ?
103
77
 
104
- You can, **optionally**, create a `Wordfile` to customize the behaviour of wordless:
78
+ If you are still working with an old Wordless theme and you need the ruby-releated features
79
+ of the `wordless` gem, you need to install the last version 1.x version released
105
80
 
106
- ```yaml
107
- wordless_repo: 'git://github.com/welaika/wordless.git'
108
- static_css:
109
- - 'wp-content/themes/mytheme/assets/stylesheets/screen.css'
110
- - 'wp-content/themes/mytheme/assets/stylesheets/print.css'
111
- static_js:
112
- - 'wp-content/themes/mytheme/assets/javascripts/application.js'
113
- - 'wp-content/themes/mytheme/assets/javascripts/mobile.js'
114
- deploy_command: 'wordmove push -t'
81
+ ```
82
+ gem uninstall wordless
83
+ gem install wordless -v '1.1.6'
115
84
  ```
116
85
 
117
- **Note**: remember to add `screen.css` and/or `application.js` if you want to define `static_css` or `static_js`
118
-
119
- ## Caveats
120
-
121
- - If you attempt to download a WordPress localization that's outdated, the latest English version will be downloaded instead.
122
- - Not tested on Windows
86
+ and you can read the old README [here](https://github.com/welaika/wordless_gem/tree/v1.1.2)
123
87
 
124
88
  ## Running specs
125
89
 
126
90
  ```bash
127
- bundle install && ./setup_tests.sh && rspec
91
+ bundle install && ./bin/setup.sh && rspec
128
92
  ```
129
93
 
130
94
  We've noticed problems running tests while using `rvm`; all of them solved using `rbenv`.
@@ -133,7 +97,7 @@ the CI tool to _sempaphore_, which use rbenv, so pull requests will be tested in
133
97
  environement.
134
98
 
135
99
  ## Need more tools?
136
- Visit [Wordpress Tools](http://wptools.it).
100
+ Visit [Wordpress Tools](https://www.wptools.it).
137
101
 
138
102
  ## Contributing
139
103
 
@@ -146,4 +110,4 @@ Visit [Wordpress Tools](http://wptools.it).
146
110
 
147
111
  ## Author
148
112
 
149
- made with ❤️ and ☕️ by [weLaika](http://dev.welaika.com)
113
+ made with ❤️ and ☕️ by [weLaika](https://dev.welaika.com)
data/Rakefile CHANGED
@@ -1,7 +1,9 @@
1
- #!/usr/bin/env rake
2
-
3
1
  require "bundler/gem_tasks"
4
2
  require 'rspec/core/rake_task'
3
+ require 'rubocop/rake_task'
5
4
 
6
5
  RSpec::Core::RakeTask.new(:spec)
7
- task :default => :spec
6
+ task default: :spec
7
+
8
+ RuboCop::RakeTask.new(:rubocop)
9
+ task default: :rubocop
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'rake' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require "pathname"
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require "rubygems"
15
+ require "bundler/setup"
16
+
17
+ load Gem.bin_path("rake", "rake")
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'rubocop' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require "pathname"
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require "rubygems"
15
+ require "bundler/setup"
16
+
17
+ load Gem.bin_path("rubocop", "rubocop")
@@ -13,16 +13,10 @@ function log {
13
13
 
14
14
  log "Deleting {$FIXTURE_PATH}..."
15
15
  rm -rf $FIXTURE_PATH
16
- mkdir $FIXTURE_PATH
16
+ mkdir -p $FIXTURE_PATH
17
17
  echo "Done!"
18
18
 
19
19
  log "Downloading wordless from github..."
20
20
  cd $FIXTURE_PATH
21
21
  wget $WORDLESS_ARCHIVE -O - | tar -xz --strip 1
22
22
  echo "Done!"
23
-
24
- log "Customizing ruby and compass paths..."
25
- cp -f ../wordless_preferences.php $WORDLESS_PREFERENCES
26
- perl -p -i -e "s|<RUBY_PATH>|$(which ruby)|" $WORDLESS_PREFERENCES
27
- perl -p -i -e "s|<COMPASS_PATH>|$(which compass)|" $WORDLESS_PREFERENCES
28
- echo "Done!"
@@ -9,39 +9,17 @@ module Wordless
9
9
  end
10
10
  end
11
11
 
12
- desc "new [NAME]", "Download WordPress in specified directory, install the Wordless plugin and create a Wordless theme"
12
+ desc "new <NAME>", "Download WordPress in specified directory,
13
+ install the Wordless plugin and create a Wordless theme"
13
14
  add_method_options(shared_options)
14
- method_option :bare, type: :boolean, aliases: "-b", desc: "Remove default themes and plugins", default: true
15
+ method_option :bare,
16
+ type: :boolean,
17
+ aliases: "-b",
18
+ desc: "Remove default themes and plugins",
19
+ default: true
20
+
15
21
  def new(name)
16
22
  wordless_cli.start(name)
17
23
  end
18
-
19
- desc "install", "Install the Wordless plugin into an existing WordPress installation"
20
- def install
21
- wordless_cli.install_wordless
22
- end
23
-
24
- desc "theme [NAME]", "Create a new Wordless theme NAME"
25
- def theme(name)
26
- wordless_cli.create_theme(name)
27
- end
28
-
29
- desc "compile", "Compile static assets"
30
- def compile
31
- wordless_cli.compile
32
- end
33
-
34
- desc "clean", "Clean static assets"
35
- def clean
36
- wordless_cli.clean
37
- end
38
-
39
- desc "deploy", "Deploy your WordPress site using the deploy_command defined in your Wordfile"
40
- method_option :refresh, aliases: "-r", desc: "Compile static assets before deploying and clean them afterwards"
41
- method_option :command, aliases: "-c", desc: "Use a custom deploy command"
42
- def deploy
43
- wordless_cli.deploy
44
- end
45
24
  end
46
25
  end
47
-
@@ -3,7 +3,7 @@ module Wordless
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  included do
6
- [ :say, :run ].each do |sym|
6
+ %i[say run].each do |sym|
7
7
  define_method sym do |*args|
8
8
  thor.send(sym, *args)
9
9
  end
@@ -51,7 +51,7 @@ module Wordless
51
51
  end
52
52
 
53
53
  def void
54
- RbConfig::CONFIG['host_os'] =~ /msdos|mswin|djgpp|mingw/ ? 'NUL' : '/dev/null'
54
+ /msdos|mswin|djgpp|mingw/.match? RbConfig::CONFIG['host_os'] ? 'NUL' : '/dev/null'
55
55
  end
56
56
  end
57
57
  end
@@ -1,3 +1,3 @@
1
1
  module Wordless
2
- VERSION = "1.1.6"
2
+ VERSION = "2.0.0".freeze
3
3
  end
@@ -15,8 +15,10 @@ module Wordless
15
15
  PATH::WORDFILE => 'Wordfile',
16
16
  PATH::WP_CONTENT => 'wp-content',
17
17
  PATH::PLUGINS => 'wp-content/plugins',
18
- PATH::THEMES => 'wp-content/themes',
19
- }
18
+ PATH::THEMES => 'wp-content/themes'
19
+ }.freeze
20
+
21
+ GLOBAL_NODE_MODULES = %w[foreman yarn].freeze
20
22
 
21
23
  def initialize(thor, options = {})
22
24
  @options = options
@@ -24,14 +26,23 @@ module Wordless
24
26
  end
25
27
 
26
28
  def start(name)
29
+ install_global_node_modules
27
30
  install_wordpress_and_wp_cli(name)
28
31
 
29
32
  Dir.chdir(name)
30
33
 
31
34
  install_wordless
32
- create_theme(name)
33
- activate_theme(name)
35
+ create_and_activate_theme(name)
34
36
  set_permalinks
37
+
38
+ Dir.chdir("wp-content/themes/#{name}")
39
+
40
+ info("Installing theme's node modules...")
41
+ run_command("yarn install") || error("Problem installing theme's node modules")
42
+
43
+ success("All done! Now yor're ready to use Wordless with following commands:")
44
+ info("`cd #{name}/wp-content/themes/#{name}`")
45
+ info("`yarn run server`")
35
46
  end
36
47
 
37
48
  def install_wordless
@@ -49,61 +60,26 @@ module Wordless
49
60
  end
50
61
  end
51
62
 
52
- def create_theme(name)
53
- at_wordpress_root do
54
- if File.directory?(themes_path)
55
- if run_command("php #{File.join(lib_dir, 'theme_builder.php')} #{name}")
56
- success("Created a new Wordless theme in '#{File.join(themes_path, name)}'.")
57
- else
58
- error("Couldn't create Wordless theme.")
59
- end
60
- else
61
- error("Directory '#{themes_path}' not found.")
62
- end
63
- end
64
- end
65
-
66
- def compile
67
- at_wordpress_root do
68
- if system "php #{File.join(lib_dir, 'compile_assets.php')}"
69
- success("Compiled static assets.")
70
- else
71
- error("Couldn't compile static assets.")
72
- end
73
- end
74
- end
75
-
76
- def clean
77
- at_wordpress_root do
78
- if File.directory?(themes_path)
79
- static_css = Array(config[:static_css] || Dir['wp-content/themes/*/assets/stylesheets/screen.css'])
80
- static_js = Array(config[:static_js] || Dir['wp-content/themes/*/assets/javascripts/application.js'])
63
+ def install_global_node_modules
64
+ info("Check for necessary global NPM packages")
65
+ run_command('which npm') ||
66
+ error("Node isn't installed. Head to https://nodejs.org/en/download/package-manager")
81
67
 
82
- (static_css + static_js).each do |file|
83
- FileUtils.rm_f(file) if File.exist?(file)
84
- end
68
+ global_node_modules = GLOBAL_NODE_MODULES.dup
85
69
 
86
- success("Cleaned static assets.")
87
- else
88
- error("Directory '#{themes_path}' not found.")
89
- end
70
+ global_node_modules.reject! do |m|
71
+ run_command("npm list -g #{m}")
90
72
  end
91
- end
92
-
93
- def deploy
94
- at_wordpress_root do
95
- compile if options['refresh']
96
-
97
- deploy_command = options['command'].presence || config[:deploy_command]
98
73
 
99
- if deploy_command
100
- system("#{deploy_command}")
101
- else
102
- error("deploy_command not set. Make sure it is included in your Wordfile.")
103
- end
74
+ if global_node_modules.empty?
75
+ success("Global NPM packages needed by Wordless already installed. Good job!")
76
+ return true
77
+ end
104
78
 
105
- clean if options['refresh']
79
+ global_node_modules.each do |m|
80
+ run_command("npm install -g #{m}") && success("Installed NPM package #{m} globally")
106
81
  end
82
+ success("Done!")
107
83
  end
108
84
 
109
85
  private
@@ -115,11 +91,11 @@ module Wordless
115
91
  end
116
92
 
117
93
  def lib_dir
118
- @@lib_dir ||= File.expand_path(File.dirname(__FILE__))
94
+ @lib_dir ||= __dir__
119
95
  end
120
96
 
121
97
  def wordpress_dir(current_dir = Dir.pwd)
122
- @wordpress_dir ||= (
98
+ @wordpress_dir ||= begin
123
99
  current_dir = File.expand_path(current_dir)
124
100
 
125
101
  if File.exist?(File.join(current_dir, wp_content_path))
@@ -129,7 +105,7 @@ module Wordless
129
105
  else
130
106
  wordpress_dir(upper_dir(current_dir))
131
107
  end
132
- )
108
+ end
133
109
  end
134
110
 
135
111
  def last_dir?(directory)
@@ -141,13 +117,13 @@ module Wordless
141
117
  end
142
118
 
143
119
  def config
144
- @@config ||= (
120
+ @config ||= begin
145
121
  if File.exist?(wordfile_path)
146
- YAML::load(File.open(wordfile_path)).symbolize_keys
122
+ YAML.safe_load(File.open(wordfile_path)).symbolize_keys
147
123
  else
148
124
  {}
149
125
  end
150
- )
126
+ end
151
127
  end
152
128
 
153
129
  def at_wordpress_root
@@ -164,18 +140,18 @@ module Wordless
164
140
  WordPressTools::CLI.new.invoke('new', [name], options)
165
141
  end
166
142
 
167
- def activate_theme(name)
143
+ def create_and_activate_theme(name)
168
144
  at_wordpress_root do
169
145
  info("Activating theme...")
170
- run_command("wp theme activate #{name}") || error("Cannot activate theme '#{name}'")
146
+ run_command("wp wordless theme create #{name}") || error("Cannot activate theme '#{name}'")
171
147
  success("Done!")
172
148
  end
173
149
  end
174
150
 
175
151
  def set_permalinks
176
152
  at_wordpress_root do
177
- info("Setting permalinks for wordless...")
178
- run_command("wp rewrite structure /%postname%/") || error("Cannot set permalinks")
153
+ info("Setting permalinks...")
154
+ run_command('wp rewrite structure /%postname%/') || error("Cannot set permalinks")
179
155
  success("Done!")
180
156
  end
181
157
  end
@@ -1,4 +1,3 @@
1
- # coding: utf-8
2
1
  lib = File.expand_path('../lib', __FILE__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require "wordless/version"
@@ -6,31 +5,39 @@ require "wordless/version"
6
5
  Gem::Specification.new do |spec|
7
6
  spec.name = "wordless"
8
7
  spec.version = Wordless::VERSION
9
- spec.authors = ["Étienne Després", "Alessandro Fazzi", "Filippo Gangi Dino", "Ju Liu", "Fabrizio Monti"]
10
- spec.email = ["etienne@molotov.ca", "alessandro.fazzi@welaika.com", "filippo.gangidino@welaika.com", "ju.liu@welaika.com", "fabrizio.monti@welaika.com"]
11
- spec.summary = %q{Manage Wordless themes.}
12
- spec.description = %q{Command line tool to manage Wordless themes.}
8
+ spec.authors = ["Étienne Després", "Alessandro Fazzi",
9
+ "Filippo Gangi Dino", "Ju Liu", "Fabrizio Monti"]
10
+ spec.email = ["etienne@molotov.ca",
11
+ "alessandro.fazzi@welaika.com",
12
+ "filippo.gangidino@welaika.com",
13
+ "ju.liu@welaika.com",
14
+ "fabrizio.monti@welaika.com"]
15
+ spec.summary = 'Manage Wordless themes.'
16
+ spec.description = 'The quickest CLI tool to setup a new WordPress locally. Wordless ready.'
13
17
  spec.homepage = "http://github.com/welaika/wordless_gem"
14
18
  spec.license = "MIT"
15
19
 
16
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
+ spec.files = `git ls-files -z`
21
+ .split("\x0")
22
+ .reject { |f| f.match(%r{^(test|spec|features)/}) }
17
23
  spec.bindir = "exe"
18
24
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
25
  spec.require_paths = ["lib"]
20
26
 
21
- spec.required_ruby_version = ">= 2.1.2"
27
+ spec.required_ruby_version = ">= 2.4.1"
22
28
 
23
- spec.add_dependency "thor", "~> 0.19.1"
24
29
  spec.add_dependency "activesupport"
25
- spec.add_dependency "sprockets"
26
- spec.add_dependency "compass"
27
30
  spec.add_dependency "coffee-script"
31
+ spec.add_dependency "compass"
32
+ spec.add_dependency "sprockets"
33
+ spec.add_dependency "thor", "~> 0.19.1"
34
+ spec.add_dependency "wordpress_tools", "~> 1.4.1"
28
35
  spec.add_dependency "yui-compressor"
29
- spec.add_dependency "wordpress_tools", "~> 1.3.0"
30
36
 
31
- spec.add_development_dependency "rspec", "~> 3.2.0"
32
- spec.add_development_dependency "pry-byebug", "~> 3.0"
33
- spec.add_development_dependency "priscilla", "~> 1.0"
34
37
  spec.add_development_dependency "gem-release"
38
+ spec.add_development_dependency "priscilla", "~> 1.0"
39
+ spec.add_development_dependency "pry-byebug", "~> 3.0"
40
+ spec.add_development_dependency "rake", "~> 10.0"
41
+ spec.add_development_dependency "rspec", "~> 3.2.0"
42
+ spec.add_development_dependency "rubocop"
35
43
  end
36
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wordless
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.6
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Étienne Després
@@ -12,24 +12,24 @@ authors:
12
12
  autorequire:
13
13
  bindir: exe
14
14
  cert_chain: []
15
- date: 2017-07-12 00:00:00.000000000 Z
15
+ date: 2018-01-04 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
- name: thor
18
+ name: activesupport
19
19
  requirement: !ruby/object:Gem::Requirement
20
20
  requirements:
21
- - - "~>"
21
+ - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.19.1
23
+ version: '0'
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
27
27
  requirements:
28
- - - "~>"
28
+ - - ">="
29
29
  - !ruby/object:Gem::Version
30
- version: 0.19.1
30
+ version: '0'
31
31
  - !ruby/object:Gem::Dependency
32
- name: activesupport
32
+ name: coffee-script
33
33
  requirement: !ruby/object:Gem::Requirement
34
34
  requirements:
35
35
  - - ">="
@@ -43,7 +43,7 @@ dependencies:
43
43
  - !ruby/object:Gem::Version
44
44
  version: '0'
45
45
  - !ruby/object:Gem::Dependency
46
- name: sprockets
46
+ name: compass
47
47
  requirement: !ruby/object:Gem::Requirement
48
48
  requirements:
49
49
  - - ">="
@@ -57,7 +57,7 @@ dependencies:
57
57
  - !ruby/object:Gem::Version
58
58
  version: '0'
59
59
  - !ruby/object:Gem::Dependency
60
- name: compass
60
+ name: sprockets
61
61
  requirement: !ruby/object:Gem::Requirement
62
62
  requirements:
63
63
  - - ">="
@@ -71,7 +71,35 @@ dependencies:
71
71
  - !ruby/object:Gem::Version
72
72
  version: '0'
73
73
  - !ruby/object:Gem::Dependency
74
- name: coffee-script
74
+ name: thor
75
+ requirement: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - "~>"
78
+ - !ruby/object:Gem::Version
79
+ version: 0.19.1
80
+ type: :runtime
81
+ prerelease: false
82
+ version_requirements: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - "~>"
85
+ - !ruby/object:Gem::Version
86
+ version: 0.19.1
87
+ - !ruby/object:Gem::Dependency
88
+ name: wordpress_tools
89
+ requirement: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - "~>"
92
+ - !ruby/object:Gem::Version
93
+ version: 1.4.1
94
+ type: :runtime
95
+ prerelease: false
96
+ version_requirements: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - "~>"
99
+ - !ruby/object:Gem::Version
100
+ version: 1.4.1
101
+ - !ruby/object:Gem::Dependency
102
+ name: yui-compressor
75
103
  requirement: !ruby/object:Gem::Requirement
76
104
  requirements:
77
105
  - - ">="
@@ -85,13 +113,13 @@ dependencies:
85
113
  - !ruby/object:Gem::Version
86
114
  version: '0'
87
115
  - !ruby/object:Gem::Dependency
88
- name: yui-compressor
116
+ name: gem-release
89
117
  requirement: !ruby/object:Gem::Requirement
90
118
  requirements:
91
119
  - - ">="
92
120
  - !ruby/object:Gem::Version
93
121
  version: '0'
94
- type: :runtime
122
+ type: :development
95
123
  prerelease: false
96
124
  version_requirements: !ruby/object:Gem::Requirement
97
125
  requirements:
@@ -99,63 +127,63 @@ dependencies:
99
127
  - !ruby/object:Gem::Version
100
128
  version: '0'
101
129
  - !ruby/object:Gem::Dependency
102
- name: wordpress_tools
130
+ name: priscilla
103
131
  requirement: !ruby/object:Gem::Requirement
104
132
  requirements:
105
133
  - - "~>"
106
134
  - !ruby/object:Gem::Version
107
- version: 1.3.0
108
- type: :runtime
135
+ version: '1.0'
136
+ type: :development
109
137
  prerelease: false
110
138
  version_requirements: !ruby/object:Gem::Requirement
111
139
  requirements:
112
140
  - - "~>"
113
141
  - !ruby/object:Gem::Version
114
- version: 1.3.0
142
+ version: '1.0'
115
143
  - !ruby/object:Gem::Dependency
116
- name: rspec
144
+ name: pry-byebug
117
145
  requirement: !ruby/object:Gem::Requirement
118
146
  requirements:
119
147
  - - "~>"
120
148
  - !ruby/object:Gem::Version
121
- version: 3.2.0
149
+ version: '3.0'
122
150
  type: :development
123
151
  prerelease: false
124
152
  version_requirements: !ruby/object:Gem::Requirement
125
153
  requirements:
126
154
  - - "~>"
127
155
  - !ruby/object:Gem::Version
128
- version: 3.2.0
156
+ version: '3.0'
129
157
  - !ruby/object:Gem::Dependency
130
- name: pry-byebug
158
+ name: rake
131
159
  requirement: !ruby/object:Gem::Requirement
132
160
  requirements:
133
161
  - - "~>"
134
162
  - !ruby/object:Gem::Version
135
- version: '3.0'
163
+ version: '10.0'
136
164
  type: :development
137
165
  prerelease: false
138
166
  version_requirements: !ruby/object:Gem::Requirement
139
167
  requirements:
140
168
  - - "~>"
141
169
  - !ruby/object:Gem::Version
142
- version: '3.0'
170
+ version: '10.0'
143
171
  - !ruby/object:Gem::Dependency
144
- name: priscilla
172
+ name: rspec
145
173
  requirement: !ruby/object:Gem::Requirement
146
174
  requirements:
147
175
  - - "~>"
148
176
  - !ruby/object:Gem::Version
149
- version: '1.0'
177
+ version: 3.2.0
150
178
  type: :development
151
179
  prerelease: false
152
180
  version_requirements: !ruby/object:Gem::Requirement
153
181
  requirements:
154
182
  - - "~>"
155
183
  - !ruby/object:Gem::Version
156
- version: '1.0'
184
+ version: 3.2.0
157
185
  - !ruby/object:Gem::Dependency
158
- name: gem-release
186
+ name: rubocop
159
187
  requirement: !ruby/object:Gem::Requirement
160
188
  requirements:
161
189
  - - ">="
@@ -168,7 +196,7 @@ dependencies:
168
196
  - - ">="
169
197
  - !ruby/object:Gem::Version
170
198
  version: '0'
171
- description: Command line tool to manage Wordless themes.
199
+ description: The quickest CLI tool to setup a new WordPress locally. Wordless ready.
172
200
  email:
173
201
  - etienne@molotov.ca
174
202
  - alessandro.fazzi@welaika.com
@@ -182,25 +210,25 @@ extra_rdoc_files: []
182
210
  files:
183
211
  - ".gitignore"
184
212
  - ".rspec"
185
- - ".ruby-gemset"
213
+ - ".rubocop.yml"
186
214
  - ".ruby-version"
187
215
  - ".vscode/launch.json"
188
216
  - Gemfile
217
+ - Gemfile.lock
189
218
  - LICENSE
190
219
  - README.mdown
191
220
  - Rakefile
192
221
  - assets/images/wordless_gem.png
193
222
  - bin/autospec
223
+ - bin/rake
194
224
  - bin/rspec
225
+ - bin/rubocop
195
226
  - bin/setup.sh
196
227
  - exe/wordless
197
228
  - lib/wordless.rb
198
229
  - lib/wordless/cli.rb
199
230
  - lib/wordless/cli_helper.rb
200
- - lib/wordless/compile_assets.php
201
- - lib/wordless/theme_builder.php
202
231
  - lib/wordless/version.rb
203
- - lib/wordless/wordless_bridge.php
204
232
  - lib/wordless/wordless_cli.rb
205
233
  - wordless.gemspec
206
234
  homepage: http://github.com/welaika/wordless_gem
@@ -215,7 +243,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
215
243
  requirements:
216
244
  - - ">="
217
245
  - !ruby/object:Gem::Version
218
- version: 2.1.2
246
+ version: 2.4.1
219
247
  required_rubygems_version: !ruby/object:Gem::Requirement
220
248
  requirements:
221
249
  - - ">="
@@ -1 +0,0 @@
1
- wordless_gem
@@ -1,36 +0,0 @@
1
- <?php
2
-
3
- require 'wordless_bridge.php';
4
-
5
- class CompileAssets extends WordlessBridge {
6
- public static function start() {
7
- parent::initialize();
8
-
9
- // Determine theme name
10
- foreach (scandir(self::$current_dir . '/wp-content/themes') as $theme_dir) {
11
- if (in_array($theme_dir, array('.', '..', 'index.php')) && !is_dir($theme_dir)) {
12
- continue;
13
- }
14
-
15
- $previous_theme_name = WordlessBridge::$theme_name;
16
- WordlessBridge::$theme_name = $theme_dir;
17
- if (Wordless::theme_is_wordless_compatible()) {
18
- if (basename(self::$current_dir) == $theme_dir) {
19
- // A theme with the same name as the site is Wordless-compatible, this is probably the one we want
20
- break;
21
- }
22
- } else {
23
- WordlessBridge::$theme_name = $previous_theme_name;
24
- }
25
- }
26
-
27
- require(get_template_directory() . '/config/initializers/wordless_preferences.php');
28
-
29
- Wordless::register_preprocessors();
30
- Wordless::compile_assets();
31
- }
32
- }
33
-
34
- CompileAssets::start();
35
-
36
- ?>
@@ -1,23 +0,0 @@
1
- <?php
2
-
3
- require 'wordless_bridge.php';
4
-
5
- class ThemeBuilder extends WordlessBridge {
6
- public static function start() {
7
- global $argv, $theme_name;
8
-
9
- parent::initialize();
10
-
11
- require_once Wordless::join_paths(self::$plugin_dir, "wordless", "theme_builder.php");
12
-
13
- $theme_name = $argv[1] ? $argv[1] : 'wordless';
14
- $permissions = substr(sprintf('%o', fileperms(self::$plugin_dir)), -4);
15
-
16
- $builder = new WordlessThemeBuilder($theme_name, $theme_name, intval($permissions, 8));
17
- $builder->build();
18
- }
19
- }
20
-
21
- ThemeBuilder::start();
22
-
23
- ?>
@@ -1,26 +0,0 @@
1
- <?php
2
-
3
- // WordPress function stubs
4
-
5
- function get_template_directory() {
6
- return Wordless::join_paths(getcwd(), "wp-content", "themes", WordlessBridge::$theme_name);
7
- }
8
-
9
- function __($string) {
10
- return $string;
11
- }
12
-
13
- class WordlessBridge {
14
- public static $current_dir;
15
- public static $plugin_dir;
16
- public static $theme_name = 'stub';
17
-
18
- public static function initialize() {
19
- self::$current_dir = getcwd();
20
- self::$plugin_dir = self::$current_dir . '/wp-content/plugins/wordless';
21
-
22
- require_once self::$plugin_dir . "/wordless/wordless.php";
23
- }
24
- }
25
-
26
- ?>