ops_preflight 1.2.1 → 1.3.0

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: fd48049711cde0ea907828086220cfd33dc0fa07
4
- data.tar.gz: eeb1c04fe898406d86827cfcd15072421c402040
3
+ metadata.gz: cbd1e6271108d8cf4b0bc775ad182d1ac6dc44f1
4
+ data.tar.gz: 344f3f4e7a70dd77e83fe942cfc744de55593bbd
5
5
  SHA512:
6
- metadata.gz: f11b8f065b19492b330d24bba1e40966f2aa23e09d7f59f8d28bf073a994a3c5ec45956b61cdb613f983f1ef4146e193a28fc92a6dceb74b1534a23ce54e246e
7
- data.tar.gz: 6a09d626224956ac82a28aaefa5172b4eab94e0954829c380b0680727eb0b996d596d4719e2623c8851f80d61d20d6086419f12cc23f8cb053631ae7353f6341
6
+ metadata.gz: 0b67dea8afe3bf402a23906d0412d63be5b2f36926ccc4b47ab469633bdf1bdc2d7770b9d0f80d8e8c2b27c38aca9ccfe0031d97937a91eddf1bf3e7e890ad4d
7
+ data.tar.gz: dddf544bfaa0f922c91a718b324ff6c141bd428a446736f5bdd6d90e926a32b00eb6d78cf26d159312ac397c8d04bb9a71fd4ba4fdf652500f8f8bbb68d2b783
data/data/deploy.rb CHANGED
@@ -4,6 +4,7 @@ require 'mina/git'
4
4
  # require 'mina/rbenv' # for rbenv support. (http://rbenv.org)
5
5
  # require 'mina/rvm' # for rvm support. (http://rvm.io)
6
6
  require 'ops_preflight/tasks'
7
+ require 'ops_preflight/ember_tasks'
7
8
 
8
9
  # Basic settings:
9
10
  # domain - The hostname to SSH to.
@@ -17,6 +18,9 @@ set :app_name, ENV['APP_NAME']
17
18
  set :deploy_to, lambda { "/home/#{settings.user!}/preflight/#{settings.app_name!}-#{settings.rails_env!}" }
18
19
  set :repository, ENV['REPOSITORY']
19
20
  set :branch, ENV['BRANCH']
21
+ set :remove_git_dir, false
22
+ set :deploy_rails, true
23
+ set :deploy_ember, false
20
24
 
21
25
  # set :rbenv_path, '/usr/local/rbenv'
22
26
  set :preflight_bucket, ENV['PREFLIGHT_BUCKET']
@@ -70,12 +74,28 @@ task :environment do
70
74
  end
71
75
  end
72
76
 
77
+ if ENV['DEPLOY_EMBER'] == 'true'
78
+ set :deploy_ember, true
79
+ end
80
+
81
+ if ENV['EMBER_ONLY'] == 'true'
82
+ set :deploy_ember, true
83
+ set :deploy_rails, false
84
+ end
73
85
  end
74
86
 
75
87
  # Put any custom mkdir's in here for when `mina setup` is ran.
76
88
  # For Rails apps, we'll make some of the shared paths that are shared between
77
89
  # all releases.
78
90
  task :setup => :environment do
91
+ # Ember
92
+ queue! %[mkdir -p "#{deploy_to}/#{shared_path}/node_modules"]
93
+ queue! %[chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/node_modules"]
94
+
95
+ queue! %[mkdir -p "#{deploy_to}/#{shared_path}/bower_components"]
96
+ queue! %[chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/bower_components"]
97
+
98
+ # Rails
79
99
  queue! %[mkdir -p "#{deploy_to}/shared/log"]
80
100
  queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/log"]
81
101
 
@@ -88,6 +108,7 @@ task :setup => :environment do
88
108
  end
89
109
 
90
110
  queue! %[touch "#{deploy_to}/shared/config/database.yml"]
111
+ queue! %[touch "#{deploy_to}/shared/config/env.deploy.production"]
91
112
 
92
113
  queue %[echo "-----> Please add ForwardAgent yes to your ssh config for #{settings.domain!}"]
93
114
  end
@@ -95,30 +116,56 @@ end
95
116
  desc "Deploys the current version to the server."
96
117
  task :deploy => :environment do
97
118
  deploy do
119
+ if !settings.deploy_rails && !settings.deploy_ember
120
+ print_error('Nothing to deploy')
121
+ die(2)
122
+ end
123
+
124
+ deploy_message = []
125
+ if settings.deploy_rails
126
+ deploy_message << %[Rails]
127
+ end
128
+ if settings.deploy_ember
129
+ deploy_message << %[Ember]
130
+ end
131
+ print_status('Deploying ' + deploy_message.join(', '))
132
+
98
133
  # Put things that will set up an empty directory into a fully set-up
99
134
  # instance of your project.
100
135
  invoke :'git:clone'
101
136
  invoke :'deploy:link_shared_paths'
102
- invoke :'bundle:install'
137
+ invoke :'ember:link_config' if settings.deploy_ember
138
+
139
+ invoke :'bundle:install' if settings.deploy_rails
140
+ invoke :'ember:install' if settings.deploy_ember
103
141
 
104
- if settings.use_env_file! == 'true'
142
+ if settings.use_env_file! == 'true' && settings.deploy_rails
105
143
  invoke :'preflight:fetch_environment'
106
144
  end
107
145
 
108
- if settings.run_db_migrate! == 'true'
109
- invoke :'rails:db_migrate'
110
- end
146
+ if settings.deploy_rails
147
+ if settings.run_db_migrate! == 'true'
148
+ invoke :'rails:db_migrate'
149
+ end
111
150
 
112
- if settings.use_turbo_sprockets! == 'true'
113
- invoke :'rails:assets_precompile:force' # Defer to turbo sprockets change tracking instead of mina
114
- else
115
- invoke :'rails:assets_precompile'
151
+ if settings.use_turbo_sprockets! == 'true'
152
+ invoke :'rails:assets_precompile:force' # Defer to turbo sprockets change tracking instead of mina
153
+ else
154
+ invoke :'rails:assets_precompile'
155
+ end
116
156
  end
117
157
 
158
+ invoke :'ember:deploy' if settings.deploy_ember
159
+
118
160
  to :launch do
119
- invoke :'preflight:bundle'
120
- invoke :'preflight:assets'
121
- invoke :'preflight:deploy'
161
+ if settings.deploy_rails
162
+ invoke :'preflight:bundle'
163
+ invoke :'preflight:assets'
164
+ invoke :'preflight:deploy'
165
+ end
166
+ if settings.deploy_ember
167
+ invoke :'ember:activate_deploy'
168
+ end
122
169
  end
123
170
  end
124
171
  end
@@ -23,8 +23,10 @@ module OpsPreflight
23
23
  end
24
24
 
25
25
  desc "deploy <rails_env>", "Deploys to the configured app"
26
+ option :ember, type: :boolean, default: false
27
+ option :ember_only, type: :boolean, default: false
26
28
  def deploy(rails_env)
27
- run "bundle exec mina deploy RAILS_ENV=#{rails_env} #{Config.new.client_args(rails_env)} #{mina_args}", :verbose => false
29
+ run "bundle exec mina deploy RAILS_ENV=#{rails_env} DEPLOY_EMBER=#{options[:ember]} EMBER_ONLY=#{options[:ember_only]} #{Config.new.client_args(rails_env)} #{mina_args}", :verbose => false
28
30
  end
29
31
 
30
32
  # Fixes thor's banners when used with :default namespace
@@ -0,0 +1,46 @@
1
+ namespace :ember do
2
+ desc 'Links the ember-cli-deploy dotenv config'
3
+ task link_config: :environment do
4
+ in_directory './ember' do
5
+ queue %[echo "-----> Symlinking ember deploy config"]
6
+ queue! echo_cmd(%{rm -rf "./.env.deploy.production"})
7
+ queue! echo_cmd(%{ln -s "#{deploy_to}/#{shared_path}/config/env.deploy.production" "./.env.deploy.production"})
8
+ end
9
+ end
10
+
11
+ desc 'Installs ember-cli and bower'
12
+ task install: :environment do
13
+ in_directory './ember' do
14
+ queue! %[
15
+ ln -sf "#{deploy_to}/#{shared_path}/node_modules" "./node_modules"
16
+ ln -sf "#{deploy_to}/#{shared_path}/bower_components" "./bower_components"
17
+ ]
18
+ queue %[
19
+ echo "-----> Installing ember dependencies"
20
+ #{echo_cmd %[npm install bower ember-cli]} &&
21
+ #{echo_cmd %[npm install]} &&
22
+ #{echo_cmd %[./node_modules/.bin/bower install]}
23
+ ]
24
+ end
25
+ end
26
+
27
+ desc 'Runs ember-cli-deploy'
28
+ task deploy: :environment do
29
+ in_directory './ember' do
30
+ queue %[
31
+ echo "-----> Running ember deploy"
32
+ #{echo_cmd %[./node_modules/.bin/ember deploy production | egrep -e "--revision=(.*)$" -o | sed "s/--revision=//" > ember-deploy-revision]}
33
+ ]
34
+ end
35
+ end
36
+
37
+ desc 'Activates the deployed revision'
38
+ task activate_deploy: :environment do
39
+ in_directory './ember' do
40
+ queue %[
41
+ echo "-----> Activating ember deploy"
42
+ #{echo_cmd %[./node_modules/.bin/ember deploy:activate production --revision $(cat ember-deploy-revision)]}
43
+ ]
44
+ end
45
+ end
46
+ end
@@ -1,3 +1,3 @@
1
1
  module OpsPreflight
2
- VERSION = "1.2.1"
2
+ VERSION = "1.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ops_preflight
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Schlesinger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-26 00:00:00.000000000 Z
11
+ date: 2015-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -101,6 +101,7 @@ files:
101
101
  - lib/ops_preflight.rb
102
102
  - lib/ops_preflight/client.rb
103
103
  - lib/ops_preflight/config.rb
104
+ - lib/ops_preflight/ember_tasks.rb
104
105
  - lib/ops_preflight/exit_code.rb
105
106
  - lib/ops_preflight/ops_works/base.rb
106
107
  - lib/ops_preflight/ops_works/deploy.rb
@@ -129,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
130
  version: '0'
130
131
  requirements: []
131
132
  rubyforge_project:
132
- rubygems_version: 2.4.3
133
+ rubygems_version: 2.4.8
133
134
  signing_key:
134
135
  specification_version: 4
135
136
  summary: Preflight by packaging the bundle, precompiled assets, or anything else needed