shipwright 1.2.3 → 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: 8c9002d5caf62515e3b8055008fcbecfe0e8beef
4
- data.tar.gz: f167184ec90012623f0a34b9e9d55f6aba9c20d5
3
+ metadata.gz: e44c35d9884464043334b20bbfe06005f3673fc3
4
+ data.tar.gz: d5f30bb8905753f17571925c047ed05a0df0229d
5
5
  SHA512:
6
- metadata.gz: bf5c0652db61dd3eda9eec55cff6f9ac1be453806441e015638367e95a275197d8fa04b53cd34a86cdc744cd98ef38a7f5be8d3816833a5147bfa803682121c6
7
- data.tar.gz: acd4cce4adeb337db623ac5b942c031094f64216ddef9c7dfa504f6a56ad0a7265c402728cae0c27f03dde49ce5e14126278b48bd5af9dbc0fab3e955c42306a
6
+ metadata.gz: d7a4a5912fcabc6f55155c6d3614301a38452c7b848b9e6e68bfd2ba52091e290ea1c43c7977482fc4285e3a9e33a4fbc14ccb29e9e25374ba29c3d38f153d63
7
+ data.tar.gz: 59359e0de1c9097aedcecd2e170c017eacf9a6ad108d88cad89992b4bb85f5cbe1b0042a92fd809b2006e49b9c84da00d5ca01ea9db822162df08c8ad4aeec72
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.3
1
+ 1.3.0
@@ -0,0 +1,51 @@
1
+ module Shipwright
2
+ module ElasticBeanstalk
3
+ class Dockerrun
4
+ attr_accessor :path, :version
5
+
6
+ def initialize(path, version)
7
+ self.path, self.version = path, version
8
+ end
9
+
10
+ def json
11
+ @json ||= JSON.parse(File.read(path))
12
+ end
13
+
14
+ def run_version
15
+ json.fetch('AWSEBDockerrunVersion')
16
+ end
17
+
18
+ def update!
19
+ if respond_to?("update_#{run_version}")
20
+ send("update_#{run_version}")
21
+ else
22
+ invalid_version_error!
23
+ end
24
+ File.open(path, 'wb') { |file| file.write JSON.pretty_generate(json) }
25
+ end
26
+
27
+ def update_1
28
+ json['Image']['Name'] = image(json['Image']['Name'])
29
+ end
30
+
31
+ def update_2
32
+ json['containerDefinitions'].each do |container|
33
+ container['image'] = image(container['image'])
34
+ end
35
+ end
36
+
37
+ def image(name)
38
+ bits = name.to_s.split(':').tap(&:pop)
39
+ bits.push(version).join(':')
40
+ end
41
+
42
+ def invalid_version_error!
43
+ raise InvalidDockerrunVersionError.new(
44
+ "invalid AWSEBDockerrunVersion version: #{run_version.inspect}")
45
+ end
46
+
47
+ InvalidDockerrunVersionError = Class.new(StandardError)
48
+ end
49
+ end
50
+ end
51
+
@@ -13,15 +13,8 @@ module Shipwright
13
13
  extend self
14
14
 
15
15
  def update_dockerrun
16
- dockerrun = JSON.parse(File.read DOCKERRUN)
17
-
18
- dockerrun['containerDefinitions'].each do |container|
19
- bits = container['image'].to_s.split(':').tap(&:pop)
20
- container['image'] = bits.push(version).join(':')
21
- end
22
-
23
- File.open(DOCKERRUN, 'wb') { |file|
24
- file.write JSON.pretty_generate(dockerrun) }
16
+ dockerrun = Dockerrun.new(DOCKERRUN, version)
17
+ dockerrun.update!
25
18
  end
26
19
 
27
20
  def generate_artifact
data/lib/shipwright.rb CHANGED
@@ -27,3 +27,4 @@ end
27
27
 
28
28
  require 'shipwright/builder'
29
29
  require 'shipwright/elastic_beanstalk'
30
+ require 'shipwright/elastic_beanstalk/dockerrun'
data/shipwright.gemspec CHANGED
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
33
33
  spec.add_dependency 'git', '~> 1.2.9'
34
34
  spec.add_dependency 'rubyzip', '~> 1.1.7'
35
35
 
36
- spec.add_development_dependency "bundler", "~> 1.9"
36
+ spec.add_development_dependency "bundler", "~> 1.7"
37
37
  spec.add_development_dependency "rake", "~> 10.0"
38
38
  spec.add_development_dependency "rspec", "~> 3.2.0"
39
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shipwright
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Hunter
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-05-29 00:00:00.000000000 Z
11
+ date: 2015-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '1.9'
103
+ version: '1.7'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '1.9'
110
+ version: '1.7'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rake
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -158,6 +158,7 @@ files:
158
158
  - lib/shipwright/builder.rb
159
159
  - lib/shipwright/cli.rb
160
160
  - lib/shipwright/elastic_beanstalk.rb
161
+ - lib/shipwright/elastic_beanstalk/dockerrun.rb
161
162
  - shipwright.gemspec
162
163
  homepage: https://github.com/tma1/shipwright
163
164
  licenses: []