sinatra-cmd 0.0.4 → 0.0.5

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: c99f71fdc8ec9de1d7cf494c2496a2fbb64c59d0
4
- data.tar.gz: c191c2f433b082c4d28a5a23386c59366c5300b3
3
+ metadata.gz: d301b238470b4cbae35482251bb45fa39784c7d2
4
+ data.tar.gz: f8bdcc3d886decb2ada679feaf8450bfd84b958c
5
5
  SHA512:
6
- metadata.gz: 7e1c732439da6cb151f4f0fc5573bd2b9d62d792fcff127c773b907281ae0a8f116c641834de07f6489530b980c9fe3c8f11d151af47b146a256f14651b55499
7
- data.tar.gz: bca6c0e0f901aebbd31ef41ab67edd902e95d2e5b0b397f794549666e07402f9ae58e90e222a20524b2b988039d22878bbc821dce851b573bf8fe384e40fe290
6
+ metadata.gz: f64d990d1ae18a4852645e81f44ead592ed133e10d753f906ffb0c60ce5b3ddf5f12d4946899d283fe90e2700349667469d22dd94d96dc3c7099c19b17d21100
7
+ data.tar.gz: ca0bd0ee5099b142f7242a1bfc0349df0e08f96b6c71aee016d5ef3ff41cd052219257c8f63c489de74d6f233b615b7fae01beff2fb45c2fd3aa5828baa56b40
data/README.md CHANGED
@@ -1,9 +1,5 @@
1
1
  # Sinatra::Cmd
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/sinatra/cmd`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
6
-
7
3
  ## Installation
8
4
 
9
5
  Add this line to your application's Gemfile:
@@ -22,13 +18,22 @@ Or install it yourself as:
22
18
 
23
19
  ## Usage
24
20
 
25
- Default db is mongoid.
21
+ sinatra app_name
26
22
 
27
- ## Development
23
+ ##How to use pry
28
24
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
25
+ create .pryrc file in `/Users/username` folder.
30
26
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
27
+ ```shell
28
+ #!/usr/bin/ruby
29
+
30
+ if defined?(PryByebug)
31
+ Pry.commands.alias_command 'c', 'continue'
32
+ Pry.commands.alias_command 's', 'step'
33
+ Pry.commands.alias_command 'n', 'next'
34
+ Pry.commands.alias_command 'f', 'finish'
35
+ end
36
+ ```
32
37
 
33
38
  ## Contributing
34
39
 
data/bin/sinatra CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "sinatra/cmd"
3
+ require "sinatra_cmd"
4
4
 
5
- Sinatra::CLI::Generator.start(ARGV)
5
+ SinatraCmd::Generator.start(ARGV)
@@ -0,0 +1,54 @@
1
+ require "thor"
2
+
3
+ module SinatraCmd
4
+ class Generator < Thor::Group
5
+ include Thor::Actions
6
+
7
+ argument :app_name
8
+
9
+ def self.source_root
10
+ File.join(File.dirname(__FILE__), "../../", "templates")
11
+ end
12
+
13
+ def create_models_dir
14
+ keep_file "#{app_name}/models"
15
+ end
16
+
17
+ def create_routes_dir
18
+ keep_file "#{app_name}/routes"
19
+ template "routes/demo.rb.erb", "#{app_name}/routes/demo.rb"
20
+ end
21
+
22
+ def create_config
23
+ template "config/database.yml.erb", "#{app_name}/config/database.yml"
24
+ template "config/application.rb.erb", "#{app_name}/config/application.rb"
25
+ template "config/boot.rb.erb", "#{app_name}/config/boot.rb"
26
+ copy_file "config/environment.rb", "#{app_name}/config/environment.rb"
27
+ copy_file "config/scheduler.rb", "#{app_name}/config/scheduler.rb"
28
+ end
29
+
30
+ def create_appfile
31
+ copy_file ".gitignore", "#{app_name}/.gitignore"
32
+ copy_file "Gemfile", "#{app_name}/Gemfile"
33
+ copy_file "Rakefile", "#{app_name}/Rakefile"
34
+ template "config.ru.erb", "#{app_name}/config.ru"
35
+ template "README.md.erb", "#{app_name}/README.md"
36
+ end
37
+
38
+ def setup_rspec
39
+ keep_file "#{app_name}/sepc"
40
+ copy_file "sepc/spec_helper.rb", "#{app_name}/sepc/spec_helper.rb"
41
+ copy_file ".rspec", "#{app_name}/.rspec"
42
+ end
43
+
44
+ def bundle_install
45
+ system "cd #{app_name} && bundle install && cd ../"
46
+ end
47
+
48
+ protected
49
+
50
+ def keep_file(destination)
51
+ create_file "#{destination}/.keep"
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,3 @@
1
+ module SinatraCmd
2
+ VERSION = '0.0.5'
3
+ end
@@ -0,0 +1,3 @@
1
+ module SinatraCmd
2
+ autoload :Generator, 'spear/generator'
3
+ end
data/sinatra-cmd.gemspec CHANGED
@@ -1,22 +1,22 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'sinatra/cmd/version'
4
+ require 'sinatra_cmd/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "sinatra-cmd"
8
- spec.version = Sinatra::Cmd::VERSION
8
+ spec.version = SinatraCmd::VERSION
9
9
  spec.authors = ["CBluowei"]
10
10
  spec.email = ["wei.luo@careerbuilder.com"]
11
11
 
12
- spec.summary = %q{A CLI of generate sinatra project.}
13
- spec.description = %q{Generate a sinatra project}
12
+ spec.summary = %q{Command for generating sinatra project}
13
+ spec.description = %q{Generate a sinatra project.}
14
14
  spec.homepage = "https://github.com/hilotus/sinatra-cli"
15
15
  spec.license = "MIT"
16
16
 
17
- spec.files = `git ls-files -z`.split("\x0")
18
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
+ spec.files = `git ls-files -z`.split("\x0")
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
20
  spec.require_paths = ["lib"]
21
21
 
22
22
  spec.add_development_dependency "bundler", "~> 1.9"
@@ -1,15 +1,2 @@
1
- <%= app_name %>
1
+ <%= app_name.capitalize %>
2
2
  ====================
3
-
4
- ##How to use pry
5
- create .pryrc file in `/Users/username` folder.
6
- ```shell
7
- #!/usr/bin/ruby
8
-
9
- if defined?(PryByebug)
10
- Pry.commands.alias_command 'c', 'continue'
11
- Pry.commands.alias_command 's', 'step'
12
- Pry.commands.alias_command 'n', 'next'
13
- Pry.commands.alias_command 'f', 'finish'
14
- end
15
- ```
@@ -8,7 +8,7 @@ Dir[File.expand_path('../../routes/*.rb', __FILE__)].each { |f| require f }
8
8
 
9
9
  require File.expand_path('../scheduler', __FILE__)
10
10
 
11
- module <%= app_name %>
11
+ module <%= app_name.capitalize %>
12
12
  class App
13
13
  # custome register
14
14
  register ErrorHandling
@@ -14,7 +14,7 @@ module Sinatra::Namespace::SharedMethods
14
14
  remove_method :namespace
15
15
  end
16
16
 
17
- module <%= app_name %>
17
+ module <%= app_name.capitalize %>
18
18
  API_V1 = '/App/1'
19
19
 
20
20
  class App < Sinatra::Application
@@ -1,3 +1,3 @@
1
1
  require ::File.expand_path('../config/environment', __FILE__)
2
2
 
3
- run <%= app_name %>::App
3
+ run <%= app_name.capitalize %>::App
@@ -1,4 +1,4 @@
1
- module <%= app_name %>
1
+ module <%= app_name.capitalize %>
2
2
  module ApplicationHelper
3
3
  def logger
4
4
  return @logger unless @logger.nil?
@@ -1,4 +1,4 @@
1
- module <%= app_name %>
1
+ module <%= app_name.capitalize %>
2
2
  module ErrorHandling
3
3
  module Helpers
4
4
  def halt_with_400(message=nil)
@@ -1,8 +1,8 @@
1
1
  # encoding: utf-8
2
2
 
3
- module <%= app_name %>
3
+ module <%= app_name.capitalize %>
4
4
  class App
5
- sinatra_namespace <%= app_name %>::API_V1 do
5
+ sinatra_namespace <%= app_name.capitalize %>::API_V1 do
6
6
  get '/demo' do
7
7
  unless params[:error].nil?
8
8
  raise 'There are some errors.'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-cmd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - CBluowei
@@ -52,7 +52,7 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.19'
55
- description: Generate a sinatra project
55
+ description: Generate a sinatra project.
56
56
  email:
57
57
  - wei.luo@careerbuilder.com
58
58
  executables:
@@ -67,9 +67,9 @@ files:
67
67
  - README.md
68
68
  - Rakefile
69
69
  - bin/sinatra
70
- - lib/sinatra/cmd.rb
71
- - lib/sinatra/cmd/generator.rb
72
- - lib/sinatra/cmd/version.rb
70
+ - lib/sinatra_cmd.rb
71
+ - lib/sinatra_cmd/generator.rb
72
+ - lib/sinatra_cmd/version.rb
73
73
  - sinatra-cmd.gemspec
74
74
  - templates/.gitignore
75
75
  - templates/.rspec
@@ -111,5 +111,5 @@ rubyforge_project:
111
111
  rubygems_version: 2.2.2
112
112
  signing_key:
113
113
  specification_version: 4
114
- summary: A CLI of generate sinatra project.
114
+ summary: Command for generating sinatra project
115
115
  test_files: []
@@ -1,55 +0,0 @@
1
- require "thor"
2
-
3
- module Sinatra
4
- module CLI
5
- class Generator < Thor::Group
6
- include Thor::Actions
7
-
8
- argument :app_name
9
-
10
- def self.source_root
11
- File.join(File.dirname(__FILE__), "../../../", "templates")
12
- end
13
-
14
- def create_models_dir
15
- keep_file "#{app_name}/app/models"
16
- end
17
-
18
- def create_routes_dir
19
- keep_file "#{app_name}/app/routes"
20
- template "routes/demo.rb.erb", "#{app_name}/routes/demo.rb"
21
- end
22
-
23
- def create_config
24
- template "config/database.yml.erb", "#{app_name}/config/database.yml"
25
- template "config/application.rb.erb", "#{app_name}/config/application.rb"
26
- template "config/boot.rb.erb", "#{app_name}/config/boot.rb"
27
- copy_file "config/environment.rb", "#{app_name}/config/environment.rb"
28
- copy_file "config/scheduler.rb", "#{app_name}/config/scheduler.rb"
29
- end
30
-
31
- def create_appfile
32
- copy_file ".gitignore", "#{app_name}/.gitignore"
33
- copy_file "Gemfile", "#{app_name}/Gemfile"
34
- copy_file "Rakefile", "#{app_name}/Rakefile"
35
- template "config.ru.erb", "#{app_name}/config.ru"
36
- template "README.md.erb", "#{app_name}/README.md"
37
- end
38
-
39
- def setup_rspec
40
- copy_file "sepc/spec_helper.rb", "#{app_name}/sepc/spec_helper.rb"
41
- copy_file ".rspec", "#{app_name}/.rspec"
42
- end
43
-
44
- def bundle_install
45
- system "cd #{app_name} && bundle install && cd ../"
46
- end
47
-
48
- protected
49
-
50
- def keep_file(destination)
51
- create_file "#{destination}/.keep"
52
- end
53
- end
54
- end
55
- end
@@ -1,5 +0,0 @@
1
- module Sinatra
2
- module Cmd
3
- VERSION = "0.0.4"
4
- end
5
- end
data/lib/sinatra/cmd.rb DELETED
@@ -1,7 +0,0 @@
1
- require 'sinatra/cmd/generator'
2
- require 'sinatra/cmd/version'
3
-
4
- module Sinatra
5
- module Cmd
6
- end
7
- end