gordon 0.0.11 → 0.0.12
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.
- checksums.yaml +4 -4
- data/README.md +22 -7
- data/gordon.gemspec +0 -1
- data/lib/gordon/application/templates/java_web_app.rb +6 -4
- data/lib/gordon/application/templates/ruby_standalone_app.rb +4 -6
- data/lib/gordon/application/templates/ruby_web_app.rb +4 -6
- data/lib/gordon/application/types.rb +1 -1
- data/lib/gordon/cli.rb +15 -11
- data/lib/gordon/cooker.rb +4 -4
- data/lib/gordon/cookery/application_user.rb +1 -1
- data/lib/gordon/cookery/common.rb +7 -6
- data/lib/gordon/cookery/dependency_resolver.rb +8 -2
- data/lib/gordon/cookery/http_server.rb +3 -1
- data/lib/gordon/cookery/init.rb +5 -3
- data/lib/gordon/cookery/java/common.rb +0 -1
- data/lib/gordon/cookery/ruby/common.rb +0 -8
- data/lib/gordon/cookery/standalone.rb +3 -1
- data/lib/gordon/cookery/web_server.rb +3 -1
- data/lib/gordon/env_vars.rb +11 -8
- data/lib/gordon/exceptions.rb +10 -0
- data/lib/gordon/options.rb +3 -4
- data/lib/gordon/process.rb +5 -1
- data/lib/gordon/recipe.rb +1 -1
- data/lib/gordon/skeleton/types.rb +7 -0
- data/lib/gordon/version.rb +1 -1
- data/lib/gordon.rb +1 -0
- data/spec/gordon/application/types_spec.rb +48 -0
- data/spec/gordon/cli_spec.rb +63 -3
- data/spec/gordon/cooker_spec.rb +81 -4
- data/spec/gordon/cookery/application_user_spec.rb +59 -2
- data/spec/gordon/cookery/common_spec.rb +72 -5
- data/spec/gordon/cookery/dependency_resolver_spec.rb +58 -1
- data/spec/gordon/cookery/http_server_spec.rb +26 -1
- data/spec/gordon/cookery/init_spec.rb +52 -2
- data/spec/gordon/cookery/java/common_spec.rb +6 -2
- data/spec/gordon/cookery/java/web_app_spec.rb +33 -1
- data/spec/gordon/cookery/ruby/common_spec.rb +6 -2
- data/spec/gordon/cookery/standalone_spec.rb +25 -1
- data/spec/gordon/cookery/web_server_spec.rb +33 -0
- data/spec/gordon/env_vars_spec.rb +14 -11
- data/spec/gordon/factory_spec.rb +15 -1
- data/spec/gordon/options_spec.rb +1 -1
- data/spec/gordon/process_spec.rb +18 -1
- data/spec/gordon/recipe_spec.rb +13 -2
- data/spec/gordon/skeleton/types_spec.rb +147 -7
- metadata +8 -17
data/spec/gordon/factory_spec.rb
CHANGED
@@ -2,7 +2,21 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Gordon::Factory do
|
4
4
|
describe 'creating a instance of some object' do
|
5
|
-
|
5
|
+
it 'returns a new instance of a skeleton' do
|
6
|
+
namespace, object_type = "Skeleton::Types", "systemd"
|
7
|
+
|
8
|
+
result = described_class.create_instance(namespace, object_type)
|
9
|
+
|
10
|
+
expect(result).to be_instance_of(Gordon::Skeleton::Types::Systemd)
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'returns a new instance of a application type' do
|
14
|
+
namespace, object_type = "Application::Types", "ruby_web_app"
|
15
|
+
|
16
|
+
result = described_class.create_instance(namespace, object_type)
|
17
|
+
|
18
|
+
expect(result).to be_instance_of(Gordon::Application::Types::RubyWebApp)
|
19
|
+
end
|
6
20
|
end
|
7
21
|
end
|
8
22
|
|
data/spec/gordon/options_spec.rb
CHANGED
data/spec/gordon/process_spec.rb
CHANGED
@@ -1,8 +1,25 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Gordon::Process do
|
4
|
+
let(:command) { 'uname -a' }
|
5
|
+
let(:pid) { 3329 }
|
6
|
+
|
4
7
|
describe 'running a command' do
|
5
|
-
|
8
|
+
before :each do
|
9
|
+
expect(Process).to receive(:spawn).with(command, out: $stdout, err: $stderr).and_return(pid)
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'spawns and waits for execution' do
|
13
|
+
expect(Process).to receive(:wait2).with(pid).and_return([ pid, 0 ])
|
14
|
+
|
15
|
+
expect(described_class.run(command)).to be_truthy
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'raises error if call returns one' do
|
19
|
+
expect(Process).to receive(:wait2).with(pid).and_return([ pid, 1 ])
|
20
|
+
|
21
|
+
expect{ described_class.run(command) }.to raise_error
|
22
|
+
end
|
6
23
|
end
|
7
24
|
end
|
8
25
|
|
data/spec/gordon/recipe_spec.rb
CHANGED
@@ -1,8 +1,17 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Gordon::Recipe do
|
4
|
+
let(:options) { instance_double Gordon::Options, app_type: :ruby_web_app }
|
5
|
+
let(:app_type) { Gordon::Application::Types::RubyWebApp.new }
|
6
|
+
|
7
|
+
subject do
|
8
|
+
described_class.new(options)
|
9
|
+
end
|
10
|
+
|
4
11
|
describe 'creating a new instance' do
|
5
|
-
|
12
|
+
it 'maps a new instance of application' do
|
13
|
+
expect(subject.application).to be_instance_of(app_type.class)
|
14
|
+
end
|
6
15
|
end
|
7
16
|
|
8
17
|
# TODO: check if is really needed
|
@@ -16,7 +25,9 @@ describe Gordon::Recipe do
|
|
16
25
|
end
|
17
26
|
|
18
27
|
describe 'getting application template path' do
|
19
|
-
|
28
|
+
it 'returns expected path based on app type' do
|
29
|
+
expect(subject.application_template_path).to eq(app_type.get_template_path)
|
30
|
+
end
|
20
31
|
end
|
21
32
|
end
|
22
33
|
|
@@ -1,29 +1,169 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Gordon::Skeleton::Types::Base do
|
4
|
-
|
4
|
+
subject do
|
5
|
+
class MyExample
|
6
|
+
include Gordon::Skeleton::Types::Base
|
7
|
+
|
8
|
+
def get_os_package_map ; { centos: :my_example, debian: :my_example } ; end
|
9
|
+
|
10
|
+
def get_default_path ; '/a/path' ; end
|
11
|
+
end
|
12
|
+
|
13
|
+
MyExample.new
|
14
|
+
end
|
15
|
+
|
16
|
+
describe 'getting path' do
|
17
|
+
it 'returns default path based on class' do
|
18
|
+
expect(subject.path).to eq('/a/path/')
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'returns a custom path' do
|
22
|
+
expect(subject.path('customized')).to eq('/a/path/customized')
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe 'getting os package name' do
|
27
|
+
it 'returns value for mapped operational systems' do
|
28
|
+
%w(centos debian).each do |os|
|
29
|
+
expected = subject.get_os_package_map[os.to_sym]
|
30
|
+
expect(subject.get_os_package_name(os.to_sym)).to eq(expected)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'raises error if not found' do
|
35
|
+
expect { subject.get_os_package_name(:freebsd) }.to raise_exception(Gordon::Exceptions::OperationalSystemNotMapped)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe 'checking if requires app name' do
|
40
|
+
it 'returns false' do
|
41
|
+
expect(subject.requires_app_name?).to be_falsey
|
42
|
+
end
|
43
|
+
end
|
5
44
|
end
|
6
45
|
|
7
46
|
describe Gordon::Skeleton::Types::Nginx do
|
8
|
-
|
47
|
+
describe 'getting os package map' do
|
48
|
+
it 'returns a map' do
|
49
|
+
map = { centos: :nginx, debian: :nginx }
|
50
|
+
|
51
|
+
expect(subject.get_os_package_map).to eq(map)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe 'getting default path' do
|
56
|
+
it 'returns a path' do
|
57
|
+
expect(subject.get_default_path).to eq('/usr/share/nginx/html')
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe 'checking if requires app name' do
|
62
|
+
it 'returns false' do
|
63
|
+
expect(subject.requires_app_name?).to be_falsey
|
64
|
+
end
|
65
|
+
end
|
9
66
|
end
|
10
67
|
|
11
68
|
describe Gordon::Skeleton::Types::Apache do
|
12
|
-
|
69
|
+
describe 'getting os package map' do
|
70
|
+
it 'returns a map' do
|
71
|
+
map = { centos: :httpd, debian: :apache2 }
|
72
|
+
|
73
|
+
expect(subject.get_os_package_map).to eq(map)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
describe 'getting default path' do
|
78
|
+
it 'returns a path' do
|
79
|
+
expect(subject.get_default_path).to eq('/var/www/html')
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
describe 'checking if requires app name' do
|
84
|
+
it 'returns false' do
|
85
|
+
expect(subject.requires_app_name?).to be_falsey
|
86
|
+
end
|
87
|
+
end
|
13
88
|
end
|
14
89
|
|
15
90
|
describe Gordon::Skeleton::Types::Tomcat do
|
16
|
-
|
91
|
+
describe 'getting os package map' do
|
92
|
+
it 'returns a map' do
|
93
|
+
map = { centos: :tomcat, debian: :tomcat7 }
|
94
|
+
|
95
|
+
expect(subject.get_os_package_map).to eq(map)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
describe 'getting default path' do
|
100
|
+
it 'returns a path' do
|
101
|
+
expect(subject.get_default_path).to eq('/var/lib/tomcat/webapps')
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
describe 'checking if requires app name' do
|
106
|
+
it 'returns false' do
|
107
|
+
expect(subject.requires_app_name?).to be_falsey
|
108
|
+
end
|
109
|
+
end
|
17
110
|
end
|
18
111
|
|
19
112
|
describe Gordon::Skeleton::Types::Jetty do
|
20
|
-
|
113
|
+
describe 'getting os package map' do
|
114
|
+
it 'returns a map' do
|
115
|
+
map = { centos: :'jetty-server', debian: :jetty }
|
116
|
+
|
117
|
+
expect(subject.get_os_package_map).to eq(map)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
describe 'getting default path' do
|
122
|
+
it 'returns a path' do
|
123
|
+
expect(subject.get_default_path).to eq('/var/lib/jetty/webapps')
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
describe 'checking if requires app name' do
|
128
|
+
it 'returns false' do
|
129
|
+
expect(subject.requires_app_name?).to be_falsey
|
130
|
+
end
|
131
|
+
end
|
21
132
|
end
|
22
133
|
|
23
134
|
describe Gordon::Skeleton::Types::Systemd do
|
24
|
-
|
135
|
+
describe 'getting os package map' do
|
136
|
+
it 'returns a map' do
|
137
|
+
map = { centos: :systemd, debian: :systemd }
|
138
|
+
|
139
|
+
expect(subject.get_os_package_map).to eq(map)
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
describe 'getting default path' do
|
144
|
+
it 'returns a path' do
|
145
|
+
expect(subject.get_default_path).to eq('/usr/lib/systemd/system')
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
describe 'checking if requires app name' do
|
150
|
+
it 'returns false' do
|
151
|
+
expect(subject.requires_app_name?).to be_falsey
|
152
|
+
end
|
153
|
+
end
|
25
154
|
end
|
26
155
|
|
27
156
|
describe Gordon::Skeleton::Types::Misc do
|
28
|
-
|
157
|
+
describe 'getting default path' do
|
158
|
+
it 'returns a path' do
|
159
|
+
expect(subject.get_default_path).to eq('/opt')
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
describe 'checking if requires app name' do
|
164
|
+
it 'returns true' do
|
165
|
+
expect(subject.requires_app_name?).to be_truthy
|
166
|
+
end
|
167
|
+
end
|
29
168
|
end
|
169
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gordon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcelo Pinheiro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: bundler
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: fpm-cookery
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -116,6 +102,7 @@ files:
|
|
116
102
|
- lib/gordon/cookery/standalone.rb
|
117
103
|
- lib/gordon/cookery/web_server.rb
|
118
104
|
- lib/gordon/env_vars.rb
|
105
|
+
- lib/gordon/exceptions.rb
|
119
106
|
- lib/gordon/factory.rb
|
120
107
|
- lib/gordon/options.rb
|
121
108
|
- lib/gordon/process.rb
|
@@ -126,6 +113,7 @@ files:
|
|
126
113
|
- spec/gordon/application/templates/java_web_app_spec.rb
|
127
114
|
- spec/gordon/application/templates/ruby_standalone_app_spec.rb
|
128
115
|
- spec/gordon/application/templates/ruby_web_app_spec.rb
|
116
|
+
- spec/gordon/application/types_spec.rb
|
129
117
|
- spec/gordon/cli_spec.rb
|
130
118
|
- spec/gordon/cooker_spec.rb
|
131
119
|
- spec/gordon/cookery/application_user_spec.rb
|
@@ -137,6 +125,7 @@ files:
|
|
137
125
|
- spec/gordon/cookery/java/web_app_spec.rb
|
138
126
|
- spec/gordon/cookery/ruby/common_spec.rb
|
139
127
|
- spec/gordon/cookery/standalone_spec.rb
|
128
|
+
- spec/gordon/cookery/web_server_spec.rb
|
140
129
|
- spec/gordon/env_vars_spec.rb
|
141
130
|
- spec/gordon/factory_spec.rb
|
142
131
|
- spec/gordon/options_spec.rb
|
@@ -164,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
164
153
|
version: '0'
|
165
154
|
requirements: []
|
166
155
|
rubyforge_project:
|
167
|
-
rubygems_version: 2.4.
|
156
|
+
rubygems_version: 2.4.6
|
168
157
|
signing_key:
|
169
158
|
specification_version: 4
|
170
159
|
summary: A tool to create application OS packages
|
@@ -172,6 +161,7 @@ test_files:
|
|
172
161
|
- spec/gordon/application/templates/java_web_app_spec.rb
|
173
162
|
- spec/gordon/application/templates/ruby_standalone_app_spec.rb
|
174
163
|
- spec/gordon/application/templates/ruby_web_app_spec.rb
|
164
|
+
- spec/gordon/application/types_spec.rb
|
175
165
|
- spec/gordon/cli_spec.rb
|
176
166
|
- spec/gordon/cooker_spec.rb
|
177
167
|
- spec/gordon/cookery/application_user_spec.rb
|
@@ -183,6 +173,7 @@ test_files:
|
|
183
173
|
- spec/gordon/cookery/java/web_app_spec.rb
|
184
174
|
- spec/gordon/cookery/ruby/common_spec.rb
|
185
175
|
- spec/gordon/cookery/standalone_spec.rb
|
176
|
+
- spec/gordon/cookery/web_server_spec.rb
|
186
177
|
- spec/gordon/env_vars_spec.rb
|
187
178
|
- spec/gordon/factory_spec.rb
|
188
179
|
- spec/gordon/options_spec.rb
|