sinatra-cmd 0.0.11 → 0.0.12

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: 652d5717aa4178b5698b1c616c49e41d8bac2173
4
- data.tar.gz: a6ba25cf24fed7e3ad25be08722c0afed4bcd538
3
+ metadata.gz: 860b59723bc6fce5d5556ed3976f95df281af964
4
+ data.tar.gz: b8279af5abd2aafe17c5b7671d1a17bea0f78635
5
5
  SHA512:
6
- metadata.gz: b11fd3b02089da84227bab3ad80d8948e17c3b26dc3959f561b5da02cc068a09fedb675d46ca993719eb9434cc23fc66fdd715c1db5ac47a73a6cb3905eeb278
7
- data.tar.gz: 0cd82ba6214d195720513568272e3e0516b54f8dde5d7549079c2cf6fedae9416e538cc8837085e03a8bf745381034c63be8fe105d711ffba4f1216c1582f9d0
6
+ metadata.gz: df8b384b25f49cade5699da4abb9432fd62d8c10ec7f6f2d2f5d3c8e2a83a47bd26347fdece865e8593d7d6af1d7560f035614959d9ae50563056ae2da2ea151
7
+ data.tar.gz: 178fa0785054c9f559cc2d7c08d4284c461f8a1a8ec651cc4453220b018a2fee07f456dd79b5c678bd5a927f921385d0a63c85c6a446e3ffed3d8a2c98f15fdb
@@ -30,11 +30,9 @@ module SinatraCmd
30
30
  end
31
31
 
32
32
  def setup_config
33
- template "config/database.yml.erb", "#{app_name}/config/database.yml"
34
33
  template "config/application.rb.erb", "#{app_name}/config/application.rb"
35
34
  template "config/boot.rb.erb", "#{app_name}/config/boot.rb"
36
35
  copy_file "config/environment.rb", "#{app_name}/config/environment.rb"
37
- copy_file "config/scheduler.rb", "#{app_name}/config/scheduler.rb"
38
36
 
39
37
  # i18n
40
38
  copy_file "config/i18n/en-us.yml", "#{app_name}/config/i18n/en-us.yml"
@@ -1,3 +1,3 @@
1
1
  module SinatraCmd
2
- VERSION = '0.0.11'
2
+ VERSION = '0.0.12'
3
3
  end
data/templates/Gemfile CHANGED
@@ -4,9 +4,6 @@ gem 'sinatra', '~> 1.4.6'
4
4
  gem 'sinatra-contrib', '~> 1.4.2', require: false
5
5
  gem 'sinatra-r18n', '~> 2.0.3'
6
6
 
7
- gem 'mongoid', '~> 4.0.1'
8
- gem 'rufus-scheduler', '~> 3.0.9'
9
-
10
7
  group :test, :development do
11
8
  gem 'pry', '~> 0.10.1'
12
9
  gem 'pry-stack_explorer', '~> 0.4.9.2'
@@ -6,8 +6,6 @@ require File.expand_path('../boot', __FILE__)
6
6
  Dir[File.expand_path("../../#{folder}/**/*.rb", __FILE__)].each {|file| require file}
7
7
  end
8
8
 
9
- require File.expand_path('../scheduler', __FILE__)
10
-
11
9
  module <%= app_name.capitalize %>
12
10
  class App
13
11
  # custome register
@@ -8,14 +8,8 @@ require 'sinatra/reloader' if development?
8
8
  require 'sinatra/namespace'
9
9
  require 'sinatra/json'
10
10
 
11
- # sinatra and rake namespace global method conflict.
12
- module Sinatra::Namespace::SharedMethods
13
- alias :sinatra_namespace :namespace
14
- remove_method :namespace
15
- end
16
-
17
11
  module <%= app_name.capitalize %>
18
- API_V1 = '/1'
12
+ API_VERSION = '1'
19
13
 
20
14
  class App < Sinatra::Base
21
15
  register Sinatra::Namespace
@@ -23,9 +17,11 @@ module <%= app_name.capitalize %>
23
17
  # language automatic changed by params['locale']
24
18
  register Sinatra::R18n
25
19
 
20
+ set :logging, true
21
+
26
22
  configure do
27
23
  # Mongoid config file load
28
- Mongoid.load!(File.expand_path('../database.yml', __FILE__))
24
+ # Mongoid.load!(File.expand_path('../database.yml', __FILE__))
29
25
 
30
26
  # Error blocks don't trigger in development mode.
31
27
  # https://github.com/sinatra/sinatra/issues/578
@@ -1,8 +1,8 @@
1
1
  error_handling:
2
- bad_request: "Bad request"
3
- authorization_required: "Authorization required"
4
- forbidden: "Forbidden"
5
- not_found: "Not found"
6
- internal_server_error: "Internal server error"
2
+ bad_request: "错误请求"
3
+ authorization_required: "需要进行验证"
4
+ forbidden: "被禁止"
5
+ not_found: "未找到"
6
+ internal_server_error: "服务器内部错误"
7
7
  multi_json:
