eb-docker-deploy 0.0.4 → 0.0.5

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: dcdf073505a1c8d779dfad1ef5e76221bea5e7c8
4
- data.tar.gz: 7136c8372a618c15e839b867f48ad6c246030ad2
3
+ metadata.gz: 4b2b80953e5929cb073a96e9c8d931e0ff55c297
4
+ data.tar.gz: 564e206885bcc11f24bc3ab128be29de1d272836
5
5
  SHA512:
6
- metadata.gz: 58c18b5b0bc7f5c9f17f94cbc4acac0c4001b5ae3e6973b42de84f3c1fb2c90dee709cea36ee1b659e4d3785aeb257ee1cb076941ed8e9ed38c78407699f3710
7
- data.tar.gz: 5ef170c6c8853dd9b44881b8f99a5dcc7f70a2558b92119b4b21b39de1d572ec2cc67c3a279219ba071afdb684e2ac3a4ae726cb20eaffe1cfbd68f17e538eb5
6
+ metadata.gz: 612d94bdb7a3340b906abae7f5017a9a3237b8153b81f69cc65673c7579875b85fc720995b541f2380dec8731ffb7a5cbad84a332c6178355f50ff527d90739d
7
+ data.tar.gz: 64d8598f62462f557ebce461e898a662d63208830a82310f3739a68a581d369de84a2dad79359d2257c70a255462a310d2c96b22f08f8cb3a8fe8e42516df27a
@@ -2,8 +2,11 @@ module Deploy
2
2
  class Deployer < Thor
3
3
  include Deploy::Output
4
4
 
5
- desc 'setup eb', 'setup eb'
5
+ desc 'setup config', 'setup config'
6
6
  def setup
7
+
8
+ raise StandardError, 'elasticbeanstalk not configured' unless File.exist?('~/.aws/config')
9
+
7
10
  command = "eb init"
8
11
  system(command)
9
12
  end
@@ -16,23 +19,14 @@ module Deploy
16
19
  version = options[:version]
17
20
  repo = ENV['DOCKER_REPO']
18
21
 
19
- shout "Building Docker Image: #{repo}:#{version}"
20
- command = "docker build -t #{repo}:#{version} ."
21
- system(command)
22
+ build_image(repo, version)
22
23
 
23
- shout "Tagging #{version} Docker Image"
24
- command = "docker tag -f #{repo}:#{version} #{repo}:latest"
25
- system(command)
24
+ tag_image_as_latest(repo, version)
26
25
 
27
- shout "Pushing Docker Image: #{repo}:#{version}"
28
- command = "docker push #{repo}:#{version}"
29
- system(command)
30
- shout "Pushing Docker Image: #{repo}:latest"
31
- command = "docker push #{repo}:latest"
32
- system(command)
26
+ push_image(repo, version)
27
+ push_image(repo, 'latest')
33
28
 
34
- command = "eb deploy --label #{version}"
35
- system(command)
29
+ run_deploy(version)
36
30
  end
37
31
 
38
32
  method_option :version, aliases: '-v', desc: 'Version'
@@ -41,25 +35,44 @@ module Deploy
41
35
  version = options[:version]
42
36
  repo = ENV['DOCKER_REPO']
43
37
 
44
- shout "Tagging #{version} Docker Image"
45
- command = "docker tag -f #{repo}:#{version} #{repo}:latest"
46
- system(command)
38
+ tag_image_as_latest(repo, version)
47
39
 
48
- shout "Pushing Docker Image: #{repo}:latest"
49
- command = "docker push #{repo}:latest"
50
- system(command)
40
+ push_image(repo, 'latest')
51
41
 
52
- command = "eb deploy --version #{version}"
53
- system(command)
42
+ run_deploy(version)
54
43
  end
55
44
 
56
45
  no_commands do
57
46
 
47
+ def build_image(repo, tag)
48
+ shout "Building Docker Image: #{repo}:#{tag}"
49
+ command = "docker build -t #{repo}:#{tag} ."
50
+ system(command)
51
+ end
52
+
53
+ def tag_image_as_latest(repo, tag)
54
+ shout "Tagging #{tag} Docker Image as Latest"
55
+ command = "docker tag -f #{repo}:#{tag} #{repo}:latest"
56
+ system(command)
57
+ end
58
+
59
+ def push_image(repo, tag)
60
+ shout "Pushing Docker Image: #{repo}:#{tag}"
61
+ command = "docker push #{repo}:#{tag}"
62
+ system(command)
63
+ end
64
+
65
+ def run_deploy(version)
66
+ command = "eb deploy --label #{version}"
67
+ system(command)
68
+ end
69
+
58
70
  def check_setup
59
71
  raise StandardError, 'docker not installed' unless command?('docker')
60
72
  raise StandardError, 'eb command not installed' unless command?('eb')
61
73
  raise StandardError, 'elasticbeanstalk not configured' unless File.exist?('.elasticbeanstalk')
62
- raise StandardError, 'Env DOCKER_REPO not set' unless ENV['DOCKER_REPO']
74
+ raise StandardError, 'elasticbeanstalk not configured' unless File.exist?('~/.aws/config')
75
+ raise StandardError, 'ENV DOCKER_REPO not set' unless ENV['DOCKER_REPO']
63
76
  end
64
77
 
65
78
  def command?(command)
@@ -1,3 +1,3 @@
1
1
  module Deploy
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eb-docker-deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-13 00:00:00.000000000 Z
11
+ date: 2015-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler