natives 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +15 -0
  2. data/.document +5 -0
  3. data/.rspec +1 -0
  4. data/Gemfile +17 -0
  5. data/Gemfile.lock +137 -0
  6. data/LICENSE.txt +20 -0
  7. data/README.rdoc +19 -0
  8. data/Rakefile +42 -0
  9. data/VERSION +1 -0
  10. data/bin/natives +7 -0
  11. data/chef-solo/.gitignore +17 -0
  12. data/chef-solo/.kitchen.yml +27 -0
  13. data/chef-solo/Berksfile +4 -0
  14. data/chef-solo/config.rb +17 -0
  15. data/chef-solo/vendored-cookbooks/apt/CHANGELOG.md +144 -0
  16. data/chef-solo/vendored-cookbooks/apt/README.md +247 -0
  17. data/chef-solo/vendored-cookbooks/apt/attributes/default.rb +27 -0
  18. data/chef-solo/vendored-cookbooks/apt/files/default/apt-proxy-v2.conf +50 -0
  19. data/chef-solo/vendored-cookbooks/apt/libraries/helpers.rb +47 -0
  20. data/chef-solo/vendored-cookbooks/apt/libraries/network.rb +33 -0
  21. data/chef-solo/vendored-cookbooks/apt/metadata.json +54 -0
  22. data/chef-solo/vendored-cookbooks/apt/metadata.rb +34 -0
  23. data/chef-solo/vendored-cookbooks/apt/providers/preference.rb +61 -0
  24. data/chef-solo/vendored-cookbooks/apt/providers/repository.rb +141 -0
  25. data/chef-solo/vendored-cookbooks/apt/recipes/cacher-client.rb +81 -0
  26. data/chef-solo/vendored-cookbooks/apt/recipes/cacher-ng.rb +43 -0
  27. data/chef-solo/vendored-cookbooks/apt/recipes/default.rb +83 -0
  28. data/chef-solo/vendored-cookbooks/apt/resources/preference.rb +30 -0
  29. data/chef-solo/vendored-cookbooks/apt/resources/repository.rb +41 -0
  30. data/chef-solo/vendored-cookbooks/apt/templates/debian-6.0/acng.conf.erb +173 -0
  31. data/chef-solo/vendored-cookbooks/apt/templates/default/01proxy.erb +5 -0
  32. data/chef-solo/vendored-cookbooks/apt/templates/default/acng.conf.erb +275 -0
  33. data/chef-solo/vendored-cookbooks/apt/templates/ubuntu-10.04/acng.conf.erb +269 -0
  34. data/chef-solo/vendored-cookbooks/homebrew/CHANGELOG.md +36 -0
  35. data/chef-solo/vendored-cookbooks/homebrew/README.md +110 -0
  36. data/chef-solo/vendored-cookbooks/homebrew/attributes/default.rb +22 -0
  37. data/chef-solo/vendored-cookbooks/homebrew/libraries/homebrew_mixin.rb +53 -0
  38. data/chef-solo/vendored-cookbooks/homebrew/libraries/homebrew_package.rb +104 -0
  39. data/chef-solo/vendored-cookbooks/homebrew/metadata.json +32 -0
  40. data/chef-solo/vendored-cookbooks/homebrew/metadata.rb +10 -0
  41. data/chef-solo/vendored-cookbooks/homebrew/providers/tap.rb +48 -0
  42. data/chef-solo/vendored-cookbooks/homebrew/recipes/default.rb +46 -0
  43. data/chef-solo/vendored-cookbooks/homebrew/resources/tap.rb +35 -0
  44. data/lib/natives/app.rb +53 -0
  45. data/lib/natives/cli.rb +11 -0
  46. data/lib/natives.rb +0 -0
  47. data/natives.gemspec +113 -0
  48. data/spec/natives/app_spec.rb +68 -0
  49. data/spec/spec_helper.rb +12 -0
  50. metadata +224 -0
