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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 46e089d53f603cc8fa32d4f3778925386691355e
4
- data.tar.gz: d279941fd0cec2fb7ced2a7016caff987e92ffe7
3
+ metadata.gz: cc7e28ff1fea07cafd0d6ffd36117240aca7bf3c
4
+ data.tar.gz: 2356b00a9925161560a62402000fb3f981f6f6fc
5
5
  SHA512:
6
- metadata.gz: 77a5fe320058b05aef9c4d1d054dd7d53a5de7a0357c515da845c0333644a72226af63a348a5ba84e918969308d1888b6e2d4f3f6c60686e1bd9abf351d3a576
7
- data.tar.gz: daa5e793b2367c7ef112d4e5933721639fbcecab39fb3a820fa57749ca11cc9733a50ccbf4e0d39f1005e4294fd982bd9fae827ed4fa3abea04b278ae1eba266
6
+ metadata.gz: 16e57a0bbeedb990eca6d58b87d20639e348a1b534e8fc99640baa1049cd0796ee0116ac62d1e2653470eae7c2386446c560d5dfdea2259081e6c8d0a3c65ac2
7
+ data.tar.gz: f3394b5d1621eef724bd01dd36c8405f96e5ddcb8993e4561c34b8fe46e41386df044bf838b3ec0848080da1c0984cd6855a0ea37fa01803f509407675143d30
@@ -1,6 +1,6 @@
1
1
  set :unicorn_config, -> { "#{deploy_to}/#{current_path}/config/unicorn/production.rb" }
2
2
  set :branch, 'master'
3
- set :rails_env, 'master'
3
+ set :rails_env, 'production'
4
4
 
5
5
  set :domain, 'domain_for_replace'
6
6
  set :deploy_to, 'deploy_directory_for_replace'
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
- repo_path = `git config --get remote.origin.url`.strip()
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
- run 'mina setup'
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 'scp config/database.yml ' + username + '@' + domain + ':' + deploy_directory + '_staging/shared/config/'
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"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weapon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - seaify