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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9a5dfec4762cf237d2d3326a9aeae5d47910e908
4
- data.tar.gz: 9c1e37b8bf4c009da199f114d6ee38a1d1b5fd63
3
+ metadata.gz: ff409e0fdfc205d823e99c55b8c5351383e0ca59
4
+ data.tar.gz: e09c6ba5c02d05a52e3b2b28cacd65ba54ca78a7
5
5
  SHA512:
6
- metadata.gz: 8f38b0361a488b72dad0b7d7dcdcfdfc4c75f1aa17dcc126f19dd21d04a4a41b36bfaeb8b739196f313b88d36af4d929d5e26b05c1dc342f0089d517ffc89ffa
7
- data.tar.gz: 80272cb9dd97e40d199fd36974a75560e90a9f4b02aacb71d9bd7b945803f922e1a64b8a10dd7b114d8546c473a64359d86ed9dca4df028faae009c729390680
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
 
@@ -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
- instance_variable_set "@#{key.to_s}".to_sym, value
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 create_angular_app
33
- directory 'angular', @app_path
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
@@ -1,3 +1,3 @@
1
1
  module Singu
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
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.1.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
@@ -1 +0,0 @@
1
- web: bundle exec rails s
@@ -1 +0,0 @@
1
- require "bundler/gem_tasks"
@@ -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
@@ -1,13 +0,0 @@
1
- namespace :db do
2
- desc 'Run DB migrations'
3
- task :migrate => :app do
4
- end
5
-
6
- desc 'Rollback migration'
7
- task :rollback => :app do
8
- end
9
-
10
- desc 'Dump the database schema'
11
- task :dump => :app do
12
- end
13
- end
@@ -1,6 +0,0 @@
1
- module <%= @name.camel_case %>
2
- module Models
3
- # Example:
4
- # autoload :Post, 'app/models/post'
5
- end
6
- end
File without changes
@@ -1,8 +0,0 @@
1
- module <%= @name.camel_case %>
2
- module Routes
3
- autoload :Base, 'app/routes/base'
4
-
5
- # Example route loading:
6
- # autoload :Posts, 'app/routes/posts'
7
- end
8
- end
@@ -1,9 +0,0 @@
1
- module <%= @name.camel_case %>
2
- module Routes
3
- class Base < Sinatra::Application
4
- configure do
5
- set :root, App.root
6
- end
7
- end
8
- end
9
- end
@@ -1,3 +0,0 @@
1
- require './app'
2
-
3
- run <%= @name.camel_case %>::App
File without changes