theme-juice 0.7.7 → 0.7.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +204 -204
- data/bin/tj +15 -15
- data/lib/theme-juice.rb +46 -46
- data/lib/theme-juice/cli.rb +248 -248
- data/lib/theme-juice/command.rb +20 -20
- data/lib/theme-juice/commands/create.rb +221 -221
- data/lib/theme-juice/commands/delete.rb +51 -51
- data/lib/theme-juice/commands/deploy.rb +20 -20
- data/lib/theme-juice/config.rb +68 -70
- data/lib/theme-juice/env.rb +25 -25
- data/lib/theme-juice/io.rb +323 -323
- data/lib/theme-juice/project.rb +35 -35
- data/lib/theme-juice/task.rb +42 -42
- data/lib/theme-juice/tasks/create_confirm.rb +33 -33
- data/lib/theme-juice/tasks/create_success.rb +42 -42
- data/lib/theme-juice/tasks/database.rb +50 -50
- data/lib/theme-juice/tasks/delete_confirm.rb +24 -24
- data/lib/theme-juice/tasks/delete_success.rb +31 -31
- data/lib/theme-juice/tasks/dns.rb +45 -45
- data/lib/theme-juice/tasks/dot_env.rb +53 -53
- data/lib/theme-juice/tasks/entry.rb +50 -50
- data/lib/theme-juice/tasks/hosts.rb +43 -43
- data/lib/theme-juice/tasks/import_database.rb +28 -28
- data/lib/theme-juice/tasks/landrush.rb +33 -33
- data/lib/theme-juice/tasks/list.rb +50 -50
- data/lib/theme-juice/tasks/location.rb +23 -23
- data/lib/theme-juice/tasks/nginx.rb +51 -51
- data/lib/theme-juice/tasks/repo.rb +49 -49
- data/lib/theme-juice/tasks/synced_folder.rb +30 -30
- data/lib/theme-juice/tasks/theme.rb +34 -34
- data/lib/theme-juice/tasks/vm.rb +30 -30
- data/lib/theme-juice/tasks/vm_customfile.rb +42 -42
- data/lib/theme-juice/tasks/vm_location.rb +32 -32
- data/lib/theme-juice/tasks/vm_plugins.rb +32 -32
- data/lib/theme-juice/tasks/vm_provision.rb +39 -39
- data/lib/theme-juice/tasks/vm_restart.rb +25 -25
- data/lib/theme-juice/tasks/wp_cli.rb +52 -52
- data/lib/theme-juice/util.rb +45 -45
- data/lib/theme-juice/version.rb +5 -5
- metadata +6 -7
data/lib/theme-juice/project.rb
CHANGED
@@ -1,35 +1,35 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
module ThemeJuice
|
4
|
-
module Project
|
5
|
-
attr_accessor :name
|
6
|
-
attr_accessor :location
|
7
|
-
attr_accessor :url
|
8
|
-
attr_accessor :theme
|
9
|
-
attr_accessor :vm_root
|
10
|
-
attr_accessor :vm_location
|
11
|
-
attr_accessor :vm_srv
|
12
|
-
attr_accessor :vm_restart
|
13
|
-
attr_accessor :repository
|
14
|
-
attr_accessor :db_host
|
15
|
-
attr_accessor :db_name
|
16
|
-
attr_accessor :db_user
|
17
|
-
attr_accessor :db_pass
|
18
|
-
attr_accessor :db_import
|
19
|
-
attr_accessor :db_drop
|
20
|
-
attr_accessor :bare
|
21
|
-
attr_accessor :skip_repo
|
22
|
-
attr_accessor :skip_db
|
23
|
-
attr_accessor :use_defaults
|
24
|
-
attr_accessor :no_wp
|
25
|
-
attr_accessor :no_db
|
26
|
-
|
27
|
-
def inspect
|
28
|
-
res = []
|
29
|
-
self.instance_variables.each { |k, _| res << "#{k[1..-1]}: #{instance_variable_get(k)}" }
|
30
|
-
res.sort
|
31
|
-
end
|
32
|
-
|
33
|
-
extend self
|
34
|
-
end
|
35
|
-
end
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
module ThemeJuice
|
4
|
+
module Project
|
5
|
+
attr_accessor :name
|
6
|
+
attr_accessor :location
|
7
|
+
attr_accessor :url
|
8
|
+
attr_accessor :theme
|
9
|
+
attr_accessor :vm_root
|
10
|
+
attr_accessor :vm_location
|
11
|
+
attr_accessor :vm_srv
|
12
|
+
attr_accessor :vm_restart
|
13
|
+
attr_accessor :repository
|
14
|
+
attr_accessor :db_host
|
15
|
+
attr_accessor :db_name
|
16
|
+
attr_accessor :db_user
|
17
|
+
attr_accessor :db_pass
|
18
|
+
attr_accessor :db_import
|
19
|
+
attr_accessor :db_drop
|
20
|
+
attr_accessor :bare
|
21
|
+
attr_accessor :skip_repo
|
22
|
+
attr_accessor :skip_db
|
23
|
+
attr_accessor :use_defaults
|
24
|
+
attr_accessor :no_wp
|
25
|
+
attr_accessor :no_db
|
26
|
+
|
27
|
+
def inspect
|
28
|
+
res = []
|
29
|
+
self.instance_variables.each { |k, _| res << "#{k[1..-1]}: #{instance_variable_get(k)}" }
|
30
|
+
res.sort
|
31
|
+
end
|
32
|
+
|
33
|
+
extend self
|
34
|
+
end
|
35
|
+
end
|
data/lib/theme-juice/task.rb
CHANGED
@@ -1,42 +1,42 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
module ThemeJuice
|
4
|
-
class Task
|
5
|
-
|
6
|
-
def initialize(opts = {})
|
7
|
-
@env = Env
|
8
|
-
@io = IO
|
9
|
-
@project = Project
|
10
|
-
@config = Config
|
11
|
-
@util = Util.new
|
12
|
-
@opts = opts.dup
|
13
|
-
@tasks = []
|
14
|
-
end
|
15
|
-
|
16
|
-
def runner
|
17
|
-
yield @tasks
|
18
|
-
end
|
19
|
-
|
20
|
-
def execute
|
21
|
-
@io.error "Method 'execute' not implemented for #{self.class.name}"
|
22
|
-
end
|
23
|
-
|
24
|
-
def unexecute
|
25
|
-
@io.error "Method 'unexecute' not implemented for #{self.class.name}"
|
26
|
-
end
|
27
|
-
|
28
|
-
private
|
29
|
-
|
30
|
-
def vm_root
|
31
|
-
File.expand_path "#{@env.vm_path}/www"
|
32
|
-
end
|
33
|
-
|
34
|
-
def vm_location
|
35
|
-
"#{vm_root}/#{@env.vm_prefix}#{@project.name}"
|
36
|
-
end
|
37
|
-
|
38
|
-
def vm_srv
|
39
|
-
"/srv/www/#{@env.vm_prefix}#{@project.name}"
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
module ThemeJuice
|
4
|
+
class Task
|
5
|
+
|
6
|
+
def initialize(opts = {})
|
7
|
+
@env = Env
|
8
|
+
@io = IO
|
9
|
+
@project = Project
|
10
|
+
@config = Config
|
11
|
+
@util = Util.new
|
12
|
+
@opts = opts.dup
|
13
|
+
@tasks = []
|
14
|
+
end
|
15
|
+
|
16
|
+
def runner
|
17
|
+
yield @tasks
|
18
|
+
end
|
19
|
+
|
20
|
+
def execute
|
21
|
+
@io.error "Method 'execute' not implemented for #{self.class.name}"
|
22
|
+
end
|
23
|
+
|
24
|
+
def unexecute
|
25
|
+
@io.error "Method 'unexecute' not implemented for #{self.class.name}"
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def vm_root
|
31
|
+
File.expand_path "#{@env.vm_path}/www"
|
32
|
+
end
|
33
|
+
|
34
|
+
def vm_location
|
35
|
+
"#{vm_root}/#{@env.vm_prefix}#{@project.name}"
|
36
|
+
end
|
37
|
+
|
38
|
+
def vm_srv
|
39
|
+
"/srv/www/#{@env.vm_prefix}#{@project.name}"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -1,33 +1,33 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
module ThemeJuice
|
4
|
-
module Tasks
|
5
|
-
class CreateConfirm < Task
|
6
|
-
|
7
|
-
def initialize(opts = {})
|
8
|
-
super
|
9
|
-
end
|
10
|
-
|
11
|
-
def execute
|
12
|
-
confirm
|
13
|
-
end
|
14
|
-
|
15
|
-
private
|
16
|
-
|
17
|
-
def confirm
|
18
|
-
@io.list "Your settings :", :yellow, settings
|
19
|
-
unless @io.agree? "Do these settings look correct?"
|
20
|
-
@io.error "Dang typos..."
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def settings
|
25
|
-
if @env.verbose
|
26
|
-
@env.inspect + @project.inspect
|
27
|
-
else
|
28
|
-
@project.inspect
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
module ThemeJuice
|
4
|
+
module Tasks
|
5
|
+
class CreateConfirm < Task
|
6
|
+
|
7
|
+
def initialize(opts = {})
|
8
|
+
super
|
9
|
+
end
|
10
|
+
|
11
|
+
def execute
|
12
|
+
confirm
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def confirm
|
18
|
+
@io.list "Your settings :", :yellow, settings
|
19
|
+
unless @io.agree? "Do these settings look correct?"
|
20
|
+
@io.error "Dang typos..."
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def settings
|
25
|
+
if @env.verbose
|
26
|
+
@env.inspect + @project.inspect
|
27
|
+
else
|
28
|
+
@project.inspect
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -1,42 +1,42 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
module ThemeJuice
|
4
|
-
module Tasks
|
5
|
-
class CreateSuccess < Task
|
6
|
-
|
7
|
-
def initialize(opts = {})
|
8
|
-
super
|
9
|
-
|
10
|
-
@vm_provision = Tasks::VMProvision.new(opts)
|
11
|
-
end
|
12
|
-
|
13
|
-
def execute
|
14
|
-
provision_vm
|
15
|
-
success
|
16
|
-
end
|
17
|
-
|
18
|
-
private
|
19
|
-
|
20
|
-
def provision_vm
|
21
|
-
if @io.agree? "In order to finish creating your project, you need to provision the VM. Do it now?"
|
22
|
-
@vm_provision.execute
|
23
|
-
else
|
24
|
-
@io.notice "Remember, the VM needs to be provisioned before you can use your new site"
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def success
|
29
|
-
@io.success "Successfully created project '#{@project.name}'"
|
30
|
-
@io.list "Your settings :", :yellow, settings
|
31
|
-
end
|
32
|
-
|
33
|
-
def settings
|
34
|
-
if @env.verbose
|
35
|
-
@env.inspect + @project.inspect
|
36
|
-
else
|
37
|
-
@project.inspect
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
module ThemeJuice
|
4
|
+
module Tasks
|
5
|
+
class CreateSuccess < Task
|
6
|
+
|
7
|
+
def initialize(opts = {})
|
8
|
+
super
|
9
|
+
|
10
|
+
@vm_provision = Tasks::VMProvision.new(opts)
|
11
|
+
end
|
12
|
+
|
13
|
+
def execute
|
14
|
+
provision_vm
|
15
|
+
success
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def provision_vm
|
21
|
+
if @io.agree? "In order to finish creating your project, you need to provision the VM. Do it now?"
|
22
|
+
@vm_provision.execute
|
23
|
+
else
|
24
|
+
@io.notice "Remember, the VM needs to be provisioned before you can use your new site"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def success
|
29
|
+
@io.success "Successfully created project '#{@project.name}'"
|
30
|
+
@io.list "Your settings :", :yellow, settings
|
31
|
+
end
|
32
|
+
|
33
|
+
def settings
|
34
|
+
if @env.verbose
|
35
|
+
@env.inspect + @project.inspect
|
36
|
+
else
|
37
|
+
@project.inspect
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -1,50 +1,50 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
module ThemeJuice
|
4
|
-
module Tasks
|
5
|
-
class Database < Entry
|
6
|
-
|
7
|
-
def initialize(opts = {})
|
8
|
-
super
|
9
|
-
|
10
|
-
@entry = {
|
11
|
-
:project => @project.name,
|
12
|
-
:file => "#{@env.vm_path}/database/init-custom.sql",
|
13
|
-
:name => "database",
|
14
|
-
:id => "DB"
|
15
|
-
}
|
16
|
-
end
|
17
|
-
|
18
|
-
def execute
|
19
|
-
if @project.db_host && @project.db_name && @project.db_user && @project.db_pass
|
20
|
-
create_entry_file
|
21
|
-
create_entry do
|
22
|
-
%Q{CREATE DATABASE IF NOT EXISTS `#{@project.db_name}`;
|
23
|
-
GRANT ALL PRIVILEGES ON `#{@project.db_name}`.* TO '#{@project.db_user}'@'localhost' IDENTIFIED BY '#{@project.db_pass}';}
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def unexecute
|
29
|
-
remove_entry
|
30
|
-
drop_database
|
31
|
-
end
|
32
|
-
|
33
|
-
private
|
34
|
-
|
35
|
-
def drop_database
|
36
|
-
if @project.db_drop
|
37
|
-
|
38
|
-
# Double check that the database should be dropped
|
39
|
-
if @io.agree? "Are you sure you want to drop the database for '#{@project.name}'?"
|
40
|
-
@io.log "Dropping database"
|
41
|
-
@util.run_inside_vm [], :verbose => @env.verbose do |cmds|
|
42
|
-
cmds << "cd #{@project.vm_srv}"
|
43
|
-
cmds << "wp db drop --yes"
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
module ThemeJuice
|
4
|
+
module Tasks
|
5
|
+
class Database < Entry
|
6
|
+
|
7
|
+
def initialize(opts = {})
|
8
|
+
super
|
9
|
+
|
10
|
+
@entry = {
|
11
|
+
:project => @project.name,
|
12
|
+
:file => "#{@env.vm_path}/database/init-custom.sql",
|
13
|
+
:name => "database",
|
14
|
+
:id => "DB"
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
18
|
+
def execute
|
19
|
+
if @project.db_host && @project.db_name && @project.db_user && @project.db_pass
|
20
|
+
create_entry_file
|
21
|
+
create_entry do
|
22
|
+
%Q{CREATE DATABASE IF NOT EXISTS `#{@project.db_name}`;
|
23
|
+
GRANT ALL PRIVILEGES ON `#{@project.db_name}`.* TO '#{@project.db_user}'@'localhost' IDENTIFIED BY '#{@project.db_pass}';}
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def unexecute
|
29
|
+
remove_entry
|
30
|
+
drop_database
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def drop_database
|
36
|
+
if @project.db_drop
|
37
|
+
|
38
|
+
# Double check that the database should be dropped
|
39
|
+
if @io.agree? "Are you sure you want to drop the database for '#{@project.name}'?"
|
40
|
+
@io.log "Dropping database"
|
41
|
+
@util.run_inside_vm [], :verbose => @env.verbose do |cmds|
|
42
|
+
cmds << "cd #{@project.vm_srv}"
|
43
|
+
cmds << "wp db drop --yes"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -1,24 +1,24 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
module ThemeJuice
|
4
|
-
module Tasks
|
5
|
-
class DeleteConfirm < Task
|
6
|
-
|
7
|
-
def initialize(opts = {})
|
8
|
-
super
|
9
|
-
end
|
10
|
-
|
11
|
-
def unexecute
|
12
|
-
confirm
|
13
|
-
end
|
14
|
-
|
15
|
-
private
|
16
|
-
|
17
|
-
def confirm
|
18
|
-
unless @io.agree? "Are you sure you want to remove '#{@project.name}'?"
|
19
|
-
@io.error "Aborting mission"
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
module ThemeJuice
|
4
|
+
module Tasks
|
5
|
+
class DeleteConfirm < Task
|
6
|
+
|
7
|
+
def initialize(opts = {})
|
8
|
+
super
|
9
|
+
end
|
10
|
+
|
11
|
+
def unexecute
|
12
|
+
confirm
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def confirm
|
18
|
+
unless @io.agree? "Are you sure you want to remove '#{@project.name}'?"
|
19
|
+
@io.error "Aborting mission"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|