itamae 1.0.0.beta7 → 1.0.0.beta8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +13 -0
- data/itamae.gemspec +1 -1
- data/lib/itamae/backend.rb +2 -2
- data/lib/itamae/resource/base.rb +6 -4
- data/lib/itamae/resource/file.rb +3 -5
- data/lib/itamae/resource/local_ruby_block.rb +15 -0
- data/lib/itamae/resource.rb +1 -0
- data/lib/itamae/version.rb +1 -1
- data/lib/itamae/version.txt +1 -0
- data/spec/integration/recipes/default.rb +9 -0
- data/spec/unit/lib/itamae/resource/remote_file_spec.rb +3 -3
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42aaacb52f264283b58b0fe62dd723ec02a6f6f5
|
4
|
+
data.tar.gz: c288561f91f88f46979c43c4bd809f0ccb8a38b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8977726e0c923e4055af6ce1c0492e5e375cc461cc3d67516650c12354e6a6aff10cdd1aac4317fb5866609246efe204c1a8191de2164b55b1d93f6ec7c9f97b
|
7
|
+
data.tar.gz: b500d236ff804664009b79747be7e52068462a28dedb3b099f5a72f547da1f8df631d9e5bc3851b3e26a335a5ba1f984ce5fe279558d68a84fc76f356868f002
|
data/Rakefile
CHANGED
@@ -62,3 +62,16 @@ namespace :spec do
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
end
|
65
|
+
|
66
|
+
namespace :release do
|
67
|
+
desc "Bump up version and commit"
|
68
|
+
task :bump_up_version do
|
69
|
+
version_file = File.expand_path("lib/itamae/version.txt")
|
70
|
+
current_version = File.read(version_file)
|
71
|
+
open(version_file, "w") do |f|
|
72
|
+
f.write current_version.succ
|
73
|
+
end
|
74
|
+
system "git add #{version_file}"
|
75
|
+
system "git commit -m 'Bump up version'"
|
76
|
+
end
|
77
|
+
end
|
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.
|
21
|
+
spec.add_runtime_dependency "specinfra", "2.0.0.beta37"
|
22
22
|
spec.add_runtime_dependency "hashie"
|
23
23
|
spec.add_runtime_dependency "ansi"
|
24
24
|
|
data/lib/itamae/backend.rb
CHANGED
data/lib/itamae/resource/base.rb
CHANGED
@@ -108,9 +108,11 @@ module Itamae
|
|
108
108
|
|
109
109
|
private
|
110
110
|
|
111
|
-
def method_missing(method, *args)
|
111
|
+
def method_missing(method, *args, &block)
|
112
112
|
if args.size == 1 && self.class.defined_attributes[method]
|
113
113
|
return @attributes[method] = args.first
|
114
|
+
elsif args.size == 0 && block_given?
|
115
|
+
return @attributes[method] = block
|
114
116
|
elsif args.size == 0 && @attributes.has_key?(method)
|
115
117
|
return @attributes[method]
|
116
118
|
end
|
@@ -162,12 +164,12 @@ module Itamae
|
|
162
164
|
end
|
163
165
|
end
|
164
166
|
|
165
|
-
def
|
166
|
-
Logger.debug "
|
167
|
+
def send_file(src, dst)
|
168
|
+
Logger.debug " Sending a file from '#{src}' to '#{dst}'..."
|
167
169
|
unless ::File.exist?(src)
|
168
170
|
raise Error, "The file '#{src}' doesn't exist."
|
169
171
|
end
|
170
|
-
backend.
|
172
|
+
backend.send_file(src, dst)
|
171
173
|
end
|
172
174
|
|
173
175
|
def only_if(command)
|
data/lib/itamae/resource/file.rb
CHANGED
@@ -22,7 +22,7 @@ module Itamae
|
|
22
22
|
end
|
23
23
|
|
24
24
|
@temppath = ::File.join(runner.tmpdir, Time.now.to_f.to_s)
|
25
|
-
|
25
|
+
send_file(src, @temppath)
|
26
26
|
end
|
27
27
|
|
28
28
|
def set_current_attributes
|
@@ -70,12 +70,10 @@ module Itamae
|
|
70
70
|
end
|
71
71
|
|
72
72
|
if run_specinfra(:check_file_is_file, path)
|
73
|
-
|
74
|
-
run_command(["cp", path, "#{path}.bak"])
|
73
|
+
run_specinfra(:copy_file, path, "#{path}.bak")
|
75
74
|
end
|
76
75
|
|
77
|
-
|
78
|
-
run_command(["mv", @temppath, path])
|
76
|
+
run_specinfra(:move_file, @temppath, path)
|
79
77
|
end
|
80
78
|
end
|
81
79
|
end
|
data/lib/itamae/resource.rb
CHANGED
data/lib/itamae/version.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0.beta8
|
@@ -23,10 +23,10 @@ module Itamae
|
|
23
23
|
describe "#create_action" do
|
24
24
|
it "copies a file" do
|
25
25
|
recipe.stub(:path).and_return("/recipe_dir/recipe_file")
|
26
|
-
expect(subject).to receive(:
|
26
|
+
expect(subject).to receive(:send_file).with("/recipe_dir/source.file", %r{^/tmp/itamae/[\d\.]+$})
|
27
27
|
expect(subject).to receive(:run_specinfra).with(:check_file_is_file, "/path/to/dst").and_return(true)
|
28
|
-
expect(subject).to receive(:
|
29
|
-
expect(subject).to receive(:
|
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
30
|
subject.pre_action
|
31
31
|
subject.create_action
|
32
32
|
end
|
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.
|
4
|
+
version: 1.0.0.beta8
|
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.
|
33
|
+
version: 2.0.0.beta37
|
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.
|
40
|
+
version: 2.0.0.beta37
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: hashie
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -165,6 +165,7 @@ files:
|
|
165
165
|
- lib/itamae/resource/execute.rb
|
166
166
|
- lib/itamae/resource/file.rb
|
167
167
|
- lib/itamae/resource/link.rb
|
168
|
+
- lib/itamae/resource/local_ruby_block.rb
|
168
169
|
- lib/itamae/resource/mail_alias.rb
|
169
170
|
- lib/itamae/resource/package.rb
|
170
171
|
- lib/itamae/resource/remote_file.rb
|
@@ -173,6 +174,7 @@ files:
|
|
173
174
|
- lib/itamae/resource_collection.rb
|
174
175
|
- lib/itamae/runner.rb
|
175
176
|
- lib/itamae/version.rb
|
177
|
+
- lib/itamae/version.txt
|
176
178
|
- spec/integration/Vagrantfile
|
177
179
|
- spec/integration/default_spec.rb
|
178
180
|
- spec/integration/recipes/default.rb
|