itamae 1.0.0.beta37 → 1.0.0.beta38

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: b676dcff820c3b0bbf5f289bc16147d3c377c907
4
- data.tar.gz: 20a076ed061d32a1b1a9e6db047e6e5d5d35c436
3
+ metadata.gz: 8b3714f298036bb34c563fd1d7d95b594af288db
4
+ data.tar.gz: 416f02e423816f68ce22d45ba191af0096015690
5
5
  SHA512:
6
- metadata.gz: 87f664da49330ed6a1e2e9bc645f63bb79af8eee6c22b4bd3aec5b38b96154098de80fdfe9a5e5f843d714e5712d7ca22bb842098e44858b2da1358f4460a657
7
- data.tar.gz: f8bea8f07778c0750f32f7b16e69f4fd44c3970d833d1ac5fcead189f08b0976614c9ecc7d8a6f5ee4f7cfbfcf1a68af74893bf2d98d757370aebb3cd61b9547
6
+ metadata.gz: eb55a96ab5f7971118cc69d94f95cc795993783f671cd834a0282633410d4946bd0694c4748a837c5584caf37fb5dc3c495eb4e057c05706ce4cabb39a91b1de
7
+ data.tar.gz: eeec88c4ccdf6ef0c118b34e2204e05de07e15b17ecd03fdfb2272e47424235c45e78ef2d41016bb64fb52ccfd01e3e3c7780b87c3a7bc4ee3ba30b661a2c85b
data/README.md CHANGED
@@ -15,31 +15,24 @@ Simple and lightweight configuration management tool inspired by Chef.
15
15
  $ gem install itamae
16
16
  ```
17
17
 
18
- ## Usage
18
+ ## Basic Usage
19
19
 
20
20
  ### Run locally
21
21
 
22
22
  ```
