weapon 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/support/mina_unicorn/deploy_production.rb +1 -1
- data/lib/weapon.rb +16 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc7e28ff1fea07cafd0d6ffd36117240aca7bf3c
|
4
|
+
data.tar.gz: 2356b00a9925161560a62402000fb3f981f6f6fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16e57a0bbeedb990eca6d58b87d20639e348a1b534e8fc99640baa1049cd0796ee0116ac62d1e2653470eae7c2386446c560d5dfdea2259081e6c8d0a3c65ac2
|
7
|
+
data.tar.gz: f3394b5d1621eef724bd01dd36c8405f96e5ddcb8993e4561c34b8fe46e41386df044bf838b3ec0848080da1c0984cd6855a0ea37fa01803f509407675143d30
|
data/lib/weapon.rb
CHANGED
@@ -37,7 +37,8 @@ class Weapon < Thor
|
|
37
37
|
desc "setup_mina_unicorn", "setup mina deploy and unicorn server"
|
38
38
|
def setup_mina_unicorn
|
39
39
|
makesure_in_git
|
40
|
-
|
40
|
+
repo_path = `git config --get remote.origin.url`.strip()
|
41
|
+
return puts "at least one remote url should be set before we start!!!".colorize(:red) unless repo_path.present?
|
41
42
|
gem_group :development do
|
42
43
|
gem 'mina-multistage', require: false
|
43
44
|
gem 'mina-unicorn', require: false
|
@@ -60,7 +61,7 @@ class Weapon < Thor
|
|
60
61
|
app_name = `pwd`.split('/')[-1].strip()
|
61
62
|
username, domain = ask("input your username && host like seaify@1.2.3.4: ").split('@')
|
62
63
|
deploy_directory = "/home/#{username}/#{app_name}"
|
63
|
-
|
64
|
+
|
64
65
|
|
65
66
|
%w(app_name username domain deploy_directory repo_path).each do |key|
|
66
67
|
ap key
|
@@ -90,20 +91,30 @@ class Weapon < Thor
|
|
90
91
|
=end
|
91
92
|
run "ssh-copy-id #{username}@#{domain}"
|
92
93
|
|
93
|
-
|
94
|
+
staging = `git branch -a | grep staging | ag remote`
|
95
|
+
ap staging
|
96
|
+
run 'mina setup' if staging.present?
|
97
|
+
run 'mina production setup'
|
94
98
|
|
95
99
|
run 'scp config/database.yml ' + username + '@' + domain + ':' + deploy_directory + '/shared/config/'
|
96
100
|
run 'scp config/application.yml ' + username + '@' + domain + ':' + deploy_directory + '/shared/config/'
|
97
101
|
run 'scp config/secrets.yml ' + username + '@' + domain + ':' + deploy_directory + '/shared/config/'
|
98
102
|
|
99
|
-
run '
|
103
|
+
run 'cp config/database.yml config/staging_database.yml'
|
104
|
+
gsub_file "config/staging_database.yml", "production", "staging"
|
105
|
+
run 'scp config/staging_database.yml ' + username + '@' + domain + ':' + deploy_directory + '_staging/shared/config/database.yml'
|
106
|
+
run "rm config/staging_database.yml"
|
100
107
|
run 'scp config/application.yml ' + username + '@' + domain + ':' + deploy_directory + '_staging/shared/config/'
|
101
108
|
run 'scp config/secrets.yml ' + username + '@' + domain + ':' + deploy_directory + '_staging/shared/config/'
|
102
109
|
|
103
|
-
run 'mina deploy'
|
110
|
+
run 'mina deploy' if staging.present?
|
111
|
+
run 'mina production deploy'
|
112
|
+
run 'git add config/ .gitignore staging-unicorn-nginx.conf unicorn-nginx.conf'
|
113
|
+
run 'git commit -a -m "add mina unicorn multi stage support"'
|
104
114
|
puts "remember to make soft link to unicorn-nginx.conf && staging-unicorn-nginx.conf".colorize(:blue)
|
105
115
|
puts "remember to restart nginx server".colorize(:blue)
|
106
116
|
puts "remember to add ssh key to your repo setting url".colorize(:blue)
|
117
|
+
puts "staging branch missing, you need create staging branch, then exec mina setup, mina deploy".colorize(:red) unless staging.present?
|
107
118
|
end
|
108
119
|
|
109
120
|
desc "setup_settings_ui", "setup settings ui"
|