hassox-pancake 0.1.6
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.
- data/LICENSE +20 -0
- data/README.textile +95 -0
- data/Rakefile +56 -0
- data/TODO +18 -0
- data/bin/jeweler +19 -0
- data/bin/pancake-gen +17 -0
- data/bin/rubyforge +19 -0
- data/lib/pancake.rb +48 -0
- data/lib/pancake/bootloaders.rb +180 -0
- data/lib/pancake/configuration.rb +140 -0
- data/lib/pancake/core_ext/class.rb +44 -0
- data/lib/pancake/core_ext/object.rb +22 -0
- data/lib/pancake/core_ext/symbol.rb +15 -0
- data/lib/pancake/errors.rb +61 -0
- data/lib/pancake/generators.rb +8 -0
- data/lib/pancake/generators/base.rb +12 -0
- data/lib/pancake/generators/flat_generator.rb +17 -0
- data/lib/pancake/generators/short_generator.rb +17 -0
- data/lib/pancake/generators/stack_generator.rb +17 -0
- data/lib/pancake/generators/templates/common/dotgitignore +22 -0
- data/lib/pancake/generators/templates/common/dothtaccess +17 -0
- data/lib/pancake/generators/templates/flat/%stack_name%/%stack_name%.rb.tt +8 -0
- data/lib/pancake/generators/templates/flat/%stack_name%/.gitignore +21 -0
- data/lib/pancake/generators/templates/flat/%stack_name%/config.ru.tt +12 -0
- data/lib/pancake/generators/templates/flat/%stack_name%/pancake.init.tt +1 -0
- data/lib/pancake/generators/templates/flat/%stack_name%/public/.empty_directory +0 -0
- data/lib/pancake/generators/templates/flat/%stack_name%/tmp/.empty_directory +0 -0
- data/lib/pancake/generators/templates/short/%stack_name%/.gitignore +21 -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 +48 -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 +5 -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 +12 -0
- data/lib/pancake/generators/templates/short/%stack_name%/lib/%stack_name%/gems/cache/.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%/tmp/.empty_directory +0 -0
- data/lib/pancake/generators/templates/short/%stack_name%/pancake.init.tt +1 -0
- data/lib/pancake/generators/templates/short/%stack_name%/spec/%stack_name%_spec.rb.tt +7 -0
- data/lib/pancake/generators/templates/short/%stack_name%/spec/spec_helper.rb.tt +9 -0
- data/lib/pancake/generators/templates/stack/%stack_name%/.gitignore +21 -0
- data/lib/pancake/generators/templates/stack/%stack_name%/LICENSE.tt +20 -0
- data/lib/pancake/generators/templates/stack/%stack_name%/README.tt +7 -0
- data/lib/pancake/generators/templates/stack/%stack_name%/Rakefile.tt +48 -0
- data/lib/pancake/generators/templates/stack/%stack_name%/VERSION.tt +1 -0
- data/lib/pancake/generators/templates/stack/%stack_name%/lib/%stack_name%.rb.tt +3 -0
- data/lib/pancake/generators/templates/stack/%stack_name%/lib/%stack_name%/config.ru.tt +12 -0
- data/lib/pancake/generators/templates/stack/%stack_name%/lib/%stack_name%/config/environments/development.rb.tt +18 -0
- data/lib/pancake/generators/templates/stack/%stack_name%/lib/%stack_name%/config/environments/production.rb.tt +18 -0
- data/lib/pancake/generators/templates/stack/%stack_name%/lib/%stack_name%/config/router.rb.tt +6 -0
- data/lib/pancake/generators/templates/stack/%stack_name%/lib/%stack_name%/gems/cache/.empty_directory +0 -0
- data/lib/pancake/generators/templates/stack/%stack_name%/lib/%stack_name%/mounts/.empty_directory +0 -0
- data/lib/pancake/generators/templates/stack/%stack_name%/lib/%stack_name%/public/.empty_directory +0 -0
- data/lib/pancake/generators/templates/stack/%stack_name%/lib/%stack_name%/tmp/.empty_directory +0 -0
- data/lib/pancake/generators/templates/stack/%stack_name%/pancake.init.tt +1 -0
- data/lib/pancake/generators/templates/stack/%stack_name%/spec/%stack_name%_spec.rb.tt +7 -0
- data/lib/pancake/generators/templates/stack/%stack_name%/spec/spec_helper.rb.tt +9 -0
- data/lib/pancake/hooks/inheritable_inner_classes.rb +60 -0
- data/lib/pancake/hooks/on_inherit.rb +34 -0
- data/lib/pancake/master.rb +87 -0
- data/lib/pancake/middleware.rb +354 -0
- data/lib/pancake/mime_types.rb +265 -0
- data/lib/pancake/mixins/publish.rb +125 -0
- data/lib/pancake/mixins/publish/action_options.rb +104 -0
- data/lib/pancake/mixins/render.rb +61 -0
- data/lib/pancake/mixins/request_helper.rb +92 -0
- data/lib/pancake/mixins/stack_helper.rb +44 -0
- data/lib/pancake/mixins/url.rb +10 -0
- data/lib/pancake/more/controller.rb +4 -0
- data/lib/pancake/more/controller/base.rb +34 -0
- data/lib/pancake/paths.rb +218 -0
- data/lib/pancake/router.rb +99 -0
- data/lib/pancake/stack/app.rb +10 -0
- data/lib/pancake/stack/bootloader.rb +79 -0
- data/lib/pancake/stack/configuration.rb +44 -0
- data/lib/pancake/stack/middleware.rb +0 -0
- data/lib/pancake/stack/router.rb +18 -0
- data/lib/pancake/stack/stack.rb +57 -0
- data/lib/pancake/stacks/short.rb +2 -0
- data/lib/pancake/stacks/short/controller.rb +105 -0
- data/lib/pancake/stacks/short/stack.rb +194 -0
- data/spec/helpers/helpers.rb +20 -0
- data/spec/helpers/matchers.rb +25 -0
- data/spec/pancake/bootloaders_spec.rb +109 -0
- data/spec/pancake/configuration_spec.rb +177 -0
- data/spec/pancake/fixtures/foo_stack/pancake.init +0 -0
- data/spec/pancake/fixtures/paths/controllers/controller1.rb +0 -0
- data/spec/pancake/fixtures/paths/controllers/controller2.rb +0 -0
- data/spec/pancake/fixtures/paths/controllers/controller3.rb +0 -0
- data/spec/pancake/fixtures/paths/models/model1.rb +0 -0
- data/spec/pancake/fixtures/paths/models/model2.rb +0 -0
- data/spec/pancake/fixtures/paths/models/model3.rb +0 -0
- data/spec/pancake/fixtures/paths/stack/controllers/controller1.rb +0 -0
- data/spec/pancake/fixtures/paths/stack/models/model3.rb +0 -0
- data/spec/pancake/fixtures/paths/stack/views/view1.erb +0 -0
- data/spec/pancake/fixtures/paths/stack/views/view1.rb +0 -0
- data/spec/pancake/fixtures/paths/stack/views/view2.erb +0 -0
- data/spec/pancake/fixtures/paths/stack/views/view2.haml +0 -0
- data/spec/pancake/fixtures/render_templates/context_template.html.erb +1 -0
- data/spec/pancake/fixtures/render_templates/erb_template.html.erb +1 -0
- data/spec/pancake/fixtures/render_templates/erb_template.json.erb +1 -0
- data/spec/pancake/fixtures/render_templates/haml_template.html.haml +1 -0
- data/spec/pancake/fixtures/render_templates/haml_template.xml.haml +1 -0
- data/spec/pancake/hooks/on_inherit_spec.rb +65 -0
- data/spec/pancake/inheritance_spec.rb +100 -0
- data/spec/pancake/middleware_spec.rb +401 -0
- data/spec/pancake/mime_types_spec.rb +234 -0
- data/spec/pancake/mixins/publish_spec.rb +94 -0
- data/spec/pancake/mixins/render_spec.rb +55 -0
- data/spec/pancake/mixins/stack_helper_spec.rb +46 -0
- data/spec/pancake/pancake_spec.rb +31 -0
- data/spec/pancake/paths_spec.rb +210 -0
- data/spec/pancake/stack/app_spec.rb +28 -0
- data/spec/pancake/stack/bootloader_spec.rb +41 -0
- data/spec/pancake/stack/middleware_spec.rb +0 -0
- data/spec/pancake/stack/router_spec.rb +266 -0
- data/spec/pancake/stack/stack_configuration_spec.rb +101 -0
- data/spec/pancake/stack/stack_spec.rb +55 -0
- data/spec/pancake/stacks/short/controller_spec.rb +287 -0
- data/spec/pancake/stacks/short/router_spec.rb +132 -0
- data/spec/pancake/stacks/short/stack_spec.rb +40 -0
- data/spec/spec_helper.rb +21 -0
- metadata +238 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require File.join(File.expand_path(File.dirname(__FILE__), "<%= stack_name %>"))
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.DS_Store
|
|
2
|
+
log/*
|
|
3
|
+
TAGS
|
|
4
|
+
*~
|
|
5
|
+
.#*
|
|
6
|
+
schema/schema.rb
|
|
7
|
+
schema/*_structure.sql
|
|
8
|
+
schema/*.sqlite3
|
|
9
|
+
schema/*.sqlite
|
|
10
|
+
schema/*.db
|
|
11
|
+
*.sqlite
|
|
12
|
+
*.sqlite3
|
|
13
|
+
*.db
|
|
14
|
+
src/*
|
|
15
|
+
.hgignore
|
|
16
|
+
.hg/*
|
|
17
|
+
.svn/*
|
|
18
|
+
gems/gems/*/
|
|
19
|
+
gems/specifications/*
|
|
20
|
+
!gems/gems/thor*/
|
|
21
|
+
!gems/specifications/thor*
|
|
@@ -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,48 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'rake'
|
|
3
|
+
|
|
4
|
+
begin
|
|
5
|
+
require 'jeweler'
|
|
6
|
+
Jeweler::Tasks.new do |gem|
|
|
7
|
+
gem.name = "<%= stack_name %>"
|
|
8
|
+
gem.summary = %Q{TODO}
|
|
9
|
+
gem.email = "TODO"
|
|
10
|
+
gem.homepage = "TODO"
|
|
11
|
+
gem.authors = ["TODO"]
|
|
12
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
rescue LoadError
|
|
16
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
require 'spec/rake/spectask'
|
|
20
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
|
21
|
+
spec.libs << 'lib' << 'spec'
|
|
22
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
|
26
|
+
spec.libs << 'lib' << 'spec'
|
|
27
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
|
28
|
+
spec.rcov = true
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
task :default => :spec
|
|
33
|
+
|
|
34
|
+
require 'rake/rdoctask'
|
|
35
|
+
Rake::RDocTask.new do |rdoc|
|
|
36
|
+
if File.exist?('VERSION.yml')
|
|
37
|
+
config = YAML.load(File.read('VERSION.yml'))
|
|
38
|
+
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
|
39
|
+
else
|
|
40
|
+
version = ""
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
rdoc.rdoc_dir = 'rdoc'
|
|
44
|
+
rdoc.title = "foo #{version}"
|
|
45
|
+
rdoc.rdoc_files.include('README*')
|
|
46
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
47
|
+
end
|
|
48
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.0.0
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
|
|
3
|
+
require 'pancake'
|
|
4
|
+
require ::File.join(::File.expand_path(::File.dirname(__FILE__)), "..", "<%= stack_name %>")
|
|
5
|
+
|
|
6
|
+
# get the application to run. The applicadtion in the Pancake.start block
|
|
7
|
+
# is the master application. It will have all requests directed to it through the
|
|
8
|
+
# pancake middleware
|
|
9
|
+
# This should be a very minimal file, but should be used when any stand alone code needs to be included
|
|
10
|
+
app = Pancake.start(:root => Pancake.get_root(__FILE__)){ <%= stack_name.camel_case %>.stackup }
|
|
11
|
+
|
|
12
|
+
run app
|
|
File without changes
|
data/lib/pancake/generators/templates/short/%stack_name%/lib/%stack_name%/mounts/.empty_directory
ADDED
|
File without changes
|
data/lib/pancake/generators/templates/short/%stack_name%/lib/%stack_name%/public/.empty_directory
ADDED
|
File without changes
|
data/lib/pancake/generators/templates/short/%stack_name%/lib/%stack_name%/tmp/.empty_directory
ADDED
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require ::File.join(::File.expand_path(::File.dirname(__FILE__)), "lib", "<%= stack_name %>")
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.DS_Store
|
|
2
|
+
log/*
|
|
3
|
+
TAGS
|
|
4
|
+
*~
|
|
5
|
+
.#*
|
|
6
|
+
schema/schema.rb
|
|
7
|
+
schema/*_structure.sql
|
|
8
|
+
schema/*.sqlite3
|
|
9
|
+
schema/*.sqlite
|
|
10
|
+
schema/*.db
|
|
11
|
+
*.sqlite
|
|
12
|
+
*.sqlite3
|
|
13
|
+
*.db
|
|
14
|
+
src/*
|
|
15
|
+
.hgignore
|
|
16
|
+
.hg/*
|
|
17
|
+
.svn/*
|
|
18
|
+
gems/gems/*/
|
|
19
|
+
gems/specifications/*
|
|
20
|
+
!gems/gems/thor*/
|
|
21
|
+
!gems/specifications/thor*
|
|
@@ -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,48 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'rake'
|
|
3
|
+
|
|
4
|
+
begin
|
|
5
|
+
require 'jeweler'
|
|
6
|
+
Jeweler::Tasks.new do |gem|
|
|
7
|
+
gem.name = "<%= stack_name %>"
|
|
8
|
+
gem.summary = %Q{TODO}
|
|
9
|
+
gem.email = "TODO"
|
|
10
|
+
gem.homepage = "TODO"
|
|
11
|
+
gem.authors = ["TODO"]
|
|
12
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
rescue LoadError
|
|
16
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
require 'spec/rake/spectask'
|
|
20
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
|
21
|
+
spec.libs << 'lib' << 'spec'
|
|
22
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
|
26
|
+
spec.libs << 'lib' << 'spec'
|
|
27
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
|
28
|
+
spec.rcov = true
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
task :default => :spec
|
|
33
|
+
|
|
34
|
+
require 'rake/rdoctask'
|
|
35
|
+
Rake::RDocTask.new do |rdoc|
|
|
36
|
+
if File.exist?('VERSION.yml')
|
|
37
|
+
config = YAML.load(File.read('VERSION.yml'))
|
|
38
|
+
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
|
39
|
+
else
|
|
40
|
+
version = ""
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
rdoc.rdoc_dir = 'rdoc'
|
|
44
|
+
rdoc.title = "foo #{version}"
|
|
45
|
+
rdoc.rdoc_files.include('README*')
|
|
46
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
47
|
+
end
|
|
48
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.0.0
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
|
|
3
|
+
require 'pancake'
|
|
4
|
+
require ::File.join(::File.expand_path(::File.dirname(__FILE__)), "..", "<%= stack_name %>")
|
|
5
|
+
|
|
6
|
+
# get the application to run. The applicadtion in the Pancake.start block
|
|
7
|
+
# is the master application. It will have all requests directed to it through the
|
|
8
|
+
# pancake middleware
|
|
9
|
+
# This should be a very minimal file, but should be used when any stand alone code needs to be included
|
|
10
|
+
app = Pancake.start(:root => Pancake.get_root(__FILE__)){ <%= stack_name.camel_case %>.stackup }
|
|
11
|
+
|
|
12
|
+
run app
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
puts "Loading Development Environment"
|
|
2
|
+
|
|
3
|
+
# Get Access
|
|
4
|
+
Pancake.configuration.configs(<%= stack_name.camel_case %> ) do |config|
|
|
5
|
+
config.foo = :foo
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
# Allows Pancake to selectively apply middlewares in the stack.
|
|
9
|
+
# If a middleware is not declared with a specific stack label then it will always be loaded
|
|
10
|
+
# You can specify Middleware to be active under particular stack labels only however.
|
|
11
|
+
#
|
|
12
|
+
# Example
|
|
13
|
+
# <%= stack_name.camel_case %>.stack(:my_middlware, :labels => [:demo, :development]).use(Middlware, :with => :opts)
|
|
14
|
+
#
|
|
15
|
+
# This would only include the middleware Middlware in stacks with either the :demo, or :development label
|
|
16
|
+
#
|
|
17
|
+
# Setting The Pancake.stack_labels will use any relevant stacks
|
|
18
|
+
Pancake.stack_labels = [:development]
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
puts "Loading Production Environment"
|
|
2
|
+
|
|
3
|
+
# Get Access
|
|
4
|
+
Pancake.configuration.configs(<%= stack_name.camel_case %> ) do |config|
|
|
5
|
+
# config.foo = :foo
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
# Allows Pancake to selectively apply middlewares in the stack.
|
|
9
|
+
# If a middleware is not declared with a specific stack label then it will always be loaded
|
|
10
|
+
# You can specify Middleware to be active under particular stack labels only however.
|
|
11
|
+
#
|
|
12
|
+
# Example
|
|
13
|
+
# <%= stack_name.camel_case %>.stack(:my_middlware, :labels => [:demo, :development]).use(Middlware, :with => :opts)
|
|
14
|
+
#
|
|
15
|
+
# This would only include the middleware Middlware in stacks with either the :demo, or :development label
|
|
16
|
+
#
|
|
17
|
+
# Setting The Pancake.stack_labels will use any relevant stacks
|
|
18
|
+
Pancake.stack_labels = [:production]
|
|
File without changes
|
data/lib/pancake/generators/templates/stack/%stack_name%/lib/%stack_name%/mounts/.empty_directory
ADDED
|
File without changes
|
data/lib/pancake/generators/templates/stack/%stack_name%/lib/%stack_name%/public/.empty_directory
ADDED
|
File without changes
|
data/lib/pancake/generators/templates/stack/%stack_name%/lib/%stack_name%/tmp/.empty_directory
ADDED
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require File.join(File.dirname(__FILE__), "lib", "<%= stack_name %>")
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
module Pancake
|
|
2
|
+
module Hooks
|
|
3
|
+
module InheritableInnerClasses
|
|
4
|
+
def self.extended(base)
|
|
5
|
+
base.class_eval do
|
|
6
|
+
class_inheritable_reader :_inhertiable_inner_classes
|
|
7
|
+
@_inhertiable_inner_classes = []
|
|
8
|
+
end
|
|
9
|
+
end # extended
|
|
10
|
+
|
|
11
|
+
# Declare inner classes to be inherited when the outer class in inherited
|
|
12
|
+
# The best way to show this is by example:
|
|
13
|
+
#
|
|
14
|
+
# @example
|
|
15
|
+
# class Foo
|
|
16
|
+
# inheritable_inner_class :Bar
|
|
17
|
+
#
|
|
18
|
+
# class Bar
|
|
19
|
+
# end
|
|
20
|
+
# end
|
|
21
|
+
#
|
|
22
|
+
# class Baz < Foo
|
|
23
|
+
# # When Foo is inherited, the following occurs
|
|
24
|
+
# class Bar < Foo::Bar; end
|
|
25
|
+
# end
|
|
26
|
+
#
|
|
27
|
+
# This provides a more organic inheritance where the child gets their own
|
|
28
|
+
# version of the inner class which is actually inherited from the parents inner class.
|
|
29
|
+
# The inheritance chain remains intact.
|
|
30
|
+
#
|
|
31
|
+
# @api public
|
|
32
|
+
# @since 0.1.0
|
|
33
|
+
# @author Daniel Neighman
|
|
34
|
+
def inheritable_inner_classes(*classes)
|
|
35
|
+
_inhertiable_inner_classes
|
|
36
|
+
unless classes.empty?
|
|
37
|
+
_inhertiable_inner_classes << classes
|
|
38
|
+
_inhertiable_inner_classes.flatten!
|
|
39
|
+
end
|
|
40
|
+
_inhertiable_inner_classes
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# The inherited hook that sets up inherited inner classes. Remember if you overwrite this method, you should
|
|
44
|
+
# call super!
|
|
45
|
+
#
|
|
46
|
+
# @api private
|
|
47
|
+
# @since 0.1.0
|
|
48
|
+
# @author Daniel Neighman
|
|
49
|
+
def inherited(base)
|
|
50
|
+
super
|
|
51
|
+
class_defs = inheritable_inner_classes.map do |klass|
|
|
52
|
+
"class #{klass} < superclass::#{klass}; end\n"
|
|
53
|
+
end
|
|
54
|
+
# puts "#{base.name} is INHERITING INNER CLASSES #{class_defs.inspect}"
|
|
55
|
+
base.class_eval(class_defs.join)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
end # InheritableInnerClasses
|
|
59
|
+
end # Hooks
|
|
60
|
+
end # Pancake
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
module Pancake
|
|
2
|
+
module Hooks
|
|
3
|
+
module OnInherit
|
|
4
|
+
def self.extended(base)
|
|
5
|
+
base.class_eval do
|
|
6
|
+
class_inheritable_reader :_on_inherit
|
|
7
|
+
@_on_inherit = []
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# Provides an inheritance hook to all extended classes
|
|
12
|
+
# Allows ou to hook into the inheritance
|
|
13
|
+
def inherited(base)
|
|
14
|
+
super
|
|
15
|
+
_on_inherit.each{|b| b.call(base,self)}
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# A hook to add code when the stack is inherited
|
|
19
|
+
# The code will be executed when the class is inherited
|
|
20
|
+
#
|
|
21
|
+
# @example
|
|
22
|
+
# MyClass.on_inherit do |base, parent|
|
|
23
|
+
# # do stuff here between the child and parent
|
|
24
|
+
# end
|
|
25
|
+
#
|
|
26
|
+
# @api public
|
|
27
|
+
# @author Daniel Neighman
|
|
28
|
+
def on_inherit(&block)
|
|
29
|
+
_on_inherit << block if block
|
|
30
|
+
_on_inherit
|
|
31
|
+
end
|
|
32
|
+
end # OnInherit
|
|
33
|
+
end # Hooks
|
|
34
|
+
end # Pancake
|