poise-javascript 1.0.0

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.
Files changed (50) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +11 -0
  3. data/.kitchen.travis.yml +9 -0
  4. data/.kitchen.yml +8 -0
  5. data/.travis.yml +21 -0
  6. data/.yardopts +7 -0
  7. data/Berksfile +28 -0
  8. data/CHANGELOG.md +6 -0
  9. data/Gemfile +33 -0
  10. data/LICENSE +201 -0
  11. data/README.md +332 -0
  12. data/Rakefile +17 -0
  13. data/chef/attributes/default.rb +23 -0
  14. data/chef/recipes/default.rb +19 -0
  15. data/lib/poise_javascript.rb +24 -0
  16. data/lib/poise_javascript/cheftie.rb +18 -0
  17. data/lib/poise_javascript/error.rb +23 -0
  18. data/lib/poise_javascript/javascript_command_mixin.rb +56 -0
  19. data/lib/poise_javascript/javascript_providers.rb +40 -0
  20. data/lib/poise_javascript/javascript_providers/base.rb +97 -0
  21. data/lib/poise_javascript/javascript_providers/dummy.rb +77 -0
  22. data/lib/poise_javascript/javascript_providers/iojs.rb +64 -0
  23. data/lib/poise_javascript/javascript_providers/nodejs.rb +64 -0
  24. data/lib/poise_javascript/javascript_providers/scl.rb +79 -0
  25. data/lib/poise_javascript/javascript_providers/system.rb +71 -0
  26. data/lib/poise_javascript/resources.rb +29 -0
  27. data/lib/poise_javascript/resources/javascript_execute.rb +83 -0
  28. data/lib/poise_javascript/resources/javascript_runtime.rb +85 -0
  29. data/lib/poise_javascript/resources/javascript_runtime_test.rb +226 -0
  30. data/lib/poise_javascript/resources/node_package.rb +254 -0
  31. data/lib/poise_javascript/resources/npm_install.rb +94 -0
  32. data/lib/poise_javascript/version.rb +20 -0
  33. data/poise-javascript.gemspec +41 -0
  34. data/test/cookbooks/poise-javascript_test/metadata.rb +18 -0
  35. data/test/cookbooks/poise-javascript_test/recipes/default.rb +49 -0
  36. data/test/gemfiles/chef-12.gemfile +19 -0
  37. data/test/gemfiles/master.gemfile +23 -0
  38. data/test/integration/default/serverspec/default_spec.rb +107 -0
  39. data/test/spec/javascript_command_mixin_spec.rb +59 -0
  40. data/test/spec/javascript_providers/base_spec.rb +89 -0
  41. data/test/spec/javascript_providers/dummy_spec.rb +62 -0
  42. data/test/spec/javascript_providers/iojs_spec.rb +77 -0
  43. data/test/spec/javascript_providers/nodejs_spec.rb +82 -0
  44. data/test/spec/javascript_providers/scl_spec.rb +68 -0
  45. data/test/spec/javascript_providers/system_spec.rb +73 -0
  46. data/test/spec/resources/javascript_execute_spec.rb +67 -0
  47. data/test/spec/resources/node_package_spec.rb +324 -0
  48. data/test/spec/resources/npm_install_spec.rb +118 -0
  49. data/test/spec/spec_helper.rb +19 -0
  50. metadata +169 -0
