rack-generator 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +18 -0
- data/Rakefile +9 -0
- data/TODO.md +1 -0
- data/bin/rack-generator +4 -0
- data/lib/rack/generator.rb +2 -0
- data/lib/rack/generator/command.rb +35 -0
- data/lib/rack/generator/version.rb +5 -0
- data/lib/templates/middleware/rack-NAME/Gemfile.erb +4 -0
- data/lib/templates/middleware/rack-NAME/LICENSE.txt.erb +22 -0
- data/lib/templates/middleware/rack-NAME/README.md.erb +24 -0
- data/lib/templates/middleware/rack-NAME/Rakefile.erb +9 -0
- data/lib/templates/middleware/rack-NAME/lib/rack/NAME.rb.erb +17 -0
- data/lib/templates/middleware/rack-NAME/lib/rack/NAME/version.rb.erb +5 -0
- data/lib/templates/middleware/rack-NAME/rack-NAME.gemspec.erb +24 -0
- data/lib/templates/middleware/rack-NAME/test/rack_NAME_test.rb.erb +33 -0
- data/lib/templates/middleware/rack-NAME/test/test_helper.rb.erb +10 -0
- data/rack-generator.gemspec +27 -0
- data/test/fixtures/middleware/rack-uppercase/.gitignore +17 -0
- data/test/fixtures/middleware/rack-uppercase/Gemfile +4 -0
- data/test/fixtures/middleware/rack-uppercase/LICENSE.txt +22 -0
- data/test/fixtures/middleware/rack-uppercase/README.md +24 -0
- data/test/fixtures/middleware/rack-uppercase/Rakefile +9 -0
- data/test/fixtures/middleware/rack-uppercase/lib/rack/uppercase.rb +17 -0
- data/test/fixtures/middleware/rack-uppercase/lib/rack/uppercase/version.rb +5 -0
- data/test/fixtures/middleware/rack-uppercase/rack-uppercase.gemspec +24 -0
- data/test/fixtures/middleware/rack-uppercase/test/rack_uppercase_test.rb +33 -0
- data/test/fixtures/middleware/rack-uppercase/test/test_helper.rb +10 -0
- data/test/rack_generator_test.rb +68 -0
- metadata +157 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: 1a96059b2382ac1cadf817ffd35f00e0a4dd2a85
|
4
|
+
data.tar.gz: f8b569069a87cf7f9991c21c2d7c19a8ac7b234f
|
5
|
+
!binary "U0hBNTEy":
|
6
|
+
metadata.gz: c30b98147cdd1f74767d573559e49007777b70f5919789933ad266960633d2f60eb6169e7f611ac0e8460856810843715f56238cb599e5a4e871395ea3dbed6b
|
7
|
+
data.tar.gz: e965d92164587656b299b81f7f9bca10e3206eeda175773da8be4b4d29719b2e01117c6072384359990c65a936d84aa06ded235923788e50255204ffeb63d17d
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Raul Murciano http://www.raulmurciano.com
|
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,18 @@
|
|
1
|
+
# Rack::Generator
|
2
|
+
|
3
|
+
Rack middleware generator.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
$ gem install rack-generator
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
rack-generator new my-middleware "Raul Murciano" "raul@murciano.net" "Description of my middleware"
|
12
|
+
|
13
|
+
You'll see a new `rack-my-middleware` directory, containing a few useful files:
|
14
|
+
|
15
|
+
- `lib/rack/my-middleware.rb` contains a sample middleware that upcases the response bodies of the embedding app
|
16
|
+
- `test/rack_my_middleware_test.rb` includes sample tests that you can run with `bundle exec rake`
|
17
|
+
- `rack-my-middleware.gemspec` is ready to build a gem from your middleware with `gem build rack-my-middleware.gemspec`. That will generate a `rack-my-middleware-1.0.0.gem` file that you can install locally (`gem install rack-my-middleware-1.0.0.gem`) or release with `gem push rack-my-middleware-1.0.0.gem`
|
18
|
+
- `README.md` and `LICENSE.txt` files should include your name, review them before pushing your code
|
data/Rakefile
ADDED
data/TODO.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
[ ] Test, trying to generate the fixtures/rack-uppercase
|
data/bin/rack-generator
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'active_support/inflector'
|
3
|
+
require 'pathname'
|
4
|
+
|
5
|
+
module Rack
|
6
|
+
module Generator
|
7
|
+
class Command < Thor
|
8
|
+
|
9
|
+
include Thor::Actions
|
10
|
+
|
11
|
+
desc 'middleware NAME AUTHOR EMAIL DESCRIPTION', 'Generates a new Rack middleware. E.g: rack-generator middleware "my-middleware" "Raul Murciano" "raul@murciano.net" "Description of my middleware"'
|
12
|
+
def middleware(name, author, email, description)
|
13
|
+
@name = name.gsub(/\W/,'-').underscore.dasherize.gsub(/\Arack\-/, '')
|
14
|
+
@constant = @name.gsub(/-/, '_').camelize
|
15
|
+
@author = author
|
16
|
+
@email = email
|
17
|
+
@description = description
|
18
|
+
|
19
|
+
templates_dir = Pathname.new("#{self.class.source_root}/../../templates/middleware").realpath.to_s
|
20
|
+
templates = Dir.glob("#{templates_dir}/**/*.erb")
|
21
|
+
|
22
|
+
templates.each do |template_path|
|
23
|
+
rel_path = template_path.gsub(templates_dir, '')
|
24
|
+
new_path = "#{Dir.pwd}#{rel_path}".gsub('NAME', @name).gsub(/\.erb\Z/, '')
|
25
|
+
template template_path, new_path
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.source_root
|
30
|
+
File.dirname(__FILE__)
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) <%= Time.now.year %> <%= @author %>
|
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.
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Rack::<%= @constant %>
|
2
|
+
|
3
|
+
<%= @description %>
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
Add it to your app's `Gemfile`:
|
8
|
+
|
9
|
+
gem 'rack-<%= @name %>'
|
10
|
+
|
11
|
+
Add it to your `config.ru` file, before running your app:
|
12
|
+
|
13
|
+
use Rack::<%= @constant %>
|
14
|
+
|
15
|
+
If your app is Rails-based, you can add it in your `config/application.rb` instead:
|
16
|
+
|
17
|
+
config.middleware.use Rack::<%= @constant %>
|
18
|
+
|
19
|
+
(Read the [Rails on Rack guide](http://guides.rubyonrails.org/rails_on_rack.html) to learn more).
|
20
|
+
|
21
|
+
## Development
|
22
|
+
|
23
|
+
Install the dependencies with `bundle install`.
|
24
|
+
Run the tests with `bundle rake`.
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rack/<%= @name %>/version'
|
2
|
+
|
3
|
+
module Rack
|
4
|
+
class <%= @constant %>
|
5
|
+
|
6
|
+
def initialize(app)
|
7
|
+
@app = app
|
8
|
+
end
|
9
|
+
|
10
|
+
def call(env)
|
11
|
+
status, headers, response = @app.call(env)
|
12
|
+
response.each{ |str| str.upcase! }
|
13
|
+
[ status, headers, response ]
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'rack/<%= @name %>/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "rack-<%= @name %>"
|
7
|
+
spec.version = Rack::<%= @constant %>::VERSION
|
8
|
+
spec.authors = ["<%= @author %>"]
|
9
|
+
spec.email = ["<%= @email %>"]
|
10
|
+
spec.description = %q{<%= @description %>}
|
11
|
+
spec.summary = ""
|
12
|
+
spec.homepage = ""
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files`.split($/)
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_runtime_dependency "rack", "~> 1.5.2"
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "rack-test"
|
24
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require_relative "test_helper"
|
2
|
+
|
3
|
+
describe Rack::<%= @constant %> do
|
4
|
+
include Rack::Test::Methods
|
5
|
+
|
6
|
+
class HelloWorldApp
|
7
|
+
def call(env)
|
8
|
+
[ 200, {"Content-Type" => "text/html"}, ["Hello world!"] ]
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def app
|
13
|
+
Rack::Builder.new do
|
14
|
+
use Rack::<%= @constant %>
|
15
|
+
run HelloWorldApp.new
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
it "has a version" do
|
20
|
+
assert_equal "1.0.0", Rack::<%= @constant %>::VERSION
|
21
|
+
end
|
22
|
+
|
23
|
+
it "returns successful responses" do
|
24
|
+
get "/"
|
25
|
+
assert_equal 200, last_response.status
|
26
|
+
end
|
27
|
+
|
28
|
+
it "returns uppercase responses" do
|
29
|
+
get "/"
|
30
|
+
assert_equal "HELLO WORLD!", last_response.body
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'rack/generator/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = "rack-generator"
|
9
|
+
spec.version = Rack::Generator::VERSION
|
10
|
+
spec.authors = ["Raul Murciano"]
|
11
|
+
spec.email = ["raul@murciano.net"]
|
12
|
+
spec.description = %q{Rack middleware generator}
|
13
|
+
spec.summary = ""
|
14
|
+
spec.homepage = "https://github.com/raul/rack-generator"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files`.split($\)
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_runtime_dependency "thor"
|
23
|
+
spec.add_runtime_dependency "activesupport"
|
24
|
+
spec.add_development_dependency "minitest"
|
25
|
+
spec.add_development_dependency "bundler"
|
26
|
+
spec.add_development_dependency "rake"
|
27
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Raul Murciano
|
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.
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Rack::Uppercase
|
2
|
+
|
3
|
+
Rack middleware which uppercases your app's responses, built as an example/demo.
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
Add it to your app's `Gemfile`:
|
8
|
+
|
9
|
+
gem 'rack-uppercase'
|
10
|
+
|
11
|
+
Add it to your `config.ru` file, before running your app:
|
12
|
+
|
13
|
+
use Rack::Uppercase
|
14
|
+
|
15
|
+
If your app is Rails-based, you can add it in your `config/application.rb` instead:
|
16
|
+
|
17
|
+
config.middleware.use Rack::Uppercase
|
18
|
+
|
19
|
+
(Read the [Rails on Rack guide](http://guides.rubyonrails.org/rails_on_rack.html) to learn more).
|
20
|
+
|
21
|
+
## Development
|
22
|
+
|
23
|
+
Install the dependencies with `bundle install`.
|
24
|
+
Run the tests with `bundle rake`.
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rack/uppercase/version'
|
2
|
+
|
3
|
+
module Rack
|
4
|
+
class Uppercase
|
5
|
+
|
6
|
+
def initialize(app)
|
7
|
+
@app = app
|
8
|
+
end
|
9
|
+
|
10
|
+
def call(env)
|
11
|
+
status, headers, response = @app.call(env)
|
12
|
+
response.each{ |str| str.upcase! }
|
13
|
+
[ status, headers, response ]
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'rack/uppercase/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "rack-uppercase"
|
7
|
+
spec.version = Rack::Uppercase::VERSION
|
8
|
+
spec.authors = ["Raul Murciano"]
|
9
|
+
spec.email = ["raul@murciano.net"]
|
10
|
+
spec.description = %q{Rack middleware which uppercases your app's responses, built as an example/demo.}
|
11
|
+
spec.summary = ""
|
12
|
+
spec.homepage = ""
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files`.split($/)
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_runtime_dependency "rack", "~> 1.5.2"
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "rack-test"
|
24
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require_relative "test_helper"
|
2
|
+
|
3
|
+
describe Rack::Uppercase do
|
4
|
+
include Rack::Test::Methods
|
5
|
+
|
6
|
+
class HelloWorldApp
|
7
|
+
def call(env)
|
8
|
+
[ 200, {"Content-Type" => "text/html"}, ["Hello world!"] ]
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def app
|
13
|
+
Rack::Builder.new do
|
14
|
+
use Rack::Uppercase
|
15
|
+
run HelloWorldApp.new
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
it "has a version" do
|
20
|
+
assert_equal "1.0.0", Rack::Uppercase::VERSION
|
21
|
+
end
|
22
|
+
|
23
|
+
it "returns successful responses" do
|
24
|
+
get "/"
|
25
|
+
assert_equal 200, last_response.status
|
26
|
+
end
|
27
|
+
|
28
|
+
it "returns uppercase responses" do
|
29
|
+
get "/"
|
30
|
+
assert_equal "HELLO WORLD!", last_response.body
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
require "minitest/autorun"
|
3
|
+
require "minitest/spec"
|
4
|
+
|
5
|
+
require_relative '../lib/rack/generator'
|
6
|
+
|
7
|
+
describe "rack-generator" do
|
8
|
+
|
9
|
+
before do
|
10
|
+
reset_tmp_dir
|
11
|
+
Dir.chdir tmp_dir
|
12
|
+
end
|
13
|
+
|
14
|
+
after do
|
15
|
+
delete_tmp_dir
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "middleware" do
|
19
|
+
it "should generate an identical copy of the middleware fixtures" do
|
20
|
+
system('bundle exec ../../bin/rack-generator middleware uppercase "Raul Murciano" "raul@murciano.net" "Rack middleware which uppercases your app\'s responses, built as an example/demo."')
|
21
|
+
|
22
|
+
expected_files = files_under "#{fixtures_dir}/middleware"
|
23
|
+
generated_files = files_under tmp_dir
|
24
|
+
|
25
|
+
missing_files = expected_files - generated_files
|
26
|
+
extra_files = generated_files - expected_files
|
27
|
+
|
28
|
+
assert missing_files.empty?, "Missing files: #{missing_files}"
|
29
|
+
assert extra_files.empty?, "Files generated but not expected: #{extra_files}"
|
30
|
+
|
31
|
+
expected_files.select{ |f| File.file?(f) }.each do |f|
|
32
|
+
assert_equal generated_content(f), expected_content("middleware/#{f}")
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def files_under(dir)
|
38
|
+
Dir.glob("#{dir}/**/*").select { |f| File.file?(f) }.map{ |path| path.gsub("#{dir}/", '') }
|
39
|
+
end
|
40
|
+
|
41
|
+
def generated_content(path)
|
42
|
+
filepath = File.join tmp_dir, path
|
43
|
+
File.open(filepath) { |file| file.read }
|
44
|
+
end
|
45
|
+
|
46
|
+
def expected_content(path)
|
47
|
+
filepath = File.join fixtures_dir, path
|
48
|
+
File.open(filepath) { |file| file.read }
|
49
|
+
end
|
50
|
+
|
51
|
+
def fixtures_dir
|
52
|
+
File.join File.dirname(__FILE__), 'fixtures'
|
53
|
+
end
|
54
|
+
|
55
|
+
def reset_tmp_dir
|
56
|
+
delete_tmp_dir if File.directory?(tmp_dir)
|
57
|
+
FileUtils.mkdir_p tmp_dir
|
58
|
+
end
|
59
|
+
|
60
|
+
def delete_tmp_dir
|
61
|
+
FileUtils.rm_r tmp_dir
|
62
|
+
end
|
63
|
+
|
64
|
+
def tmp_dir
|
65
|
+
File.join File.dirname(__FILE__), 'tmp'
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
metadata
ADDED
@@ -0,0 +1,157 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rack-generator
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Raul Murciano
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-12-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ! '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ! '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: Rack middleware generator
|
84
|
+
email:
|
85
|
+
- raul@murciano.net
|
86
|
+
executables:
|
87
|
+
- rack-generator
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- .gitignore
|
92
|
+
- Gemfile
|
93
|
+
- LICENSE.txt
|
94
|
+
- README.md
|
95
|
+
- Rakefile
|
96
|
+
- TODO.md
|
97
|
+
- bin/rack-generator
|
98
|
+
- lib/rack/generator.rb
|
99
|
+
- lib/rack/generator/command.rb
|
100
|
+
- lib/rack/generator/version.rb
|
101
|
+
- lib/templates/middleware/rack-NAME/Gemfile.erb
|
102
|
+
- lib/templates/middleware/rack-NAME/LICENSE.txt.erb
|
103
|
+
- lib/templates/middleware/rack-NAME/README.md.erb
|
104
|
+
- lib/templates/middleware/rack-NAME/Rakefile.erb
|
105
|
+
- lib/templates/middleware/rack-NAME/lib/rack/NAME.rb.erb
|
106
|
+
- lib/templates/middleware/rack-NAME/lib/rack/NAME/version.rb.erb
|
107
|
+
- lib/templates/middleware/rack-NAME/rack-NAME.gemspec.erb
|
108
|
+
- lib/templates/middleware/rack-NAME/test/rack_NAME_test.rb.erb
|
109
|
+
- lib/templates/middleware/rack-NAME/test/test_helper.rb.erb
|
110
|
+
- rack-generator.gemspec
|
111
|
+
- test/fixtures/middleware/rack-uppercase/.gitignore
|
112
|
+
- test/fixtures/middleware/rack-uppercase/Gemfile
|
113
|
+
- test/fixtures/middleware/rack-uppercase/LICENSE.txt
|
114
|
+
- test/fixtures/middleware/rack-uppercase/README.md
|
115
|
+
- test/fixtures/middleware/rack-uppercase/Rakefile
|
116
|
+
- test/fixtures/middleware/rack-uppercase/lib/rack/uppercase.rb
|
117
|
+
- test/fixtures/middleware/rack-uppercase/lib/rack/uppercase/version.rb
|
118
|
+
- test/fixtures/middleware/rack-uppercase/rack-uppercase.gemspec
|
119
|
+
- test/fixtures/middleware/rack-uppercase/test/rack_uppercase_test.rb
|
120
|
+
- test/fixtures/middleware/rack-uppercase/test/test_helper.rb
|
121
|
+
- test/rack_generator_test.rb
|
122
|
+
homepage: https://github.com/raul/rack-generator
|
123
|
+
licenses:
|
124
|
+
- MIT
|
125
|
+
metadata: {}
|
126
|
+
post_install_message:
|
127
|
+
rdoc_options: []
|
128
|
+
require_paths:
|
129
|
+
- lib
|
130
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - ! '>='
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ! '>='
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
requirements: []
|
141
|
+
rubyforge_project:
|
142
|
+
rubygems_version: 2.0.3
|
143
|
+
signing_key:
|
144
|
+
specification_version: 4
|
145
|
+
summary: ''
|
146
|
+
test_files:
|
147
|
+
- test/fixtures/middleware/rack-uppercase/.gitignore
|
148
|
+
- test/fixtures/middleware/rack-uppercase/Gemfile
|
149
|
+
- test/fixtures/middleware/rack-uppercase/LICENSE.txt
|
150
|
+
- test/fixtures/middleware/rack-uppercase/README.md
|
151
|
+
- test/fixtures/middleware/rack-uppercase/Rakefile
|
152
|
+
- test/fixtures/middleware/rack-uppercase/lib/rack/uppercase.rb
|
153
|
+
- test/fixtures/middleware/rack-uppercase/lib/rack/uppercase/version.rb
|
154
|
+
- test/fixtures/middleware/rack-uppercase/rack-uppercase.gemspec
|
155
|
+
- test/fixtures/middleware/rack-uppercase/test/rack_uppercase_test.rb
|
156
|
+
- test/fixtures/middleware/rack-uppercase/test/test_helper.rb
|
157
|
+
- test/rack_generator_test.rb
|