bivouac 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +15 -0
- data/bin/bivouac +5 -10
- data/doc/rdoc/classes/BivouacHelpers/HtmlView.html +46 -37
- data/doc/rdoc/classes/BivouacHelpers/ScriptAculoUsView.html +27 -20
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/README.html +45 -1
- data/doc/rdoc/files/lib/bivouac/helpers/view/goh/html_rb.html +1 -1
- data/doc/rdoc/files/lib/bivouac/helpers/view/goh/javascript_rb.html +1 -1
- data/doc/rdoc/files/lib/bivouac/helpers/view/goh/scriptaculous_rb.html +1 -1
- data/examples/bivouac_sample/Rakefile +0 -0
- data/examples/bivouac_sample/app/controllers/toggle_sortable.rb +2 -1
- data/examples/bivouac_sample/app/views/_sortable_result.rb +1 -1
- data/examples/bivouac_sample/script/console +0 -0
- data/examples/bivouac_sample/script/generate +0 -0
- data/examples/bivouac_sample/script/plugin +0 -0
- data/examples/bivouac_sample/script/server +0 -0
- data/examples/blog/Rakefile +56 -0
- data/examples/blog/app/blog.rb +107 -0
- data/examples/blog/app/controllers/comment.rb +17 -0
- data/examples/blog/app/controllers/index.rb +15 -0
- data/examples/blog/app/controllers/login.rb +33 -0
- data/examples/blog/app/controllers/logout.rb +15 -0
- data/examples/blog/app/controllers/not_found.rb +14 -0
- data/examples/blog/app/controllers/post.rb +48 -0
- data/examples/blog/app/helpers/_helpers.rb +30 -0
- data/examples/blog/app/helpers/blog.rb +14 -0
- data/examples/blog/app/models/comment.rb +18 -0
- data/examples/blog/app/models/post.rb +19 -0
- data/examples/blog/app/models/user.rb +12 -0
- data/examples/blog/app/views/_partials.rb +81 -0
- data/examples/blog/app/views/index/index.rb +23 -0
- data/examples/blog/app/views/layouts/default_layout.rb +40 -0
- data/examples/blog/app/views/login/login.rb +27 -0
- data/examples/blog/app/views/not_found.rb +13 -0
- data/examples/blog/app/views/post/add.rb +12 -0
- data/examples/blog/app/views/post/edit.rb +12 -0
- data/examples/blog/app/views/post/view.rb +14 -0
- data/examples/blog/config/console.rc +12 -0
- data/examples/blog/config/database.yml +3 -0
- data/examples/blog/config/environment.rb +58 -0
- data/examples/blog/db/blog.db +0 -0
- data/examples/blog/db/create.rb +11 -0
- data/examples/blog/db/migrate/001_users.rb +22 -0
- data/examples/blog/db/migrate/002_posts.rb +24 -0
- data/examples/blog/db/migrate/003_comments.rb +24 -0
- data/examples/blog/log/Blog.log +382 -0
- data/examples/{blog_goh → blog}/public/images/camping.png +0 -0
- data/examples/{blog_goh → blog}/public/index.html +3 -2
- data/examples/blog/public/javascripts/builder.js +136 -0
- data/examples/blog/public/javascripts/controls.js +965 -0
- data/examples/blog/public/javascripts/dragdrop.js +974 -0
- data/examples/blog/public/javascripts/effects.js +1122 -0
- data/examples/blog/public/javascripts/prototype.js +4320 -0
- data/examples/blog/public/javascripts/scriptaculous.js +58 -0
- data/examples/blog/public/javascripts/slider.js +275 -0
- data/examples/blog/public/javascripts/sound.js +55 -0
- data/examples/blog/public/javascripts/unittest.js +568 -0
- data/examples/blog/public/stylesheets/autocomplete.css +22 -0
- data/examples/blog/public/stylesheets/blog.css +107 -0
- data/examples/blog/script/console +12 -0
- data/examples/blog/script/generate +17 -0
- data/examples/blog/script/plugin +16 -0
- data/examples/blog/script/server +135 -0
- data/examples/blog/test/test_comment.rb +22 -0
- data/examples/blog/test/test_index.rb +22 -0
- data/examples/blog/test/test_login.rb +22 -0
- data/examples/blog/test/test_logout.rb +18 -0
- data/examples/blog/test/test_post.rb +30 -0
- data/examples/blog/test/test_post_new.rb +22 -0
- data/lib/bivouac.rb +2 -2
- data/lib/bivouac/commands/generate.rb +48 -8
- data/lib/bivouac/commands/plugin.rb +30 -15
- data/lib/bivouac/ext/filtering_camping.rb +46 -0
- data/lib/bivouac/helpers/view/goh/html.rb +9 -0
- data/lib/bivouac/helpers/view/goh/scriptaculous.rb +12 -8
- data/lib/bivouac/tasks/bivouac.rb +1 -0
- data/lib/bivouac/tasks/framework.rake +8 -8
- data/lib/bivouac/tasks/plugins.rake +17 -1
- data/lib/bivouac/template.rb +0 -0
- data/lib/bivouac/template/{application_goh.rb → application.rb} +36 -12
- data/lib/bivouac/template/application/{helpers_goh.rb → helpers.rb} +1 -1
- data/lib/bivouac/template/console.rb +2 -4
- data/lib/bivouac/template/environment.rb +1 -1
- data/lib/bivouac/template/generate.rb +0 -0
- data/lib/bivouac/template/generate/create.rb +0 -0
- data/lib/bivouac/template/generate/helper.rb +12 -0
- data/lib/bivouac/template/generate/migrate.rb +0 -0
- data/lib/bivouac/template/generate/migrate_end.rb +1 -0
- data/lib/bivouac/template/plugin.rb +6 -1
- data/lib/bivouac/template/server.rb +124 -3
- data/lib/bivouac/template/static/builder.js +19 -19
- data/lib/bivouac/template/static/controls.js +74 -74
- data/lib/bivouac/template/static/dragdrop.js +167 -166
- data/lib/bivouac/template/static/effects.js +171 -163
- data/lib/bivouac/template/static/not_found_controller.rb +8 -4
- data/lib/bivouac/template/static/prototype.js +218 -119
- data/lib/bivouac/template/static/scriptaculous.js +22 -20
- data/lib/bivouac/template/static/slider.js +39 -39
- data/lib/bivouac/template/static/sound.js +11 -11
- data/lib/bivouac/template/static/unittest.js +16 -16
- metadata +96 -60
- data/examples/blog_goh/app/blog.rb +0 -72
- data/examples/blog_goh/app/controllers/add.rb +0 -19
- data/examples/blog_goh/app/controllers/comment.rb +0 -9
- data/examples/blog_goh/app/controllers/edit.rb +0 -18
- data/examples/blog_goh/app/controllers/index.rb +0 -8
- data/examples/blog_goh/app/controllers/info.rb +0 -11
- data/examples/blog_goh/app/controllers/login.rb +0 -15
- data/examples/blog_goh/app/controllers/logout.rb +0 -8
- data/examples/blog_goh/app/controllers/view.rb +0 -9
- data/examples/blog_goh/app/models/comment.rb +0 -5
- data/examples/blog_goh/app/models/post.rb +0 -5
- data/examples/blog_goh/app/models/user.rb +0 -4
- data/examples/blog_goh/app/views/_form.rb +0 -16
- data/examples/blog_goh/app/views/_login.rb +0 -13
- data/examples/blog_goh/app/views/_post.rb +0 -9
- data/examples/blog_goh/app/views/add.rb +0 -9
- data/examples/blog_goh/app/views/edit.rb +0 -9
- data/examples/blog_goh/app/views/index.rb +0 -12
- data/examples/blog_goh/app/views/layout.rb +0 -18
- data/examples/blog_goh/app/views/login.rb +0 -6
- data/examples/blog_goh/app/views/logout.rb +0 -6
- data/examples/blog_goh/app/views/view.rb +0 -20
- data/examples/blog_goh/config/environment.rb +0 -27
- data/examples/blog_goh/db/Blog.db +0 -0
- data/examples/blog_goh/db/create.rb +0 -8
- data/examples/blog_goh/db/migrate/comment.rb +0 -15
- data/examples/blog_goh/db/migrate/post.rb +0 -15
- data/examples/blog_goh/db/migrate/user.rb +0 -15
- data/examples/blog_goh/log/Blog.log +0 -75
- data/examples/blog_goh/public/stylesheets/style.css +0 -10
- data/examples/blog_goh/script/generate +0 -3
- data/examples/blog_goh/script/server +0 -5
- data/lib/bivouac/template/application/postamble.rb +0 -195
- data/lib/camping/cookies_sessions.rb +0 -39
data/lib/bivouac.rb
CHANGED
@@ -30,11 +30,11 @@ module Bivouac
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def addControllerHelperModule( m )
|
33
|
-
@@
|
33
|
+
@@_plugins_controller_helpers << m
|
34
34
|
end
|
35
35
|
|
36
36
|
def controllerHelperModule
|
37
|
-
@@
|
37
|
+
@@_plugins_controller_helpers
|
38
38
|
end
|
39
39
|
|
40
40
|
def filePath( from, *data )
|
@@ -47,7 +47,7 @@ module Bivouac
|
|
47
47
|
|
48
48
|
def run
|
49
49
|
# If the générator is not installed, display help and exit
|
50
|
-
unless ( ["controller", "model", "migration", "view", "test"] + @@plugins_generators ).include?( @generator_type )
|
50
|
+
unless ( ["controller", "model", "migration", "view", "test", "helper"] + @@plugins_generators ).include?( @generator_type )
|
51
51
|
help
|
52
52
|
exit
|
53
53
|
end
|
@@ -62,7 +62,7 @@ module Bivouac
|
|
62
62
|
puts "Usage: script/generate generator [options] [args]"
|
63
63
|
puts ""
|
64
64
|
puts "Generators"
|
65
|
-
puts " Builtin: controller, model, migration, test"
|
65
|
+
puts " Builtin: controller, view, helper, model, migration, test"
|
66
66
|
puts " Plugins: " + @@plugins_generators.join(", ") if @@plugins_generators.size > 0
|
67
67
|
puts ""
|
68
68
|
puts "Commun options:"
|
@@ -168,11 +168,7 @@ module Bivouac
|
|
168
168
|
end
|
169
169
|
end
|
170
170
|
|
171
|
-
# DEPRECATED
|
172
171
|
def view( view_name = nil )
|
173
|
-
warn "View generator is deprecated."
|
174
|
-
return
|
175
|
-
|
176
172
|
if @app.environment.orgtype.downcase == "erb"
|
177
173
|
raise "ERB applications are no longer supported. Sorry!"
|
178
174
|
end
|
@@ -207,11 +203,55 @@ module Bivouac
|
|
207
203
|
@view_name = view.underscore
|
208
204
|
|
209
205
|
# Set destination file, passed to the template
|
210
|
-
@
|
206
|
+
@view_file = File.dirname( $0 ) + "/../app/views/" + @view_name.underscore + ".rb"
|
211
207
|
|
212
208
|
# Create view file
|
209
|
+
createFile( @view_file ) do |io|
|
210
|
+
io.puts template( "generate/view", binding )
|
211
|
+
end
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
def helper( helper_name = nil )
|
216
|
+
if @app.environment.orgtype.downcase == "erb"
|
217
|
+
raise "ERB applications are no longer supported. Sorry!"
|
218
|
+
end
|
219
|
+
|
220
|
+
# Helper options
|
221
|
+
argument_options = OptionParser.new do |opts|
|
222
|
+
opts.banner = ""
|
223
|
+
opts.separator "helper generator options:"
|
224
|
+
opts.on_tail("-h", "--help", "Show this message") do
|
225
|
+
help
|
226
|
+
puts opts
|
227
|
+
exit
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
# parse options if view name is not passed
|
232
|
+
if helper_name.nil?
|
233
|
+
argument_options.parse! @script_arguments
|
234
|
+
if @script_arguments.length < 1
|
235
|
+
help
|
236
|
+
puts argument_options
|
237
|
+
exit
|
238
|
+
end
|
239
|
+
|
240
|
+
helper_name = @script_arguments
|
241
|
+
else
|
242
|
+
helper_name = [ view_name ]
|
243
|
+
end
|
244
|
+
|
245
|
+
helper_name.each do |helper|
|
246
|
+
# Set helper name, passed to the template
|
247
|
+
@helper_name = helper.underscore
|
248
|
+
|
249
|
+
# Set destination file, passed to the template
|
250
|
+
@destination_file = File.dirname( $0 ) + "/../app/helpers/" + @helper_name.underscore + ".rb"
|
251
|
+
|
252
|
+
# Create helper file
|
213
253
|
createFile( @destination_file ) do |io|
|
214
|
-
io.puts template( "generate/
|
254
|
+
io.puts template( "generate/helper", binding )
|
215
255
|
end
|
216
256
|
end
|
217
257
|
end
|
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'bivouac/template'
|
3
3
|
require 'fileutils'
|
4
4
|
require 'open-uri'
|
5
|
-
require
|
5
|
+
require 'open3'
|
6
6
|
|
7
7
|
BASE_URL = "http://bivouac.rubyforge.org/svn/trunk/plugins/"
|
8
8
|
|
@@ -19,7 +19,7 @@ module Bivouac
|
|
19
19
|
# script/plugin install roo_s_tent will_paginate
|
20
20
|
# @script_arguments = ['roo_s_tent', 'will_paginate']
|
21
21
|
@script_arguments = argv.dup
|
22
|
-
|
22
|
+
|
23
23
|
# Application environment
|
24
24
|
@app = Bivouac::Environment.new( )
|
25
25
|
|
@@ -29,8 +29,8 @@ module Bivouac
|
|
29
29
|
def run
|
30
30
|
begin
|
31
31
|
send( @command.to_sym )
|
32
|
-
rescue
|
33
|
-
send
|
32
|
+
rescue => e
|
33
|
+
send :help
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -51,18 +51,32 @@ module Bivouac
|
|
51
51
|
def install(desc = false)
|
52
52
|
return "Install plugin" if desc
|
53
53
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
54
|
+
@script_arguments.each do |plugin|
|
55
|
+
FileUtils::cd( ENV['BIVOUAC_ROOT'] + '/plugins' )
|
56
|
+
|
57
|
+
r = true
|
58
|
+
begin
|
59
|
+
# r = system "svn", "co", "#{BASE_URL}#{plugin}"
|
60
|
+
cmdin, cmdout, cmderr = Open3.popen3( "svn co #{BASE_URL}#{plugin}" )
|
61
|
+
if cmderr.read.size > 0
|
62
|
+
r = false
|
63
|
+
else
|
64
|
+
puts cmdout.read
|
65
|
+
end
|
66
|
+
rescue => e
|
67
|
+
r = false
|
68
|
+
end
|
69
|
+
|
70
|
+
if r == false
|
71
|
+
get_with_http( BASE_URL, plugin )
|
72
|
+
end
|
59
73
|
end
|
60
74
|
end
|
61
75
|
|
62
76
|
def list(desc = false)
|
63
77
|
return "List available plugins" if desc
|
64
78
|
|
65
|
-
plugins_path =
|
79
|
+
plugins_path = ENV['BIVOUAC_ROOT'] + "/plugins/"
|
66
80
|
installed_plugins = Dir.glob( plugins_path + "*" ).map { |p| p.gsub!( plugins_path, "" ) }
|
67
81
|
|
68
82
|
open(BASE_URL).read.each do |l|
|
@@ -77,9 +91,12 @@ module Bivouac
|
|
77
91
|
|
78
92
|
private
|
79
93
|
def get_with_http( root, dir_name )
|
80
|
-
|
94
|
+
begin
|
95
|
+
FileUtils::mkdir( dir_name )
|
96
|
+
rescue Errno::EEXIST
|
97
|
+
end
|
81
98
|
FileUtils::cd( dir_name )
|
82
|
-
|
99
|
+
|
83
100
|
open( root + dir_name ).read.each do |l|
|
84
101
|
if m = /<li><a href="([^"]*)">(\1)<\/a><\/li>/.match( l )
|
85
102
|
file_name = m[1]
|
@@ -99,6 +116,4 @@ module Bivouac
|
|
99
116
|
FileUtils::cd( ".." )
|
100
117
|
end
|
101
118
|
end
|
102
|
-
end
|
103
|
-
|
104
|
-
Bivouac::Plugin.new( ARGV ).run( )
|
119
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# Magnus Holm
|
2
|
+
# See http://github.com/judofyr/filtering_camping/tree/master
|
3
|
+
|
4
|
+
module CampingFilters
|
5
|
+
module ClassMethods
|
6
|
+
def filters
|
7
|
+
@filters ||= {:before => [], :after => []}
|
8
|
+
end
|
9
|
+
|
10
|
+
def before(actions, &blk)
|
11
|
+
actions = [actions] unless actions.is_a?(Array)
|
12
|
+
actions.each do |action|
|
13
|
+
filters[:before] << [action, blk]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def after(actions, &blk)
|
18
|
+
actions = [actions] unless actions.is_a?(Array)
|
19
|
+
actions.each do |action|
|
20
|
+
filters[:after] << [action, blk]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.included(mod)
|
26
|
+
mod.extend(ClassMethods)
|
27
|
+
end
|
28
|
+
|
29
|
+
def run_filters(type)
|
30
|
+
o = self.class.to_s.split("::")
|
31
|
+
filters = Object.const_get(o.first).filters
|
32
|
+
filters[type].each do |filter|
|
33
|
+
if (filter[0].is_a?(Symbol) && (filter[0] == o.last.to_sym || filter[0] == :all)) ||
|
34
|
+
(filter[0].is_a?(String) && /^#{filter[0]}\/?$/ =~ @env.REQUEST_URI)
|
35
|
+
self.instance_eval(&filter[1])
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def service(*a)
|
41
|
+
run_filters(:before)
|
42
|
+
ret = super(*a)
|
43
|
+
run_filters(:after)
|
44
|
+
self
|
45
|
+
end
|
46
|
+
end
|
@@ -43,6 +43,7 @@ module BivouacHelpers
|
|
43
43
|
def javascript_include_tag( *sources )
|
44
44
|
options = sources.last.is_a?(Hash) ? sources.pop : { }
|
45
45
|
options[:type] = "text/javascript"
|
46
|
+
ie_only = options.delete( :ieOnly ) || []
|
46
47
|
|
47
48
|
if sources.include?(:defaults)
|
48
49
|
sources = sources[0..(sources.index(:defaults))] +
|
@@ -57,6 +58,14 @@ module BivouacHelpers
|
|
57
58
|
options[:src] = "/public/javascripts/#{file}"
|
58
59
|
script( options ) {}
|
59
60
|
end
|
61
|
+
ie_only.collect do |file|
|
62
|
+
file = file.to_s
|
63
|
+
file << ".js" if File.extname(file).blank?
|
64
|
+
options[:src] = "/public/javascripts/#{file}"
|
65
|
+
text "<!--[if IE]>"
|
66
|
+
script( options ) {}
|
67
|
+
text "<![endif]-->"
|
68
|
+
end
|
60
69
|
end
|
61
70
|
|
62
71
|
# Returns an html image tag for the +source+. The +source+ must be a file
|
@@ -34,16 +34,20 @@ module BivouacHelpers
|
|
34
34
|
# If you wan't to use +onChange+ and/or +onUpdate+ you can pass a javascript string
|
35
35
|
# or a Hash, if you want to call a remote function.
|
36
36
|
#
|
37
|
+
# Important: For this to work, the elements contained in your Sortable must have id
|
38
|
+
# attributes in the following form:
|
39
|
+
# id="string_identifier"
|
40
|
+
#
|
37
41
|
# Example:
|
38
42
|
# ul( :id => 'my_list' ) do
|
39
|
-
# li "Google"
|
40
|
-
# li "Yahoo"
|
41
|
-
# li "Accoona"
|
42
|
-
# li "Ask.com"
|
43
|
-
# li "Baidu"
|
44
|
-
# li "Exalead"
|
45
|
-
# li "Voila"
|
46
|
-
# li "Lycos"
|
43
|
+
# li "Google", :id => "crawler_1"
|
44
|
+
# li "Yahoo", :id => "crawler_2"
|
45
|
+
# li "Accoona", :id => "crawler_3"
|
46
|
+
# li "Ask.com", :id => "crawler_4"
|
47
|
+
# li "Baidu", :id => "crawler_5"
|
48
|
+
# li "Exalead", :id => "crawler_6"
|
49
|
+
# li "Voila", :id => "crawler_7"
|
50
|
+
# li "Lycos", :id => "crawler_8"
|
47
51
|
# end
|
48
52
|
# sortable_element( 'my_list',
|
49
53
|
# :onChange => {
|
@@ -22,6 +22,7 @@ config = Bivouac::Environment.new( )
|
|
22
22
|
@conf = config.environment
|
23
23
|
@conf.versions = @app_versions
|
24
24
|
@conf.session = config.environment.session_type if config.environment.session_type
|
25
|
+
@conf.host ||= @conf.address
|
25
26
|
|
26
27
|
def update_version( opts )
|
27
28
|
@conf.versions << opts
|
@@ -76,7 +76,7 @@ namespace :bivouac do
|
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
-
desc "Update app/#{@conf.appfile}.rb,
|
79
|
+
desc "Update app/#{@conf.appfile}.rb, helpers/_helpers.rb and controllers/not_found.rb"
|
80
80
|
task :app => [ "do_app", "configs" ]
|
81
81
|
task :do_app do
|
82
82
|
if @app_versions[:app] != BIVOUAC_VERSION or ["true", "1"].include?(ENV['FORCE'])
|
@@ -84,19 +84,19 @@ namespace :bivouac do
|
|
84
84
|
@conf.versions << { :app => BIVOUAC_VERSION }
|
85
85
|
@force = true
|
86
86
|
|
87
|
-
# Create Application Postamble file
|
88
|
-
createFile( "config/postamble.rb", false, true ) { |io|
|
89
|
-
io.puts template( "application/postamble" )
|
90
|
-
}
|
91
|
-
|
92
87
|
# Create Application file
|
93
88
|
createFile( "app/#{@conf.appfile}.rb", false, true ) { |io|
|
94
|
-
io.puts template( "
|
89
|
+
io.puts template( "application" )
|
95
90
|
}
|
96
91
|
|
97
92
|
# Create Application Helpers Loader file
|
98
93
|
createFile( "app/helpers/_helpers.rb", false, true ) { |io|
|
99
|
-
io.puts template( "application/
|
94
|
+
io.puts template( "application/helpers" )
|
95
|
+
}
|
96
|
+
|
97
|
+
# Create not_found controller
|
98
|
+
createFile( "app/controllers/not_found.rb" ) { |io|
|
99
|
+
io.puts template( "static/not_found_controller" )
|
100
100
|
}
|
101
101
|
end
|
102
102
|
end
|
@@ -1,10 +1,26 @@
|
|
1
|
+
require 'bivouac/commands/plugin'
|
2
|
+
|
1
3
|
namespace :plugin do
|
2
4
|
desc "List installed plugins"
|
3
5
|
task :list do
|
4
6
|
Dir.glob( BIVOUAC_ROOT + '/plugins/**' ).each do |p|
|
5
7
|
pn = p.gsub( /.*\//, "" )
|
6
|
-
|
8
|
+
puts "#{pn} : "
|
7
9
|
Rake::Task["plugin:#{pn}:desc"].invoke
|
10
|
+
puts
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
desc "Update installed plugins"
|
15
|
+
task :update do
|
16
|
+
Dir.glob( BIVOUAC_ROOT + '/plugins/**' ).each do |p|
|
17
|
+
pn = p.gsub( /.*\//, "" )
|
18
|
+
puts "** Update plugin #{pn}"
|
19
|
+
Bivouac::Plugin.new( ['install', pn] ).run( )
|
20
|
+
begin
|
21
|
+
Rake::Task["plugin:#{pn}:install"].invoke
|
22
|
+
rescue
|
23
|
+
end
|
8
24
|
end
|
9
25
|
end
|
10
26
|
|
data/lib/bivouac/template.rb
CHANGED
File without changes
|
@@ -10,22 +10,30 @@
|
|
10
10
|
# USE script/generate helper my_helper
|
11
11
|
#
|
12
12
|
require 'rubygems'
|
13
|
+
|
13
14
|
require 'camping'
|
15
|
+
require 'camping/ar'
|
16
|
+
require 'markaby'
|
17
|
+
|
14
18
|
require 'mime/types'
|
19
|
+
|
15
20
|
require 'bivouac'
|
16
|
-
require 'bivouac/
|
21
|
+
require 'bivouac/ext/filtering_camping'
|
22
|
+
# require 'bivouac/filter'
|
17
23
|
|
18
24
|
<% if @conf.session == :db %>
|
19
|
-
require 'camping/session'
|
25
|
+
require 'camping/ar/session'
|
20
26
|
module <%= @conf.appname %>
|
21
|
-
include Bivouac::Filters
|
22
|
-
include
|
27
|
+
# include Bivouac::Filters
|
28
|
+
include CampingFilters
|
29
|
+
include Camping::ARSession
|
23
30
|
end
|
24
31
|
<% else %>
|
25
|
-
require 'camping/
|
32
|
+
require 'camping/session'
|
26
33
|
module <%= @conf.appname %>
|
27
|
-
include Bivouac::Filters
|
28
|
-
include
|
34
|
+
# include Bivouac::Filters
|
35
|
+
include CampingFilters
|
36
|
+
include Camping::Session
|
29
37
|
@@state_secret = "You want a really really long string of rubbish nobody could ever ever guess! Don't tell anyone! Not even your girlfriend or dog!"
|
30
38
|
end
|
31
39
|
<% end %>
|
@@ -89,10 +97,31 @@ end
|
|
89
97
|
# If you don't want to use layout add
|
90
98
|
# layout :none
|
91
99
|
# in your controller
|
100
|
+
#
|
101
|
+
# use xml|json|js|<none> render :view to render as xml, json, js or html
|
92
102
|
module <%= @conf.appname %>::Helpers
|
93
103
|
def layout( l )
|
94
104
|
@layout = l
|
95
105
|
end
|
106
|
+
|
107
|
+
def xml( r )
|
108
|
+
layout :none
|
109
|
+
@headers['Content-Type'] = 'application/xml'
|
110
|
+
r
|
111
|
+
end
|
112
|
+
|
113
|
+
def json( r )
|
114
|
+
layout :none
|
115
|
+
@headers['Content-Type'] = 'text/x-json'
|
116
|
+
r
|
117
|
+
end
|
118
|
+
|
119
|
+
def js( r )
|
120
|
+
layout :none
|
121
|
+
@headers['Content-Type'] = 'text/javascript'
|
122
|
+
r
|
123
|
+
end
|
124
|
+
|
96
125
|
end
|
97
126
|
module <%= @conf.appname %>::Views
|
98
127
|
def layout
|
@@ -104,8 +133,3 @@ module <%= @conf.appname %>::Views
|
|
104
133
|
end
|
105
134
|
end
|
106
135
|
end
|
107
|
-
|
108
|
-
# Load postamble and configuration
|
109
|
-
if __FILE__ == $0
|
110
|
-
files( '../config' ) { |file| require( file ) }
|
111
|
-
end
|
@@ -26,5 +26,5 @@ helpers = [
|
|
26
26
|
<%= @conf.appname %>.module_eval "class Mab < Markaby::Builder; include #{helpers.join(', ')}; end"
|
27
27
|
|
28
28
|
if controllerHelperModule.size > 0
|
29
|
-
|
29
|
+
<%= @conf.appname %>.class_eval "include #{controllerHelperModule.join(', ')}"
|
30
30
|
end
|