gordon 0.0.20 → 0.0.21

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: c0791b1bd7bc5327593a6e37cdc185b0d13e8ea8
4
- data.tar.gz: 59d54ac3399fa0d7a44a32f1f0c292f525d8cf10
3
+ metadata.gz: 92355b0ef213be4b1cf55eceeea64e67c32e13f3
4
+ data.tar.gz: 8f4257916fc921dd70dc09168684965551d7d923
5
5
  SHA512:
6
- metadata.gz: f15e13158890ca69f6702916b594097c4d3dffd1c996431a9770371b46db024bab6fe811afbe50d9703c264456b67c40cbafc07618d0dea10b3142067c0e2a99
7
- data.tar.gz: ed592c91f32be8160815aa9dde3ad7543191257680cc32b8f74b70fccf42d2585c9173fc41495fced2e9c7fb48b5b0c322e2b74a4df3614e185f89d6582adc62
6
+ metadata.gz: 97f28ad1766b41487f41716a0347e78b029046151c926f6324b3aa8e4350b3d63319e1a5d313e38c4a8c4d2c24f3c535bfb89f1d4cbb7899e73022e7724cbd6a
7
+ data.tar.gz: 6d384435ab5c0e29b19ccd19d956e0d89163e3ca3dbc76c78bdbd8c1f05410c959c27a9e07f60b8e7bfdde62124b8601ec7d64369871f3c74c6564d84c7ffb87
data/README.md CHANGED
@@ -58,24 +58,25 @@ First, you need to vendorize all gems in deployment mode:
58
58
 
59
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:
60
60
 
61
- $ ruby -S gordon \
62
- --app-type web \
63
- --app-name $APP_NAME \
64
- --app-desc $APP_DESC \
65
- --app-home $APP_HOME \
66
- --app-version $APP_VERSION \
67
- --app-source . \
68
- --runtime-name ruby \
69
- --runtime-version $MRI_VERSION \
70
- --http-server-type nginx \
71
- --init-type systemd \
72
- --package-type rpm \
61
+ $ ruby -S gordon \
62
+ --app-type web \
63
+ --app-name my-app \
64
+ --app-description "my app" \
65
+ --app-homepage https://github.com/myuser/my-app \
66
+ --app-version 1.0.0 \
67
+ --app-source . \
68
+ --runtime-name ruby \
69
+ --runtime-version 2.2.0 \
70
+ --http-server-type nginx \
71
+ --init-type systemd \
72
+ --package-type rpm \
73
73
  --output pkg
74
74
 
75
75
  It will generate a RPM package in pkg/ with the following structure:
76
76
 
77
77
  * /usr/share/nginx/html/*all-app-stuff*
78
78
  * /usr/lib/systemd/system/*all-systemd-stuff*
79
+ * /var/log/*app-name*
79
80
 
80
81
  Due for conventions, remember:
81
82
 
@@ -113,7 +114,7 @@ Because I like Gordon Ramsay.
113
114
  ## TODO
114
115
 
115
116
  * Add Oracle JRE support for Debian (oracle-jre-installer?)
116
- * Validate outputs
117
+ * Validate inputs
117
118
  * Debian check (gem heavly developed under CentOS environment)
118
119
 
119
120
  ## Contributing
@@ -10,6 +10,7 @@ class RubyStandaloneApp < FPM::Cookery::Recipe
10
10
 
11
11
  include Gordon::Cookery::Common,
12
12
  Gordon::Cookery::Init,
13
+ Gordon::Cookery::Log,
13
14
  Gordon::Cookery::ApplicationUser,
14
15
  Gordon::Cookery::Standalone,
15
16
  Gordon::Cookery::Ruby::Common
@@ -23,6 +24,9 @@ class RubyStandaloneApp < FPM::Cookery::Recipe
23
24
 
24
25
  depends *resolve_dependencies($env_vars, platform)
25
26
 
27
+ fpm_attributes["#{FPM::Cookery::Facts.target}_user".to_sym] = $env_vars.app_name
28
+ fpm_attributes["#{FPM::Cookery::Facts.target}_group".to_sym] = $env_vars.app_name
29
+
26
30
  def build
27
31
  home_path = get_skeleton_path_from_type($env_vars, :misc)
28
32
 
@@ -33,6 +37,8 @@ class RubyStandaloneApp < FPM::Cookery::Recipe
33
37
  end
34
38
 
35
39
  def install
40
+ create_log_folder($env_vars)
41
+
36
42
  install_init($env_vars)
37
43
  install_standalone_files($env_vars, RUBY_BLACKLIST_FILES)
38
44
  end
@@ -10,6 +10,7 @@ class RubyWebApp < FPM::Cookery::Recipe
10
10
 
11
11
  include Gordon::Cookery::Common,
12
12
  Gordon::Cookery::Init,
13
+ Gordon::Cookery::Log,
13
14
  Gordon::Cookery::ApplicationUser,
14
15
  Gordon::Cookery::HttpServer,
15
16
  Gordon::Cookery::Ruby::Common
@@ -23,6 +24,9 @@ class RubyWebApp < FPM::Cookery::Recipe
23
24
 
24
25
  depends *resolve_dependencies($env_vars, platform)
25
26
 
27
+ fpm_attributes["#{FPM::Cookery::Facts.target}_user".to_sym] = $env_vars.app_name
28
+ fpm_attributes["#{FPM::Cookery::Facts.target}_group".to_sym] = $env_vars.app_name
29
+
26
30
  def build
27
31
  home_path = get_skeleton_path_from_type($env_vars, $env_vars.http_server_type)
28
32
 
@@ -33,6 +37,8 @@ class RubyWebApp < FPM::Cookery::Recipe
33
37
  end
34
38
 
35
39
  def install
40
+ create_log_folder($env_vars)
41
+
36
42
  install_init($env_vars)
37
43
  install_http_server_files($env_vars, RUBY_BLACKLIST_FILES)
38
44
  end
@@ -0,0 +1,12 @@
1
+ module Gordon
2
+ module Cookery
3
+ module Log
4
+ def create_log_folder(env_vars)
5
+ log_path = "/var/log/#{env_vars.app_name}"
6
+
7
+ root(log_path).mkdir
8
+ end
9
+ end
10
+ end
11
+ end
12
+
@@ -1,3 +1,3 @@
1
1
  module Gordon
2
- VERSION = "0.0.20"
2
+ VERSION = "0.0.21"
3
3
  end
data/lib/gordon.rb CHANGED
@@ -18,6 +18,7 @@ module Gordon
18
18
  require 'gordon/cookery/java/web_app'
19
19
  require 'gordon/cookery/init'
20
20
  require 'gordon/cookery/http_server'
21
+ require 'gordon/cookery/log'
21
22
  require 'gordon/cookery/ruby/common'
22
23
  require 'gordon/cookery/standalone'
23
24
  require 'gordon/cookery/web_server'
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ describe Gordon::Cookery::Log do
4
+ subject do
5
+ class MyLog
6
+ include Gordon::Cookery::Log
7
+ end.new
8
+ end
9
+
10
+ let(:app_name) { "gordon" }
11
+ let(:log_path) { "/var/log/#{app_name}" }
12
+ let(:env_vars) { instance_double Gordon::EnvVars }
13
+
14
+ it 'creates folder' do
15
+ expect(env_vars).to receive(:app_name).and_return(app_name)
16
+
17
+ path_helper = instance_double 'A fpm cookery path helper'
18
+ expect(subject).to receive(:root).with(log_path).and_return(path_helper)
19
+ expect(path_helper).to receive(:mkdir)
20
+
21
+ subject.create_log_folder(env_vars)
22
+ end
23
+ end
24
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gordon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.20
4
+ version: 0.0.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcelo Pinheiro
@@ -98,6 +98,7 @@ files:
98
98
  - lib/gordon/cookery/init.rb
99
99
  - lib/gordon/cookery/java/common.rb
100
100
  - lib/gordon/cookery/java/web_app.rb
101
+ - lib/gordon/cookery/log.rb
101
102
  - lib/gordon/cookery/ruby/common.rb
102
103
  - lib/gordon/cookery/standalone.rb
103
104
  - lib/gordon/cookery/web_server.rb
@@ -124,6 +125,7 @@ files:
124
125
  - spec/gordon/cookery/init_spec.rb
125
126
  - spec/gordon/cookery/java/common_spec.rb
126
127
  - spec/gordon/cookery/java/web_app_spec.rb
128
+ - spec/gordon/cookery/log_spec.rb
127
129
  - spec/gordon/cookery/ruby/common_spec.rb
128
130
  - spec/gordon/cookery/standalone_spec.rb
129
131
  - spec/gordon/cookery/web_server_spec.rb
@@ -173,6 +175,7 @@ test_files:
173
175
  - spec/gordon/cookery/init_spec.rb
174
176
  - spec/gordon/cookery/java/common_spec.rb
175
177
  - spec/gordon/cookery/java/web_app_spec.rb
178
+ - spec/gordon/cookery/log_spec.rb
176
179
  - spec/gordon/cookery/ruby/common_spec.rb
177
180
  - spec/gordon/cookery/standalone_spec.rb
178
181
  - spec/gordon/cookery/web_server_spec.rb