short_stack 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +24 -0
- data/Gemfile +13 -0
- data/Gemfile.lock +71 -0
- data/LICENSE +20 -0
- data/README.rdoc +17 -0
- data/Rakefile +26 -0
- data/VERSION +1 -0
- data/lib/pancake/generators/global.rb +2 -0
- data/lib/pancake/generators/micro_generator.rb +23 -0
- data/lib/pancake/generators/short_generator.rb +23 -0
- data/lib/pancake/generators/templates/common/Gemfile +7 -0
- data/lib/pancake/generators/templates/common/dotgitignore +22 -0
- data/lib/pancake/generators/templates/common/dothtaccess +17 -0
- data/lib/pancake/generators/templates/micro/%stack_name%/%stack_name%.rb.tt +9 -0
- data/lib/pancake/generators/templates/micro/%stack_name%/Rakefile.tt +40 -0
- data/lib/pancake/generators/templates/micro/%stack_name%/config.ru.tt +15 -0
- data/lib/pancake/generators/templates/micro/%stack_name%/pancake_init.rb.tt +1 -0
- data/lib/pancake/generators/templates/micro/%stack_name%/public/.empty_directory +0 -0
- data/lib/pancake/generators/templates/micro/%stack_name%/tmp/.empty_directory +0 -0
- data/lib/pancake/generators/templates/micro/%stack_name%/views/layouts/application.html.haml +5 -0
- data/lib/pancake/generators/templates/micro/%stack_name%/views/root.html.haml +1 -0
- data/lib/pancake/generators/templates/short/%stack_name%/LICENSE.tt +20 -0
- data/lib/pancake/generators/templates/short/%stack_name%/README.tt +7 -0
- data/lib/pancake/generators/templates/short/%stack_name%/Rakefile.tt +56 -0
- data/lib/pancake/generators/templates/short/%stack_name%/VERSION.tt +1 -0
- data/lib/pancake/generators/templates/short/%stack_name%/lib/%stack_name%.rb.tt +14 -0
- data/lib/pancake/generators/templates/short/%stack_name%/lib/%stack_name%/%stack_name%.rb.tt +6 -0
- data/lib/pancake/generators/templates/short/%stack_name%/lib/%stack_name%/config.ru.tt +11 -0
- data/lib/pancake/generators/templates/short/%stack_name%/lib/%stack_name%/config/config.rb.tt +23 -0
- data/lib/pancake/generators/templates/short/%stack_name%/lib/%stack_name%/config/environments/development.rb.tt +15 -0
- data/lib/pancake/generators/templates/short/%stack_name%/lib/%stack_name%/config/environments/production.rb.tt +16 -0
- data/lib/pancake/generators/templates/short/%stack_name%/lib/%stack_name%/config/environments/staging.rb.tt +15 -0
- data/lib/pancake/generators/templates/short/%stack_name%/lib/%stack_name%/models/.empty_directory +0 -0
- data/lib/pancake/generators/templates/short/%stack_name%/lib/%stack_name%/mounts/.empty_directory +0 -0
- data/lib/pancake/generators/templates/short/%stack_name%/lib/%stack_name%/public/.empty_directory +0 -0
- data/lib/pancake/generators/templates/short/%stack_name%/lib/%stack_name%/tasks/%stack_name%.rake.tt +4 -0
- data/lib/pancake/generators/templates/short/%stack_name%/lib/%stack_name%/tmp/.empty_directory +0 -0
- data/lib/pancake/generators/templates/short/%stack_name%/lib/%stack_name%/views/layouts/application.html.haml +5 -0
- data/lib/pancake/generators/templates/short/%stack_name%/lib/%stack_name%/views/root.html.haml +2 -0
- data/lib/pancake/generators/templates/short/%stack_name%/pancake_init.rb.tt +1 -0
- data/lib/pancake/generators/templates/short/%stack_name%/spec/%stack_name%_spec.rb.tt +11 -0
- data/lib/pancake/generators/templates/short/%stack_name%/spec/spec_helper.rb.tt +13 -0
- data/lib/short_stack.rb +213 -0
- data/lib/short_stack/controller.rb +185 -0
- data/lib/short_stack/default/views/base.html.haml +5 -0
- data/lib/short_stack/default/views/error.html.haml +12 -0
- data/lib/short_stack/middleware.rb +14 -0
- data/short_stack.gemspec +38 -0
- data/spec/fixtures/foobar/other_root/views/base.html.haml +4 -0
- data/spec/fixtures/foobar/views/basic.html.haml +1 -0
- data/spec/fixtures/foobar/views/inherited_from_base.html.haml +5 -0
- data/spec/fixtures/foobar/views/template.html.haml +3 -0
- data/spec/fixtures/foobar/views/vault.html.haml +3 -0
- data/spec/short_stack/controller_spec.rb +444 -0
- data/spec/short_stack/middlewares_spec.rb +14 -0
- data/spec/short_stack/router_spec.rb +153 -0
- data/spec/short_stack/short_stack_spec.rb +122 -0
- data/spec/short_stack/stack_spec.rb +124 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +13 -0
- metadata +181 -0
data/.document
ADDED
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
---
|
2
|
+
hash: c2bd72a57ebf25f4cfc4d35cc52a9c3deeb478a7
|
3
|
+
sources:
|
4
|
+
- Rubygems:
|
5
|
+
uri: http://gemcutter.org
|
6
|
+
specs:
|
7
|
+
- rake:
|
8
|
+
version: 0.8.7
|
9
|
+
- activesupport:
|
10
|
+
version: 3.0.0.beta4
|
11
|
+
- tilt:
|
12
|
+
version: 1.0.1
|
13
|
+
- any_view:
|
14
|
+
version: 0.2.3
|
15
|
+
- extlib:
|
16
|
+
version: 0.9.15
|
17
|
+
- haml:
|
18
|
+
version: 3.0.12
|
19
|
+
- hashie:
|
20
|
+
version: 0.2.0
|
21
|
+
- rack:
|
22
|
+
version: 1.2.1
|
23
|
+
- url_mount:
|
24
|
+
version: 0.2.1
|
25
|
+
- http_router:
|
26
|
+
version: 0.2.5
|
27
|
+
- json:
|
28
|
+
version: 1.4.3
|
29
|
+
- rack-accept-media-types:
|
30
|
+
version: "0.9"
|
31
|
+
- rack-test:
|
32
|
+
version: 0.5.4
|
33
|
+
- thor:
|
34
|
+
version: 0.13.6
|
35
|
+
- wrapt:
|
36
|
+
version: 0.1.7
|
37
|
+
- pancake:
|
38
|
+
version: 0.3.0
|
39
|
+
- rack-rescue:
|
40
|
+
version: 0.1.2
|
41
|
+
- rspec:
|
42
|
+
version: 1.3.0
|
43
|
+
dependencies:
|
44
|
+
pancake:
|
45
|
+
version: ~> 0.3
|
46
|
+
group:
|
47
|
+
- :default
|
48
|
+
rack-rescue:
|
49
|
+
version: ">= 0.1.2"
|
50
|
+
group:
|
51
|
+
- :default
|
52
|
+
wrapt:
|
53
|
+
version: ">= 0"
|
54
|
+
group:
|
55
|
+
- :default
|
56
|
+
rake:
|
57
|
+
version: ">= 0"
|
58
|
+
group:
|
59
|
+
- :test
|
60
|
+
rspec:
|
61
|
+
version: ">= 0"
|
62
|
+
group:
|
63
|
+
- :test
|
64
|
+
rack-test:
|
65
|
+
version: ">= 0"
|
66
|
+
group:
|
67
|
+
- :test
|
68
|
+
haml:
|
69
|
+
version: ">= 0"
|
70
|
+
group:
|
71
|
+
- :test
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 Daniel Neighman
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
= short_stack
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Note on Patches/Pull Requests
|
6
|
+
|
7
|
+
* Fork the project.
|
8
|
+
* Make your feature addition or bug fix.
|
9
|
+
* Add tests for it. This is important so I don't break it in a
|
10
|
+
future version unintentionally.
|
11
|
+
* Commit, do not mess with rakefile, version, or history.
|
12
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
13
|
+
* Send me a pull request. Bonus points for topic branches.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2010 Daniel Neighman. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
require 'spec/rake/spectask'
|
5
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
6
|
+
spec.libs << 'lib' << 'spec'
|
7
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
8
|
+
end
|
9
|
+
|
10
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
11
|
+
spec.libs << 'lib' << 'spec'
|
12
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
13
|
+
spec.rcov = true
|
14
|
+
end
|
15
|
+
|
16
|
+
task :default => :spec
|
17
|
+
|
18
|
+
require 'rake/rdoctask'
|
19
|
+
Rake::RDocTask.new do |rdoc|
|
20
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
21
|
+
|
22
|
+
rdoc.rdoc_dir = 'rdoc'
|
23
|
+
rdoc.title = "short_stack #{version}"
|
24
|
+
rdoc.rdoc_files.include('README*')
|
25
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
26
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.1
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Pancake
|
2
|
+
module Generators
|
3
|
+
class Micro < Thor::Group
|
4
|
+
include Thor::Actions
|
5
|
+
|
6
|
+
def self.source_root
|
7
|
+
File.join(File.dirname(__FILE__), "templates")
|
8
|
+
end
|
9
|
+
|
10
|
+
namespace "micro"
|
11
|
+
argument :stack_name, :banner => "Name of stack"
|
12
|
+
|
13
|
+
desc "Generates a Micro stack"
|
14
|
+
def stack
|
15
|
+
say "Creating The Stack For #{stack_name}"
|
16
|
+
directory "micro/%stack_name%", stack_name
|
17
|
+
template File.join(self.class.source_root, "common/dotgitignore"), "#{stack_name}/.gitignore"
|
18
|
+
template File.join(self.class.source_root, "common/dothtaccess"), "#{stack_name}/public/.htaccess"
|
19
|
+
template File.join(self.class.source_root, "common/Gemfile"), "#{stack_name}/Gemfile"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Pancake
|
2
|
+
module Generators
|
3
|
+
class Short < Thor::Group
|
4
|
+
include Thor::Actions
|
5
|
+
|
6
|
+
def self.source_root
|
7
|
+
File.join(File.dirname(__FILE__), "templates")
|
8
|
+
end
|
9
|
+
|
10
|
+
namespace "short"
|
11
|
+
argument :stack_name, :banner => "Name of stack"
|
12
|
+
|
13
|
+
desc "Generates a short stack"
|
14
|
+
def stack
|
15
|
+
say "Creating The Short Stack For #{stack_name}"
|
16
|
+
directory "short/%stack_name%", stack_name
|
17
|
+
template File.join(self.class.source_root, "common/dotgitignore"), "#{stack_name}/.gitignore"
|
18
|
+
template File.join(self.class.source_root, "common/dothtaccess"), "#{stack_name}/lib/#{stack_name}/public/.htaccess"
|
19
|
+
template File.join(self.class.source_root, "common/Gemfile"), "#{stack_name}/Gemfile"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
.DS_Store
|
2
|
+
log/*
|
3
|
+
tmp/*
|
4
|
+
TAGS
|
5
|
+
*~
|
6
|
+
.#*
|
7
|
+
schema/schema.rb
|
8
|
+
schema/*_structure.sql
|
9
|
+
schema/*.sqlite3
|
10
|
+
schema/*.sqlite
|
11
|
+
schema/*.db
|
12
|
+
*.sqlite
|
13
|
+
*.sqlite3
|
14
|
+
*.db
|
15
|
+
src/*
|
16
|
+
.hgignore
|
17
|
+
.hg/*
|
18
|
+
.svn/*
|
19
|
+
gems/gems/*/
|
20
|
+
gems/specifications/*
|
21
|
+
!gems/gems/thor*/
|
22
|
+
!gems/specifications/thor*
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Sets the default handler for FastCGI scripts
|
2
|
+
AddHandler fastcgi-script .fcgi
|
3
|
+
|
4
|
+
# If Apache2 is used together with mod_fcgid,
|
5
|
+
# uncomment the line below and comment in the line
|
6
|
+
# above to set the correct script handler
|
7
|
+
#AddHandler fcgid-script .fcgi
|
8
|
+
|
9
|
+
RewriteEngine On
|
10
|
+
|
11
|
+
RewriteRule ^$ index.html [QSA]
|
12
|
+
RewriteRule ^([^.]+)$ $1.html [QSA]
|
13
|
+
RewriteCond %{REQUEST_FILENAME} !-f
|
14
|
+
RewriteRule ^(.*)$ merb.fcgi [QSA,L]
|
15
|
+
|
16
|
+
|
17
|
+
ErrorDocument 500 "<h2>Application Error</h2>Merb could not be reached"
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'pancake'
|
4
|
+
<% klass_name = ActiveSupport::Inflector.camelize(stack_name) %>
|
5
|
+
require File.join(Pancake.get_root(__FILE__), "<%= stack_name %>")
|
6
|
+
Pancake.root = Pancake.get_root(__FILE__)
|
7
|
+
THIS_STACK = <%= klass_name %>
|
8
|
+
<%= klass_name %>.load_rake_tasks!(:master => true)
|
9
|
+
|
10
|
+
require 'spec/rake/spectask'
|
11
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
12
|
+
spec.libs << 'lib' << 'spec'
|
13
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
14
|
+
end
|
15
|
+
|
16
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
17
|
+
spec.libs << 'lib' << 'spec'
|
18
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
19
|
+
spec.rcov = true
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
task :default => :spec
|
24
|
+
|
25
|
+
require 'rake/rdoctask'
|
26
|
+
Rake::RDocTask.new do |rdoc|
|
27
|
+
if File.exist?('VERSION.yml')
|
28
|
+
config = YAML.load(File.read('VERSION.yml'))
|
29
|
+
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
30
|
+
else
|
31
|
+
version = ""
|
32
|
+
end
|
33
|
+
|
34
|
+
rdoc.rdoc_dir = 'rdoc'
|
35
|
+
rdoc.title = "foo #{version}"
|
36
|
+
rdoc.rdoc_files.include('README*')
|
37
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
38
|
+
end
|
39
|
+
|
40
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'short_stack'
|
3
|
+
require 'haml'
|
4
|
+
|
5
|
+
require ::File.join(::File.expand_path(::File.dirname(__FILE__)), "<%= stack_name %>")
|
6
|
+
|
7
|
+
# get the application to run. The application in the Pancake.start block
|
8
|
+
# is the master application. It will have all requests directed to it through the
|
9
|
+
# pancake middleware
|
10
|
+
# This should be a very minimal file, but should be used when any stand alone code needs to be included
|
11
|
+
<%= ActiveSupport::Inflector.camelize(stack_name) %>.include_pancake_stack!
|
12
|
+
|
13
|
+
app = Pancake.start(:root => Pancake.get_root(__FILE__)){ <%= ActiveSupport::Inflector.camelize(stack_name) %>.stackup(:master => true) }
|
14
|
+
|
15
|
+
run app
|
@@ -0,0 +1 @@
|
|
1
|
+
require File.join(File.expand_path(File.dirname(__FILE__)), "<%= stack_name %>")
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
- inherits_from :base
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) <%= Date.today.year %> <YOUR NAME HERE>
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'pancake'
|
4
|
+
|
5
|
+
begin
|
6
|
+
require 'jeweler'
|
7
|
+
Jeweler::Tasks.new do |gem|
|
8
|
+
gem.name = "<%= stack_name %>"
|
9
|
+
gem.summary = %Q{TODO}
|
10
|
+
gem.email = "TODO"
|
11
|
+
gem.homepage = "TODO"
|
12
|
+
gem.authors = ["TODO"]
|
13
|
+
gem.add_dependency "pancake", ">=0.1.8"
|
14
|
+
gem.files = FileList["[A-Z]*", "pancake.init", "{lib,spec,rails}/**/*"]
|
15
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
|
+
end
|
17
|
+
|
18
|
+
rescue LoadError
|
19
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
20
|
+
end
|
21
|
+
|
22
|
+
require File.join(File.dirname(__FILE__), "lib", "<%= stack_name %>")
|
23
|
+
Pancake.root = Pancake.get_root(__FILE__, "lib", "<%= stack_name %>")
|
24
|
+
THIS_STACK = <%= ActiveSupport::Inflector.camelize(stack_name) %>
|
25
|
+
<%= ActiveSupport::Inflector.camelize(stack_name) %>.load_rake_tasks!(:master => true)
|
26
|
+
|
27
|
+
require 'spec/rake/spectask'
|
28
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
29
|
+
spec.libs << 'lib' << 'spec'
|
30
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
31
|
+
end
|
32
|
+
|
33
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
34
|
+
spec.libs << 'lib' << 'spec'
|
35
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
36
|
+
spec.rcov = true
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
task :default => :spec
|
41
|
+
|
42
|
+
require 'rake/rdoctask'
|
43
|
+
Rake::RDocTask.new do |rdoc|
|
44
|
+
if File.exist?('VERSION.yml')
|
45
|
+
config = YAML.load(File.read('VERSION.yml'))
|
46
|
+
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
47
|
+
else
|
48
|
+
version = ""
|
49
|
+
end
|
50
|
+
|
51
|
+
rdoc.rdoc_dir = 'rdoc'
|
52
|
+
rdoc.title = "foo #{version}"
|
53
|
+
rdoc.rdoc_files.include('README*')
|
54
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
55
|
+
end
|
56
|
+
|