gordon 0.0.20 → 0.0.21
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 +14 -13
- data/lib/gordon/application/templates/ruby_standalone_app.rb +6 -0
- data/lib/gordon/application/templates/ruby_web_app.rb +6 -0
- data/lib/gordon/cookery/log.rb +12 -0
- data/lib/gordon/version.rb +1 -1
- data/lib/gordon.rb +1 -0
- data/spec/gordon/cookery/log_spec.rb +24 -0
- metadata +4 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 92355b0ef213be4b1cf55eceeea64e67c32e13f3
         | 
| 4 | 
            +
              data.tar.gz: 8f4257916fc921dd70dc09168684965551d7d923
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 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          | 
| 64 | 
            -
                  --app- | 
| 65 | 
            -
                  --app- | 
| 66 | 
            -
                  --app-version       | 
| 67 | 
            -
                  --app-source       . | 
| 68 | 
            -
                  --runtime-name     ruby | 
| 69 | 
            -
                  --runtime-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  | 
| 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
         | 
    
        data/lib/gordon/version.rb
    CHANGED
    
    
    
        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. | 
| 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
         |