itamae 1.0.0.beta11 → 1.0.0.beta12

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: 1e79cccb302b213dead194d1fb5a47ee4421325d
4
- data.tar.gz: 7ed4180528acd9fb5e0ae50834f85e44aeb91a7e
3
+ metadata.gz: b087207f8dd1d64fab754c7fe61fd0d20f2c4c57
4
+ data.tar.gz: 739a7f780a6e1687572a6b7dd5509ebdb2be36ec
5
5
  SHA512:
6
- metadata.gz: 8bf822b67930b8281bfae4eef594eec40c592f65b99086a566fc2c9ef0cfa6d9497ca9cbd34c6ef1827f8353785cd298502f5a4cc079c9b178a7cb437ee44267
7
- data.tar.gz: 67b3ac8336ae73558e746595212b21301356d4184e2f33486ef3381b052b42698adf24a6051c27d515b1adf1d1e5ef2f872af9ef6c61156c491b0e0b84b6d79a
6
+ metadata.gz: 8ef7e9523ffb54111b38b7e253bd45ceaab1f36c70f32c0508473eb585306231ffe38978c38e6b257e06721c1e21710aa84d0bbb5438d6e8cb762debf07adf9b
7
+ data.tar.gz: 0b96462e7ad3862fdc337a1fb9eac5e20543a7ba28671179414724d2028583bfba4cd1d9494d1598bff87141f662f2629f92d11fbf674c8286499c057182a18e
data/itamae.gemspec CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.require_paths = ["lib"]
19
19
 
20
20
  spec.add_runtime_dependency "thor"
21
- spec.add_runtime_dependency "specinfra", "2.0.0.beta37"
21
+ spec.add_runtime_dependency "specinfra", "2.0.0.beta38"
22
22
  spec.add_runtime_dependency "hashie"
23
23
  spec.add_runtime_dependency "ansi"
24
24
 
@@ -115,13 +115,11 @@ module Itamae
115
115
  return @attributes[method] = args.first
116
116
  elsif args.size == 0 && block_given?
117
117
  return @attributes[method] = block
118
+ elsif args.size == 0
119
+ return @attributes[method]
118
120
  end
119
121
  end
120
122
 
121
- if args.size == 0 && @attributes.has_key?(method)
122
- return @attributes[method]
123
- end
124
-
125
123
  super
126
124
  end
127
125
 
@@ -5,9 +5,26 @@ module Itamae
5
5
  class Package < Base
6
6
  define_attribute :action, default: :install
7
7
  define_attribute :name, type: String, default_name: true
8
+ define_attribute :version, type: String
9
+
10
+ def set_current_attributes
11
+ installed = run_specinfra(:check_package_is_installed, name)
12
+ @current_attributes[:installed?] = installed
13
+
14
+ if installed
15
+ @current_attributes[:version] = run_specinfra(:get_package_version, name).stdout.strip
16
+ end
17
+
18
+ if action == :install
19
+ @attributes[:installed?] = true
20
+ end
21
+ end
8
22
 
9
23
  def install_action
10
- run_specinfra(:install_package, name)
24
+ unless run_specinfra(:check_package_is_installed, name, version)
25
+ run_specinfra(:install_package, name, version)
26
+ updated!
27
+ end
11
28
  end
12
29
  end
13
30
  end
@@ -1 +1 @@
1
- 1.0.0.beta11
1
+ 1.0.0.beta12
@@ -9,7 +9,9 @@ package 'dstat' do
9
9
  action :install
10
10
  end
11
11
 
12
- package 'sl'
12
+ package 'sl' do
13
+ version '3.03-17'
14
+ end
13
15
 
14
16
  ######
15
17
 
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.beta11
4
+ version: 1.0.0.beta12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryota Arai
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 2.0.0.beta37
33
+ version: 2.0.0.beta38
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 2.0.0.beta37
40
+ version: 2.0.0.beta38
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: hashie
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -186,9 +186,6 @@ files:
186
186
  - spec/unit/lib/itamae/node_spec.rb
