sinatra-cmd 0.1.0 → 0.1.1

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: ea81795ea492ba2d56ddff90e6ec4b129a9c3ab4
4
- data.tar.gz: 58a14ebbf864548ace2759c1fc842901e6dbdfeb
3
+ metadata.gz: d647af50011bda3073f6674c6e30888cd0349ef4
4
+ data.tar.gz: c54a1c1b97993062e5dd9079abffd40629bcbdde
5
5
  SHA512:
6
- metadata.gz: 35ad2c65af27fbd9b33f27a9c5d7a1144a00358e53051b0063ff812231f8a5b8238b4be892c349ff7c086aa79d9af38d812f23b284828444846d44735719f53a
7
- data.tar.gz: 6026113055d9d28d655616fa414305dbcb8e7b5acacf2b20fef77731ad72713948798b886002a923cd7a2ba98083ff79fe3e3d2dd39d91133e51a5397cb8ba3b
6
+ metadata.gz: b522839aea1de75e2cfc2b41e700a27df5de0169e30573f2660394c593c6adbdfe56688b390c11ee4995719c4f713f866bcca48e709a0263e934ddb2e0d6de46
7
+ data.tar.gz: 4e8caeda62b75c82b58b0f5e5f59440386116db6056b9f60d76b05e0d5b72b72bb36b7a3a6c908604622b911d7624d822ac8f9364993b470d64c8cb79a73512c
data/.gitignore CHANGED
@@ -10,3 +10,4 @@
10
10
 
11
11
  /.DS_Store
12
12
  /*.gem
13
+ /test-project
data/README.md CHANGED
@@ -2,11 +2,7 @@
2
2
 
3
3
  ## Installation
4
4
 
5
- Add this line to your application's Gemfile:
6
-
7
- ```ruby
8
- gem 'sinatra-cmd'
9
- ```
5
+ Add `gem 'sinatra-cmd'` to your application's Gemfile:
10
6
 
11
7
  And then execute:
12
8
 
@@ -26,6 +22,11 @@ Or install it yourself as:
26
22
 
27
23
  sinatra {app_name}
28
24
  ```
25
+ > Supported options:
26
+
27
+ 1. --skip_bundle_install
28
+ 2. continue...
29
+
29
30
 
30
31
  ##How to use pry (option, latest version is unnecessary)
31
32
 
@@ -5,6 +5,7 @@ module SinatraCmd
5
5
  include Thor::Actions
6
6
 
7
7
  argument :app_name
8
+ class_option :skip_bundle_install, :type => :boolean
8
9
 
9
10
  def self.source_root
10
11
  File.join(File.dirname(__FILE__), "../../", "templates")
@@ -15,7 +16,7 @@ module SinatraCmd
15
16
  end
16
17
 
17
18
  def setup_helpers
18
- keep_file "#{app_name}/helpers"
19
+ empty_directory "#{app_name}/helpers"
19
20
  template "helpers/application.rb.erb", "#{app_name}/helpers/application.rb"
20
21
  template "helpers/error_handling.rb.erb", "#{app_name}/helpers/error_handling.rb"
21
22
  end
@@ -25,7 +26,7 @@ module SinatraCmd
25
26
  end
26
27
 
27
28
  def setup_routes
28
- keep_file "#{app_name}/routes"
29
+ empty_directory "#{app_name}/routes"
29
30
  template "routes/demo.rb.erb", "#{app_name}/routes/demo.rb"
30
31
  end
31
32
 
@@ -40,6 +41,12 @@ module SinatraCmd
40
41
  copy_file "config/i18n/zh-cn.yml", "#{app_name}/config/i18n/zh-cn.yml"
41
42
  end
42
43
 
44
+ def setup_rspec
45
+ empty_directory "#{app_name}/spec"
46
+ copy_file ".rspec", "#{app_name}/.rspec"
47
+ copy_file "spec/spec_helper.rb", "#{app_name}/spec/spec_helper.rb"
48
+ end
49
+
43
50
  def setup_appfile
44
51
  copy_file ".gitignore", "#{app_name}/.gitignore"
45
52
  copy_file "Gemfile", "#{app_name}/Gemfile"
@@ -48,20 +55,16 @@ module SinatraCmd
48
55
  template "README.md.erb", "#{app_name}/README.md"
49
56
  end
50
57
 
51
- def setup_rspec
52
- keep_file "#{app_name}/spec"
53
- copy_file ".rspec", "#{app_name}/.rspec"
54
- copy_file "spec/spec_helper.rb", "#{app_name}/spec/spec_helper.rb"
55
- end
56
-
57
58
  def bundle_install
58
- system "cd #{app_name} && bundle install && cd ../"
59
+ unless options[:skip_bundle_install]
60
+ system "cd #{app_name} && bundle install && cd ../"
61
+ end
59
62
  end
60
63
 
61
64
  protected
62
65
 
63
66
  def keep_file(destination)
64
- create_file "#{destination}/.keep"
67
+ create_file "#{destination}/.gtkeep"
65
68
  end
66
69
  end
67
70
  end
@@ -1,3 +1,3 @@
1
1
  module SinatraCmd
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
 
12
12
  spec.summary = %q{Command for generating sinatra project}
13
13
  spec.description = %q{Generate a sinatra project.}
14
- spec.homepage = "https://github.com/hilotus/sinatra-cli"
14
+ spec.homepage = "https://github.com/hilotus/sinatra-cmd"
15
15
  spec.license = "MIT"
16
16
 
17
17
  spec.files = `git ls-files -z`.split("\x0")
@@ -1,6 +1,6 @@
1
1
  describe SinatraCmd do
2
2
  it "Generator sinatra" do
3
3
  bin_path = File.join(File.expand_path('../../bin', __FILE__))
4
- system("#{bin_path}/sinatra test-project")
4
+ system("#{bin_path}/sinatra test-project --skip_bundle_install")
5
5
  end
6
6
  end
@@ -10,6 +10,7 @@ require 'sinatra/json'
10
10
  require 'sinatra/custom_logger'
11
11
 
12
12
  require 'fileutils'
13
+ require 'logger'
13
14
 
14
15
  module <%= app_name.split(/\-|\_/).map(&:capitalize).join('') %>
15
16
  API_VERSION = '1'
@@ -68,11 +69,14 @@ module <%= app_name.split(/\-|\_/).map(&:capitalize).join('') %>
68
69
  R18n::I18n.default = 'en-us'
69
70
  end
70
71
 
71
- # Important
72
+ ##### Important
72
73
  before do
73
74
  # We have to set default locale into session,
74
75
  # because of the sinatra-r18n source code doesn't check R18n::I18n.default
75
76
  session[:locale] = R18n::I18n.default
77
+
78
+ # TODO: In sinatra-r18n-2.0.4, if params[:locale] will return true....
79
+ params[:locale] = nil if params[:locale] == ""
76
80
  end
77
81
 
78
82
  configure :development, :production do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-cmd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - wluo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-23 00:00:00.000000000 Z
11
+ date: 2015-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -146,7 +146,7 @@ files:
146
146
  - templates/helpers/error_handling.rb.erb
147
147
  - templates/routes/demo.rb.erb
148
148
  - templates/spec/spec_helper.rb
149
- homepage: https://github.com/hilotus/sinatra-cli
149
+ homepage: https://github.com/hilotus/sinatra-cmd
150
150
  licenses:
151
151
  - MIT
152
152
  metadata: {}