chef_helper 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/recipe2json +29 -0
- metadata +58 -0
data/bin/recipe2json
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
class RubyToJson
|
6
|
+
def initialize filename
|
7
|
+
@data = {
|
8
|
+
:json_class => "Chef::Role",
|
9
|
+
:chef_type => "role"
|
10
|
+
}
|
11
|
+
|
12
|
+
proc = Proc.new {}
|
13
|
+
eval(File.read(filename), proc.binding)
|
14
|
+
end
|
15
|
+
|
16
|
+
def method_missing(m, *args, &block)
|
17
|
+
method_data = args.size == 1 ? args.first : args
|
18
|
+
@data[m] = method_data
|
19
|
+
end
|
20
|
+
|
21
|
+
def get_data
|
22
|
+
JSON.pretty_generate(@data)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
filename = ARGV[0]
|
27
|
+
filename_json = filename.gsub(".rb", ".json")
|
28
|
+
r2j = RubyToJson.new filename
|
29
|
+
File.write(filename_json, r2j.get_data)
|
metadata
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: chef_helper
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Sebastian Probst Eide
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-09-20 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: json
|
16
|
+
requirement: &70297370093860 !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: *70297370093860
|
25
|
+
description: Helper scripts for chef-solo. Currently only installs a recipe2json executable
|
26
|
+
which converts your ruby recipies to json recipes
|
27
|
+
email: sebastian.probst.eide@gmail.com
|
28
|
+
executables:
|
29
|
+
- recipe2json
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- bin/recipe2json
|
34
|
+
homepage: https://github.com/sebastian/chef_helper
|
35
|
+
licenses: []
|
36
|
+
post_install_message:
|
37
|
+
rdoc_options: []
|
38
|
+
require_paths:
|
39
|
+
- lib
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
|
+
none: false
|
48
|
+
requirements:
|
49
|
+
- - ! '>='
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
requirements: []
|
53
|
+
rubyforge_project:
|
54
|
+
rubygems_version: 1.8.10
|
55
|
+
signing_key:
|
56
|
+
specification_version: 3
|
57
|
+
summary: Helper scripts for chef-solo.
|
58
|
+
test_files: []
|