187
187
  - spec/unit/lib/itamae/recipe_spec.rb
188
188
  - spec/unit/lib/itamae/resource/base_spec.rb
189
- - spec/unit/lib/itamae/resource/link_spec.rb
190
- - spec/unit/lib/itamae/resource/package_spec.rb
191
- - spec/unit/lib/itamae/resource/remote_file_spec.rb
192
189
  - spec/unit/lib/itamae/resource_spec.rb
193
190
  - spec/unit/lib/itamae/runner_spec.rb
194
191
  - spec/unit/spec_helper.rb
@@ -230,9 +227,6 @@ test_files:
230
227
  - spec/unit/lib/itamae/node_spec.rb
231
228
  - spec/unit/lib/itamae/recipe_spec.rb
232
229
  - spec/unit/lib/itamae/resource/base_spec.rb
233
- - spec/unit/lib/itamae/resource/link_spec.rb
234
- - spec/unit/lib/itamae/resource/package_spec.rb
235
- - spec/unit/lib/itamae/resource/remote_file_spec.rb
236
230
  - spec/unit/lib/itamae/resource_spec.rb
237
231
  - spec/unit/lib/itamae/runner_spec.rb
238
232
  - spec/unit/spec_helper.rb
@@ -1,24 +0,0 @@
1
- require 'itamae'
2
-
3
- module Itamae
4
- describe Resource::Link do
5
- let(:recipe) { double(:recipe) }
6
-
7
- subject(:resource) do
8
- described_class.new(recipe, "name") do
9
- to "/path/to/target"
10
- end
11
- end
12
-
13
- describe "#create_action" do
14
- it "runs install command of specinfra" do
15
- subject.link :link_name
16
- expect(subject).to receive(:run_specinfra).with(:check_file_is_linked_to, :link_name, "/path/to/target").and_return(false)
17
- expect(subject).to receive(:run_specinfra).with(:link_file_to, :link_name, "/path/to/target")
18
- subject.create_action
19
- end
20
- end
21
- end
22
- end
23
-
24
-
@@ -1,18 +0,0 @@
1
- require 'itamae'
2
-
3
- module Itamae
4
- describe Resource::Package do
5
- let(:recipe) { double(:recipe) }
6
- subject(:resource) { described_class.new(recipe, "name") }
7
-
8
- describe "#install_action" do
9
- it "runs install command of specinfra" do
10
- subject.name :package_name
11
- expect(subject).to receive(:run_specinfra).with(:install_package, :package_name)
12
- subject.install_action
13
- end
14
- end
15
- end
16
- end
17
-
18
-
@@ -1,37 +0,0 @@
1
- require 'itamae'
2
-
3
- module Itamae
4
- describe Resource::RemoteFile do
5
- let(:runner) do
6
- double(:runner).tap do |r|
7
- r.stub(:tmpdir).and_return("/tmp/itamae")
8
- end
9
- end
10
- let(:recipe) do
11
- double(:recipe).tap do |r|
12
- r.stub(:runner).and_return(runner)
13
- end
14
- end
15
-
16
- subject(:resource) do
17
- described_class.new(recipe, "name") do
18
- source "source.file"
19
- path "/path/to/dst"
20
- end
21
- end
22
-
23
- describe "#create_action" do
24
- it "copies a file" do
25
- recipe.stub(:path).and_return("/recipe_dir/recipe_file")
26
- expect(subject).to receive(:send_file).with("/recipe_dir/source.file", %r{^/tmp/itamae/[\d\.]+$})
27
- expect(subject).to receive(:run_specinfra).with(:check_file_is_file, "/path/to/dst").and_return(true)
28
- expect(subject).to receive(:run_specinfra).with(:copy_file, "/path/to/dst", "/path/to/dst.bak")
29
- expect(subject).to receive(:run_specinfra).with(:move_file, %r{/tmp/itamae/[\d\.]+}, "/path/to/dst")
30
- subject.pre_action
31
- subject.create_action
32
- end
33
- end
34
- end
35
- end
36
-
37
-