chinstrap 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +25 -0
- data/Rakefile +3 -0
- data/bin/chinstrap +7 -0
- data/chinstrap.gemspec +19 -0
- data/lib/chinstrap.rb +45 -0
- data/lib/chinstrap/templates/Gemfile +12 -0
- data/lib/chinstrap/templates/Rakefile +8 -0
- data/lib/chinstrap/templates/app/app.rb +7 -0
- data/lib/chinstrap/templates/app/routes/main.rb +7 -0
- data/lib/chinstrap/templates/config.ru +6 -0
- data/lib/chinstrap/templates/config/environment.rb +5 -0
- data/lib/chinstrap/templates/gitignore +2 -0
- data/lib/chinstrap/templates/test/test_helper.rb +1 -0
- data/lib/chinstrap/version.rb +3 -0
- metadata +81 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Brandon Weiss
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# Chinstrap
|
2
|
+
|
3
|
+
TL;DR `rails new` for Sinatra.
|
4
|
+
|
5
|
+
Manually building out the skeleton for larger, well-organized Sinatra apps sucks. There's no reason it shouldn't be as simple as `chinstrap new APP_NAME`.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
$ gem install chinstrap
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
$ chinstrap new APP_NAME
|
14
|
+
|
15
|
+
## Credits
|
16
|
+
|
17
|
+
Most of the credit goes to the creators of Thor, and other projects (Bundler, Foreman, etc.) that use it for skeleton generation so I could see the best patterns to use.
|
18
|
+
|
19
|
+
## Contributing
|
20
|
+
|
21
|
+
1. Fork it
|
22
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
23
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
24
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
25
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/bin/chinstrap
ADDED
data/chinstrap.gemspec
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path("../lib/chinstrap/version", __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Brandon Weiss"]
|
6
|
+
gem.email = ["brandon@anti-pattern.com"]
|
7
|
+
gem.description = %q{Manually building out the skeleton for larger, well-organized Sinatra apps sucks. There's no reason it shouldn't be as simple as 'chinstrap new APP_NAME'.}
|
8
|
+
gem.summary = %q{'rails new' for Sinatra}
|
9
|
+
gem.homepage = "http://github.com/brandonweiss/chinstrap"
|
10
|
+
|
11
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
12
|
+
gem.files = `git ls-files`.split("\n")
|
13
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
14
|
+
gem.name = "chinstrap"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = Chinstrap::VERSION
|
17
|
+
|
18
|
+
gem.add_dependency "thor", "~> 0.14.6"
|
19
|
+
end
|
data/lib/chinstrap.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
require "chinstrap/version"
|
2
|
+
require "thor"
|
3
|
+
|
4
|
+
module Chinstrap
|
5
|
+
class CLI < Thor
|
6
|
+
|
7
|
+
include Thor::Actions
|
8
|
+
|
9
|
+
desc "new [APP_NAME]", "Create a new skeleton for a Sinatra application named [APP_NAME]"
|
10
|
+
|
11
|
+
def new(name)
|
12
|
+
name = name.chomp("/")
|
13
|
+
target = File.join(Dir.pwd, name)
|
14
|
+
|
15
|
+
constant_name = name.split('_').map{ |p| p[0..0].upcase + p[1..-1] }.join
|
16
|
+
constant_name = constant_name.split('-').map{ |q| q[0..0].upcase + q[1..-1] }.join('::') if constant_name =~ /-/
|
17
|
+
|
18
|
+
options = {
|
19
|
+
name: name,
|
20
|
+
constant_name: constant_name
|
21
|
+
}
|
22
|
+
|
23
|
+
empty_directory target
|
24
|
+
|
25
|
+
empty_directory File.join(target, "app/models")
|
26
|
+
template File.join("app/routes/main.rb"), File.join(target, "app/routes/main.rb"), options
|
27
|
+
empty_directory File.join(target, "app/views")
|
28
|
+
template File.join("app/app.rb"), File.join(target, "app/#{name}.rb"), options
|
29
|
+
template File.join("config/environment.rb"), File.join(target, "config/environment.rb"), options
|
30
|
+
empty_directory File.join(target, "lib")
|
31
|
+
template File.join("test/test_helper.rb"), File.join(target, "test/test_helper.rb"), options
|
32
|
+
empty_directory File.join(target, "tmp")
|
33
|
+
empty_directory File.join(target, "vendor")
|
34
|
+
template File.join("gitignore"), File.join(target, ".gitignore"), options
|
35
|
+
template File.join("config.ru"), File.join(target, "config.ru"), options
|
36
|
+
template File.join("Gemfile"), File.join(target, "Gemfile"), options
|
37
|
+
template File.join("Rakefile"), File.join(target, "Rakefile"), options
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.source_root
|
41
|
+
File.expand_path(File.join(File.dirname(__FILE__), "chinstrap/templates"))
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
ENV["RACK_ENV"] = "test"
|
metadata
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: chinstrap
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Brandon Weiss
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2012-02-22 00:00:00 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: thor
|
17
|
+
prerelease: false
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ~>
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.14.6
|
24
|
+
type: :runtime
|
25
|
+
version_requirements: *id001
|
26
|
+
description: Manually building out the skeleton for larger, well-organized Sinatra apps sucks. There's no reason it shouldn't be as simple as 'chinstrap new APP_NAME'.
|
27
|
+
email:
|
28
|
+
- brandon@anti-pattern.com
|
29
|
+
executables:
|
30
|
+
- chinstrap
|
31
|
+
extensions: []
|
32
|
+
|
33
|
+
extra_rdoc_files: []
|
34
|
+
|
35
|
+
files:
|
36
|
+
- .gitignore
|
37
|
+
- Gemfile
|
38
|
+
- LICENSE
|
39
|
+
- README.md
|
40
|
+
- Rakefile
|
41
|
+
- bin/chinstrap
|
42
|
+
- chinstrap.gemspec
|
43
|
+
- lib/chinstrap.rb
|
44
|
+
- lib/chinstrap/templates/Gemfile
|
45
|
+
- lib/chinstrap/templates/Rakefile
|
46
|
+
- lib/chinstrap/templates/app/app.rb
|
47
|
+
- lib/chinstrap/templates/app/routes/main.rb
|
48
|
+
- lib/chinstrap/templates/config.ru
|
49
|
+
- lib/chinstrap/templates/config/environment.rb
|
50
|
+
- lib/chinstrap/templates/gitignore
|
51
|
+
- lib/chinstrap/templates/test/test_helper.rb
|
52
|
+
- lib/chinstrap/version.rb
|
53
|
+
homepage: http://github.com/brandonweiss/chinstrap
|
54
|
+
licenses: []
|
55
|
+
|
56
|
+
post_install_message:
|
57
|
+
rdoc_options: []
|
58
|
+
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: "0"
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: "0"
|
73
|
+
requirements: []
|
74
|
+
|
75
|
+
rubyforge_project:
|
76
|
+
rubygems_version: 1.8.17
|
77
|
+
signing_key:
|
78
|
+
specification_version: 3
|
79
|
+
summary: "'rails new' for Sinatra"
|
80
|
+
test_files: []
|
81
|
+
|