rat_deployer 0.1.3 → 0.1.4

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: 124b0ad74f1fe05802dc538c2113bf6a67b85792
4
- data.tar.gz: b50d566c0e05f40f38443fb4c8cba9d750b17766
3
+ metadata.gz: d123dc54c137abf9114ea06c8526d5e86ad5b21b
4
+ data.tar.gz: b820160c369e1a8292c71546e1023eeaea0f5331
5
5
  SHA512:
6
- metadata.gz: 4f8f055a0f13597540aef2efa86959910f7425e15ced8e49083a79b58202903b899fbed27933eb1617b473ac905c88c4f965be408397f90e2da04e3cd59aa0db
7
- data.tar.gz: 55fb3171b53a4b72f7f4a3073f428ffc2752c08e081efbf6ee07fdde2a4cd77d5525134164c851bc970b17a422d7d73ee08443a15b455d34bf2b402ad89f6d59
6
+ metadata.gz: 670e760d635e7e5bf524d66e3836c5d7c66f92f16a12c948ed97539bea474518f86d564e7c6a2f7acb587a7aaa3236244c2fba4b79b58f2367d365640b748ad6
7
+ data.tar.gz: b9c47a75fcb09ffb82afeea6a8e134130585cf87a16f34265caa2fa7a8ef3d3e87f1501de9abb2da81aaead6afdd6d0a23292e16249a9bd769c8e8a2b6a22175
@@ -12,47 +12,31 @@ module RatDeployer
12
12
 
13
13
  desc "deploy", "deploys current environment"
14
14
  def deploy
15
- unset_machine
16
15
  run "rat images update"
17
-
18
- within_machine do
19
- run "rat compose pull"
20
- run "rat compose up -d"
21
- end
16
+ run "rat compose pull"
17
+ run "rat compose up -d"
22
18
  end
23
19
 
24
20
  desc "compose ARGS...", "runs docker-compose command with default flags"
25
21
  def compose(cmd, *cmd_flags)
26
- env = RatDeployer::Config.env
27
- project_name = RatDeployer::Config.all.fetch('project_name')
22
+ env = RatDeployer::Config.env
23
+ project_name = RatDeployer::Config.all.fetch('project_name')
28
24
 
29
25
  flags = [
30
26
  "-f config/default.yml",
31
27
  "-f config/#{env}.yml",
32
28
  "-p #{project_name}_#{env}"
33
- ].join(' ')
34
-
35
- within_machine do
36
- run "docker-compose #{flags} #{cmd} #{cmd_flags.join(" ")}"
37
- end
38
- end
29
+ ]
39
30
 
40
- private
31
+ flags.unshift(remote_machine_flags) if RatDeployer::Config.remote
41
32
 
42
- def set_machine
43
- machine = RatDeployer::Config.for_env.fetch("machine")
44
- run "eval $(docker-machine env #{machine})"
33
+ run "docker-compose #{flags.join(' ')} #{cmd} #{cmd_flags.join(" ")}"
45
34
  end
46
35
 
47
- def unset_machine
48
- run "eval $(docker-machine env --unset)"
49
- end
36
+ private
50
37
 
51
- def within_machine(&block)
52
- set_machine
53
- yield
54
- ensure
55
- unset_machine
38
+ def remote_machine_flags
39
+ `docker-machine config #{RatDeployer::Config.machine}`.gsub(/\n/, ' ')
56
40
  end
57
41
 
58
42
  #def warn_if_running_on_remote_host
@@ -9,7 +9,7 @@ module RatDeployer
9
9
  puts msg
10
10
  end
11
11
 
12
- system cmd
12
+ exit 1 unless system(cmd)
13
13
  end
14
14
 
15
15
  def put_heading(str)
@@ -48,7 +48,7 @@ module RatDeployer
48
48
  end
49
49
 
50
50
  private
51
-
51
+
52
52
  def prompt_enabled?
53
53
  ENV['RAT_PROMPT'] != "false"
54
54
  end
@@ -24,5 +24,14 @@ module RatDeployer
24
24
  env_conf = environmental.fetch(e)
25
25
  default_conf.deep_merge(env_conf)
26
26
  end
27
+
28
+ def self.machine
29
+ for_env.fetch("machine")
30
+ end
31
+
32
+ def self.remote
33
+ env_var = ENV['RAT_REMOTE']
34
+ env_var.nil? ? true : env_var == 'true'
35
+ end
27
36
  end
28
37
  end
@@ -1,3 +1,3 @@
1
1
  module RatDeployer
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rat_deployer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolas Oga
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-04 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: thor