theme-juice 0.7.8 → 0.7.9

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 +216 -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 +220 -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 -68
  11. data/lib/theme-juice/env.rb +25 -25
  12. data/lib/theme-juice/io.rb +295 -323
  13. data/lib/theme-juice/project.rb +35 -35
  14. data/lib/theme-juice/task.rb +43 -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 +63 -6
@@ -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
@@ -1,33 +1,33 @@
1
- # encoding: UTF-8
2
-
3
- module ThemeJuice
4
- module Tasks
5
- class Landrush < Entry
6
-
7
- def initialize(opts = {})
8
- super
9
-
10
- @entry = {
11
- :project => "landrush",
12
- :file => "#{@env.vm_path}/Customfile",
13
- :name => "landrush",
14
- :id => "LR"
15
- }
16
- end
17
-
18
- def execute
19
- unless @env.no_landrush
20
- create_entry_file
21
- create_entry do
22
- %Q{config.landrush.enabled = true
23
- config.landrush.tld = 'dev'}
24
- end
25
- end
26
- end
27
-
28
- def unexecute
29
- remove_entry
30
- end
31
- end
32
- end
33
- end
1
+ # encoding: UTF-8
2
+
3
+ module ThemeJuice
4
+ module Tasks
5
+ class Landrush < Entry
6
+
7
+ def initialize(opts = {})
8
+ super
9
+
10
+ @entry = {
11
+ :project => "landrush",
12
+ :file => "#{@env.vm_path}/Customfile",
13
+ :name => "landrush",
14
+ :id => "LR"
15
+ }
16
+ end
17
+
18
+ def execute
19
+ unless @env.no_landrush
20
+ create_entry_file
21
+ create_entry do
22
+ %Q{config.landrush.enabled = true
23
+ config.landrush.tld = 'dev'}
24
+ end
25
+ end
26
+ end
27
+
28
+ def unexecute
29
+ remove_entry
30
+ end
31
+ end
32
+ end
33
+ end
@@ -1,50 +1,50 @@
1
- # encoding: UTF-8
2
-
3
- module ThemeJuice
4
- module Tasks
5
- class List < Task
6
-
7
- def initialize(opts = {})
8
- super
9
-
10
- @project.vm_root = vm_root
11
- @project.vm_location = vm_location
12
- end
13
-
14
- def list(prop)
15
- @io.error "Cannot list '#{prop}'" unless self.respond_to? prop
16
-
17
- if self.send(prop).empty?
18
- @io.log "Nothing to list"
19
- else
20
- @io.list "Projects :", :green, self.send(prop)
21
- end
22
- end
23
-
24
- def projects
25
- res = []
26
-
27
- Dir["#{@project.vm_root}/*"].each do |f|
28
- if File.directory?(f) && f.include?(@env.vm_prefix)
29
- res << File.basename(f).gsub(/(#{@env.vm_prefix})/, "")
30
- end
31
- end
32
-
33
- res
34
- end
35
-
36
- def urls
37
- res = []
38
- ls = `vagrant landrush ls`
39
-
40
- unless ls.nil?
41
- ls.gsub(/\s+/m, " ").split(" ").each do |url|
42
- res << url if /(\.dev)/ =~ url
43
- end
44
- end
45
-
46
- res
47
- end
48
- end
49
- end
50
- end
1
+ # encoding: UTF-8
2
+
3
+ module ThemeJuice
4
+ module Tasks
5
+ class List < Task
6
+
7
+ def initialize(opts = {})
8
+ super
9
+
10
+ @project.vm_root = vm_root
11
+ @project.vm_location = vm_location
12
+ end
13
+
14
+ def list(prop)
15
+ @io.error "Cannot list '#{prop}'", NotImplementedError unless self.respond_to? prop
16
+
17
+ if self.send(prop).empty?
18
+ @io.log "Nothing to list"
19
+ else
20
+ @io.list "Projects :", :green, self.send(prop)
21
+ end
22
+ end
23
+
24
+ def projects
25
+ res = []
26
+
27
+ Dir["#{@project.vm_root}/*"].each do |f|
28
+ if File.directory?(f) && f.include?(@env.vm_prefix)
29
+ res << File.basename(f).gsub(/(#{@env.vm_prefix})/, "")
30
+ end
31
+ end
32
+
33
+ res
34
+ end
35
+
36
+ def urls
37
+ res = []
38
+ ls = `vagrant landrush ls`
39
+
40
+ unless ls.nil?
41
+ ls.gsub(/\s+/m, " ").split(" ").each do |url|
42
+ res << url if /(\.dev)/ =~ url
43
+ end
44
+ end
45
+
46
+ res
47
+ end
48
+ end
49
+ end
50
+ end
@@ -1,23 +1,23 @@
1
- # encoding: UTF-8
2
-
3
- module ThemeJuice
4
- module Tasks
5
- class Location < Task
6
-
7
- def initialize(opts = {})
8
- super
9
- end
10
-
11
- def execute
12
- create_path
13
- end
14
-
15
- private
16
-
17
- def create_path
18
- @io.log "Creating project location"
19
- @util.empty_directory @project.location, :verbose => @env.verbose
20
- end
21
- end
22
- end
23
- end
1
+ # encoding: UTF-8
2
+
3
+ module ThemeJuice
4
+ module Tasks
5
+ class Location < Task
6
+
7
+ def initialize(opts = {})
8
+ super
9
+ end
10
+
11
+ def execute
12
+ create_path
13
+ end
14
+
15
+ private
16
+
17
+ def create_path
18
+ @io.log "Creating project location"
19
+ @util.empty_directory @project.location, :verbose => @env.verbose
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,51 +1,51 @@
1
- # encoding: UTF-8
2
-
3
- module ThemeJuice
4
- module Tasks
5
- class Nginx < Task
6
-
7
- def initialize(opts = {})
8
- super
9
- end
10
-
11
- def execute
12
- create_nginx_file
13
- end
14
-
15
- def unexecute
16
- remove_nginx_file
17
- end
18
-
19
- private
20
-
21
- def nginx_file
22
- "#{@project.location}/vvv-nginx.conf"
23
- end
24
-
25
- def nginx_is_setup?
26
- File.exist? nginx_file
27
- end
28
-
29
- def create_nginx_file
30
- unless nginx_is_setup?
31
- @io.log "Creating nginx file"
32
- @util.create_file nginx_file, :verbose => @env.verbose do
33
- %Q{server \{
34
- listen 80;
35
- server_name .#{@project.url};
36
- root {vvv_path_to_folder};
37
- include /etc/nginx/nginx-wp-common.conf;
38
- \}
39
-
40
- }
41
- end
42
- end
43
- end
44
-
45
- def remove_nginx_file
46
- @io.log "Removing nginx file"
47
- @util.remove_file nginx_file, :verbose => @env.verbose
48
- end
49
- end
50
- end
51
- end
1
+ # encoding: UTF-8
2
+
3
+ module ThemeJuice
4
+ module Tasks
5
+ class Nginx < Task
6
+
7
+ def initialize(opts = {})
8
+ super
9
+ end
10
+
11
+ def execute
12
+ create_nginx_file
13
+ end
14
+
15
+ def unexecute
16
+ remove_nginx_file
17
+ end
18
+
19
+ private
20
+
21
+ def nginx_file
22
+ "#{@project.location}/vvv-nginx.conf"
23
+ end
24
+
25
+ def nginx_is_setup?
26
+ File.exist? nginx_file
27
+ end
28
+
29
+ def create_nginx_file
30
+ unless nginx_is_setup?
31
+ @io.log "Creating nginx file"
32
+ @util.create_file nginx_file, :verbose => @env.verbose do
33
+ %Q{server \{
34
+ listen 80;
35
+ server_name .#{@project.url};
36
+ root {vvv_path_to_folder};
37
+ include /etc/nginx/nginx-wp-common.conf;
38
+ \}
39
+
40
+ }
41
+ end
42
+ end
43
+ end
44
+
45
+ def remove_nginx_file
46
+ @io.log "Removing nginx file"
47
+ @util.remove_file nginx_file, :verbose => @env.verbose
48
+ end
49
+ end
50
+ end
51
+ end
@@ -1,49 +1,49 @@
1
- # encoding: UTF-8
2
-
3
- module ThemeJuice
4
- module Tasks
5
- class Repo < Task
6
-
7
- def initialize(opts = {})
8
- super
9
- end
10
-
11
- def execute
12
- if @project.repository
13
- create_repo
14
- end
15
- end
16
-
17
- private
18
-
19
- def git_dir
20
- File.expand_path "#{@project.location}/.git"
21
- end
22
-
23
- def repo_is_setup?
24
- File.exist? git_dir
25
- end
26
-
27
- def create_repo
28
- @io.log "Creating Git repository"
29
-
30
- remove_repo if repo_is_setup?
31
-
32
- @util.inside @project.location do
33
- @util.run [], :verbose => @env.verbose do |cmds|
34
- cmds << "git init"
35
- cmds << "git remote add origin #{@project.repository}"
36
- end
37
- end
38
- end
39
-
40
- def remove_repo
41
- if @io.agree? "Do you want to overwrite the current repo in '#{@project.location}'?"
42
- @util.remove_dir git_dir, :verbose => @env.verbose
43
- else
44
- @io.error "Run the command again without a repository, or remove the repository currently in '#{@project.location}'"
45
- end
46
- end
47
- end
48
- end
49
- end
1
+ # encoding: UTF-8
2
+
3
+ module ThemeJuice
4
+ module Tasks
5
+ class Repo < Task
6
+
7
+ def initialize(opts = {})
8
+ super
9
+ end
10
+
11
+ def execute
12
+ if @project.repository
13
+ create_repo
14
+ end
15
+ end
16
+
17
+ private
18
+
19
+ def git_dir
20
+ File.expand_path "#{@project.location}/.git"
21
+ end
22
+
23
+ def repo_is_setup?
24
+ File.exist? git_dir
25
+ end
26
+
27
+ def create_repo
28
+ @io.log "Creating Git repository"
29
+
30
+ remove_repo if repo_is_setup?
31
+
32
+ @util.inside @project.location do
33
+ @util.run [], :verbose => @env.verbose do |cmds|
34
+ cmds << "git init"
35
+ cmds << "git remote add origin #{@project.repository}"
36
+ end
37
+ end
38
+ end
39
+
40
+ def remove_repo
41
+ if @io.agree? "Do you want to overwrite the current repo in '#{@project.location}'?"
42
+ @util.remove_dir git_dir, :verbose => @env.verbose
43
+ else
44
+ @io.error "Run the command again without a repository, or remove the repository currently in '#{@project.location}'"
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end