eycloud-helper-common 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # ChangeLog
2
2
 
3
+ ## v0.2
4
+
5
+ * `managed_template` - allows a recipe's files to have `keep.xyz` ("keep files") support
6
+ * `node[:owner_name]` & `node[:owner_pass]` attributes
7
+ * `chef` + `yajl-ruby` dependencies for use by "ey-recipes init --chef --on-deploy"
8
+
3
9
  ## v0.1
4
10
 
5
11
  * `ruby_block` is provided for recipes wanting to run on Chef 0.6 as well as modern Chef.
@@ -0,0 +1,2 @@
1
+ owner_name(attribute[:users].first[:username])
2
+ owner_pass(attribute[:users].first[:password])
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
- version = "0.1.0" # TODO get from metadata.json or .rb
4
+ version = "0.2.0" # TODO get from metadata.json or .rb
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "eycloud-helper-common"
@@ -18,5 +18,7 @@ Gem::Specification.new do |s|
18
18
  s.require_paths = ["lib"]
19
19
 
20
20
  # s.add_dependency("eycloud-helper-cronjobs")
21
+ s.add_dependency("chef")
22
+ s.add_dependency("yajl-ruby")
21
23
  s.add_development_dependency("rake")
22
24
  end
@@ -0,0 +1,39 @@
1
+ # This is just a small wrapper around template that allows us to add a not_if condition as follows:
2
+ # take the full path of the template "/data/someservice.conf" and check for a file on the filesystem
3
+ # called "/data/keep.someservice.conf"
4
+
5
+ # so for this managed_template resource
6
+ # managed_template "/data/someservice.conf" do
7
+ # owner "ez"
8
+ # mode 0755
9
+ # source 'someservice.conf.erb'
10
+ # action :create
11
+ # variables :applications => ['foo', 'bar', 'baz']
12
+ # end
13
+ #
14
+ # a not_if condition as follows gets automatically added for you:
15
+ # not_if { File.exists?("/data/keep.someservice.conf") }
16
+ #
17
+ # This allows for a user of a managed system to say "Hey I've made changes to this
18
+ # config file, DO NOT CLOBBER IT! KTHXBYE" by just prepending any file they want to manage by hand with 'keep.'
19
+
20
+ class Chef
21
+ class Resource
22
+ class ManagedTemplate < Template
23
+ if Chef::VERSION == '0.6.0.2'
24
+ def initialize(name, collection = nil, node = nil)
25
+ super(name, collection, node)
26
+ not_if { ::File.exists?(name.sub(/(.*)(\/)/, '\1/keep.')) }
27
+ end
28
+ else
29
+ def initialize(name, run_context=nil)
30
+ super(name, run_context)
31
+ not_if { ::File.exists?(name.sub(/(.*)(\/)/, '\1/keep.')) }
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+
38
+ Chef::Platform.platforms[:default].merge! :managed_template => Chef::Provider::Template
39
+
data/metadata.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "license": "MIT",
6
6
  "maintainer": "Dr Nic Williams",
7
7
  "maintainer_email": "drnicwilliams@gmail.com",
8
- "version": "0.1.0",
8
+ "version": "0.2.0",
9
9
  "attributes": {
10
10
  },
11
11
  "dependencies": {
data/metadata.rb CHANGED
@@ -3,5 +3,5 @@ description "Common recipe for EY Cloud"
3
3
  long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
4
4
  maintainer "Dr Nic Williams"
5
5
  maintainer_email "drnicwilliams@gmail.com"
6
- version "0.1.0"
6
+ version "0.2.0"
7
7
  # depends "cronjobs"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eycloud-helper-common
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,33 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-18 00:00:00.000000000 Z
12
+ date: 2012-03-20 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: chef
16
+ requirement: &70285966541120 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70285966541120
25
+ - !ruby/object:Gem::Dependency
26
+ name: yajl-ruby
27
+ requirement: &70285966537580 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70285966537580
14
36
  - !ruby/object:Gem::Dependency
15
37
  name: rake
16
- requirement: &70239993552200 !ruby/object:Gem::Requirement
38
+ requirement: &70285966536080 !ruby/object:Gem::Requirement
17
39
  none: false
18
40
  requirements:
19
41
  - - ! '>='
@@ -21,7 +43,7 @@ dependencies:
21
43
  version: '0'
22
44
  type: :development
23
45
  prerelease: false
24
- version_requirements: *70239993552200
46
+ version_requirements: *70285966536080
25
47
  description: Common recipe for EY Cloud
26
48
  email:
27
49
  - drnicwilliams@gmail.com
@@ -34,7 +56,9 @@ files:
34
56
  - Gemfile
35
57
  - README.md
36
58
  - Rakefile
59
+ - attributes/owner.rb
37
60
  - eycloud-helper-common.gemspec
61
+ - libraries/managed_template.rb
38
62
  - libraries/ruby_block.rb
39
63
  - metadata.json
40
64
  - metadata.rb
@@ -52,7 +76,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
52
76
  version: '0'
53
77
  segments:
54
78
  - 0
55
- hash: 1166039801459079574
79
+ hash: 2025999302468870265
56
80
  required_rubygems_version: !ruby/object:Gem::Requirement
57
81
  none: false
58
82
  requirements:
@@ -61,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
61
85
  version: '0'
62
86
  segments:
63
87
  - 0
64
- hash: 1166039801459079574
88
+ hash: 2025999302468870265
65
89
  requirements: []
66
90
  rubyforge_project:
67
91
  rubygems_version: 1.8.17