@@ -0,0 +1,68 @@
1
+ require 'spec_helper'
2
+ require 'natives/app'
3
+
4
+ describe Natives::App do
5
+ describe "#install" do
6
+ let(:app) { Natives::App.new }
7
+
8
+ it "forces packages argument to be an Array" do
9
+ app.should_receive(:run_chef_solo)
10
+ app.should_receive(:create_tmp_attrs_file).with([]).and_call_original
11
+
12
+ app.install(nil)
13
+ end
14
+ end
15
+
16
+ describe "#create_tmp_attrs_file" do
17
+ let(:app) { Natives::App.new }
18
+
19
+ it "generates a valid Chef JSON attrs file" do
20
+ json = nil
21
+ app.create_tmp_attrs_file(['foo', 'bar']) do |file|
22
+ json = JSON.parse(file.read)
23
+ end
24
+ expect(json).to eq({
25
+ "natives" => {
26
+ "install_list" => {
27
+ "rubygems" => ["foo", "bar"]
28
+ }
29
+ }
30
+ })
31
+ end
32
+
33
+ it "handles empty package list" do
34
+ json = nil
35
+ app.create_tmp_attrs_file([]) do |file|
36
+ json = JSON.parse(file.read)
37
+ end
38
+ expect(json).to eq({
39
+ "natives" => {
40
+ "install_list" => {
41
+ "rubygems" => []
42
+ }
43
+ }
44
+ })
45
+ end
46
+ end
47
+
48
+ describe "#run_chef_solo" do
49
+ let(:app) { Natives::App.new }
50
+
51
+ it "rewrites ARGV with Chef Solo options and run Chef Solo Application" do
52
+ attrs_file = double()
53
+ attrs_file.stub(:to_path) { '/path/to/attrs_file' }
54
+
55
+ Chef::Application::Solo.any_instance.should_receive(:run)
56
+
57
+ app.run_chef_solo(attrs_file)
58
+
59
+ expect(ARGV).to eq([
60
+ '-c',
61
+ File.absolute_path(File.join(
62
+ File.dirname(__FILE__), '..', '..', 'chef-solo', 'config.rb')),
63
+ '-o', 'natives',
64
+ '-j', '/path/to/attrs_file'
65
+ ])
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,12 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'rspec'
4
+ require 'natives'
5
+
6
+ # Requires supporting files with custom matchers and macros, etc,
7
+ # in ./support/ and its subdirectories.
8
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
9
+
10
+ RSpec.configure do |config|
11
+
12
+ end
metadata ADDED
@@ -0,0 +1,224 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: natives
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Huiming Teo
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-11-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: chef
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: !binary |-
20
+ MTEuNi4y
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ! '>='
26
+ - !ruby/object:Gem::Version
27
+ version: !binary |-
28
+ MTEuNi4y
29
+ - !ruby/object:Gem::Dependency
30
+ name: natives-catalog
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ! '>='
34
+ - !ruby/object:Gem::Version
35
+ version: !binary |-
36
+ MC4z
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: !binary |-
44
+ MC4z
45
+ - !ruby/object:Gem::Dependency
46
+ name: thor
47
+ requirement: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ! '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ type: :runtime
53
+ prerelease: false
54
+ version_requirements: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ! '>='
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ - !ruby/object:Gem::Dependency
60
+ name: rspec
61
+ requirement: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ! '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ - !ruby/object:Gem::Dependency
74
+ name: yard
75
+ requirement: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ! '>='
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ type: :development
81
+ prerelease: false
82
+ version_requirements: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ! '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ - !ruby/object:Gem::Dependency
88
+ name: rdoc
89
+ requirement: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ type: :development
95
+ prerelease: false
96
+ version_requirements: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ! '>='
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ - !ruby/object:Gem::Dependency
102
+ name: bundler
103
+ requirement: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ! '>='
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ type: :development
109
+ prerelease: false
110
+ version_requirements: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ! '>='
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ - !ruby/object:Gem::Dependency
116
+ name: jeweler
117
+ requirement: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ! '>='
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ type: :development
123
+ prerelease: false
124
+ version_requirements: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - ! '>='
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
129
+ - !ruby/object:Gem::Dependency
130
+ name: simplecov
131
+ requirement: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - ! '>='
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ type: :development
137
+ prerelease: false
138
+ version_requirements: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - ! '>='
141
+ - !ruby/object:Gem::Version
142
+ version: '0'
143
+ description: Automate libraries installation required by rubygems' native extension.
144
+ email: teohuiming@gmail.com
145
+ executables:
146
+ - natives
147
+ extensions: []
148
+ extra_rdoc_files:
149
+ - LICENSE.txt
150
+ - README.rdoc
151
+ files:
152
+ - .document
153
+ - .rspec
154
+ - Gemfile
155
+ - Gemfile.lock
156
+ - LICENSE.txt
157
+ - README.rdoc
158
+ - Rakefile
159
+ - VERSION
160
+ - bin/natives
161
+ - chef-solo/.gitignore
162
+ - chef-solo/.kitchen.yml
163
+ - chef-solo/Berksfile
164
+ - chef-solo/config.rb
165
+ - chef-solo/vendored-cookbooks/apt/CHANGELOG.md
166
+ - chef-solo/vendored-cookbooks/apt/README.md
167
+ - chef-solo/vendored-cookbooks/apt/attributes/default.rb
168
+ - chef-solo/vendored-cookbooks/apt/files/default/apt-proxy-v2.conf
169
+ - chef-solo/vendored-cookbooks/apt/libraries/helpers.rb
170
+ - chef-solo/vendored-cookbooks/apt/libraries/network.rb
171
+ - chef-solo/vendored-cookbooks/apt/metadata.json
172
+ - chef-solo/vendored-cookbooks/apt/metadata.rb
173
+ - chef-solo/vendored-cookbooks/apt/providers/preference.rb
174
+ - chef-solo/vendored-cookbooks/apt/providers/repository.rb
175
+ - chef-solo/vendored-cookbooks/apt/recipes/cacher-client.rb
176
+ - chef-solo/vendored-cookbooks/apt/recipes/cacher-ng.rb
177
+ - chef-solo/vendored-cookbooks/apt/recipes/default.rb
178
+ - chef-solo/vendored-cookbooks/apt/resources/preference.rb
179
+ - chef-solo/vendored-cookbooks/apt/resources/repository.rb
180
+ - chef-solo/vendored-cookbooks/apt/templates/debian-6.0/acng.conf.erb
181
+ - chef-solo/vendored-cookbooks/apt/templates/default/01proxy.erb
182
+ - chef-solo/vendored-cookbooks/apt/templates/default/acng.conf.erb
183
+ - chef-solo/vendored-cookbooks/apt/templates/ubuntu-10.04/acng.conf.erb
184
+ - chef-solo/vendored-cookbooks/homebrew/CHANGELOG.md
185
+ - chef-solo/vendored-cookbooks/homebrew/README.md
186
+ - chef-solo/vendored-cookbooks/homebrew/attributes/default.rb
187
+ - chef-solo/vendored-cookbooks/homebrew/libraries/homebrew_mixin.rb
188
+ - chef-solo/vendored-cookbooks/homebrew/libraries/homebrew_package.rb
189
+ - chef-solo/vendored-cookbooks/homebrew/metadata.json
190
+ - chef-solo/vendored-cookbooks/homebrew/metadata.rb
191
+ - chef-solo/vendored-cookbooks/homebrew/providers/tap.rb
192
+ - chef-solo/vendored-cookbooks/homebrew/recipes/default.rb
193
+ - chef-solo/vendored-cookbooks/homebrew/resources/tap.rb
194
+ - lib/natives.rb
195
+ - lib/natives/app.rb
196
+ - lib/natives/cli.rb
197
+ - natives.gemspec
198
+ - spec/natives/app_spec.rb
199
+ - spec/spec_helper.rb
200
+ homepage: http://github.com/teohm/natives
201
+ licenses:
202
+ - MIT
203
+ metadata: {}
204
+ post_install_message:
205
+ rdoc_options: []
206
+ require_paths:
207
+ - lib
208
+ required_ruby_version: !ruby/object:Gem::Requirement
209
+ requirements:
210
+ - - ! '>='
211
+ - !ruby/object:Gem::Version
212
+ version: '0'
213
+ required_rubygems_version: !ruby/object:Gem::Requirement
214
+ requirements:
215
+ - - ! '>='
216
+ - !ruby/object:Gem::Version
217
+ version: '0'
218
+ requirements: []
219
+ rubyforge_project:
220
+ rubygems_version: 2.1.10
221
+ signing_key:
222
+ specification_version: 4
223
+ summary: Install libraries required by rubygems' native extension.
224
+ test_files: []