23
- $ sudo itamae execute -j example/node.json example/recipe.rb
24
- D, [2013-12-24T14:05:50.859587 #7156] DEBUG -- : Loading node data from /vagrant/example/node.json ...
25
- I, [2013-12-24T14:05:50.862072 #7156] INFO -- : >>> Executing Itamae::Resource::Package ({:action=>:install, :name=>"git"})...
26
- D, [2013-12-24T14:05:51.335070 #7156] DEBUG -- : Command `apt-get -y install git` succeeded
27
- D, [2013-12-24T14:05:51.335251 #7156] DEBUG -- : STDOUT> Reading package lists...
28
- Building dependency tree...
29
- Reading state information...
30
- git is already the newest version.
31
- 0 upgraded, 0 newly installed, 0 to remove and 156 not upgraded.
32
- D, [2013-12-24T14:05:51.335464 #7156] DEBUG -- : STDERR>
33
- I, [2013-12-24T14:05:51.335531 #7156] INFO -- : <<< Succeeded.
34
- I, [2013-12-24T14:05:51.335728 #7156] INFO -- : >>> Executing Itamae::Resource::File ({:action=>:create, :source=>"foo", :path=>"/home/vagrant/foo"})...
35
- D, [2013-12-24T14:05:51.335842 #7156] DEBUG -- : Copying a file from '/vagrant/example/foo' to '/home/vagrant/foo'...
36
- I, [2013-12-24T14:05:51.339119 #7156] INFO -- : <<< Succeeded.
23
+ $ sudo itamae execute -j example/node.json recipe.rb
37
24
  ```
38
25
 
39
26
  ### Run via SSH
40
27
 
41
28
  ```
42
- $ itamae ssh -j example/node.json -h 192.168.10.10 -p 22 -u user -i /path/to/private_key example/recipe.rb
29
+ $ itamae ssh -j example/node.json -h 192.168.10.10 -p 22 -u user -i /path/to/private_key recipe.rb
30
+ ```
31
+
32
+ #### Vagrant Integration
33
+
34
+ ```
35
+ $ itamae ssh -h vagrant_vm_name --vagrant recipe.rb
43
36
  ```
44
37
 
45
38
  ## Recipes
@@ -54,7 +47,7 @@ end
54
47
 
55
48
  Further example is here: [spec/integration/recipes/default.rb](spec/integration/recipes/default.rb)
56
49
 
57
- ## Doc
50
+ ## Documentations
58
51
 
59
52
  https://github.com/ryotarai/itamae/wiki
60
53
 
@@ -29,7 +29,7 @@ module Itamae
29
29
  construct_resources
30
30
  end
31
31
 
32
- def run_action(options)
32
+ def action_run(options)
33
33
  @children.run(options)
34
34
  end
35
35
 
@@ -78,7 +78,7 @@ module Itamae
78
78
  Logger.debug "(in show_differences)"
79
79
  show_differences
80
80
 
81
- public_send("#{specific_action || action}_action".to_sym, options)
81
+ public_send("action_#{specific_action || action}".to_sym, options)
82
82
  end
83
83
  end
84
84
 
@@ -94,7 +94,7 @@ module Itamae
94
94
  exit 2
95
95
  end
96
96
 
97
- def nothing_action(options)
97
+ def action_nothing(options)
98
98
  # do nothing
99
99
  end
100
100
 
@@ -136,7 +136,9 @@ module Itamae
136
136
 
137
137
  def different?
138
138
  @current_attributes.each_pair.any? do |key, current_value|
139
- current_value != @attributes[key]
139
+ current_value &&
140
+ @attributes[key] &&
141
+ current_value != @attributes[key]
140
142
  end
141
143
  end
142
144
 
@@ -31,7 +31,7 @@ module Itamae
31
31
  end
32
32
  end
33
33
 
34
- def create_action(options)
34
+ def action_create(options)
35
35
  if !run_specinfra(:check_file_is_directory, path)
36
36
  run_specinfra(:create_file_as_directory, path)
37
37
  end
@@ -6,7 +6,7 @@ module Itamae
6
6
  define_attribute :action, default: :run
7
7
  define_attribute :command, type: String, default_name: true
8
8
 
9
- def run_action(options)
9
+ def action_run(options)
10
10
  run_command(command)
11
11
  updated!
12
12
  end
@@ -66,7 +66,7 @@ module Itamae
66
66
  end
67
67
  end
68
68
 
69
- def create_action(options)
69
+ def action_create(options)
70
70
  if mode
71
71
  run_specinfra(:change_file_mode, @temppath, mode)
72
72
  end
@@ -89,7 +89,7 @@ module Itamae
89
89
  run_specinfra(:move_file, @temppath, path)
90
90
  end
91
91
 
92
- def delete_action(options)
92
+ def action_delete(options)
93
93
  if run_specinfra(:check_file_is_file, path)
94
94
  run_specinfra(:remove_file, path)
95
95
  end
@@ -22,7 +22,7 @@ module Itamae
22
22
  @current_attributes[:exist?] = exist
23
23
  end
24
24
 
25
- def sync_action(options)
25
+ def action_sync(options)
26
26
  ensure_git_available
27
27
 
28
28
  new_repository = false
@@ -22,7 +22,7 @@ module Itamae
22
22
  end
23
23
  end
24
24
 
25
- def create_action(options)
25
+ def action_create(options)
26
26
  unless run_specinfra(:check_file_is_linked_to, link, to)
27
27
  run_specinfra(:link_file_to, link, to)
28
28
  end
@@ -6,7 +6,7 @@ module Itamae
6
6
  define_attribute :action, default: :run
7
7
  define_attribute :block, type: Proc
8
8
 
9
- def run_action(options)
9
+ def action_run(options)
10
10
  block.call
11
11
  end
12
12
  end
@@ -24,7 +24,7 @@ module Itamae
24
24
  end
25
25
  end
26
26
 
27
- def install_action(action_options)
27
+ def action_install(action_options)
28
28
  unless run_specinfra(:check_package_is_installed, name, version)
29
29
  run_specinfra(:install_package, name, version, options)
30
30
  updated!
@@ -24,27 +24,27 @@ module Itamae
24
24
  @current_attributes[:enabled?] = run_specinfra(:check_service_is_enabled, name)
25
25
  end
26
26
 
27
- def start_action(options)
27
+ def action_start(options)
28
28
  run_specinfra(:start_service, name)
29
29
  end
30
30
 
31
- def stop_action(options)
31
+ def action_stop(options)
32
32
  run_specinfra(:stop_service, name)
33
33
  end
34
34
 
35
- def restart_action(options)
35
+ def action_restart(options)
36
36
  run_specinfra(:restart_service, name)
37
37
  end
38
38
 
39
- def reload_action(options)
39
+ def action_reload(options)
40
40
  run_specinfra(:reload_service, name)
41
41
  end
42
42
 
43
- def enable_action(options)
43
+ def action_enable(options)
44
44
  run_specinfra(:enable_service, name)
45
45
  end
46
46
 
47
- def disable_action(options)
47
+ def action_disable(options)
48
48
  run_specinfra(:disable_service, name)
49
49
  end
50
50
  end
@@ -22,7 +22,7 @@ module Itamae
22
22
  end
23
23
  end
24
24
 
25
- def create_action(options)
25
+ def action_create(options)
26
26
  if run_specinfra(:check_user_exists, username)
27
27
  if uid && uid.to_s != @current_attributes[:uid]
28
28
  run_specinfra(:update_user_uid, username, uid)
@@ -1 +1 @@
1
- 1.0.0.beta37
1
+ 1.0.0.beta38
@@ -97,7 +97,11 @@ describe file('/tmp/created_in_default2') do
97
97
  it { should be_file }
98
98
  end
99
99
 
100
- describe file('/tmp/should_not_exist') do
100
+ describe file('/tmp/never_exist3') do
101
+ it { should_not be_file }
102
+ end
103
+
104
+ describe file('/tmp/never_exist4') do
101
105
  it { should_not be_file }
102
106
  end
103
107
 
@@ -162,11 +162,11 @@ end
162
162
 
163
163
  #####
164
164
 
165
- file "/tmp/should_not_exist" do
165
+ file "/tmp/never_exist3" do
166
166
  action :create
167
167
  end
168
168
 
169
- file "/tmp/should_not_exist" do
169
+ file "/tmp/never_exist3" do
170
170
  action :delete
171
171
  end
172
172
 
@@ -180,3 +180,18 @@ definition_example "name" do
180
180
  key 'value'
181
181
  end
182
182
 
183
+ #####
184
+
185
+ file "/tmp/never_exist4" do
186
+ action :nothing
187
+ end
188
+
189
+ file "/tmp/file1" do
190
+ content "Hello, World"
191
+ end
192
+
193
+ file "/tmp/file1" do
194
+ content "Hello, World"
195
+ notifies :create, "file[/tmp/never_exist4]"
196
+ end
197
+
@@ -109,10 +109,10 @@ describe TestResource do
109
109
 
110
110
  describe "#run" do
111
111
  before do
112
- subject.action :action_name
112
+ subject.action :name
113
113
  end
114
114
  it "executes <ACTION_NAME>_action method" do
115
- expect(subject).to receive(:action_name_action)
115
+ expect(subject).to receive(:action_name)
116
116
  subject.run
117
117
  end
118
118
  end
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.0.0.beta37
4
+ version: 1.0.0.beta38
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryota Arai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-28 00:00:00.000000000 Z
11
+ date: 2014-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor