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 +4 -4
- data/README.md +13 -8
- data/bin/sinatra +2 -2
- data/lib/sinatra_cmd/generator.rb +54 -0
- data/lib/sinatra_cmd/version.rb +3 -0
- data/lib/sinatra_cmd.rb +3 -0
- data/sinatra-cmd.gemspec +7 -7
- data/templates/README.md.erb +1 -14
- data/templates/config/application.rb.erb +1 -1
- data/templates/config/boot.rb.erb +1 -1
- data/templates/config.ru.erb +1 -1
- data/templates/helpers/application.rb.erb +1 -1
- data/templates/helpers/error_handling.rb.erb +1 -1
- data/templates/routes/demo.rb.erb +2 -2
- metadata +6 -6
- data/lib/sinatra/cmd/generator.rb +0 -55
- data/lib/sinatra/cmd/version.rb +0 -5
- data/lib/sinatra/cmd.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d301b238470b4cbae35482251bb45fa39784c7d2
|
4
|
+
data.tar.gz: f8bdcc3d886decb2ada679feaf8450bfd84b958c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
21
|
+
sinatra app_name
|
26
22
|
|
27
|
-
##
|
23
|
+
##How to use pry
|
28
24
|
|
29
|
-
|
25
|
+
create .pryrc file in `/Users/username` folder.
|
30
26
|
|
31
|
-
|
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
@@ -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
|
data/lib/sinatra_cmd.rb
ADDED
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 '
|
4
|
+
require 'sinatra_cmd/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "sinatra-cmd"
|
8
|
-
spec.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{
|
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
|
18
|
-
spec.executables
|
19
|
-
spec.test_files
|
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"
|
data/templates/README.md.erb
CHANGED
@@ -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
|
-
```
|
data/templates/config.ru.erb
CHANGED
@@ -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
|
+
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/
|
71
|
-
- lib/
|
72
|
-
- lib/
|
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:
|
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
|
data/lib/sinatra/cmd/version.rb
DELETED