singu 0.1.0 → 0.2.0
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 +9 -1
- data/lib/singu/cli.rb +21 -9
- data/lib/singu/version.rb +1 -1
- metadata +1 -16
- data/templates/angular/client/Gruntfile.js +0 -0
- data/templates/angular/client/app/index.html +0 -0
- data/templates/angular/client/package.json +0 -0
- data/templates/sinatra/.gitignore +0 -0
- data/templates/sinatra/Gemfile.tt +0 -17
- data/templates/sinatra/Procfile +0 -1
- data/templates/sinatra/Rakefile +0 -1
- data/templates/sinatra/app.rb.tt +0 -28
- data/templates/sinatra/app/lib/db.rb.tt +0 -13
- data/templates/sinatra/app/models.rb.tt +0 -6
- data/templates/sinatra/app/models/.gitkeep +0 -0
- data/templates/sinatra/app/routes.rb.tt +0 -8
- data/templates/sinatra/app/routes/base.rb.tt +0 -9
- data/templates/sinatra/config.ru.tt +0 -3
- data/templates/sinatra/public/favicon.ico +0 -0
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: ff409e0fdfc205d823e99c55b8c5351383e0ca59
         | 
| 4 | 
            +
              data.tar.gz: e09c6ba5c02d05a52e3b2b28cacd65ba54ca78a7
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: bb0d0d8f58ac8682da6b4f4dfc330b9bca84d6e8a500294f76f1f15fbfe983b0371ac8094dd3068769b93e8b24f0103a502a7c796a4afb03d3c81620bed73cb2
         | 
| 7 | 
            +
              data.tar.gz: 1ac87d6c4b05a57680356ebd12046f7bf0fa3464013eeb1da52b3c0870166a42de4a26dfc631a9ccd9161b9426d9004bc69ee951ea5f009b2ea309c81c60f399
         | 
    
        data/README.md
    CHANGED
    
    | @@ -30,10 +30,18 @@ open http://0.0.0.0:9292 | |
| 30 30 | 
             
            ```
         | 
| 31 31 |  | 
| 32 32 | 
             
            ## Possible options
         | 
| 33 | 
            +
            * --gems [array] => add following gems to Gemfile and install them
         | 
| 33 34 | 
             
            ```
         | 
| 34 | 
            -
            # --gems [array] => add following gems to Gemfile and install them
         | 
| 35 35 | 
             
            singu [your_app_name] --gems haml pry
         | 
| 36 36 | 
             
            ```
         | 
| 37 | 
            +
            * --skip-angular [boolean] => don't append client dir with base angular app
         | 
| 38 | 
            +
            ```
         | 
| 39 | 
            +
            singu [your_app_name] --skip-angular=true
         | 
| 40 | 
            +
            ```
         | 
| 41 | 
            +
            * --template [hash] => install sinatra and angular apps from external github repos
         | 
| 42 | 
            +
            ```
         | 
| 43 | 
            +
            singu [your_app_name] --template sinatra:regedarek.singu-custom-sinatra-app angular:regedarek/singu-custom-angular-app
         | 
