docker-rails 1.0.0 → 1.1.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: 61e25183a59f695d855dcfdc3d1b5caa4b6418d5
4
- data.tar.gz: 9e3059dd5e309a69d48e45d8ea86858e8052ed85
3
+ metadata.gz: c15e19eedac4b56ec333ef623365115d04359dbb
4
+ data.tar.gz: 8a9ee44313c4ef3dc653d445563920881d30c6e8
5
5
  SHA512:
6
- metadata.gz: 069b90234e74e45219f8160a316adfd112ce700cf42ccc745186b8d786f1f2334d810544d14b74c4b539762b19ea91f347763100a994602c30f1144268191bc1
7
- data.tar.gz: fb2274af2b37723c53f79fb259810700fd5c66897eab81f4e5d762a0464ff19fba03da26a0f3825f1bc4e3a8b457bc8aee6569aa515aec8fd397fc20b9cbb41f
6
+ metadata.gz: f1eb936a2fdfdbbd12d54f788f08a789b765fc66f03be04113e542527688ca00f54c063939d2b68abb0faadd605e820ea56a9115246286d171bbdeeafee39205
7
+ data.tar.gz: 930ee9bac8c4cbc077573ac6179519475524bcabfd5696af8cb17d99c884f2775d815a40c936d87a2a92a03d63807acb81e0f6d794f82a541289b0d2195fe96e
data/README.md CHANGED
@@ -176,8 +176,8 @@ COPY Gemfile Gemfile
176
176
  COPY Gemfile_shared.rb Gemfile_shared.rb
177
177
  COPY spec/dummy/Gemfile spec/dummy/Gemfile
178
178
  # This is only here to trigger re-bundle when lock changes, we actually only use the ImageGemfile.lock so that we are
179
- # always doing a fresh bundle anytime the source lock changes.
180
- COPY Gemfile.lock Gemfile.lock
179
+ # always doing a fresh bundle anytime the source lock changes. Only keep the dummy lock in the repo, not the engine lock.
180
+ COPY spec/dummy/Gemfile.lock spec/dummy/Gemfile.lock
181
181
 
182
182
  # Bundle acme and the dummy app
183
183
  RUN \
@@ -164,6 +164,14 @@ module Docker
164
164
  exec_compose 'up', false, options #unless skip? :up
165
165
  end
166
166
 
167
+ def down(options = '')
168
+ # `compose down` doesn't support force removing images, so we use `rm --force`
169
+ exec_compose 'rm', false, '--force -v'
170
+
171
+ # Stop and remove all the linked services and network
172
+ exec_compose 'down', false, options
173
+ end
174
+
167
175
  def compose_build
168
176
  # Run the compose configuration
169
177
  exec_compose 'build'
@@ -180,42 +188,42 @@ module Docker
180
188
  exec 'docker ps -a'
181
189
  end
182
190
 
183
- def stop_all
184
- puts "\n\n\n\nStopping containers..."
185
- puts '-----------------------------'
186
- containers = Docker::Container.all(all: true)
187
- containers.each do |container|
188
- if is_project_container?(container)
189
- stop(container)
190
-
191
- service_name = container.compose.service
192
- if @config['exit_code'].eql?(service_name)
193
- if container.up?
194
- puts "Unable to determine exit code, the #{service_name} is still up, current status: #{container.status}"
195
- @exit_code = -999
196
- else
197
- @exit_code = container.exit_code
198
- end
199
- end
200
- end
201
- end
202
- puts 'Done.'
203
- end
204
-
205
- def rm_volumes
206
- puts "\n\nRemoving container volumes..."
207
- puts '-----------------------------'
208
-
209
- # http://docs.docker.com/v1.7/reference/api/docker_remote_api_v1.19/#remove-a-container
210
- containers = Docker::Container.all(all: true)
211
- containers.each do |container|
212
- if is_project_container?(container)
213
- puts container.name
214
- rm_v(container)
215
- end
216
- end
217
- puts 'Done.'
218
- end
191
+ # def stop_all
192
+ # puts "\n\n\n\nStopping containers..."
193
+ # puts '-----------------------------'
194
+ # containers = Docker::Container.all(all: true)
195
+ # containers.each do |container|
196
+ # if is_project_container?(container)
197
+ # stop(container)
198
+ #
199
+ # service_name = container.compose.service
200
+ # if @config['exit_code'].eql?(service_name)
201
+ # if container.up?
202
+ # puts "Unable to determine exit code, the #{service_name} is still up, current status: #{container.status}"
203
+ # @exit_code = -999
204
+ # else
205
+ # @exit_code = container.exit_code
206
+ # end
207
+ # end
208
+ # end
209
+ # end
210
+ # puts 'Done.'
211
+ # end
212
+
213
+ # def rm_volumes
214
+ # puts "\n\nRemoving container volumes..."
215
+ # puts '-----------------------------'
216
+ #
217
+ # # http://docs.docker.com/v1.7/reference/api/docker_remote_api_v1.19/#remove-a-container
218
+ # containers = Docker::Container.all(all: true)
219
+ # containers.each do |container|
220
+ # if is_project_container?(container)
221
+ # puts container.name
222
+ # rm_v(container)
223
+ # end
224
+ # end
225
+ # puts 'Done.'
226
+ # end
219
227
 
220
228
  def rm_dangling
221
229
  puts "\n\nCleaning up dangling images..."
@@ -41,13 +41,12 @@ module Docker
41
41
  app.extract_all
42
42
  end
43
43
 
44
- desc 'cleanup <target>', 'Runs container cleanup functions stop, rm_volumes, rm_compose, rm_dangling, ps_all e.g. docker-rails cleanup --build=222 development'
44
+ desc 'cleanup <target>', 'Runs container cleanup functions extract, down, rm_compose, rm_dangling, ps_all e.g. docker-rails cleanup --build=222 development'
45
45
  option :extract, aliases: ['-e'], type: :boolean, default: true, desc: 'Extract any directories defined in configuration.'
46
46
 
47
47
  def cleanup(target)
48
- invoke :stop
49
48
  invoke :extract if options[:extract]
50
- invoke :rm_volumes
49
+ invoke :down
51
50
  invoke :rm_compose
52
51
  # invoke :rm_dangling # causes a brand new dockerfile build - don't do that. See https://github.com/alienfast/docker-rails/issues/26
53
52
  invoke :ps_all
@@ -100,18 +99,11 @@ module Docker
100
99
  app.before_command
101
100
  end
102
101
 
103
- desc 'stop <target>', 'Stop all running containers for the given build/target e.g. docker-rails stop --build=222 development'
102
+ desc 'down <target>', 'Stop and cleanup all running containers for the given build/target e.g. docker-rails down --build=222 development'
104
103
 
105
- def stop(target)
104
+ def down(target)
106
105
  invoke :compose
107
- App.configured(target, options).stop_all
108
- end
109
-
110
- desc 'rm_volumes <target>', 'Stop all running containers and remove corresponding volumes for the given build/target e.g. docker-rails rm_volumes --build=222 development'
111
-
112
- def rm_volumes(target)
113
- invoke :stop
114
- App.configured(target, options).rm_volumes
106
+ App.configured(target, options).down
115
107
  end
116
108
 
117
109
  desc 'rm_compose', 'Remove generated docker_compose file e.g. docker-rails rm_compose --build=222 development', hide: true
@@ -1,5 +1,5 @@
1
1
  module Docker
2
2
  module Rails
3
- VERSION = '1.0.0'
3
+ VERSION = '1.1.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docker-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Ross
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-19 00:00:00.000000000 Z
11
+ date: 2016-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler