pancake 0.1.17 → 0.1.18
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/bin/pancake-gen +16 -2
- data/lib/pancake/generators/templates/micro/%stack_name%/Rakefile.tt +40 -0
- data/lib/pancake/generators/templates/short/%stack_name%/Rakefile.tt +1 -1
- data/lib/pancake/generators/templates/short/%stack_name%/lib/%stack_name%.rb.tt +1 -0
- data/lib/pancake/mixins/render.rb +2 -2
- data/lib/pancake/mixins/request_helper.rb +7 -4
- data/lib/pancake/stack/configuration.rb +3 -2
- data/lib/pancake/stack/stack.rb +1 -1
- data/spec/pancake/mixins/request_helper_spec.rb +9 -0
- metadata +4 -3
data/Rakefile
CHANGED
@@ -16,7 +16,7 @@ begin
|
|
16
16
|
gem.add_dependency "thor"
|
17
17
|
gem.add_dependency "rack"
|
18
18
|
gem.add_dependency "tilt", ">=0.3"
|
19
|
-
gem.add_dependency "hashie", ">=0.1.
|
19
|
+
gem.add_dependency "hashie", ">=0.1.4"
|
20
20
|
gem.add_dependency "mynyml-rack-accept-media-types"
|
21
21
|
gem.require_path = 'lib'
|
22
22
|
gem.autorequire = 'pancake'
|
data/bin/pancake-gen
CHANGED
@@ -4,12 +4,26 @@ require 'thor'
|
|
4
4
|
require 'thor/runner'
|
5
5
|
require 'pancake/generators'
|
6
6
|
|
7
|
-
# TODO update for pancake to have a version
|
8
7
|
case ARGV.shift
|
9
8
|
when "short"
|
10
9
|
Pancake::Generators::Short.start
|
11
10
|
when "micro"
|
12
11
|
Pancake::Generators::Micro.start
|
12
|
+
when '-v', '--version'
|
13
|
+
version_file = File.dirname(__FILE__) + '/../VERSION'
|
14
|
+
if File.exists?(version_file) and version = File.read(version_file)
|
15
|
+
puts "Pancake Version: #{version}"
|
16
|
+
end
|
13
17
|
else
|
14
|
-
puts
|
18
|
+
puts %{
|
19
|
+
Usage: pancake-gen [type|options] /path/to/your/app
|
20
|
+
|
21
|
+
Type can be:
|
22
|
+
micro, short
|
23
|
+
|
24
|
+
Options:
|
25
|
+
-v, --version Show the version number and quit.
|
26
|
+
-h, --help Show this help message and quit.
|
27
|
+
}
|
15
28
|
end
|
29
|
+
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'pancake'
|
4
|
+
|
5
|
+
require File.join(Pancake.get_root(__FILE__), "<%= stack_name %>")
|
6
|
+
Pancake.root = Pancake.get_root(__FILE__)
|
7
|
+
THIS_STACK = <%= stack_name.camel_case %>
|
8
|
+
<%= stack_name.camel_case %>.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
|
+
|
@@ -22,7 +22,7 @@ end
|
|
22
22
|
require File.join(File.dirname(__FILE__), "lib", "<%= stack_name %>")
|
23
23
|
Pancake.root = Pancake.get_root(__FILE__, "lib", "<%= stack_name %>")
|
24
24
|
THIS_STACK = <%= stack_name.camel_case %>
|
25
|
-
<%= stack_name.camel_case %>.load_rake_tasks!
|
25
|
+
<%= stack_name.camel_case %>.load_rake_tasks!(:master => true)
|
26
26
|
|
27
27
|
require 'spec/rake/spectask'
|
28
28
|
Spec::Rake::SpecTask.new(:spec) do |spec|
|
@@ -96,8 +96,8 @@ module Pancake
|
|
96
96
|
view_context_before_render(view_context)
|
97
97
|
|
98
98
|
out = ""
|
99
|
-
|
100
|
-
|
99
|
+
|
100
|
+
if with.kind_of?(Array)
|
101
101
|
with.each do |item|
|
102
102
|
as.nil? ? (opts[name] = item) : (opts[as] = item)
|
103
103
|
out << view_context.render(template, opts)
|
@@ -18,6 +18,11 @@ module Pancake
|
|
18
18
|
end
|
19
19
|
alias_method :v, :vars
|
20
20
|
|
21
|
+
# Get the configuration for this request. This will be updated as the request makes its way through the stacks
|
22
|
+
def configuration
|
23
|
+
request.env[Pancake::Router::CONFIGURATION_KEY]
|
24
|
+
end
|
25
|
+
|
21
26
|
# Generate a url for the current stacks router.
|
22
27
|
#
|
23
28
|
# @example
|
@@ -39,8 +44,7 @@ module Pancake
|
|
39
44
|
# @api public
|
40
45
|
# @author Daniel Neighman
|
41
46
|
def url(name, opts = {})
|
42
|
-
|
43
|
-
konfig.router.generate(name, opts)
|
47
|
+
configuration.router.generate(name, opts)
|
44
48
|
end
|
45
49
|
|
46
50
|
# Generate the base url for the router that got you to this point.
|
@@ -64,8 +68,7 @@ module Pancake
|
|
64
68
|
# @api public
|
65
69
|
# @author Daniel Neighman
|
66
70
|
def base_url(opts={})
|
67
|
-
|
68
|
-
konfig.router.base_url(opts)
|
71
|
+
configuration.router.base_url(opts)
|
69
72
|
end
|
70
73
|
|
71
74
|
# Generate a url for any registered configuration with a router
|
@@ -1,5 +1,6 @@
|
|
1
1
|
module Pancake
|
2
2
|
class Stack
|
3
|
+
inheritable_inner_classes :Configuration
|
3
4
|
|
4
5
|
class Configuration < Pancake::Configuration::Base
|
5
6
|
end
|
@@ -28,7 +29,7 @@ end # Pancake
|
|
28
29
|
# Setup the default configuration for each stack
|
29
30
|
class Pancake::Stack::Configuration
|
30
31
|
default :router, lambda{ _router }, "The router for this stack"
|
31
|
-
|
32
|
+
|
32
33
|
def _router
|
33
34
|
@_router ||= begin
|
34
35
|
unless stack.nil?
|
@@ -38,7 +39,7 @@ class Pancake::Stack::Configuration
|
|
38
39
|
r.configuration = self
|
39
40
|
r
|
40
41
|
end
|
41
|
-
|
42
|
+
|
42
43
|
end
|
43
44
|
end
|
44
45
|
end
|
data/lib/pancake/stack/stack.rb
CHANGED
@@ -77,8 +77,8 @@ module Pancake
|
|
77
77
|
# @api public
|
78
78
|
def self.load_rake_tasks!(opts={})
|
79
79
|
stackup(opts) # load the application
|
80
|
+
master = opts.delete(:master) # Don't get the other stacks to boot as master
|
80
81
|
opts[:_rake_files_loaded] ||= []
|
81
|
-
|
82
82
|
# For each mounted application, load the rake tasks
|
83
83
|
self::Router.mounted_applications.each do |app|
|
84
84
|
if app.mounted_app.respond_to?(:load_rake_tasks!)
|
@@ -42,4 +42,13 @@ describe Pancake::Mixins::RequestHelper do
|
|
42
42
|
foo.v.data.should == :some_data
|
43
43
|
end
|
44
44
|
end
|
45
|
+
|
46
|
+
describe "configuration" do
|
47
|
+
it "should get the configuraiton from the env" do
|
48
|
+
env = { Pancake::Router::CONFIGURATION_KEY => "konfig"}
|
49
|
+
foo = FooBar.new
|
50
|
+
foo.env = env
|
51
|
+
foo.configuration.should == "konfig"
|
52
|
+
end
|
53
|
+
end
|
45
54
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pancake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Neighman
|
@@ -9,7 +9,7 @@ autorequire: pancake
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11-
|
12
|
+
date: 2009-11-14 00:00:00 +11:00
|
13
13
|
default_executable: pancake-gen
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -80,7 +80,7 @@ dependencies:
|
|
80
80
|
requirements:
|
81
81
|
- - ">="
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: 0.1.
|
83
|
+
version: 0.1.4
|
84
84
|
version:
|
85
85
|
- !ruby/object:Gem::Dependency
|
86
86
|
name: mynyml-rack-accept-media-types
|
@@ -127,6 +127,7 @@ files:
|
|
127
127
|
- lib/pancake/generators/templates/common/dotgitignore
|
128
128
|
- lib/pancake/generators/templates/common/dothtaccess
|
129
129
|
- lib/pancake/generators/templates/micro/%stack_name%/%stack_name%.rb.tt
|
130
|
+
- lib/pancake/generators/templates/micro/%stack_name%/Rakefile.tt
|
130
131
|
- lib/pancake/generators/templates/micro/%stack_name%/config.ru.tt
|
131
132
|
- lib/pancake/generators/templates/micro/%stack_name%/pancake_init.rb.tt
|
132
133
|
- lib/pancake/generators/templates/micro/%stack_name%/public/.empty_directory
|