| 44 | 
            +
            ```
         | 
| 37 45 |  | 
| 38 46 | 
             
            ## Application Structure
         | 
| 39 47 |  | 
    
        data/lib/singu/cli.rb
    CHANGED
    
    | @@ -8,6 +8,9 @@ module Singu | |
| 8 8 | 
             
              class CLI < Thor::Group
         | 
| 9 9 | 
             
                include Thor::Actions
         | 
| 10 10 |  | 
| 11 | 
            +
                DEFAULT_SINATRA_TEMPLATE_REPO = 'regedarek/singu-sinatra-template'
         | 
| 12 | 
            +
                DEFAULT_ANGULAR_TEMPLATE_REPO = 'regedarek/singu-angular-template'
         | 
| 13 | 
            +
             | 
| 11 14 | 
             
                def self.source_root
         | 
| 12 15 | 
             
                  File.expand_path('../../../templates', __FILE__)
         | 
| 13 16 | 
             
                end
         | 
| @@ -15,22 +18,23 @@ module Singu | |
| 15 18 | 
             
                desc "Creates a new Sinatra + Angular.js application"
         | 
| 16 19 | 
             
                argument :name, type: :string, desc: "The name of the new application"
         | 
| 17 20 | 
             
                class_option :gems, type: :array, description: "The names of gems you want to add to the new application"
         | 
| 21 | 
            +
                class_option :template, type: :hash, description: "The github repo ex: regedarek/skeleton", enum: 2
         | 
| 22 | 
            +
                class_option :'skip-angular', :type => :boolean
         | 
| 18 23 |  | 
| 19 24 | 
             
                def setup
         | 
| 20 25 | 
             
                  @app_path = name.directory_name
         | 
| 21 26 | 
             
                  @name     = name.file_name
         | 
| 22 27 |  | 
| 23 | 
            -
                  options.each do |key, value|
         | 
| 24 | 
            -
             | 
| 25 | 
            -
                  end
         | 
| 26 | 
            -
                end
         | 
| 27 | 
            -
             | 
| 28 | 
            -
                def create_sinatra_app
         | 
| 29 | 
            -
                  directory 'sinatra', @app_path
         | 
| 28 | 
            +
                  # options.each do |key, value|
         | 
| 29 | 
            +
                  #   instance_variable_set "@#{key.to_s}".to_sym, value
         | 
| 30 | 
            +
                  # end
         | 
| 30 31 | 
             
                end
         | 
| 31 32 |  | 
| 32 | 
            -
                def  | 
| 33 | 
            -
                   | 
| 33 | 
            +
                def create_app_from_template
         | 
| 34 | 
            +
                  sinatra_repo = options[:template].fetch('sinatra', DEFAULT_SINATRA_TEMPLATE_REPO)
         | 
| 35 | 
            +
                  angular_repo = options[:template].fetch('angular', DEFAULT_ANGULAR_TEMPLATE_REPO)
         | 
| 36 | 
            +
                  clone_repo(sinatra_repo)
         | 
| 37 | 
            +
                  clone_repo(angular_repo) unless options[:'skip-angular']
         | 
| 34 38 | 
             
                end
         | 
| 35 39 |  | 
| 36 40 | 
             
                def initialize_git_repo
         | 
| @@ -44,5 +48,13 @@ module Singu | |
| 44 48 | 
             
                    run('bundle')
         | 
| 45 49 | 
             
                  end
         | 
| 46 50 | 
             
                end
         | 
| 51 | 
            +
             | 
| 52 | 
            +
                private
         | 
| 53 | 
            +
             | 
| 54 | 
            +
                def clone_repo(repo)
         | 
| 55 | 
            +
                  repo_name = repo.split('/').last
         | 
| 56 | 
            +
                  system "git clone -q --depth 1 git@github.com:#{repo}.git templates/#{repo_name}"
         | 
| 57 | 
            +
                  directory repo_name, @app_path
         | 
| 58 | 
            +
                end
         | 
| 47 59 | 
             
              end
         | 
| 48 60 | 
             
            end
         | 
    
        data/lib/singu/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: singu
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.2.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Darek Finster
         | 
| @@ -240,21 +240,6 @@ files: | |
| 240 240 | 
             
            - singu.gemspec
         | 
| 241 241 | 
             
            - spec/singu_spec.rb
         | 
| 242 242 | 
             
            - spec/spec_helper.rb
         | 
| 243 | 
            -
            - templates/angular/client/Gruntfile.js
         | 
| 244 | 
            -
            - templates/angular/client/app/index.html
         | 
| 245 | 
            -
            - templates/angular/client/package.json
         | 
| 246 | 
            -
            - templates/sinatra/.gitignore
         | 
| 247 | 
            -
            - templates/sinatra/Gemfile.tt
         | 
| 248 | 
            -
            - templates/sinatra/Procfile
         | 
| 249 | 
            -
            - templates/sinatra/Rakefile
         | 
| 250 | 
            -
            - templates/sinatra/app.rb.tt
         | 
| 251 | 
            -
            - templates/sinatra/app/lib/db.rb.tt
         | 
| 252 | 
            -
            - templates/sinatra/app/models.rb.tt
         | 
| 253 | 
            -
            - templates/sinatra/app/models/.gitkeep
         | 
| 254 | 
            -
            - templates/sinatra/app/routes.rb.tt
         | 
| 255 | 
            -
            - templates/sinatra/app/routes/base.rb.tt
         | 
| 256 | 
            -
            - templates/sinatra/config.ru.tt
         | 
| 257 | 
            -
            - templates/sinatra/public/favicon.ico
         | 
| 258 243 | 
             
            homepage: http://github.com/regedarek/singu
         | 
| 259 244 | 
             
            licenses:
         | 
| 260 245 | 
             
            - MIT
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| @@ -1,17 +0,0 @@ | |
| 1 | 
            -
            source 'https://rubygems.org'
         | 
| 2 | 
            -
            ruby '2.1.2'
         | 
| 3 | 
            -
             | 
| 4 | 
            -
            gem 'sinatra', require: 'sinatra/base'
         | 
| 5 | 
            -
            gem 'dotenv' # environment variables
         | 
| 6 | 
            -
            gem 'rake', '~> 10.3'
         | 
| 7 | 
            -
             | 
| 8 | 
            -
            # DB
         | 
| 9 | 
            -
            gem 'sqlite3'
         | 
| 10 | 
            -
            <% if !!@gems %>
         | 
| 11 | 
            -
            # Custom gems, please set versions
         | 
| 12 | 
            -
            <%= @gems.collect{|gem| "gem '#{gem}'"}.compact.join("\n") %>
         | 
| 13 | 
            -
            <% end %>
         | 
| 14 | 
            -
            group :development do
         | 
| 15 | 
            -
              gem 'thin'   #server
         | 
| 16 | 
            -
              gem 'byebug' #debugging
         | 
| 17 | 
            -
            end
         | 
    
        data/templates/sinatra/Procfile
    DELETED
    
    | @@ -1 +0,0 @@ | |
| 1 | 
            -
            web: bundle exec rails s
         | 
    
        data/templates/sinatra/Rakefile
    DELETED
    
    | @@ -1 +0,0 @@ | |
| 1 | 
            -
            require "bundler/gem_tasks"
         | 
    
        data/templates/sinatra/app.rb.tt
    DELETED
    
    | @@ -1,28 +0,0 @@ | |
| 1 | 
            -
            require 'rubygems'
         | 
| 2 | 
            -
            require 'bundler'
         | 
| 3 | 
            -
             | 
| 4 | 
            -
            # Setup load paths
         | 
| 5 | 
            -
            Bundler.require
         | 
| 6 | 
            -
            $: << File.expand_path('../', __FILE__)
         | 
| 7 | 
            -
            $: << File.expand_path('../lib', __FILE__)
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            require 'dotenv'
         | 
| 10 | 
            -
            Dotenv.load
         | 
| 11 | 
            -
             | 
| 12 | 
            -
            # Require base
         | 
| 13 | 
            -
            require 'sinatra/base'
         | 
| 14 | 
            -
             | 
| 15 | 
            -
            libraries = Dir[File.expand_path('../lib/**/*.rb', __FILE__)]
         | 
| 16 | 
            -
            libraries.each do |path_name|
         | 
| 17 | 
            -
              require path_name
         | 
| 18 | 
            -
            end
         | 
| 19 | 
            -
             | 
| 20 | 
            -
            require 'app/models'
         | 
| 21 | 
            -
            require 'app/routes'
         | 
| 22 | 
            -
             | 
| 23 | 
            -
            module <%= @name.camel_case %>
         | 
| 24 | 
            -
              class App < Sinatra::Application
         | 
| 25 | 
            -
              end
         | 
| 26 | 
            -
            end
         | 
| 27 | 
            -
             | 
| 28 | 
            -
            include <%= @name.camel_case %>::Models
         | 
| 
            File without changes
         | 
| 
            File without changes
         |