itamae 1.4.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0fddee080e3424d311b0bcac35fcd5f91b2da227
4
- data.tar.gz: 17283f41482ec965cd35a615f21074cbd9609a04
3
+ metadata.gz: 6479d8170ea15624ce0cc01f168a0efb5cb85629
4
+ data.tar.gz: 06f82640ee02c89061ba1f9f59079caac6248ca4
5
5
  SHA512:
6
- metadata.gz: 0f7a9211a591f1a5cff1171da061bfc899ffe653759a76beb41aba25171820c808c60cec3107f1c8461cd08f748c7dc5b495ff791f49e3b89356320a4a4107e5
7
- data.tar.gz: bb9325ae57e1a3358566bb9aa43cce58a6837d683b5aa985d8c738cf2d6ad7b8be7f65b3c64dbce38e8503bc5e13d8d6ae30f448ea3a99d3067efa9bacd475d2
6
+ metadata.gz: bc12dde28ddb4352ad491ac55c245fa11499ee0c7b0442f4ce0132388b608a0678e3c2f8dd8a74b6cbaf58efe303000d7e2fe955570c4ec084f4784b01ce9ec4
7
+ data.tar.gz: a7c14368ad9a0ecc88c8e232bf15d04cef8efad9c2a613b92567d452803379e151df128aac9abb2efa3fa747201c02c4858534d18249cfdd9bea81d83d464c2b
@@ -1,3 +1,10 @@
1
+ ## v1.4.1
2
+
3
+ Improvements
4
+
5
+ - [`gem_binary` of `gem_package` resource accepts an Array too. (by @eagletmt)](https://github.com/itamae-kitchen/itamae/pull/149)
6
+ - [`git` resource executes `git clone` if the destination directory is empty (by @tacahilo)](https://github.com/itamae-kitchen/itamae/pull/150)
7
+
1
8
  ## v1.4.0
2
9
 
3
10
  Improvements
@@ -5,7 +5,7 @@ module Itamae
5
5
  class GemPackage < Base
6
6
  define_attribute :action, default: :install
7
7
  define_attribute :package_name, type: String, default_name: true
8
- define_attribute :gem_binary, type: String, default: 'gem'
8
+ define_attribute :gem_binary, type: [String, Array], default: 'gem'
9
9
  define_attribute :version, type: String
10
10
  define_attribute :source, type: String
11
11
 
@@ -51,7 +51,7 @@ module Itamae
51
51
 
52
52
  def installed_gems
53
53
  gems = []
54
- run_command([attributes.gem_binary, 'list', '-l']).stdout.each_line do |line|
54
+ run_command([*Array(attributes.gem_binary), 'list', '-l']).stdout.each_line do |line|
55
55
  if /\A([^ ]+) \(([^\)]+)\)\z/ =~ line.strip
56
56
  name = $1
57
57
  versions = $2.split(', ')
@@ -64,7 +64,7 @@ module Itamae
64
64
  end
65
65
 
66
66
  def install!
67
- cmd = [attributes.gem_binary, 'install']
67
+ cmd = [*Array(attributes.gem_binary), 'install']
68
68
  if attributes.version
69
69
  cmd << '-v' << attributes.version
70
70
  end
@@ -27,14 +27,14 @@ module Itamae
27
27
 
28
28
  new_repository = false
29
29
 
30
- if run_specinfra(:check_file_is_directory, attributes.destination)
31
- run_command_in_repo(['git', 'fetch', 'origin'])
32
- else
30
+ if check_empty_dir
33
31
  cmd = ['git', 'clone']
34
32
  cmd << '--recursive' if attributes.recursive
35
33
  cmd << attributes.repository << attributes.destination
36
34
  run_command(cmd)
37
35
  new_repository = true
36
+ else
37
+ run_command_in_repo(['git', 'fetch', 'origin'])
38
38
  end
39
39
 
40
40
  target = if attributes.revision
@@ -67,6 +67,10 @@ module Itamae
67
67
  end
68
68
  end
69
69
 
70
+ def check_empty_dir
71
+ run_command("test -z \"$(ls -A #{shell_escape(attributes.destination)})\"", error: false).success?
72
+ end
73
+
70
74
  def run_command_in_repo(*args)
71
75
  run_command(*args, cwd: attributes.destination)
72
76
  end
@@ -1 +1 @@
1
- 1.4.0
1
+ 1.4.1
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itamae
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryota Arai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-17 00:00:00.000000000 Z
11
+ date: 2015-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor