jack_and_the_elastic_beanstalk 0.2.0 → 0.2.1

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: 3cee55a57435fd7b4f30e21106eb18b460d9da7d
4
- data.tar.gz: aa3e353b4617d1566afa2935716d8a13c1ab4be3
3
+ metadata.gz: 2c859193ef4fcd5f315210c2461e0708ff4545b4
4
+ data.tar.gz: '001108add4d437960bdd4012b0bda9b23f28f607'
5
5
  SHA512:
6
- metadata.gz: cbdfe7b6367ad22caed35994f13e4ae1f88c881feee23a848601967fa1209bd1a57585c3e2a919ace52abd12174504ae8d385aa8f9339617211fb260f4fa4ac3
7
- data.tar.gz: dcd7d6fc83fef3894cc0a2b125d5bd1c746432ec82ac37f9b85172cd1a098021394bcd3a59bf96f77f6ba2148a2ba0d436dd938648708a31a764f5123ad0f4d9
6
+ metadata.gz: bce386c64551de8ad07038f6aea5d077d14a1da6b5a010a904597ff84488934f593dee294358f0c4db6ae1712899673ed8704f45cd6a28e7578073856b7d6ced
7
+ data.tar.gz: 6588c39f356aba927aeb126fce7f874f1bf8bce6666a4449e9b59ba79f9c93f9c2ecc0142fe57e70a8c95ad9ef7ae29153b62f884183704289189a320e5bf056
@@ -236,6 +236,7 @@ module JackAndTheElasticBeanstalk
236
236
 
237
237
  desc "exec GROUP command...", "Run oneoff command"
238
238
  option :keep, type: :boolean, default: false, desc: "Keep started oneoff environment"
239
+ option :docker, type: :boolean, default: false, desc: "Run command in Docker container"
239
240
  def exec(group, *command)
240
241
  env = service.each_environment(group: group).find {|_, p| p == "oneoff" }&.first
241
242
  if env
@@ -269,7 +270,11 @@ module JackAndTheElasticBeanstalk
269
270
  sleep 15
270
271
  end
271
272
 
272
- commandline = "cd /var/app/current && sudo -E -u webapp env PATH=$PATH #{command.join(' ')}"
273
+ commandline = if options[:docker]
274
+ "sudo docker ps --filter=ancestor=aws_beanstalk/current-app --latest --format='{{.ID}}' | xargs -I{} sudo docker exec {} #{command.join(' ')}"
275
+ else
276
+ "cd /var/app/current && sudo -E -u webapp env PATH=$PATH #{command.join(' ')}"
277
+ end
273
278
  out, err, status = runner.capture3 "eb", "ssh", env.environment_name, "-c", commandline
274
279
 
275
280
  runner.stdout.print out
@@ -111,9 +111,15 @@ module JackAndTheElasticBeanstalk
111
111
  end
112
112
 
113
113
  def export_files(dest:)
114
- files = runner.chdir(source_dir) do
115
- runner.capture3!("git", "ls-files", "-z").first.split("\x0")
116
- end
114
+ files = if (runner.pwd + '.git').exist?
115
+ runner.chdir(source_dir) do
116
+ runner.capture3!("git", "ls-files", "-z").first.split("\x0")
117
+ end
118
+ else
119
+ Pathname.glob(source_dir + '**/*').select(&:file?).map do |path|
120
+ path.to_s.sub(/\A#{source_dir}\//, '')
121
+ end
122
+ end
117
123
 
118
124
  files.each do |f|
119
125
  logger.debug("jeb::service") { "Copying #{f} ..."}
@@ -1,3 +1,3 @@
1
1
  module JackAndTheElasticBeanstalk
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jack_and_the_elastic_beanstalk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soutaro Matsumoto
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-11 00:00:00.000000000 Z
11
+ date: 2018-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler