gordon 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c9f8efe52ee3bd5876f355540c996a8651fe78d5
4
- data.tar.gz: ac8f7fca341bbba05bd1ae012c36d2cfd1904309
3
+ metadata.gz: 2f6c92da32b5f718a9c6e40061d550a397e44e1d
4
+ data.tar.gz: 58e7c34da8d28dc869589d2c9b52a19a45e2a95f
5
5
  SHA512:
6
- metadata.gz: b89bd962c396966d1708cd09f8e054bc8658e2806108166d28c759bf71d608c8b5949233e2d7158aa97f45556f0c8c7a8cdf0d4a186e9fe7ef1985587e5e941c
7
- data.tar.gz: 2f134d3478e0658a3eb9a1175eaa2141de00f76d6afa5738ab6188afc10ce5d4262cf9858e0a01414616eb09c7c59ab919317c5e24d3e42648a1357d483b7a42
6
+ metadata.gz: c13ff0c341f5787bd0db48d1fc6cf85546efcb06b39334a7e93d5a9af5ec9b8f10c3893846593508c4379673b583b96152f33742d837bef0f1258bfcfbbe8dd3
7
+ data.tar.gz: a81f165ee34ee5a8bc3595812e94e7f26c5747083ad55c66c59c86b41168e788be10b21f6bc5e169c5df92209ff281c72bb47c4e82ff9cc3b9730a498ea3a9e2
data/gordon.gemspec CHANGED
@@ -18,9 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_development_dependency "bundler", "~> 1.3"
22
21
  spec.add_development_dependency "rake"
23
- spec.add_development_dependency "debugger"
24
22
  spec.add_development_dependency "rspec"
25
23
 
26
24
  spec.add_dependency "bundler"
@@ -0,0 +1,39 @@
1
+ path = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', '..', 'lib'))
2
+ $LOAD_PATH.unshift path
3
+
4
+ require 'gordon'
5
+
6
+ $env_vars = Gordon::EnvVars.load
7
+
8
+ class JavaWebApp < FPM::Cookery::Recipe
9
+ extend Gordon::Cookery::DependencyResolver
10
+
11
+ include Gordon::Cookery::Common,
12
+ Gordon::Cookery::WebServer,
13
+ Gordon::Cookery::Java::Common,
14
+ Gordon::Cookery::Java::WebApp
15
+
16
+ name $env_vars.app_name
17
+ description $env_vars.app_desc
18
+ version $env_vars.app_version
19
+ homepage $env_vars.app_repo
20
+ arch :noarch
21
+
22
+ source $env_vars.app_source_dir, with: :local_path
23
+
24
+ depends *resolve_dependencies($env_vars)
25
+
26
+ fpm_attributes[:rpm_user] = 'tomcat'
27
+ fpm_attributes[:rpm_group] = 'tomcat'
28
+
29
+ def build
30
+ war_path = File.join(get_skeleton_path_from_type($env_vars.web_server_type), $env_vars.app_name)
31
+
32
+ clean_java_web_workdir($env_vars, war_path)
33
+ end
34
+
35
+ def install
36
+ install_web_server_files($env_vars, JAVA_BLACKLIST_FILES)
37
+ end
38
+ end
39
+
data/lib/gordon/cli.rb CHANGED
@@ -51,6 +51,10 @@ module Gordon
51
51
  options.http_server_type = http_server_type
52
52
  end
53
53
 
54
+ opts.on('-W', '--web-server-type WEB_SERVER_TYPE', 'Web Server Type') do |web_server_type|
55
+ options.web_server_type = web_server_type
56
+ end
57
+
54
58
  opts.on('-I', '--init-type INIT_TYPE', 'Init Type') do |init_type|
55
59
  options.init_type = init_type
56
60
  end
@@ -10,8 +10,7 @@ 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
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_desc}" #{env_vars.app_name} >/dev/null || :;
13
-
14
- __BASH
13
+ __BASH
15
14
 
16
15
  f.write(bash)
17
16
 
@@ -27,8 +26,7 @@ set -e
27
26
  set -e
28
27
 
29
28
  /usr/bin/chown -R #{env_vars.app_name}:#{env_vars.app_name} #{home_path}
30
-
31
- __BASH
29
+ __BASH
32
30
 
33
31
  f.write(bash)
34
32
 
@@ -7,8 +7,9 @@ module Gordon
7
7
 
8
8
  dependencies = []
9
9
  dependencies << get_runtime_package_name(app_runtime, env_vars)
10
- dependencies << get_http_server_package_name(env_vars) if app_type == 'web'
11
- dependencies << get_init_package_name(env_vars)
10
+ dependencies << get_http_server_package_name(env_vars) unless env_vars.http_server_type.empty?
11
+ dependencies << get_init_package_name(env_vars) unless env_vars.init_type.empty?
12
+ dependencies << get_web_server_package_name(env_vars) unless env_vars.web_server_type.empty?
12
13
 
13
14
  dependencies.collect(&:to_s)
14
15
  end
@@ -16,7 +17,14 @@ module Gordon
16
17
  private
17
18
 
18
19
  def get_runtime_package_name(app_runtime, env_vars)
19
- runtime_version = "#{app_runtime} = #{env_vars.runtime_version}"
20
+ if app_runtime == 'java'
21
+ # TODO: get a way to handle openjdk
22
+ runtime_name = :jre
23
+
24
+ runtime_version = "#{runtime_name}#{env_vars.runtime_version}"
25
+ else
26
+ runtime_version = "#{runtime_name} = #{env_vars.runtime_version}"
27
+ end
20
28
 
21
29
  runtime_version
22
30
  end
@@ -29,6 +37,10 @@ module Gordon
29
37
  get_os_package_name(env_vars, :init_type)
30
38
  end
31
39
 
40
+ def get_web_server_package_name(env_vars)
41
+ get_os_package_name(env_vars, :web_server_type)
42
+ end
43
+
32
44
  def get_os_package_name(env_vars, attribute)
33
45
  package_type = FPM::Cookery::Facts.platform.to_sym
34
46
 
@@ -0,0 +1,11 @@
1
+ module Gordon
2
+ module Cookery
3
+ module Java
4
+ module Common
5
+ JAVA_BLACKLIST_FILES = %w()
6
+ end
7
+ end
8
+ end
9
+ end
10
+
11
+
@@ -0,0 +1,24 @@
1
+ module Gordon
2
+ module Cookery
3
+ module Java
4
+ module WebApp
5
+ def clean_java_web_workdir(env_vars, workdir_path)
6
+ File.open(builddir('.gordon-before-install'), 'w', 0755) do |f|
7
+ bash = <<-__BASH
8
+ #!/bin/sh
9
+
10
+ set -e
11
+
12
+ /usr/bin/rm -rf #{workdir_path}
13
+ __BASH
14
+
15
+ f.write(bash)
16
+
17
+ self.class.pre_install(File.expand_path(f.path))
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+
@@ -0,0 +1,13 @@
1
+ module Gordon
2
+ module Cookery
3
+ module WebServer
4
+ def install_web_server_files(env_vars, blacklist)
5
+ skeleton_path = get_skeleton_path_from_type(env_vars.web_server_type)
6
+
7
+ application_files = all_files_except_blacklisted(blacklist)
8
+
9
+ root(skeleton_path).install application_files
10
+ end
11
+ end
12
+ end
13
+ end
@@ -3,6 +3,7 @@ module Gordon
3
3
  attr_accessor :app_type, :app_name, :app_desc, :app_repo, :app_version, :app_source_dir
4
4
  attr_accessor :runtime_version
5
5
  attr_accessor :http_server_type
6
+ attr_accessor :web_server_type
6
7
  attr_accessor :init_type
7
8
 
8
9
  def self.from_cook(options)
@@ -16,6 +17,7 @@ module Gordon
16
17
  env_vars << "GORDON_APP_SOURCE_DIR='#{File.expand_path(options.app_source_dir)}'"
17
18
  env_vars << "GORDON_RUNTIME_VERSION='#{options.runtime_version}'"
18
19
  env_vars << "GORDON_HTTP_SERVER_TYPE='#{options.http_server_type}'"
20
+ env_vars << "GORDON_WEB_SERVER_TYPE='#{options.web_server_type}'"
19
21
  env_vars << "GORDON_INIT_TYPE='#{options.init_type}'"
20
22
 
21
23
  env_vars
@@ -32,6 +34,7 @@ module Gordon
32
34
  env_vars.app_source_dir = ENV['GORDON_APP_SOURCE_DIR']
33
35
  env_vars.runtime_version = ENV['GORDON_RUNTIME_VERSION']
34
36
  env_vars.http_server_type = ENV['GORDON_HTTP_SERVER_TYPE']
37
+ env_vars.web_server_type = ENV['GORDON_WEB_SERVER_TYPE']
35
38
  env_vars.init_type = ENV['GORDON_INIT_TYPE']
36
39
 
37
40
  env_vars
@@ -3,6 +3,7 @@ module Gordon
3
3
  attr_accessor :app_type, :app_name, :app_desc, :app_repo, :app_version, :app_source_dir
4
4
  attr_accessor :runtime_version
5
5
  attr_accessor :http_server_type
6
+ attr_accessor :web_server_type
6
7
  attr_accessor :init_type
7
8
  attr_accessor :package_type
8
9
  attr_accessor :output_dir
@@ -27,6 +27,22 @@ module Gordon
27
27
  def get_default_path ; '/var/www/html' ; end
28
28
  end
29
29
 
30
+ class Tomcat
31
+ include Base
32
+
33
+ def get_os_package_map ; { centos: :tomcat, debian: :tomcat7 } ; end
34
+
35
+ def get_default_path ; '/var/lib/tomcat/webapps' ; end
36
+ end
37
+
38
+ class Jetty
39
+ include Base
40
+
41
+ def get_os_package_map ; { centos: :'jetty-server', debian: :jetty } ; end
42
+
43
+ def get_default_path ; '/var/lib/jetty/webapps' ; end
44
+ end
45
+
30
46
  class Systemd
31
47
  include Base
32
48
 
@@ -1,3 +1,3 @@
1
1
  module Gordon
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
data/lib/gordon.rb CHANGED
@@ -13,10 +13,13 @@ module Gordon
13
13
  require 'gordon/cookery/application_user'
14
14
  require 'gordon/cookery/common'
15
15
  require 'gordon/cookery/dependency_resolver'
16
+ require 'gordon/cookery/java/common'
17
+ require 'gordon/cookery/java/web_app'
16
18
  require 'gordon/cookery/init'
17
19
  require 'gordon/cookery/http_server'
18
20
  require 'gordon/cookery/ruby/common'
19
21
  require 'gordon/cookery/standalone'
22
+ require 'gordon/cookery/web_server'
20
23
  require 'gordon/skeleton/factory'
21
24
  require 'gordon/skeleton/types'
22
25
  end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'JavaWebApp' do
4
+ describe 'setup' do
5
+ pending
6
+ end
7
+
8
+ describe 'building' do
9
+ pending
10
+ end
11
+
12
+ describe 'installing' do
13
+ pending
14
+ end
15
+ end
16
+
@@ -2,11 +2,11 @@ require 'spec_helper'
2
2
 
3
3
  describe Gordon::Cooker do
4
4
  describe 'cooking a package' do
5
- it 'cleans fpm-cookery working directory' do
5
+ describe 'cleans fpm-cookery working directory' do
6
6
  pending
7
7
  end
8
8
 
9
- it 'packages calling fpm-cookery' do
9
+ describe 'packages calling fpm-cookery' do
10
10
  pending
11
11
  end
12
12
  end
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ describe Gordon::Cookery::Java::Common do
4
+ describe 'default blacklist files' do
5
+ pending
6
+ end
7
+ end
8
+
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ describe Gordon::Cookery::Java::WebApp do
4
+ describe 'cleaning web app workdir before install package' do
5
+ pending
6
+ end
7
+ end
8
+
@@ -11,6 +11,7 @@ describe Gordon::EnvVars do
11
11
  app_source_dir: ".",
12
12
  runtime_version: "2.2.0",
13
13
  http_server_type: "nginx",
14
+ web_server_type: "tomcat",
14
15
  init_type: "systemd",
15
16
  }
16
17
  end
@@ -28,6 +29,7 @@ describe Gordon::EnvVars do
28
29
  "GORDON_APP_SOURCE_DIR='#{File.expand_path(options.app_source_dir)}'",
29
30
  "GORDON_RUNTIME_VERSION='#{options.runtime_version}'",
30
31
  "GORDON_HTTP_SERVER_TYPE='#{options.http_server_type}'",
32
+ "GORDON_WEB_SERVER_TYPE='#{options.web_server_type}'",
31
33
  "GORDON_INIT_TYPE='#{options.init_type}'",
32
34
  ]
33
35
 
@@ -46,6 +48,7 @@ describe Gordon::EnvVars do
46
48
  'GORDON_APP_SOURCE_DIR' => options.app_source_dir,
47
49
  'GORDON_RUNTIME_VERSION' => options.runtime_version,
48
50
  'GORDON_HTTP_SERVER_TYPE' => options.http_server_type,
51
+ 'GORDON_WEB_SERVER_TYPE' => options.web_server_type,
49
52
  'GORDON_INIT_TYPE' => options.init_type,
50
53
  }
51
54
 
@@ -12,6 +12,14 @@ describe Gordon::Skeleton::Types::Apache do
12
12
  pending
13
13
  end
14
14
 
15
+ describe Gordon::Skeleton::Types::Tomcat do
16
+ pending
17
+ end
18
+
19
+ describe Gordon::Skeleton::Types::Jetty do
20
+ pending
21
+ end
22
+
15
23
  describe Gordon::Skeleton::Types::Systemd do
16
24
  pending
17
25
  end
metadata CHANGED
@@ -1,111 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gordon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
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-12 00:00:00.000000000 Z
11
+ date: 2015-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ~>
18
- - !ruby/object:Gem::Version
19
- version: '1.3'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ~>
25
- - !ruby/object:Gem::Version
26
- version: '1.3'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: rake
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
- - - '>='
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - '>='
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: debugger
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - '>='
17
+ - - ">="
46
18
  - !ruby/object:Gem::Version
47
19
  version: '0'
48
20
  type: :development
49
21
  prerelease: false
50
22
  version_requirements: !ruby/object:Gem::Requirement
51
23
  requirements:
52
- - - '>='
24
+ - - ">="
53
25
  - !ruby/object:Gem::Version
54
26
  version: '0'
55
27
  - !ruby/object:Gem::Dependency
56
28
  name: rspec
57
29
  requirement: !ruby/object:Gem::Requirement
58
30
  requirements:
59
- - - '>='
31
+ - - ">="
60
32
  - !ruby/object:Gem::Version
61
33
  version: '0'
62
34
  type: :development
63
35
  prerelease: false
64
36
  version_requirements: !ruby/object:Gem::Requirement
65
37
  requirements:
66
- - - '>='
38
+ - - ">="
67
39
  - !ruby/object:Gem::Version
68
40
  version: '0'
69
41
  - !ruby/object:Gem::Dependency
70
42
  name: bundler
71
43
  requirement: !ruby/object:Gem::Requirement
72
44
  requirements:
73
- - - '>='
45
+ - - ">="
74
46
  - !ruby/object:Gem::Version
75
47
  version: '0'
76
48
  type: :runtime
77
49
  prerelease: false
78
50
  version_requirements: !ruby/object:Gem::Requirement
79
51
  requirements:
80
- - - '>='
52
+ - - ">="
81
53
  - !ruby/object:Gem::Version
82
54
  version: '0'
83
55
  - !ruby/object:Gem::Dependency
84
56
  name: fpm-cookery
85
57
  requirement: !ruby/object:Gem::Requirement
86
58
  requirements:
87
- - - '>='
59
+ - - ">="
88
60
  - !ruby/object:Gem::Version
89
61
  version: '0'
90
62
  type: :runtime
91
63
  prerelease: false
92
64
  version_requirements: !ruby/object:Gem::Requirement
93
65
  requirements:
94
- - - '>='
66
+ - - ">="
95
67
  - !ruby/object:Gem::Version
96
68
  version: '0'
97
69
  - !ruby/object:Gem::Dependency
98
70
  name: foreman
99
71
  requirement: !ruby/object:Gem::Requirement
100
72
  requirements:
101
- - - '>='
73
+ - - ">="
102
74
  - !ruby/object:Gem::Version
103
75
  version: '0'
104
76
  type: :runtime
105
77
  prerelease: false
106
78
  version_requirements: !ruby/object:Gem::Requirement
107
79
  requirements:
108
- - - '>='
80
+ - - ">="
109
81
  - !ruby/object:Gem::Version
110
82
  version: '0'
111
83
  description: Gordon is a tool to create OS packages using fpm-cookery and foreman,
@@ -117,8 +89,8 @@ executables:
117
89
  extensions: []
118
90
  extra_rdoc_files: []
119
91
  files:
120
- - .gitignore
121
- - .rspec
92
+ - ".gitignore"
93
+ - ".rspec"
122
94
  - Gemfile
123
95
  - LICENSE.txt
124
96
  - README.md
@@ -127,6 +99,7 @@ files:
127
99
  - gordon.gemspec
128
100
  - lib/gordon.rb
129
101
  - lib/gordon/application/factory.rb
102
+ - lib/gordon/application/templates/java_web_app.rb
130
103
  - lib/gordon/application/templates/ruby_standalone_app.rb
131
104
  - lib/gordon/application/templates/ruby_web_app.rb
132
105
  - lib/gordon/application/types.rb
@@ -137,8 +110,11 @@ files:
137
110
  - lib/gordon/cookery/dependency_resolver.rb
138
111
  - lib/gordon/cookery/http_server.rb
139
112
  - lib/gordon/cookery/init.rb
113
+ - lib/gordon/cookery/java/common.rb
114
+ - lib/gordon/cookery/java/web_app.rb
140
115
  - lib/gordon/cookery/ruby/common.rb
141
116
  - lib/gordon/cookery/standalone.rb
117
+ - lib/gordon/cookery/web_server.rb
142
118
  - lib/gordon/env_vars.rb
143
119
  - lib/gordon/factory.rb
144
120
  - lib/gordon/options.rb
@@ -147,6 +123,7 @@ files:
147
123
  - lib/gordon/skeleton/factory.rb
148
124
  - lib/gordon/skeleton/types.rb
149
125
  - lib/gordon/version.rb
126
+ - spec/gordon/application/templates/java_web_app_spec.rb
150
127
  - spec/gordon/application/templates/ruby_standalone_app_spec.rb
151
128
  - spec/gordon/application/templates/ruby_web_app_spec.rb
152
129
  - spec/gordon/cli_spec.rb
@@ -156,6 +133,8 @@ files:
156
133
  - spec/gordon/cookery/dependency_resolver_spec.rb
157
134
  - spec/gordon/cookery/http_server_spec.rb
158
135
  - spec/gordon/cookery/init_spec.rb
136
+ - spec/gordon/cookery/java/common_spec.rb
137
+ - spec/gordon/cookery/java/web_app_spec.rb
159
138
  - spec/gordon/cookery/ruby/common_spec.rb
160
139
  - spec/gordon/cookery/standalone_spec.rb
161
140
  - spec/gordon/env_vars_spec.rb
@@ -175,21 +154,22 @@ require_paths:
175
154
  - lib
176
155
  required_ruby_version: !ruby/object:Gem::Requirement
177
156
  requirements:
178
- - - '>='
157
+ - - ">="
179
158
  - !ruby/object:Gem::Version
180
159
  version: '0'
181
160
  required_rubygems_version: !ruby/object:Gem::Requirement
182
161
  requirements:
183
- - - '>='
162
+ - - ">="
184
163
  - !ruby/object:Gem::Version
185
164
  version: '0'
186
165
  requirements: []
187
166
  rubyforge_project:
188
- rubygems_version: 2.0.14
167
+ rubygems_version: 2.4.5
189
168
  signing_key:
190
169
  specification_version: 4
191
170
  summary: A tool to create application OS packages
192
171
  test_files:
172
+ - spec/gordon/application/templates/java_web_app_spec.rb
193
173
  - spec/gordon/application/templates/ruby_standalone_app_spec.rb
194
174
  - spec/gordon/application/templates/ruby_web_app_spec.rb
195
175
  - spec/gordon/cli_spec.rb
@@ -199,6 +179,8 @@ test_files:
199
179
  - spec/gordon/cookery/dependency_resolver_spec.rb
200
180
  - spec/gordon/cookery/http_server_spec.rb
201
181
  - spec/gordon/cookery/init_spec.rb
182
+ - spec/gordon/cookery/java/common_spec.rb
183
+ - spec/gordon/cookery/java/web_app_spec.rb
202
184
  - spec/gordon/cookery/ruby/common_spec.rb
203
185
  - spec/gordon/cookery/standalone_spec.rb
204
186
  - spec/gordon/env_vars_spec.rb