theme-juice 0.7.11 → 0.7.12

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: f8a40e35767cddfbeb2aab96fce9dd0cf3a509aa
4
- data.tar.gz: 7dc5c7b4a1c816c61dc3312bd6d17bc52dcacfb8
3
+ metadata.gz: 47453dc6785ca46556845b56bd1a46f4cbd87fd2
4
+ data.tar.gz: b5b347209b63b93778a684add12a618a0f7e0a12
5
5
  SHA512:
6
- metadata.gz: 6051a33c1e1d44d2e2cf1023c85e1ecddd88e51c0ace13787a0f2d8ed5f1acef7cb06d20fb96a9875250f09cabec62014c934303172bd34ffd06aeedaee6f8ee
7
- data.tar.gz: 9f9952d603b915ec5564b3fef51425dfe936d1420ec5fe14b46ebb1023cca8f9942bc0caec7916d9ac201e959c740d925bfee557411556e3a1e3b0c29aba708f
6
+ metadata.gz: f7af5978b857e8c59705bbacf31bd2d8d14f47660527d41af344fa86c6d624c2a0284ac0027cca9ca6d6ab96bcce08020b8412181cf6613209338e9f34b24f92
7
+ data.tar.gz: 9dcbf6263ec2fc2fc1a622d4417e35e154e5e5836c6e9bf85603ec8f36f800af77ef499dd4147b6440018f9ec5b93c2f4fde4699b8ae50d5384dd19922c167cd
data/bin/tj CHANGED
@@ -1,6 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: UTF-8
3
3
 
4
+ lib = File.expand_path "../lib/", __FILE__
5
+ $:.unshift lib unless $:.include? lib
6
+
4
7
  require "theme-juice"
5
8
 
6
9
  Signal.trap "INT" do
data/lib/theme-juice.rb CHANGED
@@ -9,7 +9,8 @@ module ThemeJuice
9
9
  end
10
10
 
11
11
  require "theme-juice/version"
12
- require "theme-juice/helpers"
12
+ require "theme-juice/patches/option"
13
+ require "theme-juice/helpers/singleton_helper"
13
14
  require "theme-juice/env"
14
15
  require "theme-juice/project"
15
16
  require "theme-juice/util"
@@ -1,42 +1,5 @@
1
1
  # encoding: UTF-8
2
2
 
3
- #
4
- # Monkey patch to not print out reverse bool options on --help
5
- #
6
- # @see https://github.com/erikhuda/thor/issues/417
7
- #
8
- class Thor
9
- class Option < Argument
10
- def usage(padding = 0)
11
- sample = if banner && !banner.to_s.empty?
12
- "#{switch_name}=#{banner}"
13
- else
14
- switch_name
15
- end
16
-
17
- sample = "[#{sample}]" unless required?
18
-
19
- # if boolean?
20
- # sample << ", [#{dasherize("no-" + human_name)}]" unless name == "force" or name.start_with?("no-")
21
- # end
22
-
23
- if aliases.empty?
24
- (" " * padding) << sample
25
- else
26
- "#{aliases.join(', ')}, #{sample}"
27
- end
28
- end
29
-
30
- VALID_TYPES.each do |type|
31
- class_eval <<-RUBY, __FILE__, __LINE__ + 1
32
- def #{type}?
33
- self.type == #{type.inspect}
34
- end
35
- RUBY
36
- end
37
- end
38
- end
39
-
40
3
  module ThemeJuice
41
4
  class CLI < Thor
42
5
 
@@ -53,17 +16,24 @@ module ThemeJuice
53
16
  @create = Commands::Create
54
17
  @delete = Commands::Delete
55
18
  @deploy = Commands::Deploy
56
- @env.vm_path = options.fetch "vm_path", ENV.fetch("TJ_VM_PATH", File.expand_path("~/vagrant"))
57
- @env.vm_ip = options.fetch "vm_ip", ENV.fetch("TJ_VM_IP", "192.168.50.4")
58
- @env.vm_prefix = options.fetch "vm_prefix", ENV.fetch("TJ_VM_PREFIX", "tj-")
59
- @env.yolo = options.fetch "yolo", ENV.fetch("TJ_YOLO", false)
60
- @env.boring = options.fetch "boring", ENV.fetch("TJ_BORING", false)
61
- @env.no_unicode = options.fetch "no_unicode", ENV.fetch("TJ_NO_UNICODE", @env.boring)
62
- @env.no_colors = options.fetch "no_colors", ENV.fetch("TJ_NO_COLORS", @env.boring)
63
- @env.no_animations = options.fetch "no_animations", ENV.fetch("TJ_NO_ANIMATIONS", @env.boring)
64
- @env.no_landrush = options.fetch "no_landrush", ENV.fetch("TJ_NO_LANDRUSH", false)
65
- @env.verbose = options.fetch "verbose", ENV.fetch("TJ_VERBOSE", false)
66
- @env.dryrun = options.fetch "dryrun", ENV.fetch("TJ_DRYRUN", false)
19
+
20
+ init_env
21
+ end
22
+
23
+ no_commands do
24
+ def init_env
25
+ @env.vm_path = options.fetch "vm_path", ENV.fetch("TJ_VM_PATH", File.expand_path("~/vagrant"))
26
+ @env.vm_ip = options.fetch "vm_ip", ENV.fetch("TJ_VM_IP", "192.168.50.4")
27
+ @env.vm_prefix = options.fetch "vm_prefix", ENV.fetch("TJ_VM_PREFIX", "tj-")
28
+ @env.yolo = options.fetch "yolo", ENV.fetch("TJ_YOLO", false)
29
+ @env.boring = options.fetch "boring", ENV.fetch("TJ_BORING", false)
30
+ @env.no_unicode = options.fetch "no_unicode", ENV.fetch("TJ_NO_UNICODE", @env.boring)
31
+ @env.no_colors = options.fetch "no_colors", ENV.fetch("TJ_NO_COLORS", @env.boring)
32
+ @env.no_animations = options.fetch "no_animations", ENV.fetch("TJ_NO_ANIMATIONS", @env.boring)
33
+ @env.no_landrush = options.fetch "no_landrush", ENV.fetch("TJ_NO_LANDRUSH", false)
34
+ @env.verbose = options.fetch "verbose", ENV.fetch("TJ_VERBOSE", false)
35
+ @env.dryrun = options.fetch "dryrun", ENV.fetch("TJ_DRYRUN", false)
36
+ end
67
37
  end
68
38
 
69
39
  map %w[--version -v] => :version
@@ -71,7 +41,8 @@ module ThemeJuice
71
41
  map %w[up prep init] => :setup
72
42
  map %w[rm remove trash teardown] => :delete
73
43
  map %w[ls projects apps sites] => :list
74
- map %w[assets dev build] => :watch
44
+ map %w[build] => :install
45
+ map %w[assets dev] => :watch
75
46
  map %w[dependencies deps] => :vendor
76
47
  map %w[distrubute pack package] => :dist
77
48
  map %w[wordpress] => :wp
@@ -126,7 +97,7 @@ module ThemeJuice
126
97
  method_option :location, :type => :string, :aliases => "-l", :default => nil, :desc => "Location of the local project"
127
98
  method_option :url, :type => :string, :aliases => "-u", :default => nil, :desc => "Development URL for the project"
128
99
  method_option :repository, :type => :string, :aliases => "-r", :desc => "Initialize a new Git remote repository"
129
- method_option :import_db, :type => :string, :aliases => "-i", :desc => "Import an existing database"
100
+ method_option :db_import, :type => :string, :aliases => %w[-i --import-db], :desc => "Import an existing database"
130
101
  method_option :skip_repo, :type => :boolean, :desc => "Skip repository prompts and use default settings"
131
102
  method_option :skip_db, :type => :boolean, :desc => "Skip database prompts and use default settings"
132
103
  method_option :use_defaults, :type => :boolean, :desc => "Skip all prompts and use default settings"
@@ -5,33 +5,15 @@ module ThemeJuice
5
5
  class Create < Command
6
6
 
7
7
  THEMES = {
8
- "theme-juice/theme-juice-starter" => "https://github.com/ezekg/theme-juice-starter.git",
9
- "other" => nil,
10
- "none" => false
8
+ "theme-juice/trellis" => "https://github.com/ezekg/theme-juice-starter.git",
9
+ "other" => nil,
10
+ "none" => false
11
11
  }
12
12
 
13
13
  def initialize(opts = {})
14
14
  super
15
15
 
