guard-chef 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Dreamr OKelly
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,60 @@
1
+ = Guard::Chef
2
+
3
+ Chef guard allows to automatically & intelligently update roles, cookbooks, and databags for chef.
4
+
5
+ - Compatible with Bundler 1.0.x
6
+ - Tested on Ruby 1.8.6, 1.8.7 & 1.9.2.
7
+
8
+ == Install
9
+
10
+ Please be sure to have {Guard}[https://github.com/guard/guard] installed before continue.
11
+
12
+ Install the gem:
13
+
14
+ gem install guard-chef
15
+
16
+ Add it to your Gemfile (inside test group):
17
+
18
+ gem 'guard-chef'
19
+
20
+ Add guard definition to your Guardfile by running this command:
21
+
22
+ guard init bundler
23
+
24
+ == Usage
25
+
26
+ Please read {Guard usage doc}[https://github.com/guard/guard#readme]
27
+
28
+ == Guardfile
29
+
30
+ Bundler guard can be really be adapted to all kind of projects.
31
+ Advice: place Bundler guard before other is recommended.
32
+
33
+ === Standard
34
+
35
+ group 'backend' do
36
+
37
+ guard 'chef' do
38
+ watch(%r{^cookbooks/(.+)/})
39
+ watch(%r{^roles/(.+).rb})
40
+ watch(%r{^data_bags/(.+)/})
41
+ end
42
+ end
43
+
44
+ == Options
45
+
46
+ Nothing yet!
47
+
48
+ Please read {Guard doc}[https://github.com/guard/guard#readme] for more info about Guardfile DSL.
49
+
50
+ == Development
51
+
52
+ - Source hosted at {GitHub}[https://github.com/dreamr/guard-chef]
53
+ - Report issues/Questions/Feature requests on {GitHub Issues}[https://github.com/dreamr/guard-chef/issues]
54
+
55
+ Pull requests are very welcome! Make sure your patches are well tested. Please create a topic branch for every separate change
56
+ you make.
57
+
58
+ == Authors
59
+
60
+ {Dreamr OKelly}[https://github.com/dreamr]
@@ -0,0 +1,23 @@
1
+ class CookbookJob
2
+ def initialize(base_dir, target)
3
+ @base_dir, @target = base_dir, target
4
+ end
5
+
6
+ def base_cmd
7
+ "cd #{@base_dir}"
8
+ end
9
+
10
+ def target
11
+ @target
12
+ end
13
+
14
+ def update
15
+ puts "uploading changed cookbook. (#{target}) Please wait."
16
+ retval = `#{base_cmd} && rake upload_cookbook[#{target}]`
17
+ if /upload complete/ =~ retval
18
+ puts "cookbook (#{target}) uploaded."
19
+ else
20
+ puts "cookbook (#{target}) could not be uploaded."
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ class DataBagJob
2
+ def initialize(base_dir, target)
3
+ @base_dir, @target = base_dir, target
4
+ end
5
+
6
+ def base_cmd
7
+ "cd #{@base_dir}"
8
+ end
9
+
10
+ def target
11
+ @target
12
+ end
13
+
14
+ def update
15
+ puts "uploading changed databag. (#{target}) Please wait."
16
+ retval = `#{base_cmd} && rake databag:upload[#{target}]`
17
+ if /Updated data_bag_item/ =~ retval
18
+ puts "databag (#{target}) uploaded."
19
+ else
20
+ puts "databag (#{target}) could not be uploaded."
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ class RoleJob
2
+ def initialize(base_dir, target)
3
+ @base_dir, @target = base_dir, target
4
+ end
5
+
6
+ def base_cmd
7
+ "cd #{@base_dir}"
8
+ end
9
+
10
+ def target
11
+ @target
12
+ end
13
+
14
+ def update
15
+ puts "uploading changed role. (#{target}) Please wait."
16
+ retval = `#{base_cmd} && rake role[#{target}]`
17
+ if /Updated Role #{target}!/ =~ retval
18
+ puts "role (#{target}) uploaded."
19
+ else
20
+ puts "role (#{target}) could not be uploaded."
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,6 @@
1
+ # encoding: utf-8
2
+ module Guard
3
+ module ChefVersion
4
+ VERSION = '0.0.1'
5
+ end
6
+ end
metadata ADDED
@@ -0,0 +1,94 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: guard-chef
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Dreamr OKelly
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-05-11 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: guard
17
+ prerelease: false
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.2.2
24
+ type: :runtime
25
+ version_requirements: *id001
26
+ - !ruby/object:Gem::Dependency
27
+ name: bundler
28
+ prerelease: false
29
+ requirement: &id002 !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ~>
33
+ - !ruby/object:Gem::Version
34
+ version: 1.0.2
35
+ type: :development
36
+ version_requirements: *id002
37
+ - !ruby/object:Gem::Dependency
38
+ name: rspec
39
+ prerelease: false
40
+ requirement: &id003 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 2.0.1
46
+ type: :development
47
+ version_requirements: *id003
48
+ description: Guard::Chef allows to automatically & intelligently update roles, cookbooks, and databags for chef.
49
+ email:
50
+ - james@rubyloves.me
51
+ executables: []
52
+
53
+ extensions: []
54
+
55
+ extra_rdoc_files: []
56
+
57
+ files:
58
+ - lib/guard/chef/cookbook_job.rb
59
+ - lib/guard/chef/data_bag_job.rb
60
+ - lib/guard/chef/role_job.rb
61
+ - lib/guard/chef/version.rb
62
+ - LICENSE
63
+ - README.rdoc
64
+ homepage: http://rubygems.org/gems/guard-chef
65
+ licenses: []
66
+
67
+ post_install_message:
68
+ rdoc_options:
69
+ - --charset=UTF-8
70
+ - --main=README.rdoc
71
+ - --exclude='(lib|test|spec)|(Gem|Guard|Rake)file'
72
+ require_paths:
73
+ - lib
74
+ required_ruby_version: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: "0"
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: 1.3.6
86
+ requirements: []
87
+
88
+ rubyforge_project: guard-chef
89
+ rubygems_version: 1.7.2
90
+ signing_key:
91
+ specification_version: 3
92
+ summary: Guard gem for Chef
93
+ test_files: []
94
+