theme-juice 0.6.18 → 0.7.0
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/README.md +106 -75
- data/bin/tj +5 -5
- data/lib/theme-juice.rb +32 -16
- data/lib/theme-juice/cli.rb +191 -298
- data/lib/theme-juice/command.rb +14 -13
- data/lib/theme-juice/commands/create.rb +214 -9
- data/lib/theme-juice/commands/delete.rb +45 -10
- data/lib/theme-juice/commands/deploy.rb +20 -0
- data/lib/theme-juice/config.rb +43 -0
- data/lib/theme-juice/env.rb +25 -0
- data/lib/theme-juice/io.rb +323 -0
- data/lib/theme-juice/project.rb +35 -0
- data/lib/theme-juice/task.rb +42 -0
- data/lib/theme-juice/tasks/create_confirm.rb +33 -0
- data/lib/theme-juice/tasks/create_success.rb +42 -0
- data/lib/theme-juice/tasks/database.rb +50 -0
- data/lib/theme-juice/tasks/delete_confirm.rb +24 -0
- data/lib/theme-juice/tasks/delete_success.rb +31 -0
- data/lib/theme-juice/tasks/dns.rb +45 -0
- data/lib/theme-juice/tasks/dot_env.rb +53 -0
- data/lib/theme-juice/tasks/entry.rb +50 -0
- data/lib/theme-juice/tasks/hosts.rb +43 -0
- data/lib/theme-juice/tasks/import_database.rb +28 -0
- data/lib/theme-juice/tasks/landrush.rb +33 -0
- data/lib/theme-juice/tasks/list.rb +50 -0
- data/lib/theme-juice/tasks/location.rb +23 -0
- data/lib/theme-juice/tasks/nginx.rb +51 -0
- data/lib/theme-juice/tasks/repo.rb +49 -0
- data/lib/theme-juice/tasks/synced_folder.rb +30 -0
- data/lib/theme-juice/tasks/theme.rb +34 -0
- data/lib/theme-juice/tasks/vm.rb +30 -0
- data/lib/theme-juice/tasks/vm_customfile.rb +42 -0
- data/lib/theme-juice/tasks/vm_location.rb +32 -0
- data/lib/theme-juice/tasks/vm_plugins.rb +32 -0
- data/lib/theme-juice/tasks/vm_provision.rb +39 -0
- data/lib/theme-juice/tasks/vm_restart.rb +25 -0
- data/lib/theme-juice/tasks/wp_cli.rb +52 -0
- data/lib/theme-juice/util.rb +45 -0
- data/lib/theme-juice/version.rb +1 -1
- metadata +66 -34
- data/LICENSE +0 -339
- data/lib/theme-juice/commands/install.rb +0 -16
- data/lib/theme-juice/commands/list.rb +0 -16
- data/lib/theme-juice/commands/subcommand.rb +0 -16
- data/lib/theme-juice/environment.rb +0 -15
- data/lib/theme-juice/interaction.rb +0 -445
- data/lib/theme-juice/interactions/create.rb +0 -278
- data/lib/theme-juice/interactions/delete.rb +0 -48
- data/lib/theme-juice/interactions/teejay.rb +0 -12
- data/lib/theme-juice/service.rb +0 -224
- data/lib/theme-juice/services/config.rb +0 -44
- data/lib/theme-juice/services/create.rb +0 -376
- data/lib/theme-juice/services/delete.rb +0 -113
- data/lib/theme-juice/services/list.rb +0 -40
@@ -0,0 +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
|
@@ -0,0 +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
|
@@ -0,0 +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
|
@@ -0,0 +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
|
@@ -0,0 +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
|
@@ -0,0 +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
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
module ThemeJuice
|
4
|
+
module Tasks
|
5
|
+
class SyncedFolder < Entry
|
6
|
+
|
7
|
+
def initialize(opts = {})
|
8
|
+
super
|
9
|
+
|
10
|
+
@entry = {
|
11
|
+
:project => @project.name,
|
12
|
+
:file => "#{@env.vm_path}/Customfile",
|
13
|
+
:name => "synced folder",
|
14
|
+
:id => "SF"
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
18
|
+
def execute
|
19
|
+
create_entry_file
|
20
|
+
create_entry do
|
21
|
+
%Q{config.vm.synced_folder '#{@project.location}', '/srv/www/tj-#{@project.name}', mount_options: ['dmode=777','fmode=777']}
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def unexecute
|
26
|
+
remove_entry
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
module ThemeJuice
|
4
|
+
module Tasks
|
5
|
+
class Theme < Task
|
6
|
+
|
7
|
+
def initialize(opts = {})
|
8
|
+
super
|
9
|
+
end
|
10
|
+
|
11
|
+
def execute
|
12
|
+
if @project.theme
|
13
|
+
clone_theme
|
14
|
+
install_theme
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def clone_theme
|
21
|
+
@io.log "Cloning theme"
|
22
|
+
@util.inside @project.location do
|
23
|
+
@util.run "git clone --depth 1 #{@project.theme} .",
|
24
|
+
:verbose => @env.verbose
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def install_theme
|
29
|
+
@io.log "Running theme installation"
|
30
|
+
@config.install
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
module ThemeJuice
|
4
|
+
module Tasks
|
5
|
+
class VM < Task
|
6
|
+
|
7
|
+
def initialize(opts = {})
|
8
|
+
super
|
9
|
+
end
|
10
|
+
|
11
|
+
def execute
|
12
|
+
install_vvv
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def vvv_is_installed?
|
18
|
+
File.exist? @env.vm_path
|
19
|
+
end
|
20
|
+
|
21
|
+
def install_vvv
|
22
|
+
unless vvv_is_installed?
|
23
|
+
@io.log "Installing VVV"
|
24
|
+
@util.run "git clone https://github.com/Varying-Vagrant-Vagrants/VVV.git #{@env.vm_path} --depth 1",
|
25
|
+
:verbose => @env.verbose
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
module ThemeJuice
|
4
|
+
module Tasks
|
5
|
+
class VMCustomfile < Task
|
6
|
+
|
7
|
+
def initialize(opts = {})
|
8
|
+
super
|
9
|
+
end
|
10
|
+
|
11
|
+
def execute
|
12
|
+
create_custom_file
|
13
|
+
end
|
14
|
+
|
15
|
+
def unexecute
|
16
|
+
remove_custom_file
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def custom_file
|
22
|
+
File.expand_path "#{@env.vm_path}/Customfile"
|
23
|
+
end
|
24
|
+
|
25
|
+
def custom_file_is_setup?
|
26
|
+
File.exist? custom_file
|
27
|
+
end
|
28
|
+
|
29
|
+
def create_custom_file
|
30
|
+
unless custom_file_is_setup?
|
31
|
+
@io.log "Creating customfile"
|
32
|
+
@util.create_file custom_file, nil, :verbose => @env.verbose
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def remove_custom_file
|
37
|
+
@io.log "Removing customfile"
|
38
|
+
@util.remove_file custom_file, :verbose => @env.verbose
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
module ThemeJuice
|
4
|
+
module Tasks
|
5
|
+
class VMLocation < Task
|
6
|
+
|
7
|
+
def initialize(opts = {})
|
8
|
+
super
|
9
|
+
end
|
10
|
+
|
11
|
+
def execute
|
12
|
+
create_path
|
13
|
+
end
|
14
|
+
|
15
|
+
def unexecute
|
16
|
+
remove_path
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def create_path
|
22
|
+
@io.log "Creating project location in VM"
|
23
|
+
@util.empty_directory @project.vm_location, :verbose => @env.verbose
|
24
|
+
end
|
25
|
+
|
26
|
+
def remove_path
|
27
|
+
@io.log "Removing project location in VM"
|
28
|
+
@util.remove_dir @project.vm_location, :verbose => @env.verbose
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
module ThemeJuice
|
4
|
+
module Tasks
|
5
|
+
class VMPlugins < Task
|
6
|
+
|
7
|
+
def initialize(opts = {})
|
8
|
+
super
|
9
|
+
end
|
10
|
+
|
11
|
+
def execute
|
12
|
+
install_vagrant_plugin "vagrant-triggers", "0.5.0"
|
13
|
+
install_vagrant_plugin "vagrant-hostsupdater", "0.0.11"
|
14
|
+
install_vagrant_plugin "landrush", "0.18.0" unless @env.no_landrush
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def vagrant_plugin_is_installed?(plugin)
|
20
|
+
`vagrant plugin list`.include? plugin
|
21
|
+
end
|
22
|
+
|
23
|
+
def install_vagrant_plugin(plugin, version)
|
24
|
+
unless vagrant_plugin_is_installed? plugin
|
25
|
+
@io.log "Installing #{plugin}"
|
26
|
+
@util.run "vagrant plugin install #{plugin} --plugin-version #{version}",
|
27
|
+
:verbose => @env.verbose
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|