itamae 1.0.0.beta2 → 1.0.0.beta3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -0
- data/lib/itamae/resource.rb +1 -0
- data/lib/itamae/resource/service.rb +36 -0
- data/lib/itamae/version.rb +1 -1
- data/spec/integration/default_spec.rb +14 -0
- data/spec/integration/recipes/default.rb +15 -0
- metadata +2 -4
- data/example/foo +0 -1
- data/example/node.json +0 -1
- data/example/recipe.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 475a40243822c6fc6e435ba1876f210574f6ea46
|
4
|
+
data.tar.gz: 0b708944f87933422ad4ba8895c82911a7b8bc9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0c73c84729f8846f6a4f824012cdea2c0214accdb5460f2096845c974625602aa5be91fdc8b2b170f174d97d80fbaf60c8719827e6e64e373b918e29b585bd9
|
7
|
+
data.tar.gz: 0a16cc69999536d1ec3b6e2674926f6faa40fd5e28146a628d3247451faad2c216c07f7eb84f7568b3c8c33a00499c7d51ee4aaa953d7071cc2e440a4fcf3d67
|
data/README.md
CHANGED
@@ -42,6 +42,18 @@ I, [2013-12-24T14:05:51.339119 #7156] INFO -- : <<< Succeeded.
|
|
42
42
|
$ itamae ssh -j example/node.json -h 192.168.10.10 -p 22 -u user -i /path/to/private_key example/recipe.rb
|
43
43
|
```
|
44
44
|
|
45
|
+
## Recipes
|
46
|
+
|
47
|
+
You can write recipes like Chef's one.
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
package "dstat" do
|
51
|
+
action :install
|
52
|
+
end
|
53
|
+
```
|
54
|
+
|
55
|
+
Further example is here: [spec/integration/recipes/default.rb](spec/integration/recipes/default.rb)
|
56
|
+
|
45
57
|
## Run tests
|
46
58
|
|
47
59
|
Requirements: Vagrant
|
data/lib/itamae/resource.rb
CHANGED
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'itamae'
|
2
|
+
|
3
|
+
module Itamae
|
4
|
+
module Resource
|
5
|
+
class Service < Base
|
6
|
+
define_attribute :action, default: :nothing
|
7
|
+
define_attribute :name, type: String, default_name: true
|
8
|
+
|
9
|
+
def start_action
|
10
|
+
run_init_script("start")
|
11
|
+
end
|
12
|
+
|
13
|
+
def stop_action
|
14
|
+
run_init_script("stop")
|
15
|
+
end
|
16
|
+
|
17
|
+
def restart_action
|
18
|
+
run_init_script("restart")
|
19
|
+
end
|
20
|
+
|
21
|
+
def reload_action
|
22
|
+
run_init_script("reload")
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
def run_init_script(command)
|
27
|
+
run_command("#{shell_escape(init_script_path)} #{command}")
|
28
|
+
end
|
29
|
+
|
30
|
+
def init_script_path
|
31
|
+
"/etc/init.d/#{name}"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
data/lib/itamae/version.rb
CHANGED
@@ -53,3 +53,17 @@ describe file('/tmp/subscribes') do
|
|
53
53
|
its(:content) { should eq("2431") }
|
54
54
|
end
|
55
55
|
|
56
|
+
describe file('/tmp/cron_stopped') do
|
57
|
+
it { should be_file }
|
58
|
+
its(:content) do
|
59
|
+
expect(subject.content.lines.size).to eq 0
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe file('/tmp/cron_running') do
|
64
|
+
it { should be_file }
|
65
|
+
its(:content) do
|
66
|
+
expect(subject.content.lines.size).to eq 1
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
@@ -72,4 +72,19 @@ file "/tmp/never_exist2" do
|
|
72
72
|
not_if "exit 0"
|
73
73
|
end
|
74
74
|
|
75
|
+
######
|
76
|
+
|
77
|
+
service "cron" do
|
78
|
+
action :stop
|
79
|
+
end
|
80
|
+
|
81
|
+
execute "ps axu | grep cron | grep -v grep > /tmp/cron_stopped; true"
|
82
|
+
|
83
|
+
service "cron" do
|
84
|
+
action :start
|
85
|
+
end
|
86
|
+
|
87
|
+
execute "ps axu | grep cron | grep -v grep > /tmp/cron_running; true"
|
88
|
+
|
89
|
+
######
|
75
90
|
|
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.beta3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryota Arai
|
@@ -166,9 +166,6 @@ files:
|
|
166
166
|
- README.md
|
167
167
|
- Rakefile
|
168
168
|
- bin/itamae
|
169
|
-
- example/foo
|
170
|
-
- example/node.json
|
171
|
-
- example/recipe.rb
|
172
169
|
- itamae.gemspec
|
173
170
|
- lib/itamae.rb
|
174
171
|
- lib/itamae/cli.rb
|
@@ -183,6 +180,7 @@ files:
|
|
183
180
|
- lib/itamae/resource/mail_alias.rb
|
184
181
|
- lib/itamae/resource/package.rb
|
185
182
|
- lib/itamae/resource/remote_file.rb
|
183
|
+
- lib/itamae/resource/service.rb
|
186
184
|
- lib/itamae/resource/template.rb
|
187
185
|
- lib/itamae/resource_collection.rb
|
188
186
|
- lib/itamae/runner.rb
|
data/example/foo
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Hello
|
data/example/node.json
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"file_source": "foo"}
|
data/example/recipe.rb
DELETED