@@ -0,0 +1,118 @@
1
+ #
2
+ # Copyright 2015, Noah Kantrowitz
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ require 'spec_helper'
18
+
19
+ describe PoiseJavascript::Resources::NpmInstall do
20
+ step_into(:npm_install)
21
+ let(:expect_cmd) { [] }
22
+ let(:expect_output) { '' }
23
+ before do
24
+ allow(PoiseLanguages::Utils).to receive(:which).with('node').and_return('/node')
25
+ expect_any_instance_of(described_class::Provider).to receive(:javascript_shell_out!).with(*expect_cmd).and_return(double(stdout: expect_output))
26
+ end
27
+
28
+ context 'with a path' do
29
+ let(:expect_cmd) { [%w{/npm install --production --unsafe-perm true}, {cwd: '/myapp', user: nil, group: nil, environment: {'PATH' => "/:#{ENV['PATH']}"}}] }
30
+ recipe do
31
+ npm_install '/myapp'
32
+ end
33
+
34
+ it { is_expected.to install_npm_install('/myapp') }
35
+ end # /context with a path
36
+
37
+ context 'with a user' do
38
+ let(:expect_cmd) { [%w{/npm install --production --unsafe-perm true}, {cwd: '/myapp', user: 'myuser', group: nil, environment: {'PATH' => "/:#{ENV['PATH']}"}}] }
39
+ recipe do
40
+ npm_install '/myapp' do
41
+ user 'myuser'
42
+ end
43
+ end
44
+
45
+ it { is_expected.to install_npm_install('/myapp') }
46
+ end # /context with a user
47
+
48
+ context 'with production false' do
49
+ let(:expect_cmd) { [%w{/npm install --unsafe-perm true}, {cwd: '/myapp', user: nil, group: nil, environment: {'PATH' => "/:#{ENV['PATH']}"}}] }
50
+ recipe do
51
+ npm_install '/myapp' do
52
+ production false
53
+ end
54
+ end
55
+
56
+ it { is_expected.to install_npm_install('/myapp') }
57
+ end # /context with production false
58
+
59
+ context 'with unsafe_perm false' do
60
+ let(:expect_cmd) { [%w{/npm install --production --unsafe-perm false}, {cwd: '/myapp', user: nil, group: nil, environment: {'PATH' => "/:#{ENV['PATH']}"}}] }
61
+ recipe do
62
+ npm_install '/myapp' do
63
+ unsafe_perm false
64
+ end
65
+ end
66
+
67
+ it { is_expected.to install_npm_install('/myapp') }
68
+ end # /context with unsafe_perm false
69
+
70
+ context 'with unsafe_perm nil' do
71
+ let(:expect_cmd) { [%w{/npm install --production}, {cwd: '/myapp', user: nil, group: nil, environment: {'PATH' => "/:#{ENV['PATH']}"}}] }
72
+ recipe do
73
+ npm_install '/myapp' do
74
+ @unsafe_perm = nil
75
+ end
76
+ end
77
+
78
+ it { is_expected.to install_npm_install('/myapp') }
79
+ end # /context with unsafe_perm nil
80
+
81
+ context 'with output' do
82
+ let(:expect_cmd) { [%w{/npm install --production --unsafe-perm true}, {cwd: '/myapp', user: nil, group: nil, environment: {'PATH' => "/:#{ENV['PATH']}"}}] }
83
+ let(:expect_output) { <<-EOH }
84
+ express@4.13.3 node_modules/express
85
+ ├── escape-html@1.0.2
86
+ ├── merge-descriptors@1.0.0
87
+ ├── array-flatten@1.1.1
88
+ ├── cookie@0.1.3
89
+ ├── cookie-signature@1.0.6
90
+ ├── utils-merge@1.0.0
91
+ ├── methods@1.1.1
92
+ ├── fresh@0.3.0
93
+ ├── range-parser@1.0.2
94
+ ├── path-to-regexp@0.1.7
95
+ ├── vary@1.0.1
96
+ ├── content-type@1.0.1
97
+ ├── etag@1.7.0
98
+ ├── parseurl@1.3.0
99
+ ├── content-disposition@0.5.0
100
+ ├── serve-static@1.10.0
101
+ ├── depd@1.0.1
102
+ ├── qs@4.0.0
103
+ ├── on-finished@2.3.0 (ee-first@1.1.1)
104
+ ├── finalhandler@0.4.0 (unpipe@1.0.0)
105
+ ├── debug@2.2.0 (ms@0.7.1)
106
+ ├── proxy-addr@1.0.8 (forwarded@0.1.0, ipaddr.js@1.0.1)
107
+ ├── send@0.13.0 (destroy@1.0.3, statuses@1.2.1, ms@0.7.1, mime@1.3.4, http-errors@1.3.1)
108
+ ├── type-is@1.6.8 (media-typer@0.3.0, mime-types@2.1.6)
109
+ └── accepts@1.2.12 (negotiator@0.5.3, mime-types@2.1.6)
110
+ EOH
111
+ recipe do
112
+ npm_install '/myapp'
113
+ end
114
+
115
+ it { is_expected.to install_npm_install('/myapp') }
116
+ it { expect(chef_run.npm_install('/myapp').updated?).to be true }
117
+ end # /context with output
118
+ end
@@ -0,0 +1,19 @@
1
+ #
2
+ # Copyright 2015, Noah Kantrowitz
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ require 'poise_boiler/spec_helper'
18
+ require 'poise_javascript'
19
+ require 'poise_javascript/cheftie'
metadata ADDED
@@ -0,0 +1,169 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: poise-javascript
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Noah Kantrowitz
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-10-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: halite
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: poise
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: poise-languages
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.2'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.2'
55
+ - !ruby/object:Gem::Dependency
56
+ name: poise-boiler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.0'
69
+ description: A Chef cookbook for managing Node.js and io.js installations.
70
+ email:
71
+ - noah@coderanger.net
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".kitchen.travis.yml"
78
+ - ".kitchen.yml"
79
+ - ".travis.yml"
80
+ - ".yardopts"
81
+ - Berksfile
82
+ - CHANGELOG.md
83
+ - Gemfile
84
+ - LICENSE
85
+ - README.md
86
+ - Rakefile
87
+ - chef/attributes/default.rb
88
+ - chef/recipes/default.rb
89
+ - lib/poise_javascript.rb
90
+ - lib/poise_javascript/cheftie.rb
91
+ - lib/poise_javascript/error.rb
92
+ - lib/poise_javascript/javascript_command_mixin.rb
93
+ - lib/poise_javascript/javascript_providers.rb
94
+ - lib/poise_javascript/javascript_providers/base.rb
95
+ - lib/poise_javascript/javascript_providers/dummy.rb
96
+ - lib/poise_javascript/javascript_providers/iojs.rb
97
+ - lib/poise_javascript/javascript_providers/nodejs.rb
98
+ - lib/poise_javascript/javascript_providers/scl.rb
99
+ - lib/poise_javascript/javascript_providers/system.rb
100
+ - lib/poise_javascript/resources.rb
101
+ - lib/poise_javascript/resources/javascript_execute.rb
102
+ - lib/poise_javascript/resources/javascript_runtime.rb
103
+ - lib/poise_javascript/resources/javascript_runtime_test.rb
104
+ - lib/poise_javascript/resources/node_package.rb
105
+ - lib/poise_javascript/resources/npm_install.rb
106
+ - lib/poise_javascript/version.rb
107
+ - poise-javascript.gemspec
108
+ - test/cookbooks/poise-javascript_test/metadata.rb
109
+ - test/cookbooks/poise-javascript_test/recipes/default.rb
110
+ - test/docker/docker.ca
111
+ - test/docker/docker.pem
112
+ - test/gemfiles/chef-12.gemfile
113
+ - test/gemfiles/master.gemfile
114
+ - test/integration/default/serverspec/default_spec.rb
115
+ - test/spec/javascript_command_mixin_spec.rb
116
+ - test/spec/javascript_providers/base_spec.rb
117
+ - test/spec/javascript_providers/dummy_spec.rb
118
+ - test/spec/javascript_providers/iojs_spec.rb
119
+ - test/spec/javascript_providers/nodejs_spec.rb
120
+ - test/spec/javascript_providers/scl_spec.rb
121
+ - test/spec/javascript_providers/system_spec.rb
122
+ - test/spec/resources/javascript_execute_spec.rb
123
+ - test/spec/resources/node_package_spec.rb
124
+ - test/spec/resources/npm_install_spec.rb
125
+ - test/spec/spec_helper.rb
126
+ homepage: https://github.com/poise/poise-javascript
127
+ licenses:
128
+ - Apache 2.0
129
+ metadata: {}
130
+ post_install_message:
131
+ rdoc_options: []
132
+ require_paths:
133
+ - lib
134
+ required_ruby_version: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ required_rubygems_version: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - ">="
142
+ - !ruby/object:Gem::Version
143
+ version: '0'
144
+ requirements: []
145
+ rubyforge_project:
146
+ rubygems_version: 2.4.8
147
+ signing_key:
148
+ specification_version: 4
149
+ summary: A Chef cookbook for managing Node.js and io.js installations.
150
+ test_files:
151
+ - test/cookbooks/poise-javascript_test/metadata.rb
152
+ - test/cookbooks/poise-javascript_test/recipes/default.rb
153
+ - test/docker/docker.ca
154
+ - test/docker/docker.pem
155
+ - test/gemfiles/chef-12.gemfile
156
+ - test/gemfiles/master.gemfile
157
+ - test/integration/default/serverspec/default_spec.rb
158
+ - test/spec/javascript_command_mixin_spec.rb
159
+ - test/spec/javascript_providers/base_spec.rb
160
+ - test/spec/javascript_providers/dummy_spec.rb
161
+ - test/spec/javascript_providers/iojs_spec.rb
162
+ - test/spec/javascript_providers/nodejs_spec.rb
163
+ - test/spec/javascript_providers/scl_spec.rb
164
+ - test/spec/javascript_providers/system_spec.rb
165
+ - test/spec/resources/javascript_execute_spec.rb
166
+ - test/spec/resources/node_package_spec.rb
167
+ - test/spec/resources/npm_install_spec.rb
168
+ - test/spec/spec_helper.rb
169
+ has_rdoc: