itamae 1.0.0.beta20 → 1.0.0.beta21

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: 9705a019e13d9320346971b46f96c1b70e6c14a0
4
- data.tar.gz: 81370a0601b58e8380f8c75ef01213d879ff1192
3
+ metadata.gz: 696b6b9d0d4dde941a436b0cab7a717ad510740a
4
+ data.tar.gz: d06f0329589a1cb8bf19c5f99e68e4ab7edb91ed
5
5
  SHA512:
6
- metadata.gz: ea6ff64ecb88de843eac1306076b28bee27420b0b02b4c2f770f15c56bdfbff075b25fa8dd5c3c8c0498c5d3b7cefdda6eb454ace64cd48a2535e42b534e5787
7
- data.tar.gz: dbaf91ed18cf422c6f56ad4d98daf529ac2d6168edc3b6d6b20c0124c67ee66f7a56e54239632ad3370fddebec23609ed892b61f3a7726b8c3b7f34a8812f727
6
+ metadata.gz: 7222275191cb7581380abe17733226854fc37024bbc0d3f6c7e1654240ffccc6def6adddaaab8408a2abe6b595485e64aa46e9f18ec1878b008d0945f238737c
7
+ data.tar.gz: 3c65feb51906ffe4cc552b4f940ffcfdf359a805a948a70fda21ad012d8c757fea61961a2bb434a3be216b4d05f27f6e433ccb88c5b11c98d8ae79b117b34244
@@ -1,5 +1,17 @@
1
1
  require 'specinfra'
2
2
  require 'singleton'
3
+ require 'io/console'
4
+
5
+ module Specinfra
6
+ module Configuration
7
+ def self.sudo_password
8
+ return @sudo_password if @sudo_password
9
+
10
+ print "sudo password: "
11
+ @sudo_password = STDIN.noecho(&:gets).strip
12
+ end
13
+ end
14
+ end
3
15
 
4
16
  module Itamae
5
17
  class Backend
@@ -15,21 +15,11 @@ module Itamae
15
15
  when :sync
16
16
  @attributes[:exist?] = true
17
17
  end
18
-
19
- @attributes[:revision_hash] = if revision
20
- get_revision(revision)
21
- else
22
- run_command_in_repo("git ls-remote origin HEAD | cut -f1").stdout.strip
23
- end
24
18
  end
25
19
 
26
20
  def set_current_attributes
27
21
  exist = run_specinfra(:check_file_is_directory, destination)
28
22
  @current_attributes[:exist?] = exist
29
-
30
- if exist
31
- @current_attributes[:revision_hash] = get_revision('HEAD')
32
- end
33
23
  end
34
24
 
35
25
  def sync_action
@@ -44,7 +34,13 @@ module Itamae
44
34
  new_repository = true
45
35
  end
46
36
 
47
- if new_repository || @attributes[:revision_hash] != get_revision('HEAD')
37
+ target = if revision
38
+ get_revision(revision)
39
+ else
40
+ run_command_in_repo("git ls-remote origin HEAD | cut -f1").stdout.strip
41
+ end
42
+
43
+ if new_repository || target != get_revision('HEAD')
48
44
  updated!
49
45
 
50
46
  deploy_old_created = false
@@ -53,7 +49,7 @@ module Itamae
53
49
  deploy_old_created = true
54
50
  end
55
51
 
56
- run_command_in_repo(["git", "checkout", @attributes[:revision_hash], "-b", DEPLOY_BRANCH])
52
+ run_command_in_repo(["git", "checkout", target, "-b", DEPLOY_BRANCH])
57
53
 
58
54
  if deploy_old_created
59
55
  run_command_in_repo("git branch -d deploy-old")
@@ -15,7 +15,7 @@ module Itamae
15
15
  end
16
16
 
17
17
  def set_current_attributes
18
- @current_attributes[:exist?] = (run_command(["test", "-L", link]).exit_status == 0)
18
+ @current_attributes[:exist?] = (run_command(["test", "-L", link], error: false).exit_status == 0)
19
19
 
20
20
  if @current_attributes[:exist?]
21
21
  @current_attributes[:to] = run_command(["readlink", "-f", link]).stdout.strip
@@ -1 +1 @@
1
- 1.0.0.beta20
1
+ 1.0.0.beta21
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itamae
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta20
4
+ version: 1.0.0.beta21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryota Arai