8
- decode: "Problems parsing JSON"
8
+ decode: "解析JSON出错"
@@ -2,7 +2,7 @@
2
2
 
3
3
  module <%= app_name.capitalize %>
4
4
  class App
5
- sinatra_namespace <%= app_name.capitalize %>::API_V1 do
5
+ namespace "/#{<%= app_name.capitalize %>::API_VERSION}" do
6
6
  get '/demo' do
7
7
  unless params[:error].nil?
8
8
  raise 'There are some errors.'
@@ -26,4 +26,4 @@ RSpec.configure do |config|
26
26
 
27
27
  # this should give us Rack test methods
28
28
  config.include Rack::Test::Methods
29
- end
29
+ end
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.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - CBluowei
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-19 00:00:00.000000000 Z
11
+ date: 2015-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -79,11 +79,9 @@ files:
79
79
  - templates/config.ru.erb
80
80
  - templates/config/application.rb.erb
81
81
  - templates/config/boot.rb.erb
82
- - templates/config/database.yml.erb
83
82
  - templates/config/environment.rb
84
83
  - templates/config/i18n/en-us.yml
85
84
  - templates/config/i18n/zh-cn.yml
86
- - templates/config/scheduler.rb
87
85
  - templates/helpers/application.rb.erb
88
86
  - templates/helpers/error_handling.rb.erb
89
87
  - templates/routes/demo.rb.erb
@@ -108,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
106
  version: '0'
109
107
  requirements: []
110
108
  rubyforge_project:
111
- rubygems_version: 2.2.2
109
+ rubygems_version: 2.4.8
112
110
  signing_key:
113
111
  specification_version: 4
114
112
  summary: Command for generating sinatra project
@@ -1,84 +0,0 @@
1
- development:
2
- # Configure available database sessions. (required)
3
- sessions:
4
- # Defines the default session. (required)
5
- default:
6
- # Defines the name of the default database that Mongoid can connect to.
7
- # (required).
8
- database: <%= app_name %>_dev
9
- # Provides the hosts the default session can connect to. Must be an array
10
- # of host:port pairs. (required)
11
- hosts:
12
- - localhost:27017
13
- options:
14
-
15
- # Change whether the session persists in safe mode by default.
16
- # (default: false)
17
- # safe: false
18
-
19
- # Change the default consistency model to :eventual or :strong.
20
- # :eventual will send reads to secondaries, :strong sends everything
21
- # to master. (default: :eventual)
22
- # consistency: :eventual
23
-
24
- # How many times Moped should attempt to retry an operation after
25
- # failure. (default: 30)
26
- # max_retries: 30
27
-
28
- # The time in seconds that Moped should wait before retrying an
29
- # operation on failure. (default: 1)
30
- # retry_interval: 1
31
- # Configure Mongoid specific options. (optional)
32
- options:
33
- raise_not_found_error: false
34
- # Configuration for whether or not to allow access to fields that do
35
- # not have a field definition on the model. (default: true)
36
- # allow_dynamic_fields: true
37
-
38
- # Enable the identity map, needed for eager loading. (default: false)
39
- # identity_map_enabled: false
40
-
41
- # Includes the root model name in json serialization. (default: false)
42
- # include_root_in_json: false
43
-
44
- # Include the _type field in serializaion. (default: false)
45
- # include_type_for_serialization: false
46
-
47
- # Preload all models in development, needed when models use
48
- # inheritance. (default: false)
49
- # preload_models: false
50
-
51
- # Protect id and type from mass assignment. (default: true)
52
- # protect_sensitive_fields: true
53
-
54
- # Raise an error when performing a #find and the document is not found.
55
- # (default: true)
56
- # raise_not_found_error: true
57
-
58
- # Raise an error when defining a scope with the same name as an
59
- # existing method. (default: false)
60
- # scope_overwrite_exception: false
61
-
62
- # Skip the database version check, used when connecting to a db without
63
- # admin access. (default: false)
64
- # skip_version_check: false
65
-
66
- # User Active Support's time zone in conversions. (default: true)
67
- # use_activesupport_time_zone: true
68
-
69
- # Ensure all times are UTC in the app side. (default: false)
70
- # use_utc: false
71
- test:
72
- sessions:
73
- default:
74
- database: <%= app_name %>_test
75
- hosts:
76
- - localhost:27017
77
- options:
78
- consistency: :strong
79
- # In the test environment we lower the retries and retry interval to
80
- # low amounts for fast failures.
81
- max_retries: 1
82
- retry_interval: 0
83
- options:
84
- raise_not_found_error: false
@@ -1,6 +0,0 @@
1
- # scheduler = Rufus::Scheduler.new
2
-
3
- # scheduler.cron '* * * * *' do
4
- # puts ApiInfo.last
5
- # puts Error.last
6
- # end