theme-juice 0.7.11 → 0.7.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/tj +3 -0
- data/lib/theme-juice.rb +2 -1
- data/lib/theme-juice/cli.rb +21 -50
- data/lib/theme-juice/commands/create.rb +32 -28
- data/lib/theme-juice/commands/delete.rb +11 -7
- data/lib/theme-juice/commands/deploy.rb +9 -3
- data/lib/theme-juice/env.rb +1 -1
- data/lib/theme-juice/{helpers.rb → helpers/singleton_helper.rb} +1 -1
- data/lib/theme-juice/patches/option.rb +34 -0
- data/lib/theme-juice/project.rb +1 -1
- data/lib/theme-juice/tasks/dot_env.rb +2 -0
- data/lib/theme-juice/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47453dc6785ca46556845b56bd1a46f4cbd87fd2
|
4
|
+
data.tar.gz: b5b347209b63b93778a684add12a618a0f7e0a12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7af5978b857e8c59705bbacf31bd2d8d14f47660527d41af344fa86c6d624c2a0284ac0027cca9ca6d6ab96bcce08020b8412181cf6613209338e9f34b24f92
|
7
|
+
data.tar.gz: 9dcbf6263ec2fc2fc1a622d4417e35e154e5e5836c6e9bf85603ec8f36f800af77ef499dd4147b6440018f9ec5b93c2f4fde4699b8ae50d5384dd19922c167cd
|
data/bin/tj
CHANGED
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/
|
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"
|
data/lib/theme-juice/cli.rb
CHANGED
@@ -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
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
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[
|
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 :
|
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/
|
9
|
-
"other"
|
10
|
-
"none"
|
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
|
-
|
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
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
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
|
-
|
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
|
-
|
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
|
data/lib/theme-juice/env.rb
CHANGED
@@ -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
|
data/lib/theme-juice/project.rb
CHANGED
data/lib/theme-juice/version.rb
CHANGED
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.
|
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-
|
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:
|