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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +204 -204
  3. data/bin/tj +15 -15
  4. data/lib/theme-juice.rb +46 -46
  5. data/lib/theme-juice/cli.rb +248 -248
  6. data/lib/theme-juice/command.rb +20 -20
  7. data/lib/theme-juice/commands/create.rb +221 -221
  8. data/lib/theme-juice/commands/delete.rb +51 -51
  9. data/lib/theme-juice/commands/deploy.rb +20 -20
  10. data/lib/theme-juice/config.rb +68 -70
  11. data/lib/theme-juice/env.rb +25 -25
  12. data/lib/theme-juice/io.rb +323 -323
  13. data/lib/theme-juice/project.rb +35 -35
  14. data/lib/theme-juice/task.rb +42 -42
  15. data/lib/theme-juice/tasks/create_confirm.rb +33 -33
  16. data/lib/theme-juice/tasks/create_success.rb +42 -42
  17. data/lib/theme-juice/tasks/database.rb +50 -50
  18. data/lib/theme-juice/tasks/delete_confirm.rb +24 -24
  19. data/lib/theme-juice/tasks/delete_success.rb +31 -31
  20. data/lib/theme-juice/tasks/dns.rb +45 -45
  21. data/lib/theme-juice/tasks/dot_env.rb +53 -53
  22. data/lib/theme-juice/tasks/entry.rb +50 -50
  23. data/lib/theme-juice/tasks/hosts.rb +43 -43
  24. data/lib/theme-juice/tasks/import_database.rb +28 -28
  25. data/lib/theme-juice/tasks/landrush.rb +33 -33
  26. data/lib/theme-juice/tasks/list.rb +50 -50
  27. data/lib/theme-juice/tasks/location.rb +23 -23
  28. data/lib/theme-juice/tasks/nginx.rb +51 -51
  29. data/lib/theme-juice/tasks/repo.rb +49 -49
  30. data/lib/theme-juice/tasks/synced_folder.rb +30 -30
  31. data/lib/theme-juice/tasks/theme.rb +34 -34
  32. data/lib/theme-juice/tasks/vm.rb +30 -30
  33. data/lib/theme-juice/tasks/vm_customfile.rb +42 -42
  34. data/lib/theme-juice/tasks/vm_location.rb +32 -32
  35. data/lib/theme-juice/tasks/vm_plugins.rb +32 -32
  36. data/lib/theme-juice/tasks/vm_provision.rb +39 -39
  37. data/lib/theme-juice/tasks/vm_restart.rb +25 -25
  38. data/lib/theme-juice/tasks/wp_cli.rb +52 -52
  39. data/lib/theme-juice/util.rb +45 -45
  40. data/lib/theme-juice/version.rb +5 -5
  41. metadata +6 -7
@@ -1,31 +1,31 @@
1
- # encoding: UTF-8
2
-
3
- module ThemeJuice
4
- module Tasks
5
- class DeleteSuccess < Task
6
-
7
- def initialize(opts = {})
8
- super
9
-
10
- @vm_restart = Tasks::VMRestart.new(opts)
11
- end
12
-
13
- def unexecute
14
- restart_vm
15
- success
16
- end
17
-
18
- private
19
-
20
- def restart_vm
21
- if @project.vm_restart
22
- @vm_restart.execute
23
- end
24
- end
25
-
26
- def success
27
- @io.success "Successfully removed project '#{@project.name}'"
28
- end
29
- end
30
- end
31
- end
1
+ # encoding: UTF-8
2
+
3
+ module ThemeJuice
4
+ module Tasks
5
+ class DeleteSuccess < Task
6
+
7
+ def initialize(opts = {})
8
+ super
9
+
10
+ @vm_restart = Tasks::VMRestart.new(opts)
11
+ end
12
+
13
+ def unexecute
14
+ restart_vm
15
+ success
16
+ end
17
+
18
+ private
19
+
20
+ def restart_vm
21
+ if @project.vm_restart
22
+ @vm_restart.execute
23
+ end
24
+ end
25
+
26
+ def success
27
+ @io.success "Successfully removed project '#{@project.name}'"
28
+ end
29
+ end
30
+ end
31
+ end
@@ -1,45 +1,45 @@
1
- # encoding: UTF-8
2
-
3
- module ThemeJuice
4
- module Tasks
5
- class DNS < Entry
6
-
7
- def initialize(opts = {})
8
- super
9
-
10
- @entry = {
11
- :project => @project.name,
12
- :file => "#{@env.vm_path}/Customfile",
13
- :name => "DNS",
14
- :id => "DNS"
15
- }
16
- end
17
-
18
- def execute
19
- create_entry_file
20
- create_entry do
21
- %Q{if defined? Landrush
22
- config.landrush.host '#{@project.url}', '#{@env.vm_ip}'
23
- elsif defined? VagrantPlugins::HostsUpdater
24
- config.hostsupdater.aliases << '#{@project.url}'
25
- end}
26
- end
27
- end
28
-
29
- def unexecute
30
- remove_landrush_entry
31
- remove_entry
32
- end
33
-
34
- private
35
-
36
- def remove_landrush_entry
37
- unless @env.no_landrush
38
- @io.log "Removing URL from Landrush"
39
- @util.run "vagrant landrush rm #{@project.url}",
40
- :verbose => @env.verbose
41
- end
42
- end
43
- end
44
- end
45
- end
1
+ # encoding: UTF-8
2
+
3
+ module ThemeJuice
4
+ module Tasks
5
+ class DNS < Entry
6
+
7
+ def initialize(opts = {})
8
+ super
9
+
10
+ @entry = {
11
+ :project => @project.name,
12
+ :file => "#{@env.vm_path}/Customfile",
13
+ :name => "DNS",
14
+ :id => "DNS"
15
+ }
16
+ end
17
+
18
+ def execute
19
+ create_entry_file
20
+ create_entry do
21
+ %Q{if defined? Landrush
22
+ config.landrush.host '#{@project.url}', '#{@env.vm_ip}'
23
+ elsif defined? VagrantPlugins::HostsUpdater
24
+ config.hostsupdater.aliases << '#{@project.url}'
25
+ end}
26
+ end
27
+ end
28
+
29
+ def unexecute
30
+ remove_landrush_entry
31
+ remove_entry
32
+ end
33
+
34
+ private
35
+
36
+ def remove_landrush_entry
37
+ unless @env.no_landrush
38
+ @io.log "Removing URL from Landrush"
39
+ @util.run "vagrant landrush rm #{@project.url}",
40
+ :verbose => @env.verbose
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -1,53 +1,53 @@
1
- # encoding: UTF-8
2
-
3
- module ThemeJuice
4
- module Tasks
5
- class DotEnv < Task
6
-
7
- def initialize(opts = {})
8
- super
9
- end
10
-
11
- def execute
12
- unless @project.no_wp
13
- create_dot_env_file
14
- end
15
- end
16
-
17
- def unexecute
18
- remove_dot_env_file
19
- end
20
-
21
- private
22
-
23
- def dot_env_file
24
- "#{@project.location}/.env.development"
25
- end
26
-
27
- def dot_env_is_setup?
28
- File.exist? dot_env_file
29
- end
30
-
31
- def create_dot_env_file
32
- unless dot_env_is_setup?
33
- @io.log "Creating .env file"
34
- @util.create_file dot_env_file, :verbose => @env.verbose do
35
- %Q{DB_NAME=#{@project.db_name}
36
- DB_USER=#{@project.db_user}
37
- DB_PASSWORD=#{@project.db_pass}
38
- DB_HOST=#{@project.db_host}
39
- WP_HOME=http://#{@project.url}
40
- WP_SITEURL=http://#{@project.url}/wp
41
-
42
- }
43
- end
44
- end
45
- end
46
-
47
- def remove_dot_env_file
48
- @io.log "Removing .env file"
49
- @util.remove_file dot_env_file, :verbose => @env.verbose
50
- end
51
- end
52
- end
53
- end
1
+ # encoding: UTF-8
2
+
3
+ module ThemeJuice
4
+ module Tasks
5
+ class DotEnv < Task
6
+
7
+ def initialize(opts = {})
8
+ super
9
+ end
10
+
11
+ def execute
12
+ unless @project.no_wp
13
+ create_dot_env_file
14
+ end
15
+ end
16
+
17
+ def unexecute
18
+ remove_dot_env_file
19
+ end
20
+
21
+ private
22
+
23
+ def dot_env_file
24
+ "#{@project.location}/.env.development"
25
+ end
26
+
27
+ def dot_env_is_setup?
28
+ File.exist? dot_env_file
29
+ end
30
+
31
+ def create_dot_env_file
32
+ unless dot_env_is_setup?
33
+ @io.log "Creating .env file"
34
+ @util.create_file dot_env_file, :verbose => @env.verbose do
35
+ %Q{DB_NAME=#{@project.db_name}
36
+ DB_USER=#{@project.db_user}
37
+ DB_PASSWORD=#{@project.db_pass}
38
+ DB_HOST=#{@project.db_host}
39
+ WP_HOME=http://#{@project.url}
40
+ WP_SITEURL=http://#{@project.url}/wp
41
+
42
+ }
43
+ end
44
+ end
45
+ end
46
+
47
+ def remove_dot_env_file
48
+ @io.log "Removing .env file"
49
+ @util.remove_file dot_env_file, :verbose => @env.verbose
50
+ end
51
+ end
52
+ end
53
+ end
@@ -1,50 +1,50 @@
1
- # encoding: UTF-8
2
-
3
- module ThemeJuice
4
- module Tasks
5
- class Entry < Task
6
- attr_accessor :entry
7
-
8
- def initialize(opts = {})
9
- super
10
- end
11
-
12
- private
13
-
14
- def entry_file_is_setup?
15
- File.exist? @entry.fetch(:file)
16
- end
17
-
18
- def create_entry_file
19
- unless entry_file_is_setup?
20
- @io.log "Creating #{@entry.fetch(:name)} file"
21
- @util.create_file @entry.fetch(:file), nil, :verbose => @env.verbose
22
- end
23
- end
24
-
25
- def entry_is_setup?
26
- File.readlines(@entry.fetch(:file)).grep(/(#(#*)? Begin '#{@entry.fetch(:project)}' #{@entry.fetch(:id)})/m).any?
27
- end
28
-
29
- def create_entry(&block)
30
- unless entry_is_setup?
31
- @io.log "Creating #{@entry.fetch(:name)} entry"
32
- @util.append_to_file @entry.fetch(:file), :verbose => @env.verbose do
33
- %Q{# Begin '#{@entry.fetch(:project)}' #{@entry.fetch(:id)}
34
- # The contents below are automatically generated by Theme Juice. Do not modify.
35
- #{yield}
36
- # End '#{@entry.fetch(:project)}' #{@entry.fetch(:id)}
37
-
38
- }
39
- end
40
- end
41
- end
42
-
43
- def remove_entry
44
- @io.log "Removing #{@entry.fetch(:name)} entry"
45
- @util.gsub_file @entry.fetch(:file), /(#(#*)? Begin '#{@entry.fetch(:project)}' #{@entry.fetch(:id)})(.*?)(#(#*)? End '#{@entry.fetch(:project)}' #{@entry.fetch(:id)})\n+/m,
46
- "", :verbose => @env.verbose
47
- end
48
- end
49
- end
50
- end
1
+ # encoding: UTF-8
2
+
3
+ module ThemeJuice
4
+ module Tasks
5
+ class Entry < Task
6
+ attr_accessor :entry
7
+
8
+ def initialize(opts = {})
9
+ super
10
+ end
11
+
12
+ private
13
+
14
+ def entry_file_is_setup?
15
+ File.exist? @entry.fetch(:file)
16
+ end
17
+
18
+ def create_entry_file
19
+ unless entry_file_is_setup?
20
+ @io.log "Creating #{@entry.fetch(:name)} file"
21
+ @util.create_file @entry.fetch(:file), nil, :verbose => @env.verbose
22
+ end
23
+ end
24
+
25
+ def entry_is_setup?
26
+ File.readlines(@entry.fetch(:file)).grep(/(#(#*)? Begin '#{@entry.fetch(:project)}' #{@entry.fetch(:id)})/m).any?
27
+ end
28
+
29
+ def create_entry(&block)
30
+ unless entry_is_setup?
31
+ @io.log "Creating #{@entry.fetch(:name)} entry"
32
+ @util.append_to_file @entry.fetch(:file), :verbose => @env.verbose do
33
+ %Q{# Begin '#{@entry.fetch(:project)}' #{@entry.fetch(:id)}
34
+ # The contents below are automatically generated by Theme Juice. Do not modify.
35
+ #{yield}
36
+ # End '#{@entry.fetch(:project)}' #{@entry.fetch(:id)}
37
+
38
+ }
39
+ end
40
+ end
41
+ end
42
+
43
+ def remove_entry
44
+ @io.log "Removing #{@entry.fetch(:name)} entry"
45
+ @util.gsub_file @entry.fetch(:file), /(#(#*)? Begin '#{@entry.fetch(:project)}' #{@entry.fetch(:id)})(.*?)(#(#*)? End '#{@entry.fetch(:project)}' #{@entry.fetch(:id)})\n+/m,
46
+ "", :verbose => @env.verbose
47
+ end
48
+ end
49
+ end
50
+ end
@@ -1,43 +1,43 @@
1
- # encoding: UTF-8
2
-
3
- module ThemeJuice
4
- module Tasks
5
- class Hosts < Task
6
-
7
- def initialize(opts = {})
8
- super
9
- end
10
-
11
- def execute
12
- create_hosts_file
13
- end
14
-
15
- def unexecute
16
- remove_hosts_file
17
- end
18
-
19
- private
20
-
21
- def hosts_file
22
- "#{@project.location}/vvv-hosts"
23
- end
24
-
25
- def hosts_is_setup?
26
- File.exist? hosts_file
27
- end
28
-
29
- def create_hosts_file
30
- unless hosts_is_setup?
31
- @io.log "Creating hosts file"
32
- @util.create_file hosts_file, "#{@project.url}",
33
- :verbose => @env.verbose
34
- end
35
- end
36
-
37
- def remove_hosts_file
38
- @io.log "Removing hosts file"
39
- @util.remove_file hosts_file, :verbose => @env.verbose
40
- end
41
- end
42
- end
43
- end
1
+ # encoding: UTF-8
2
+
3
+ module ThemeJuice
4
+ module Tasks
5
+ class Hosts < Task
6
+
7
+ def initialize(opts = {})
8
+ super
9
+ end
10
+
11
+ def execute
12
+ create_hosts_file
13
+ end
14
+
15
+ def unexecute
16
+ remove_hosts_file
17
+ end
18
+
19
+ private
20
+
21
+ def hosts_file
22
+ "#{@project.location}/vvv-hosts"
23
+ end
24
+
25
+ def hosts_is_setup?
26
+ File.exist? hosts_file
27
+ end
28
+
29
+ def create_hosts_file
30
+ unless hosts_is_setup?
31
+ @io.log "Creating hosts file"
32
+ @util.create_file hosts_file, "#{@project.url}",
33
+ :verbose => @env.verbose
34
+ end
35
+ end
36
+
37
+ def remove_hosts_file
38
+ @io.log "Removing hosts file"
39
+ @util.remove_file hosts_file, :verbose => @env.verbose
40
+ end
41
+ end
42
+ end
43
+ end
@@ -1,28 +1,28 @@
1
- # encoding: UTF-8
2
-
3
- module ThemeJuice
4
- module Tasks
5
- class ImportDatabase < Task
6
-
7
- def initialize(opts = {})
8
- super
9
- end
10
-
11
- def execute
12
- import_db
13
- end
14
-
15
- private
16
-
17
- def import_db
18
- if @project.db_import
19
- @io.log "Importing existing database"
20
- @util.run_inside_vm [], :verbose => @env.verbose do |cmds|
21
- cmds << "cd #{@project.vm_srv}"
22
- cmds << "wp db import #{@project.db_import}"
23
- end
24
- end
25
- end
26
- end
27
- end
28
- end
1
+ # encoding: UTF-8
2
+
3
+ module ThemeJuice
4
+ module Tasks
5
+ class ImportDatabase < Task
6
+
7
+ def initialize(opts = {})
8
+ super
9
+ end
10
+
11
+ def execute
12
+ import_db
13
+ end
14
+
15
+ private
16
+
17
+ def import_db
18
+ if @project.db_import
19
+ @io.log "Importing existing database"
20
+ @util.run_inside_vm [], :verbose => @env.verbose do |cmds|
21
+ cmds << "cd #{@project.vm_srv}"
22
+ cmds << "wp db import #{@project.db_import}"
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end