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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b94b6c833eb2861fc1812fd735636616d07f51ac
|
4
|
+
data.tar.gz: b9f06696a7edd532fb343e4c3a184744b6a8ab9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 445412f2ba34785a24825b292811bf835677bfa106f9fa1e97e7e45c0ab4d6a962fa7a2bfe1b8128311dc6de97ac3cf2491c2bcd39eaa83cd18952e87e68288f
|
7
|
+
data.tar.gz: 32a14736b4795a14a46b46d426b8322512f8866cc11d7d74e0a8cd9edbc3c6a7b42e461ae652b96414d5649b0328ad6a97fdb441ff705674fdff41211b91dec8
|
data/README.md
CHANGED
@@ -22,9 +22,17 @@ Per example: create a user that will run app with credentials, whose $HOME is th
|
|
22
22
|
|
23
23
|
## How are the options?
|
24
24
|
|
25
|
-
*
|
25
|
+
* Http Servers: Nginx or Apache;
|
26
|
+
|
27
|
+
* Web Servers: Tomcat or Jetty;
|
28
|
+
|
26
29
|
* Init scripts: Systemd (all generated by Foreman soon);
|
27
|
-
|
30
|
+
|
31
|
+
* Apps supported:
|
32
|
+
|
33
|
+
* Ruby Web App (resides based on Http Server of choice)
|
34
|
+
* Ruby Standalone App (resides on /opt/*app_name*)
|
35
|
+
* Java Web App (resides based on Web Server of choice)
|
28
36
|
|
29
37
|
## Installation
|
30
38
|
|
@@ -42,15 +50,21 @@ Or install it yourself as:
|
|
42
50
|
|
43
51
|
## Usage
|
44
52
|
|
53
|
+
First, you need to vendorize all gems in deployment mode:
|
54
|
+
|
55
|
+
$ ruby -S bundle package --all
|
56
|
+
|
57
|
+
$ ruby -S bundle install --deployment --without development test debug
|
58
|
+
|
45
59
|
Here a simple example to build a Ruby Web App that runs Nginx and uses Systemd as init process. Just enter on source folder of your app and run in your terminal:
|
46
60
|
|
47
61
|
$ ruby -S gordon \
|
48
62
|
--app-type ruby_web_app \
|
49
63
|
--app-name $APP_NAME \
|
50
64
|
--app-desc $APP_DESC \
|
51
|
-
--app-
|
65
|
+
--app-home $APP_HOME \
|
52
66
|
--app-version $APP_VERSION \
|
53
|
-
--app-source
|
67
|
+
--app-source . \
|
54
68
|
--runtime-version $MRI_VERSION \
|
55
69
|
--http-server-type nginx \
|
56
70
|
--init-type systemd \
|
@@ -71,7 +85,7 @@ Sounds good?
|
|
71
85
|
|
72
86
|
## Why you not use Omnibus or Heroku buildpacks?
|
73
87
|
|
74
|
-
Because I want
|
88
|
+
Because I want a tool able to create Linux packages that can be extensible based on my needs.
|
75
89
|
|
76
90
|
## Why you use fpm-cookery templates instead of fpm?
|
77
91
|
|
@@ -84,8 +98,8 @@ Because I like Gordon Ramsay.
|
|
84
98
|
## TODO
|
85
99
|
|
86
100
|
* Validate outputs
|
87
|
-
*
|
88
|
-
*
|
101
|
+
* Refactor to have only one FPM::Cookery recipe.
|
102
|
+
* Integrate directly with FPM::Cookery classes
|
89
103
|
* Debian check (gem heavly developed under CentOS environment)
|
90
104
|
|
91
105
|
## Contributing
|
@@ -95,3 +109,4 @@ Because I like Gordon Ramsay.
|
|
95
109
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
96
110
|
4. Push to the branch (`git push origin my-new-feature`)
|
97
111
|
5. Create new Pull Request
|
112
|
+
|
data/gordon.gemspec
CHANGED
@@ -14,12 +14,12 @@ class JavaWebApp < FPM::Cookery::Recipe
|
|
14
14
|
Gordon::Cookery::Java::WebApp
|
15
15
|
|
16
16
|
name $env_vars.app_name
|
17
|
-
description $env_vars.
|
17
|
+
description $env_vars.app_description
|
18
18
|
version $env_vars.app_version
|
19
|
-
homepage $env_vars.
|
19
|
+
homepage $env_vars.app_homepage
|
20
20
|
arch :noarch
|
21
21
|
|
22
|
-
source $env_vars.
|
22
|
+
source $env_vars.app_source, with: :local_path
|
23
23
|
|
24
24
|
depends *resolve_dependencies($env_vars)
|
25
25
|
|
@@ -27,7 +27,9 @@ class JavaWebApp < FPM::Cookery::Recipe
|
|
27
27
|
fpm_attributes[:rpm_group] = 'tomcat'
|
28
28
|
|
29
29
|
def build
|
30
|
-
|
30
|
+
web_server_path = get_skeleton_path_from_type($env_vars, $env_vars.web_server_type)
|
31
|
+
|
32
|
+
war_path = File.join(web_server_path, $env_vars.app_name)
|
31
33
|
|
32
34
|
clean_java_web_workdir($env_vars, war_path)
|
33
35
|
end
|
@@ -15,23 +15,21 @@ class RubyStandaloneApp < FPM::Cookery::Recipe
|
|
15
15
|
Gordon::Cookery::Ruby::Common
|
16
16
|
|
17
17
|
name $env_vars.app_name
|
18
|
-
description $env_vars.
|
18
|
+
description $env_vars.app_description
|
19
19
|
version $env_vars.app_version
|
20
|
-
homepage $env_vars.
|
20
|
+
homepage $env_vars.app_homepage
|
21
21
|
|
22
|
-
source $env_vars.
|
22
|
+
source $env_vars.app_source, with: :local_path
|
23
23
|
|
24
24
|
depends *resolve_dependencies($env_vars)
|
25
25
|
|
26
26
|
def build
|
27
|
-
home_path = get_skeleton_path_from_type(:misc)
|
27
|
+
home_path = get_skeleton_path_from_type($env_vars, :misc)
|
28
28
|
|
29
29
|
create_user_and_group($env_vars, home_path)
|
30
30
|
setup_user_permissions($env_vars, home_path)
|
31
31
|
|
32
32
|
create_init($env_vars, :misc)
|
33
|
-
|
34
|
-
ruby_vendor_gems
|
35
33
|
end
|
36
34
|
|
37
35
|
def install
|
@@ -15,23 +15,21 @@ class RubyWebApp < FPM::Cookery::Recipe
|
|
15
15
|
Gordon::Cookery::Ruby::Common
|
16
16
|
|
17
17
|
name $env_vars.app_name
|
18
|
-
description $env_vars.
|
18
|
+
description $env_vars.app_description
|
19
19
|
version $env_vars.app_version
|
20
|
-
homepage $env_vars.
|
20
|
+
homepage $env_vars.app_homepage
|
21
21
|
|
22
|
-
source $env_vars.
|
22
|
+
source $env_vars.app_source, with: :local_path
|
23
23
|
|
24
24
|
depends *resolve_dependencies($env_vars)
|
25
25
|
|
26
26
|
def build
|
27
|
-
home_path = get_skeleton_path_from_type($env_vars.http_server_type)
|
27
|
+
home_path = get_skeleton_path_from_type($env_vars, $env_vars.http_server_type)
|
28
28
|
|
29
29
|
create_user_and_group($env_vars, home_path)
|
30
30
|
setup_user_permissions($env_vars, home_path)
|
31
31
|
|
32
32
|
create_init($env_vars, $env_vars.http_server_type)
|
33
|
-
|
34
|
-
ruby_vendor_gems
|
35
33
|
end
|
36
34
|
|
37
35
|
def install
|
data/lib/gordon/cli.rb
CHANGED
@@ -4,7 +4,7 @@ module Gordon
|
|
4
4
|
class CLI
|
5
5
|
def self.run
|
6
6
|
options = Options.new
|
7
|
-
options.
|
7
|
+
options.app_source = Dir.pwd
|
8
8
|
options.output_dir = Dir.pwd
|
9
9
|
|
10
10
|
parser = create_option_parser(options)
|
@@ -19,28 +19,32 @@ module Gordon
|
|
19
19
|
parser = OptionParser.new do |opts|
|
20
20
|
opts.banner = 'Usage: gordon [options]'
|
21
21
|
|
22
|
-
opts.on('-T', '--app-type APP_TYPE', 'Application Type') do |app_type|
|
23
|
-
options.app_type = app_type
|
24
|
-
end
|
25
|
-
|
26
22
|
opts.on('-N', '--app-name APP_NAME', 'Application Name') do |app_name|
|
27
23
|
options.app_name = app_name
|
28
24
|
end
|
29
25
|
|
30
|
-
opts.on('-D', '--app-
|
31
|
-
options.
|
26
|
+
opts.on('-D', '--app-description APP_DESCRIPTION', 'Application Description') do |app_description|
|
27
|
+
options.app_description = app_description
|
32
28
|
end
|
33
29
|
|
34
|
-
opts.on('-
|
35
|
-
options.
|
30
|
+
opts.on('-G', '--app-homepage APP_HOMEPAGE', 'Application Homepage') do |app_homepage|
|
31
|
+
options.app_homepage = app_homepage
|
36
32
|
end
|
37
33
|
|
38
34
|
opts.on('-V', '--app-version APP_VERSION', 'Application Version') do |app_version|
|
39
35
|
options.app_version = app_version
|
40
36
|
end
|
41
37
|
|
42
|
-
opts.on('-S', '--app-source
|
43
|
-
options.
|
38
|
+
opts.on('-S', '--app-source APP_SOURCE', 'Application Source') do |app_source|
|
39
|
+
options.app_source = app_source
|
40
|
+
end
|
41
|
+
|
42
|
+
opts.on('-T', '--app-type APP_TYPE', 'Application Type') do |app_type|
|
43
|
+
options.app_type = app_type
|
44
|
+
end
|
45
|
+
|
46
|
+
opts.on('-X', '--runtime-name RUNTIME_NAME', 'Runtime Name') do |runtime_name|
|
47
|
+
options.runtime_name = runtime_name
|
44
48
|
end
|
45
49
|
|
46
50
|
opts.on('-R', '--runtime-version RUNTIME_VERSION', 'Runtime Version') do |runtime_version|
|
data/lib/gordon/cooker.rb
CHANGED
@@ -2,7 +2,7 @@ module Gordon
|
|
2
2
|
class Cooker
|
3
3
|
attr_reader :recipe, :options
|
4
4
|
|
5
|
-
FPM_COOKERY_COMMAND = '
|
5
|
+
FPM_COOKERY_COMMAND = 'fpm-cook'
|
6
6
|
FPM_COOKERY_CACHE_DIR = '/tmp/gordon/cache'
|
7
7
|
FPM_COOKERY_BUILD_DIR = '/tmp/gordon/build'
|
8
8
|
|
@@ -39,10 +39,10 @@ module Gordon
|
|
39
39
|
def get_command_args
|
40
40
|
cook_args = []
|
41
41
|
|
42
|
-
cook_args << "--debug" if options.debug
|
42
|
+
cook_args << "--debug" if options.debug
|
43
43
|
|
44
44
|
cook_args << "--target #{options.package_type}"
|
45
|
-
|
45
|
+
# cook_args << "--platform #{recipe.platform}" if recipe.requires_platform?
|
46
46
|
cook_args << "--pkg-dir #{File.expand_path(options.output_dir)}"
|
47
47
|
cook_args << "--cache-dir #{File.expand_path(FPM_COOKERY_CACHE_DIR)}"
|
48
48
|
cook_args << "--tmp-root #{File.expand_path(FPM_COOKERY_BUILD_DIR)}"
|
@@ -56,7 +56,7 @@ module Gordon
|
|
56
56
|
|
57
57
|
command = "#{env_vars.join " "} #{FPM_COOKERY_COMMAND} #{cook_args.join " "}"
|
58
58
|
|
59
|
-
debug(command) if options.debug
|
59
|
+
debug(command) if options.debug
|
60
60
|
|
61
61
|
Process.run(command)
|
62
62
|
end
|
@@ -9,7 +9,7 @@ module Gordon
|
|
9
9
|
set -e
|
10
10
|
|
11
11
|
/usr/bin/getent group #{env_vars.app_name} >/dev/null || /usr/sbin/groupadd --system #{env_vars.app_name};
|
12
|
-
/usr/bin/getent passwd #{env_vars.app_name} >/dev/null || /usr/sbin/useradd --system --gid #{env_vars.app_name} --home-dir #{home_path} --shell /sbin/nologin --comment "#{env_vars.
|
12
|
+
/usr/bin/getent passwd #{env_vars.app_name} >/dev/null || /usr/sbin/useradd --system --gid #{env_vars.app_name} --home-dir #{home_path} --shell /sbin/nologin --comment "#{env_vars.app_description}" #{env_vars.app_name} >/dev/null || :;
|
13
13
|
__BASH
|
14
14
|
|
15
15
|
f.write(bash)
|
@@ -7,9 +7,14 @@ module Gordon
|
|
7
7
|
base.send(:extend, self)
|
8
8
|
end
|
9
9
|
|
10
|
-
def get_skeleton_path_from_type(type)
|
10
|
+
def get_skeleton_path_from_type(env_vars, type)
|
11
11
|
skeleton_type = create_skeleton_type(type)
|
12
|
-
skeleton_type.
|
12
|
+
appended_path = skeleton_type.requires_app_name? ? env_vars.app_name : ''
|
13
|
+
skeleton_type.path(appended_path)
|
14
|
+
end
|
15
|
+
|
16
|
+
def create_skeleton_type(type)
|
17
|
+
Skeleton::Factory.create(type)
|
13
18
|
end
|
14
19
|
|
15
20
|
def all_files_except_blacklisted(*custom_blacklist_files)
|
@@ -26,10 +31,6 @@ module Gordon
|
|
26
31
|
|
27
32
|
files
|
28
33
|
end
|
29
|
-
|
30
|
-
def create_skeleton_type(type)
|
31
|
-
Skeleton::Factory.create(type)
|
32
|
-
end
|
33
34
|
end
|
34
35
|
end
|
35
36
|
end
|
@@ -1,6 +1,10 @@
|
|
1
|
+
require 'fpm/cookery/facts'
|
2
|
+
|
1
3
|
module Gordon
|
2
4
|
module Cookery
|
3
5
|
module DependencyResolver
|
6
|
+
include Common
|
7
|
+
|
4
8
|
def resolve_dependencies(env_vars)
|
5
9
|
fragments = env_vars.app_type.split('_')
|
6
10
|
app_runtime, app_type = fragments[0], fragments[1]
|
@@ -23,6 +27,8 @@ module Gordon
|
|
23
27
|
|
24
28
|
runtime_version = "#{runtime_name}#{env_vars.runtime_version}"
|
25
29
|
else
|
30
|
+
runtime_name = app_runtime
|
31
|
+
|
26
32
|
runtime_version = "#{runtime_name} = #{env_vars.runtime_version}"
|
27
33
|
end
|
28
34
|
|
@@ -42,10 +48,10 @@ module Gordon
|
|
42
48
|
end
|
43
49
|
|
44
50
|
def get_os_package_name(env_vars, attribute)
|
45
|
-
|
51
|
+
platform = FPM::Cookery::Facts.platform.to_sym
|
46
52
|
|
47
53
|
skeleton_type = create_skeleton_type(env_vars.send(attribute))
|
48
|
-
os_package_name = skeleton_type.
|
54
|
+
os_package_name = skeleton_type.get_os_package_name(platform)
|
49
55
|
|
50
56
|
os_package_name
|
51
57
|
end
|
@@ -1,8 +1,10 @@
|
|
1
1
|
module Gordon
|
2
2
|
module Cookery
|
3
3
|
module HttpServer
|
4
|
+
include Common
|
5
|
+
|
4
6
|
def install_http_server_files(env_vars, blacklist)
|
5
|
-
skeleton_path = get_skeleton_path_from_type(env_vars.http_server_type)
|
7
|
+
skeleton_path = get_skeleton_path_from_type(env_vars, env_vars.http_server_type)
|
6
8
|
|
7
9
|
application_files = all_files_except_blacklisted(blacklist)
|
8
10
|
|
data/lib/gordon/cookery/init.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
module Gordon
|
2
2
|
module Cookery
|
3
3
|
module Init
|
4
|
+
include Common
|
5
|
+
|
4
6
|
def create_init(env_vars, skeleton_type)
|
5
7
|
init_build_dir_path = builddir(env_vars.init_type)
|
6
|
-
skeleton_path = get_skeleton_path_from_type(skeleton_type)
|
8
|
+
skeleton_path = get_skeleton_path_from_type(env_vars, skeleton_type)
|
7
9
|
|
8
|
-
command = "
|
10
|
+
command = "foreman export --procfile Procfile --root #{skeleton_path} --app #{env_vars.app_name} --user #{env_vars.app_name} #{env_vars.init_type} #{init_build_dir_path}"
|
9
11
|
|
10
12
|
safesystem(command)
|
11
13
|
end
|
@@ -13,7 +15,7 @@ module Gordon
|
|
13
15
|
def install_init(env_vars)
|
14
16
|
init_build_dir_path = builddir(env_vars.init_type)
|
15
17
|
|
16
|
-
skeleton_path = get_skeleton_path_from_type(env_vars.init_type)
|
18
|
+
skeleton_path = get_skeleton_path_from_type(env_vars, env_vars.init_type)
|
17
19
|
skeleton_files = Dir["#{init_build_dir_path}/*"]
|
18
20
|
|
19
21
|
root(skeleton_path).install skeleton_files
|
@@ -3,14 +3,6 @@ module Gordon
|
|
3
3
|
module Ruby
|
4
4
|
module Common
|
5
5
|
RUBY_BLACKLIST_FILES = %w(.rspec coverage log spec tmp)
|
6
|
-
|
7
|
-
def ruby_vendor_gems
|
8
|
-
command = 'ruby -S bundle package --all'
|
9
|
-
safesystem(command)
|
10
|
-
|
11
|
-
command = 'ruby -S bundle install --deployment --without development test'
|
12
|
-
safesystem(command)
|
13
|
-
end
|
14
6
|
end
|
15
7
|
end
|
16
8
|
end
|
@@ -1,8 +1,10 @@
|
|
1
1
|
module Gordon
|
2
2
|
module Cookery
|
3
3
|
module Standalone
|
4
|
+
include Common
|
5
|
+
|
4
6
|
def install_standalone_files(env_vars, blacklist)
|
5
|
-
skeleton_path = get_skeleton_path_from_type(:misc)
|
7
|
+
skeleton_path = get_skeleton_path_from_type(env_vars, :misc)
|
6
8
|
|
7
9
|
application_files = all_files_except_blacklisted(blacklist)
|
8
10
|
|
@@ -1,8 +1,10 @@
|
|
1
1
|
module Gordon
|
2
2
|
module Cookery
|
3
3
|
module WebServer
|
4
|
+
include Common
|
5
|
+
|
4
6
|
def install_web_server_files(env_vars, blacklist)
|
5
|
-
skeleton_path = get_skeleton_path_from_type(env_vars.web_server_type)
|
7
|
+
skeleton_path = get_skeleton_path_from_type(env_vars, env_vars.web_server_type)
|
6
8
|
|
7
9
|
application_files = all_files_except_blacklisted(blacklist)
|
8
10
|
|
data/lib/gordon/env_vars.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
module Gordon
|
2
2
|
class EnvVars
|
3
|
-
attr_accessor :app_type
|
4
|
-
attr_accessor :
|
3
|
+
attr_accessor :app_type
|
4
|
+
attr_accessor :app_name, :app_description, :app_homepage, :app_version, :app_source
|
5
|
+
attr_accessor :runtime_name, :runtime_version
|
5
6
|
attr_accessor :http_server_type
|
6
7
|
attr_accessor :web_server_type
|
7
8
|
attr_accessor :init_type
|
@@ -11,10 +12,11 @@ module Gordon
|
|
11
12
|
|
12
13
|
env_vars << "GORDON_APP_TYPE='#{options.app_type}'"
|
13
14
|
env_vars << "GORDON_APP_NAME='#{options.app_name}'"
|
14
|
-
env_vars << "
|
15
|
-
env_vars << "
|
15
|
+
env_vars << "GORDON_APP_DESCRIPTION='#{options.app_description}'"
|
16
|
+
env_vars << "GORDON_APP_HOMEPAGE='#{options.app_homepage}'"
|
16
17
|
env_vars << "GORDON_APP_VERSION='#{options.app_version}'"
|
17
|
-
env_vars << "
|
18
|
+
env_vars << "GORDON_APP_SOURCE='#{File.expand_path(options.app_source)}'"
|
19
|
+
env_vars << "GORDON_RUNTIME_NAME='#{options.runtime_name}'"
|
18
20
|
env_vars << "GORDON_RUNTIME_VERSION='#{options.runtime_version}'"
|
19
21
|
env_vars << "GORDON_HTTP_SERVER_TYPE='#{options.http_server_type}'"
|
20
22
|
env_vars << "GORDON_WEB_SERVER_TYPE='#{options.web_server_type}'"
|
@@ -28,10 +30,11 @@ module Gordon
|
|
28
30
|
|
29
31
|
env_vars.app_type = ENV['GORDON_APP_TYPE']
|
30
32
|
env_vars.app_name = ENV['GORDON_APP_NAME']
|
31
|
-
env_vars.
|
32
|
-
env_vars.
|
33
|
+
env_vars.app_description = ENV['GORDON_APP_DESCRIPTION']
|
34
|
+
env_vars.app_homepage = ENV['GORDON_APP_HOMEPAGE']
|
33
35
|
env_vars.app_version = ENV['GORDON_APP_VERSION']
|
34
|
-
env_vars.
|
36
|
+
env_vars.app_source = ENV['GORDON_APP_SOURCE']
|
37
|
+
env_vars.runtime_name = ENV['GORDON_RUNTIME_NAME']
|
35
38
|
env_vars.runtime_version = ENV['GORDON_RUNTIME_VERSION']
|
36
39
|
env_vars.http_server_type = ENV['GORDON_HTTP_SERVER_TYPE']
|
37
40
|
env_vars.web_server_type = ENV['GORDON_WEB_SERVER_TYPE']
|
data/lib/gordon/options.rb
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
module Gordon
|
2
2
|
class Options
|
3
|
-
attr_accessor :
|
4
|
-
attr_accessor :
|
3
|
+
attr_accessor :app_name, :app_description, :app_homepage, :app_version, :app_source
|
4
|
+
attr_accessor :app_type
|
5
|
+
attr_accessor :runtime_name, :runtime_version
|
5
6
|
attr_accessor :http_server_type
|
6
7
|
attr_accessor :web_server_type
|
7
8
|
attr_accessor :init_type
|
8
9
|
attr_accessor :package_type
|
9
10
|
attr_accessor :output_dir
|
10
11
|
attr_accessor :debug
|
11
|
-
|
12
|
-
def debug? ; !!debug ; end
|
13
12
|
end
|
14
13
|
end
|
data/lib/gordon/process.rb
CHANGED
@@ -2,7 +2,11 @@ module Gordon
|
|
2
2
|
class Process
|
3
3
|
def self.run(command)
|
4
4
|
pid = ::Process.spawn(command, out: $stdout, err: $stderr)
|
5
|
-
_,
|
5
|
+
_, exit_status = ::Process.wait2(pid)
|
6
|
+
|
7
|
+
raise SystemCallError.new("Failed to execute [#{command}]. Exit code: #{exit_status}") unless exit_status == 0
|
8
|
+
|
9
|
+
true
|
6
10
|
end
|
7
11
|
end
|
8
12
|
end
|
data/lib/gordon/recipe.rb
CHANGED
@@ -6,6 +6,13 @@ module Gordon
|
|
6
6
|
File.join(get_default_path, app.to_s)
|
7
7
|
end
|
8
8
|
|
9
|
+
def get_os_package_name(os_name)
|
10
|
+
package = get_os_package_map[os_name]
|
11
|
+
raise Exceptions::OperationalSystemNotMapped.new(self.class.name, os_name) if package.nil?
|
12
|
+
|
13
|
+
package
|
14
|
+
end
|
15
|
+
|
9
16
|
def requires_app_name?
|
10
17
|
false
|
11
18
|
end
|
data/lib/gordon/version.rb
CHANGED
data/lib/gordon.rb
CHANGED
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Gordon::Application::Types::Base do
|
4
|
+
subject do
|
5
|
+
class MyApplicationTypesBase
|
6
|
+
include Gordon::Application::Types::Base
|
7
|
+
|
8
|
+
def get_template ; 'vudu_eh_pra_jacoo' ; end
|
9
|
+
end
|
10
|
+
|
11
|
+
MyApplicationTypesBase.new
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'returns template path based on class' do
|
15
|
+
path = '/a/strange/path'
|
16
|
+
curdir = File.join(path, 'lib', 'gordon')
|
17
|
+
expect(File).to receive(:dirname).and_return(curdir)
|
18
|
+
|
19
|
+
expected = File.join(curdir, 'templates', 'vudu_eh_pra_jacoo.rb')
|
20
|
+
|
21
|
+
expect(subject.get_template_path).to eq(expected)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe Gordon::Application::Types::RubyWebApp do
|
26
|
+
it 'returns a template' do
|
27
|
+
expect(subject.get_template).to eq('ruby_web_app')
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe Gordon::Application::Types::RubyStandaloneApp do
|
32
|
+
it 'returns a template' do
|
33
|
+
expect(subject.get_template).to eq('ruby_standalone_app')
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe Gordon::Application::Types::JavaWebApp do
|
38
|
+
it 'returns a template' do
|
39
|
+
expect(subject.get_template).to eq('java_web_app')
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe Gordon::Application::Types::JavaStandaloneApp do
|
44
|
+
it 'returns a template' do
|
45
|
+
expect(subject.get_template).to eq('java_standalone_app')
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|