16
- @project.use_defaults = @opts.fetch("use_defaults", false)
17
- @project.bare = @opts.fetch("bare", false)
18
- @project.skip_repo = @opts.fetch("skip_repo", false)
19
- @project.skip_db = @opts.fetch("skip_db", false)
20
- @project.no_wp = @opts.fetch("no_wp", false)
21
- @project.no_db = @opts.fetch("no_db", false)
22
- @project.name = @opts.fetch("name") { name }
23
- @project.location = @opts.fetch("location") { location }
24
- @project.url = @opts.fetch("url") { url }
25
- @project.theme = @opts.fetch("theme") { theme }
26
- @project.repository = @opts.fetch("repository") { repository }
27
- @project.db_host = @opts.fetch("db_host") { db_host }
28
- @project.db_name = @opts.fetch("db_name") { db_name }
29
- @project.db_user = @opts.fetch("db_user") { db_user }
30
- @project.db_pass = @opts.fetch("db_pass") { db_pass }
31
- @project.db_import = @opts.fetch("db_import") { db_import }
32
- @project.vm_root = vm_root
33
- @project.vm_location = vm_location
34
- @project.vm_srv = vm_srv
16
+ init_project
35
17
 
36
18
  runner do |tasks|
37
19
  tasks << Tasks::CreateConfirm.new
@@ -58,6 +40,28 @@ module ThemeJuice
58
40
 
59
41
  private
60
42
 
43
+ def init_project
44
+ @project.use_defaults = @opts.fetch("use_defaults", false)
45
+ @project.bare = @opts.fetch("bare", false)
46
+ @project.skip_repo = @opts.fetch("skip_repo", false)
47
+ @project.skip_db = @opts.fetch("skip_db", false)
48
+ @project.no_wp = @opts.fetch("no_wp", false)
49
+ @project.no_db = @opts.fetch("no_db", false)
50
+ @project.name = @opts.fetch("name") { name }
51
+ @project.location = @opts.fetch("location") { location }
52
+ @project.url = @opts.fetch("url") { url }
53
+ @project.theme = @opts.fetch("theme") { theme }
54
+ @project.repository = @opts.fetch("repository") { repository }
55
+ @project.db_host = @opts.fetch("db_host") { db_host }
56
+ @project.db_name = @opts.fetch("db_name") { db_name }
57
+ @project.db_user = @opts.fetch("db_user") { db_user }
58
+ @project.db_pass = @opts.fetch("db_pass") { db_pass }
59
+ @project.db_import = @opts.fetch("db_import") { db_import }
60
+ @project.vm_root = vm_root
61
+ @project.vm_location = vm_location
62
+ @project.vm_srv = vm_srv
63
+ end
64
+
61
65
  def name
62
66
  if @env.yolo
63
67
  name = Faker::Internet.domain_word
@@ -158,12 +162,12 @@ module ThemeJuice
158
162
  define_method "db_#{task}" do
159
163
  return false if @project.no_db || @project.no_wp
160
164
 
161
- case task
162
- when "host" then default = "vvv"
163
- when "name" then default = "#{clean_name}_db"
164
- when "user" then default = "#{clean_name}_user"
165
- when "pass" then default = Faker::Internet.password(24)
166
- end
165
+ default = case task
166
+ when "host" then "vvv"
167
+ when "name" then "#{clean_name}_db"
168
+ when "user" then "#{clean_name}_user"
169
+ when "pass" then Faker::Internet.password(24)
170
+ end
167
171
 
168
172
  if @project.skip_db || @project.use_defaults
169
173
  res = default
@@ -7,13 +7,7 @@ module ThemeJuice
7
7
  def initialize(opts = {})
8
8
  super
9
9
 
10
- @project.name = @opts.fetch("name") { name }
11
- @project.url = @opts.fetch("url") { url }
12
- @project.db_drop = @opts.fetch("db_drop", false)
13
- @project.vm_restart = @opts.fetch("vm_restart", false)
14
- @project.vm_root = vm_root
15
- @project.vm_location = vm_location
16
- @project.vm_srv = vm_srv
10
+ init_project
17
11
 
18
12
  runner do |tasks|
19
13
  tasks << Tasks::DeleteConfirm.new
@@ -28,6 +22,16 @@ module ThemeJuice
28
22
 
29
23
  private
30
24
 
25
+ def init_project
26
+ @project.name = @opts.fetch("name") { name }
27
+ @project.url = @opts.fetch("url") { url }
28
+ @project.db_drop = @opts.fetch("db_drop", false)
29
+ @project.vm_restart = @opts.fetch("vm_restart", false)
30
+ @project.vm_root = vm_root
31
+ @project.vm_location = vm_location
32
+ @project.vm_srv = vm_srv
33
+ end
34
+
31
35
  def name
32
36
  name = @io.prompt "What's the project name?"
33
37
 
@@ -7,14 +7,20 @@ module ThemeJuice
7
7
  def initialize(opts = {})
8
8
  super
9
9
 
10
- @project.vm_root = vm_root
11
- @project.vm_location = vm_location
12
- @project.vm_srv = vm_srv
10
+ init_project
13
11
 
14
12
  runner do |tasks|
15
13
  @io.error "Not implemented"
16
14
  end
17
15
  end
16
+
17
+ private
18
+
19
+ def init_project
20
+ @project.vm_root = vm_root
21
+ @project.vm_location = vm_location
22
+ @project.vm_srv = vm_srv
23
+ end
18
24
  end
19
25
  end
20
26
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module ThemeJuice
4
4
  module Env
5
- include Helpers
5
+ include SingletonHelper
6
6
 
7
7
  attr_accessor :vm_path
8
8
  attr_accessor :vm_ip
@@ -1,5 +1,5 @@
1
1
  module ThemeJuice
2
- module Helpers
2
+ module SingletonHelper
3
3
  def inspect
4
4
  res = []
5
5
  self.instance_variables.each { |k, _| res << "#{k[1..-1]}: #{instance_variable_get(k)}" }
@@ -0,0 +1,34 @@
1
+ # encoding: UTF-8
2
+
3
+ #
4
+ # Monkey patch to not print out reverse bool options on --help
5
+ #
6
+ # @see https://github.com/erikhuda/thor/issues/417
7
+ #
8
+ class Thor
9
+ class Option < Argument
10
+ def usage(padding = 0)
11
+ sample = if banner && !banner.to_s.empty?
12
+ "#{switch_name}=#{banner}"
13
+ else
14
+ switch_name
15
+ end
16
+
17
+ sample = "[#{sample}]" unless required?
18
+
19
+ if aliases.empty?
20
+ (" " * padding) << sample
21
+ else
22
+ "#{aliases.join(', ')}, #{sample}"
23
+ end
24
+ end
25
+
26
+ VALID_TYPES.each do |type|
27
+ class_eval <<-RUBY, __FILE__, __LINE__ + 1
28
+ def #{type}?
29
+ self.type == #{type.inspect}
30
+ end
31
+ RUBY
32
+ end
33
+ end
34
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module ThemeJuice
4
4
  module Project
5
- include Helpers
5
+ include SingletonHelper
6
6
 
7
7
  attr_accessor :name
8
8
  attr_accessor :location
@@ -36,6 +36,8 @@ module ThemeJuice
36
36
  DB_USER=#{@project.db_user}
37
37
  DB_PASSWORD=#{@project.db_pass}
38
38
  DB_HOST=#{@project.db_host}
39
+ WP_ENV=development
40
+ WP_DEBUG=true
39
41
  WP_HOME=http://#{@project.url}
40
42
  WP_SITEURL=http://#{@project.url}/wp
41
43
 
@@ -1,5 +1,5 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  module ThemeJuice
4
- VERSION = "0.7.11"
4
+ VERSION = "0.7.12"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: theme-juice
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.11
4
+ version: 0.7.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ezekiel Gabrielse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-15 00:00:00.000000000 Z
11
+ date: 2015-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -128,8 +128,9 @@ files:
128
128
  - lib/theme-juice/commands/deploy.rb
129
129
  - lib/theme-juice/config.rb
130
130
  - lib/theme-juice/env.rb
131
- - lib/theme-juice/helpers.rb
131
+ - lib/theme-juice/helpers/singleton_helper.rb
132
132
  - lib/theme-juice/io.rb
133
+ - lib/theme-juice/patches/option.rb
133
134
  - lib/theme-juice/project.rb
134
135
  - lib/theme-juice/task.rb
135
136
  - lib/theme-juice/tasks/create_confirm.rb
@@ -183,4 +184,3 @@ signing_key:
183
184
  specification_version: 4
184
185
  summary: Theme Juice - WordPress development made easy
185
186
  test_files: []
186
- has_rdoc: