gordon 0.0.8 → 0.0.10

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: dce0a6aeb6b0c2445f2460cf56cdffeac86ba606
4
- data.tar.gz: 81a76f4f2535d95711a443c50bfce590b1506cad
3
+ metadata.gz: c9f8efe52ee3bd5876f355540c996a8651fe78d5
4
+ data.tar.gz: ac8f7fca341bbba05bd1ae012c36d2cfd1904309
5
5
  SHA512:
6
- metadata.gz: a7b522e7f891133d045198c6d28291c5c98f6eaa24e3b57f30d11d4619a5cd1ffdfbfa2ab897f2356266d47438ff490e5895a9053dca6819e7d615a98350ae13
7
- data.tar.gz: 10ce888b8a7c6485e0995d4ba239d86acf747734f905b99e847bab6d13ed9591dd51450783a14bc1dbd7197c52693653801cc18c65e090e2a5e5915c30060a93
6
+ metadata.gz: b89bd962c396966d1708cd09f8e054bc8658e2806108166d28c759bf71d608c8b5949233e2d7158aa97f45556f0c8c7a8cdf0d4a186e9fe7ef1985587e5e941c
7
+ data.tar.gz: 2f134d3478e0658a3eb9a1175eaa2141de00f76d6afa5738ab6188afc10ce5d4262cf9858e0a01414616eb09c7c59ab919317c5e24d3e42648a1357d483b7a42
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --colour
data/README.md CHANGED
@@ -60,18 +60,18 @@ Here a simple example to build a Ruby Web App that runs Nginx and uses Systemd a
60
60
  It will generate a RPM package in pkg/ with the following structure:
61
61
 
62
62
  * /usr/share/nginx/html/*all-app-stuff*
63
- * /usr/lib/systemd/system/*app-name*/*all-systemd-stuff*
63
+ * /usr/lib/systemd/system/*all-systemd-stuff*
64
64
 
65
65
  Due for conventions, remember:
66
66
 
67
67
  * /usr/share/nginx/html is $HOME of user *app-name*
68
- * Systemd will run app using user *app-name*
68
+ * Systemd will run app using user *app-name.target*
69
69
 
70
70
  Sounds good?
71
71
 
72
72
  ## Why you not use Omnibus or Heroku buildpacks?
73
73
 
74
- Because I want to create a tool that can be used as a transition step for building apps.
74
+ Because I want to create a tool able to create Linux packages.
75
75
 
76
76
  ## Why you use fpm-cookery templates instead of fpm?
77
77
 
data/gordon.gemspec CHANGED
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
22
  spec.add_development_dependency "rake"
23
23
  spec.add_development_dependency "debugger"
24
+ spec.add_development_dependency "rspec"
24
25
 
25
26
  spec.add_dependency "bundler"
26
27
  spec.add_dependency "fpm-cookery"
@@ -0,0 +1,42 @@
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 RubyStandaloneApp < FPM::Cookery::Recipe
9
+ extend Gordon::Cookery::DependencyResolver
10
+
11
+ include Gordon::Cookery::Common,
12
+ Gordon::Cookery::Init,
13
+ Gordon::Cookery::ApplicationUser,
14
+ Gordon::Cookery::Standalone,
15
+ Gordon::Cookery::Ruby::Common
16
+
17
+ name $env_vars.app_name
18
+ description $env_vars.app_desc
19
+ version $env_vars.app_version
20
+ homepage $env_vars.app_repo
21
+
22
+ source $env_vars.app_source_dir, with: :local_path
23
+
24
+ depends *resolve_dependencies($env_vars)
25
+
26
+ def build
27
+ home_path = get_skeleton_path_from_type(:misc)
28
+
29
+ create_user_and_group($env_vars, home_path)
30
+ setup_user_permissions($env_vars, home_path)
31
+
32
+ create_init($env_vars, :misc)
33
+
34
+ ruby_vendor_gems
35
+ end
36
+
37
+ def install
38
+ install_init($env_vars)
39
+ install_standalone_files($env_vars, RUBY_BLACKLIST_FILES)
40
+ end
41
+ end
42
+
@@ -16,6 +16,12 @@ module Gordon
16
16
  def get_template ; 'ruby_web_app' ; end
17
17
  end
18
18
 
19
+ class RubyStandaloneApp
20
+ include Base
21
+
22
+ def get_template ; 'ruby_standalone_app' ; end
23
+ end
24
+
19
25
  class JavaWebApp
20
26
  include Base
21
27
 
@@ -1,7 +1,7 @@
1
1
  module Gordon
2
2
  module Cookery
3
3
  module Common
4
- MAIN_BLACKLIST_FILES = %w(.git .gitignore .pki Vagrantfile)
4
+ MAIN_BLACKLIST_FILES = %w(.git .gitignore .pki Vagrantfile cruise-output)
5
5
 
6
6
  def self.included(base)
7
7
  base.send(:extend, self)
@@ -0,0 +1,15 @@
1
+ module Gordon
2
+ module Cookery
3
+ module Standalone
4
+ def install_standalone_files(env_vars, blacklist)
5
+ skeleton_path = get_skeleton_path_from_type(:misc)
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
14
+
15
+
@@ -1,7 +1,7 @@
1
1
  module Gordon
2
2
  class Factory
3
3
  def self.create_instance(namespace, object_type)
4
- fragments = object_type.split('_')
4
+ fragments = object_type.to_s.split('_')
5
5
 
6
6
  type = fragments.map do |fragment|
7
7
  fragment[0].upcase + fragment[1..-1]
@@ -1,3 +1,3 @@
1
1
  module Gordon
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.10"
3
3
  end
data/lib/gordon.rb CHANGED
@@ -16,6 +16,7 @@ module Gordon
16
16
  require 'gordon/cookery/init'
17
17
  require 'gordon/cookery/http_server'
18
18
  require 'gordon/cookery/ruby/common'
19
+ require 'gordon/cookery/standalone'
19
20
  require 'gordon/skeleton/factory'
20
21
  require 'gordon/skeleton/types'
21
22
  end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'RubyStandaloneApp' 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
+
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'RubyWebApp' 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
+
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe Gordon::CLI do
4
+ describe 'running a recipe' do
5
+ pending
6
+ end
7
+
8
+ describe 'getting a option parser' do
9
+ pending
10
+ end
11
+ end
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ describe Gordon::Cooker do
4
+ describe 'cooking a package' do
5
+ it 'cleans fpm-cookery working directory' do
6
+ pending
7
+ end
8
+
9
+ it 'packages calling fpm-cookery' do
10
+ pending
11
+ end
12
+ end
13
+ end
14
+
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe Gordon::Cookery::ApplicationUser do
4
+ describe 'creating user and group' do
5
+ pending
6
+ end
7
+
8
+ describe 'setting user permissions' do
9
+ pending
10
+ end
11
+ end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ describe Gordon::Cookery::Common do
4
+ describe 'getting skeleton path from type' do
5
+ pending
6
+ end
7
+
8
+ describe 'getting all files with blacklist' do
9
+ pending
10
+ end
11
+
12
+ describe 'creating skeleton type' do
13
+ pending
14
+ end
15
+ end
16
+
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ describe Gordon::Cookery::DependencyResolver do
4
+ describe 'resolving dependencies' do
5
+ pending
6
+ end
7
+ end
8
+
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ describe Gordon::Cookery::HttpServer do
4
+ describe 'installing files' do
5
+ pending
6
+ end
7
+ end
8
+
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe Gordon::Cookery::Init do
4
+ describe 'creating init files' do
5
+ pending
6
+ end
7
+
8
+ describe 'installing init files' do
9
+ pending
10
+ end
11
+ end
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ describe Gordon::Cookery::Ruby::Common do
4
+ describe 'vendorizing gems' do
5
+ pending
6
+ end
7
+ end
8
+
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ describe Gordon::Cookery::Standalone do
4
+ describe 'installing files' do
5
+ pending
6
+ end
7
+ end
8
+
@@ -0,0 +1,62 @@
1
+ require 'spec_helper'
2
+
3
+ describe Gordon::EnvVars do
4
+ let(:attributes) do
5
+ {
6
+ app_type: :ruby_web_app,
7
+ app_name: :xirubiru,
8
+ app_desc: "a nice description",
9
+ app_repo: "http://some.github.repo",
10
+ app_version: "2.0.0",
11
+ app_source_dir: ".",
12
+ runtime_version: "2.2.0",
13
+ http_server_type: "nginx",
14
+ init_type: "systemd",
15
+ }
16
+ end
17
+
18
+ let(:options) { double(Gordon::Options, attributes) }
19
+
20
+ describe 'getting from cook options' do
21
+ it 'returns a array of environment variables setted' do
22
+ expected = [
23
+ "GORDON_APP_TYPE='#{options.app_type}'",
24
+ "GORDON_APP_NAME='#{options.app_name}'",
25
+ "GORDON_APP_DESC='#{options.app_desc}'",
26
+ "GORDON_APP_REPO='#{options.app_repo}'",
27
+ "GORDON_APP_VERSION='#{options.app_version}'",
28
+ "GORDON_APP_SOURCE_DIR='#{File.expand_path(options.app_source_dir)}'",
29
+ "GORDON_RUNTIME_VERSION='#{options.runtime_version}'",
30
+ "GORDON_HTTP_SERVER_TYPE='#{options.http_server_type}'",
31
+ "GORDON_INIT_TYPE='#{options.init_type}'",
32
+ ]
33
+
34
+ expect(described_class.from_cook(options)).to eq(expected)
35
+ end
36
+ end
37
+
38
+ describe 'loading from environment' do
39
+ it 'returns a instance with all specified values' do
40
+ env = {
41
+ 'GORDON_APP_TYPE' => options.app_type,
42
+ 'GORDON_APP_NAME' => options.app_name,
43
+ 'GORDON_APP_DESC' => options.app_desc,
44
+ 'GORDON_APP_REPO' => options.app_repo,
45
+ 'GORDON_APP_VERSION' => options.app_version,
46
+ 'GORDON_APP_SOURCE_DIR' => options.app_source_dir,
47
+ 'GORDON_RUNTIME_VERSION' => options.runtime_version,
48
+ 'GORDON_HTTP_SERVER_TYPE' => options.http_server_type,
49
+ 'GORDON_INIT_TYPE' => options.init_type,
50
+ }
51
+
52
+ env.each_pair { |k, v| expect(ENV).to receive(:[]).with(k).and_return(v.to_s) }
53
+
54
+ described_class.load.tap do |env_vars|
55
+ env.each_pair do |k, v|
56
+ expect(env_vars.send(k.gsub(/GORDON_/, '').downcase)).to eq(v.to_s)
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
62
+
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ describe Gordon::Factory do
4
+ describe 'creating a instance of some object' do
5
+ pending
6
+ end
7
+ end
8
+
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ describe Gordon::Options do
4
+ describe 'debugging' do
5
+ pending
6
+ end
7
+ end
8
+
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ describe Gordon::Process do
4
+ describe 'running a command' do
5
+ pending
6
+ end
7
+ end
8
+
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ describe Gordon::Recipe do
4
+ describe 'creating a new instance' do
5
+ pending
6
+ end
7
+
8
+ # TODO: check if is really needed
9
+ describe 'getting a platform' do
10
+ pending
11
+ end
12
+
13
+ # TODO: check if is really needed
14
+ describe 'checking if requires platform' do
15
+ pending
16
+ end
17
+
18
+ describe 'getting application template path' do
19
+ pending
20
+ end
21
+ end
22
+
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe Gordon::Skeleton::Types::Base do
4
+ pending
5
+ end
6
+
7
+ describe Gordon::Skeleton::Types::Nginx do
8
+ pending
9
+ end
10
+
11
+ describe Gordon::Skeleton::Types::Apache do
12
+ pending
13
+ end
14
+
15
+ describe Gordon::Skeleton::Types::Systemd do
16
+ pending
17
+ end
18
+
19
+ describe Gordon::Skeleton::Types::Misc do
20
+ pending
21
+ end
@@ -0,0 +1 @@
1
+ require 'gordon'
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.8
4
+ version: 0.0.10
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-01-23 00:00:00.000000000 Z
11
+ date: 2015-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: bundler
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -104,6 +118,7 @@ extensions: []
104
118
  extra_rdoc_files: []
105
119
  files:
106
120
  - .gitignore
121
+ - .rspec
107
122
  - Gemfile
108
123
  - LICENSE.txt
109
124
  - README.md
@@ -112,6 +127,7 @@ files:
112
127
  - gordon.gemspec
113
128
  - lib/gordon.rb
114
129
  - lib/gordon/application/factory.rb
130
+ - lib/gordon/application/templates/ruby_standalone_app.rb
115
131
  - lib/gordon/application/templates/ruby_web_app.rb
116
132
  - lib/gordon/application/types.rb
117
133
  - lib/gordon/cli.rb
@@ -122,6 +138,7 @@ files:
122
138
  - lib/gordon/cookery/http_server.rb
123
139
  - lib/gordon/cookery/init.rb
124
140
  - lib/gordon/cookery/ruby/common.rb
141
+ - lib/gordon/cookery/standalone.rb
125
142
  - lib/gordon/env_vars.rb
126
143
  - lib/gordon/factory.rb
127
144
  - lib/gordon/options.rb
@@ -130,6 +147,24 @@ files:
130
147
  - lib/gordon/skeleton/factory.rb
131
148
  - lib/gordon/skeleton/types.rb
132
149
  - lib/gordon/version.rb
150
+ - spec/gordon/application/templates/ruby_standalone_app_spec.rb
151
+ - spec/gordon/application/templates/ruby_web_app_spec.rb
152
+ - spec/gordon/cli_spec.rb
153
+ - spec/gordon/cooker_spec.rb
154
+ - spec/gordon/cookery/application_user_spec.rb
155
+ - spec/gordon/cookery/common_spec.rb
156
+ - spec/gordon/cookery/dependency_resolver_spec.rb
157
+ - spec/gordon/cookery/http_server_spec.rb
158
+ - spec/gordon/cookery/init_spec.rb
159
+ - spec/gordon/cookery/ruby/common_spec.rb
160
+ - spec/gordon/cookery/standalone_spec.rb
161
+ - spec/gordon/env_vars_spec.rb
162
+ - spec/gordon/factory_spec.rb
163
+ - spec/gordon/options_spec.rb
164
+ - spec/gordon/process_spec.rb
165
+ - spec/gordon/recipe_spec.rb
166
+ - spec/gordon/skeleton/types_spec.rb
167
+ - spec/spec_helper.rb
133
168
  homepage: https://github.com/salizzar/gordon
134
169
  licenses:
135
170
  - MIT
@@ -154,4 +189,22 @@ rubygems_version: 2.0.14
154
189
  signing_key:
155
190
  specification_version: 4
156
191
  summary: A tool to create application OS packages
157
- test_files: []
192
+ test_files:
193
+ - spec/gordon/application/templates/ruby_standalone_app_spec.rb
194
+ - spec/gordon/application/templates/ruby_web_app_spec.rb
195
+ - spec/gordon/cli_spec.rb
196
+ - spec/gordon/cooker_spec.rb
197
+ - spec/gordon/cookery/application_user_spec.rb
198
+ - spec/gordon/cookery/common_spec.rb
199
+ - spec/gordon/cookery/dependency_resolver_spec.rb
200
+ - spec/gordon/cookery/http_server_spec.rb
201
+ - spec/gordon/cookery/init_spec.rb
202
+ - spec/gordon/cookery/ruby/common_spec.rb
203
+ - spec/gordon/cookery/standalone_spec.rb
204
+ - spec/gordon/env_vars_spec.rb
205
+ - spec/gordon/factory_spec.rb
206
+ - spec/gordon/options_spec.rb
207
+ - spec/gordon/process_spec.rb
208
+ - spec/gordon/recipe_spec.rb
209
+ - spec/gordon/skeleton/types_spec.rb
210
+ - spec/spec_helper.rb