sumodev 0.13.1 → 0.13.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sumodev/command.rb +48 -0
- data/lib/sumodev/commands/box.rb +95 -95
- data/lib/sumodev/commands/hooks.rb +18 -0
- data/lib/sumodev/commands/project.rb +215 -20
- data/lib/sumodev/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b76c8021b88540087b06d6db8def2031bc8caca6
|
4
|
+
data.tar.gz: b5d283150c9d3e43c17132aeb2c2cbbcde3ca669
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f04e5008f84998df569567cbaf42e035e9554b2919707d1265051b161e4f46e87d5e0ac57a46e8ca208c6b39f1558d3571a18adceb146d9e3a611e6f2e146bb
|
7
|
+
data.tar.gz: 2d2d98eef7f47c78d2a92cccd8a598b9257bd2c1b952dfc157766ae8eb6a0e47f71867f3a3c28e9d5675205bdba6bf1e4838e39841de5f6ad09d2b767c127b58
|
data/lib/sumodev/command.rb
CHANGED
@@ -1,5 +1,53 @@
|
|
1
|
+
require 'open3'
|
2
|
+
|
1
3
|
class Sumodev::Command < Thor
|
2
4
|
def self.banner(task, namespace = true, subcommand = false)
|
3
5
|
"#{basename} #{task.formatted_usage(self, true, subcommand)}"
|
4
6
|
end
|
7
|
+
|
8
|
+
no_commands do
|
9
|
+
def run_command_without_output(cmd, in_dir = nil, message = nil, verbose = false)
|
10
|
+
if !message.nil?
|
11
|
+
say message, :green
|
12
|
+
end
|
13
|
+
|
14
|
+
if cmd.kind_of?(Array)
|
15
|
+
real_cmd = cmd.join('; ')
|
16
|
+
else
|
17
|
+
real_cmd = cmd
|
18
|
+
end
|
19
|
+
|
20
|
+
if !in_dir.nil?
|
21
|
+
real_cmd = "cd #{in_dir}; #{real_cmd}"
|
22
|
+
end
|
23
|
+
|
24
|
+
out, error, status = Open3.capture3(real_cmd)
|
25
|
+
|
26
|
+
puts out if verbose
|
27
|
+
raise error if status != 0
|
28
|
+
|
29
|
+
return CommandOutput.new out, error, status
|
30
|
+
end
|
31
|
+
|
32
|
+
def continue?(message)
|
33
|
+
ask colorize("#{message}\nPress a key to continue\n")
|
34
|
+
end
|
35
|
+
|
36
|
+
def colorize(message)
|
37
|
+
message = message
|
38
|
+
.gsub(/\*(.*)\*/) { "\033[33m\033[1m#{$1}\033[22m\033[0m" }
|
39
|
+
|
40
|
+
return message
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
class CommandOutput
|
46
|
+
attr_reader :out, :error, :status
|
47
|
+
|
48
|
+
def initialize(out, error, status)
|
49
|
+
@out = out
|
50
|
+
@error = error
|
51
|
+
@status = status
|
52
|
+
end
|
5
53
|
end
|
data/lib/sumodev/commands/box.rb
CHANGED
@@ -1,95 +1,95 @@
|
|
1
|
-
require 'sumodev/command'
|
2
|
-
require 'sumodev/config'
|
3
|
-
require 'sumodev/sumofile'
|
4
|
-
|
5
|
-
class Sumodev::Commands::Box < Sumodev::Command
|
6
|
-
namespace :box
|
7
|
-
|
8
|
-
no_commands do
|
9
|
-
def box_path
|
10
|
-
possible_paths = [
|
11
|
-
Dir.pwd,
|
12
|
-
Sumodev::Config.get('SUMO_VAGRANT_PATH')
|
13
|
-
]
|
14
|
-
|
15
|
-
vagrantfile = possible_paths.detect do |path|
|
16
|
-
File.file?(File.join(File.expand_path(path), "Vagrantfile"))
|
17
|
-
end || raise("No Vagrant file found in #{possible_paths.join(', ')}")
|
18
|
-
|
19
|
-
File.expand_path(vagrantfile)
|
20
|
-
end
|
21
|
-
|
22
|
-
def run_vagrant_command(command, *arguments)
|
23
|
-
# See https://github.com/mitchellh/vagrant/issues/5199#issuecomment-73278236
|
24
|
-
if ["reload", "halt"].include?(command.split(" ")[0])
|
25
|
-
system "rm -rf #{box_path}/.vagrant/machines/*/virtualbox/synced_folders"
|
26
|
-
end
|
27
|
-
system "cd #{box_path}; vagrant #{command} #{arguments.join(' ')}"
|
28
|
-
end
|
29
|
-
|
30
|
-
def box_running?
|
31
|
-
output = `cd #{box_path}; vagrant status`
|
32
|
-
output =~ /The VM is running/
|
33
|
-
end
|
34
|
-
|
35
|
-
def configure_port_mapping
|
36
|
-
return unless Sumodev::Config.true?('SUMO_FORWARD_PORTS')
|
37
|
-
system "sudo pfctl -f /etc/pf.conf"
|
38
|
-
end
|
39
|
-
|
40
|
-
def convert_sumofile_into_env_variables
|
41
|
-
sumofile_path = Dir.pwd + "/Sumofile"
|
42
|
-
|
43
|
-
file = Sumodev::Sumofile.from_file sumofile_path
|
44
|
-
file.convert_into_json_file
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
desc 'up', "Starts the Vagrant-box"
|
49
|
-
def up
|
50
|
-
say("There is already a box running, you should manually start the box. Or halt the running instance", :red) && exit(1) if box_running?
|
51
|
-
|
52
|
-
convert_sumofile_into_env_variables
|
53
|
-
configure_port_mapping
|
54
|
-
run_vagrant_command("up", "--provision")
|
55
|
-
rescue Sumodev::Sumofile::NoSuchFileError
|
56
|
-
say("No Sumofile found! Please define one so the correct versions will be used!", :red) && exit(1)
|
57
|
-
end
|
58
|
-
|
59
|
-
desc 'install', "Installs everything required to use the box command"
|
60
|
-
def install
|
61
|
-
# install vagrant plugins
|
62
|
-
%x(vagrant plugin install vagrant-omnibus)
|
63
|
-
%x(vagrant plugin install vagrant-vbguest)
|
64
|
-
%x(vagrant plugin install vagrant-berkshelf
|
65
|
-
%x(berks vendor berks-cookbooks)
|
66
|
-
|
67
|
-
# install .sumorc file
|
68
|
-
File.open(File.expand_path("~/.sumorc"), 'w') do |f|
|
69
|
-
f.write <<-SUMORC
|
70
|
-
export SUMO_VAGRANT_PATH=""
|
71
|
-
SUMORC
|
72
|
-
end unless File.exists?(File.expand_path("~/.sumorc"))
|
73
|
-
|
74
|
-
# setup resolver
|
75
|
-
File.open("/tmp/vagrant-resolver", 'w') do |f|
|
76
|
-
f.write <<-RESOLVER
|
77
|
-
# Created by sumo command
|
78
|
-
nameserver 10.11.12.13
|
79
|
-
port 53
|
80
|
-
RESOLVER
|
81
|
-
end
|
82
|
-
|
83
|
-
%x(sudo mv /tmp/vagrant-resolver /etc/resolver/vagrant)
|
84
|
-
end
|
85
|
-
|
86
|
-
# Vagrant commands
|
87
|
-
%w(halt provision resume reload ssh status suspend).each do |method|
|
88
|
-
class_eval <<-VAGRANT_METHOD
|
89
|
-
desc '#{method}', 'Runs the #{method} vagrant command'
|
90
|
-
def #{method}(*args)
|
91
|
-
run_vagrant_command("#{method} \#{args.join(' ')}")
|
92
|
-
end
|
93
|
-
VAGRANT_METHOD
|
94
|
-
end
|
95
|
-
end
|
1
|
+
require 'sumodev/command'
|
2
|
+
require 'sumodev/config'
|
3
|
+
require 'sumodev/sumofile'
|
4
|
+
|
5
|
+
class Sumodev::Commands::Box < Sumodev::Command
|
6
|
+
namespace :box
|
7
|
+
|
8
|
+
no_commands do
|
9
|
+
def box_path
|
10
|
+
possible_paths = [
|
11
|
+
Dir.pwd,
|
12
|
+
Sumodev::Config.get('SUMO_VAGRANT_PATH')
|
13
|
+
]
|
14
|
+
|
15
|
+
vagrantfile = possible_paths.detect do |path|
|
16
|
+
File.file?(File.join(File.expand_path(path), "Vagrantfile"))
|
17
|
+
end || raise("No Vagrant file found in #{possible_paths.join(', ')}")
|
18
|
+
|
19
|
+
File.expand_path(vagrantfile)
|
20
|
+
end
|
21
|
+
|
22
|
+
def run_vagrant_command(command, *arguments)
|
23
|
+
# See https://github.com/mitchellh/vagrant/issues/5199#issuecomment-73278236
|
24
|
+
if ["reload", "halt"].include?(command.split(" ")[0])
|
25
|
+
system "rm -rf #{box_path}/.vagrant/machines/*/virtualbox/synced_folders"
|
26
|
+
end
|
27
|
+
system "cd #{box_path}; vagrant #{command} #{arguments.join(' ')}"
|
28
|
+
end
|
29
|
+
|
30
|
+
def box_running?
|
31
|
+
output = `cd #{box_path}; vagrant status`
|
32
|
+
output =~ /The VM is running/
|
33
|
+
end
|
34
|
+
|
35
|
+
def configure_port_mapping
|
36
|
+
return unless Sumodev::Config.true?('SUMO_FORWARD_PORTS')
|
37
|
+
system "sudo pfctl -f /etc/pf.conf"
|
38
|
+
end
|
39
|
+
|
40
|
+
def convert_sumofile_into_env_variables
|
41
|
+
sumofile_path = Dir.pwd + "/Sumofile"
|
42
|
+
|
43
|
+
file = Sumodev::Sumofile.from_file sumofile_path
|
44
|
+
file.convert_into_json_file
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
desc 'up', "Starts the Vagrant-box"
|
49
|
+
def up
|
50
|
+
say("There is already a box running, you should manually start the box. Or halt the running instance", :red) && exit(1) if box_running?
|
51
|
+
|
52
|
+
convert_sumofile_into_env_variables
|
53
|
+
configure_port_mapping
|
54
|
+
run_vagrant_command("up", "--provision")
|
55
|
+
rescue Sumodev::Sumofile::NoSuchFileError
|
56
|
+
say("No Sumofile found! Please define one so the correct versions will be used!", :red) && exit(1)
|
57
|
+
end
|
58
|
+
|
59
|
+
desc 'install', "Installs everything required to use the box command"
|
60
|
+
def install
|
61
|
+
# install vagrant plugins
|
62
|
+
%x(vagrant plugin install vagrant-omnibus)
|
63
|
+
%x(vagrant plugin install vagrant-vbguest)
|
64
|
+
%x(vagrant plugin install vagrant-berkshelf)
|
65
|
+
%x(berks vendor berks-cookbooks)
|
66
|
+
|
67
|
+
# install .sumorc file
|
68
|
+
File.open(File.expand_path("~/.sumorc"), 'w') do |f|
|
69
|
+
f.write <<-SUMORC
|
70
|
+
export SUMO_VAGRANT_PATH=""
|
71
|
+
SUMORC
|
72
|
+
end unless File.exists?(File.expand_path("~/.sumorc"))
|
73
|
+
|
74
|
+
# setup resolver
|
75
|
+
File.open("/tmp/vagrant-resolver", 'w') do |f|
|
76
|
+
f.write <<-RESOLVER
|
77
|
+
# Created by sumo command
|
78
|
+
nameserver 10.11.12.13
|
79
|
+
port 53
|
80
|
+
RESOLVER
|
81
|
+
end
|
82
|
+
|
83
|
+
%x(sudo mv /tmp/vagrant-resolver /etc/resolver/vagrant)
|
84
|
+
end
|
85
|
+
|
86
|
+
# Vagrant commands
|
87
|
+
%w(halt provision resume reload ssh status suspend).each do |method|
|
88
|
+
class_eval <<-VAGRANT_METHOD
|
89
|
+
desc '#{method}', 'Runs the #{method} vagrant command'
|
90
|
+
def #{method}(*args)
|
91
|
+
run_vagrant_command("#{method} \#{args.join(' ')}")
|
92
|
+
end
|
93
|
+
VAGRANT_METHOD
|
94
|
+
end
|
95
|
+
end
|
@@ -67,6 +67,24 @@ class Sumodev::Commands::Hooks < Sumodev::Command
|
|
67
67
|
errors_and_warnings
|
68
68
|
end
|
69
69
|
|
70
|
+
def check_for_merge_conflicts(files)
|
71
|
+
methods = [
|
72
|
+
{
|
73
|
+
:human_readable_message => "Checking for merge conflicts",
|
74
|
+
:command => "egrep -no '<<<<<<<' %{file}",
|
75
|
+
:line_handler => lambda { |line|
|
76
|
+
return build_error_or_warning(
|
77
|
+
'warning',
|
78
|
+
line.scan(/([0-9]*):/)[0][0],
|
79
|
+
"Merge conflict found: " + line.scan(/[0-9]*:(.*)/)[0][0]
|
80
|
+
)
|
81
|
+
}
|
82
|
+
}
|
83
|
+
]
|
84
|
+
|
85
|
+
check_files(files, methods)
|
86
|
+
end
|
87
|
+
|
70
88
|
def check_css_files(files)
|
71
89
|
methods = [
|
72
90
|
{
|
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'sumodev/command'
|
2
2
|
require 'sumodev/config'
|
3
|
+
require 'open3'
|
4
|
+
require 'securerandom'
|
3
5
|
|
4
6
|
class Sumodev::Commands::Project < Sumodev::Command
|
5
7
|
namespace :project
|
@@ -48,6 +50,115 @@ class Sumodev::Commands::Project < Sumodev::Command
|
|
48
50
|
end
|
49
51
|
end
|
50
52
|
|
53
|
+
option :project_path, :desc => "the path where the project should be placed"
|
54
|
+
option :bundles, :type => :boolean, :default => true, :desc => "install bundles"
|
55
|
+
option :node_modules, :type => :boolean, :default => true, :desc => "install node-modules"
|
56
|
+
option :bower, :type => :boolean, :default => true, :desc => "install bower packages"
|
57
|
+
option :composer, :type => :boolean, :default => true, :desc => "install composer packages"
|
58
|
+
option :composer_run_scripts, :type => :boolean, :default => true, :desc => "run composer scripts"
|
59
|
+
|
60
|
+
desc 'new fork|framework client project', 'create a new Fork Project'
|
61
|
+
def new(type, client, project)
|
62
|
+
begin
|
63
|
+
if type != "fork"
|
64
|
+
raise "Only fork is implemented"
|
65
|
+
end
|
66
|
+
|
67
|
+
repo = "git@git.sumocoders.be:sumocoders/#{client}-#{project}.git"
|
68
|
+
repo_url = repo.gsub('.be:', '.be/').gsub('git@', 'http://').gsub('.git', '')
|
69
|
+
|
70
|
+
# check if repo exists
|
71
|
+
begin
|
72
|
+
self.run_command_without_output("git ls-remote #{repo}", nil, "--> Check if repo #{repo} exists.")
|
73
|
+
rescue Exception => e
|
74
|
+
raise "Please create a repository named #{client}-#{project} first:\nhttp://git.sumocoders.be/projects/new"
|
75
|
+
end
|
76
|
+
|
77
|
+
tmp_path = File.expand_path(Sumodev::Config.get('SUMO_TEMP_PATH'));
|
78
|
+
sites_path = File.expand_path(Sumodev::Config.get('SUMO_SITES_PATH'))
|
79
|
+
|
80
|
+
if options[:project_path].nil?
|
81
|
+
project_path = File.expand_path("#{sites_path}/#{client}/#{project}")
|
82
|
+
else
|
83
|
+
project_path = File.expand_path(options[:project_path])
|
84
|
+
end
|
85
|
+
|
86
|
+
clone_repo("git://github.com/sumocoders/forkcms.git", "#{tmp_path}/temp_project")
|
87
|
+
run_command_without_output("rm -rf #{tmp_path}/temp_project/.git")
|
88
|
+
initialize_repo("#{tmp_path}/temp_project", repo)
|
89
|
+
|
90
|
+
# ask to set the default branch to staging
|
91
|
+
run_command_without_output("open #{repo_url}/edit")
|
92
|
+
continue?("Gitlab will now open, change the default branch to *staging*")
|
93
|
+
|
94
|
+
move_project("#{tmp_path}/temp_project", project_path)
|
95
|
+
populate_capfile("#{project_path}/Capfile", client, project, repo)
|
96
|
+
|
97
|
+
# install assets
|
98
|
+
install_bundles(project_path) if options[:bundles]
|
99
|
+
install_node_modules(project_path) if options[:node_modules]
|
100
|
+
install_bower_packages(project_path) if options[:bower]
|
101
|
+
install_composer_packages(project_path, options[:composer_run_scripts]) if options[:composer]
|
102
|
+
|
103
|
+
# create database
|
104
|
+
run_command_without_output(
|
105
|
+
[
|
106
|
+
"bundle exec cap staging sumodev:db:create",
|
107
|
+
"bundle exec cap staging sumodev:db:get"
|
108
|
+
],
|
109
|
+
project_path,
|
110
|
+
"--> Creating database on staging and local"
|
111
|
+
)
|
112
|
+
|
113
|
+
# grab database information
|
114
|
+
output = run_command_without_output("bundle exec cap staging sumodev:db:info 2>&1", project_path)
|
115
|
+
database_information = output.out
|
116
|
+
.gsub("** [out :: dev.sumocoders.be] ", "")
|
117
|
+
.gsub("\n", "")
|
118
|
+
|
119
|
+
database_name = database_information.scan(/database:(.*)user/)[0][0].gsub(/\s+/, '')
|
120
|
+
database_user = database_information.scan(/user:(.*)pass/)[0][0].gsub(/\s+/, '')
|
121
|
+
database_password = database_information.scan(/pass:(.*)command/)[0][0].gsub(/\s+/, '')
|
122
|
+
|
123
|
+
run_command_without_output(
|
124
|
+
"sed -i '' -e 's|site.path_www:.*|site.path_www: /home/sites/#{client}/#{project}|g' #{project_path}/app/config/parameters_install.yml",
|
125
|
+
nil,
|
126
|
+
"--> Configuring parameters_install.yml"
|
127
|
+
)
|
128
|
+
run_command_without_output("rm -rf #{project_path}/app/cache/install")
|
129
|
+
|
130
|
+
# run the installer
|
131
|
+
run_command_without_output("open http://#{project}.#{client}.dev")
|
132
|
+
continue?("The installer will now open.\nYou can use *#{database_name}* as the database_name.")
|
133
|
+
|
134
|
+
install_initial_theme(project_path, database_name)
|
135
|
+
|
136
|
+
# commit our changes
|
137
|
+
run_command_without_output(
|
138
|
+
[
|
139
|
+
"git add Capfile",
|
140
|
+
"git add app/config/parameters_install.yml",
|
141
|
+
"git add package.json",
|
142
|
+
"git add Gemfile.lock",
|
143
|
+
"git add src/Frontend/Themes/Custom",
|
144
|
+
"git commit -m 'Init configuration of the project'",
|
145
|
+
"git push"
|
146
|
+
],
|
147
|
+
project_path,
|
148
|
+
"--> Commiting the initial configuration of the project"
|
149
|
+
)
|
150
|
+
|
151
|
+
# deploy
|
152
|
+
initial_deploy(project_path, client, project, database_name, database_user, database_password)
|
153
|
+
deploy(project_path, "staging")
|
154
|
+
|
155
|
+
change_location(project_path)
|
156
|
+
say "All done", :green
|
157
|
+
rescue Exception => e
|
158
|
+
say e.message, :red
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
51
162
|
no_commands do
|
52
163
|
def get_client(path)
|
53
164
|
return get_var(path, "client")
|
@@ -70,9 +181,27 @@ class Sumodev::Commands::Project < Sumodev::Command
|
|
70
181
|
end
|
71
182
|
|
72
183
|
def clone_repo(repo, destination)
|
73
|
-
|
74
|
-
|
75
|
-
|
184
|
+
run_command_without_output(
|
185
|
+
"rm -rf #{destination}; git clone #{repo} #{destination}",
|
186
|
+
nil,
|
187
|
+
"--> Cloning repo #{repo}"
|
188
|
+
)
|
189
|
+
end
|
190
|
+
|
191
|
+
def initialize_repo(path, repo)
|
192
|
+
run_command_without_output(
|
193
|
+
[
|
194
|
+
"git init",
|
195
|
+
"git add .",
|
196
|
+
"git commit -n -m 'Initial commit'",
|
197
|
+
"git remote add origin #{repo}",
|
198
|
+
"git push -u origin master",
|
199
|
+
"git checkout -b staging",
|
200
|
+
"git push -u origin staging"
|
201
|
+
],
|
202
|
+
path,
|
203
|
+
"--> Initialize repo #{repo}"
|
204
|
+
)
|
76
205
|
end
|
77
206
|
|
78
207
|
def process_capfile(path)
|
@@ -96,13 +225,27 @@ class Sumodev::Commands::Project < Sumodev::Command
|
|
96
225
|
]
|
97
226
|
end
|
98
227
|
|
228
|
+
def populate_capfile(path, client, project, repo)
|
229
|
+
unless File.file?(path)
|
230
|
+
raise "No Capfile found"
|
231
|
+
end
|
232
|
+
|
233
|
+
say "--> Configuring Capfile", :green
|
234
|
+
|
235
|
+
content = File.read(path)
|
236
|
+
.gsub(/set :client,.*/, "set :client, \"#{client}\"")
|
237
|
+
.gsub(/set :project,.*/, "set :project, \"#{project}\"")
|
238
|
+
.gsub(/set :repository,.*/, "set :repository, \"#{repo}\"")
|
239
|
+
|
240
|
+
File.write(path, content)
|
241
|
+
end
|
242
|
+
|
99
243
|
def install_bundles(path)
|
100
244
|
unless File.file?("#{path}/Gemfile")
|
101
245
|
return
|
102
246
|
end
|
103
247
|
|
104
|
-
|
105
|
-
system "cd #{path}; bundle install"
|
248
|
+
run_command_without_output("bundle install", path, "--> Installing gems")
|
106
249
|
end
|
107
250
|
|
108
251
|
def install_node_modules(path)
|
@@ -110,8 +253,7 @@ class Sumodev::Commands::Project < Sumodev::Command
|
|
110
253
|
return
|
111
254
|
end
|
112
255
|
|
113
|
-
|
114
|
-
system "cd #{path}; npm install"
|
256
|
+
run_command_without_output("npm install", path, "--> Installing node modules")
|
115
257
|
end
|
116
258
|
|
117
259
|
def install_bower_packages(path)
|
@@ -119,23 +261,36 @@ class Sumodev::Commands::Project < Sumodev::Command
|
|
119
261
|
return
|
120
262
|
end
|
121
263
|
|
122
|
-
|
123
|
-
system "cd #{path}; bower install"
|
264
|
+
run_command_without_output("bower install", path, "--> Installing bower packages")
|
124
265
|
end
|
125
266
|
|
126
267
|
def install_composer_packages(path, run_scripts)
|
127
268
|
unless File.file?("#{path}/composer.json")
|
128
|
-
puts "foo"
|
129
269
|
return
|
130
270
|
end
|
131
271
|
|
132
|
-
|
272
|
+
cmd = "composer install"
|
133
273
|
|
134
|
-
if run_scripts
|
135
|
-
|
136
|
-
else
|
137
|
-
system "cd #{path}; composer install --no-scripts"
|
274
|
+
if !run_scripts
|
275
|
+
cmd = "#{cmd} --no-scripts"
|
138
276
|
end
|
277
|
+
|
278
|
+
run_command_without_output(cmd, path, "--> Installing composer dependencies")
|
279
|
+
end
|
280
|
+
|
281
|
+
def install_initial_theme(path, database)
|
282
|
+
run_command_without_output(
|
283
|
+
[
|
284
|
+
"php tools/install_locale.php -f src/Frontend/Themes/Bootstrap/locale.xml",
|
285
|
+
"cp -r src/Frontend/Themes/Bootstrap src/Frontend/Themes/Custom",
|
286
|
+
"sed -i '' -e 's|.*<name>bootstrap</name>.*| <name>custom</name>|g' src/Frontend/Themes/Custom/info.xml",
|
287
|
+
"sed -i '' -e 's/set :theme.*/set :theme, \"Custom\"/g' Capfile",
|
288
|
+
"sed -i '' -e 's/.*\"theme\":.*/ \"theme\": \"Custom\",/g' package.json",
|
289
|
+
"mysql #{database} -e \"UPDATE modules_settings SET value='s:6:\\\"Custom\\\"' where module='Core' and name='theme'\""
|
290
|
+
],
|
291
|
+
path,
|
292
|
+
"--> Creating the initial Custom theme"
|
293
|
+
)
|
139
294
|
end
|
140
295
|
|
141
296
|
def move_project(source, destination)
|
@@ -143,9 +298,14 @@ class Sumodev::Commands::Project < Sumodev::Command
|
|
143
298
|
raise "Project folder already exists."
|
144
299
|
end
|
145
300
|
|
146
|
-
|
147
|
-
|
148
|
-
|
301
|
+
run_command_without_output(
|
302
|
+
[
|
303
|
+
"mkdir -p #{destination}",
|
304
|
+
"shopt -s dotglob; mv #{source}/* #{destination}"
|
305
|
+
],
|
306
|
+
nil,
|
307
|
+
"--> Moving everything into place"
|
308
|
+
)
|
149
309
|
end
|
150
310
|
|
151
311
|
def fetch_data(path, stage)
|
@@ -165,7 +325,7 @@ class Sumodev::Commands::Project < Sumodev::Command
|
|
165
325
|
return
|
166
326
|
end
|
167
327
|
|
168
|
-
content = File.read(
|
328
|
+
content = File.read("#{path}/VERSION.md")
|
169
329
|
min_version = Gem::Version.new('3.6')
|
170
330
|
project_version = Gem::Version.new(content)
|
171
331
|
|
@@ -183,8 +343,43 @@ class Sumodev::Commands::Project < Sumodev::Command
|
|
183
343
|
end
|
184
344
|
end
|
185
345
|
|
346
|
+
def initial_deploy(path, client, project, database_name, database_user, database_password)
|
347
|
+
content = File.read("#{path}/app/config/parameters.yml")
|
348
|
+
content = content
|
349
|
+
.gsub(/database.host:.*/, "database.host: 127.0.0.1")
|
350
|
+
.gsub(/database.name:.*/, "database.name: #{database_name}")
|
351
|
+
.gsub(/database.user:.*/, "database.user: #{database_user}")
|
352
|
+
.gsub(/database.password:.*/, "database.password: #{database_password}")
|
353
|
+
.gsub(/site.domain:.*/, "site.domain: #{project}.#{client}.sumocoders.eu")
|
354
|
+
File.write("#{path}/app/config/parameters.dev.yml", content)
|
355
|
+
|
356
|
+
run_command_without_output(
|
357
|
+
[
|
358
|
+
"bundle exec cap deploy:setup",
|
359
|
+
"bundle exec cap deploy",
|
360
|
+
"bundle exec cap sumodev:db:put",
|
361
|
+
"bundle exec cap sumodev:db:lock",
|
362
|
+
"scp app/config/parameters.dev.yml sites@dev.sumocoders.eu:/home/sites/apps/#{client}/#{project}/shared/config/parameters.yml",
|
363
|
+
"rm #{path}/app/config/parameters.dev.yml"
|
364
|
+
],
|
365
|
+
path,
|
366
|
+
"--> Running initial deploy, aka deploy:setup"
|
367
|
+
)
|
368
|
+
end
|
369
|
+
|
370
|
+
def deploy(path, stage)
|
371
|
+
run_command_without_output(
|
372
|
+
[
|
373
|
+
"grunt build",
|
374
|
+
"bundle exec cap #{stage} deploy"
|
375
|
+
],
|
376
|
+
path,
|
377
|
+
"--> Deploying to #{stage}"
|
378
|
+
)
|
379
|
+
end
|
380
|
+
|
186
381
|
def change_location(destination)
|
187
|
-
say "Your project is located in
|
382
|
+
say colorize("Your project is located in: *#{destination}*"), :green
|
188
383
|
end
|
189
384
|
end
|
190
385
|
end
|
data/lib/sumodev/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sumodev
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.13.
|
4
|
+
version: 0.13.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan De Poorter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|