merb 0.5.3 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +0 -20
- data/README +0 -277
- data/Rakefile +80 -199
- data/TODO +0 -3
- metadata +19 -438
- data/SVN_REVISION +0 -1
- data/app_generators/merb/USAGE +0 -5
- data/app_generators/merb/merb_generator.rb +0 -108
- data/app_generators/merb/templates/Rakefile +0 -124
- data/app_generators/merb/templates/app/controllers/application.rb +0 -3
- data/app_generators/merb/templates/app/controllers/exceptions.rb +0 -13
- data/app_generators/merb/templates/app/helpers/global_helper.rb +0 -5
- data/app_generators/merb/templates/app/mailers/views/layout/application.html.erb +0 -1
- data/app_generators/merb/templates/app/mailers/views/layout/application.text.erb +0 -1
- data/app_generators/merb/templates/app/parts/views/layout/application.html.erb +0 -1
- data/app_generators/merb/templates/app/views/exceptions/internal_server_error.html.erb +0 -216
- data/app_generators/merb/templates/app/views/exceptions/not_acceptable.html.erb +0 -38
- data/app_generators/merb/templates/app/views/exceptions/not_found.html.erb +0 -40
- data/app_generators/merb/templates/app/views/layout/application.html.erb +0 -11
- data/app_generators/merb/templates/config/boot.rb +0 -11
- data/app_generators/merb/templates/config/dependencies.rb +0 -41
- data/app_generators/merb/templates/config/environments/development.rb +0 -1
- data/app_generators/merb/templates/config/environments/production.rb +0 -1
- data/app_generators/merb/templates/config/environments/test.rb +0 -1
- data/app_generators/merb/templates/config/merb.yml +0 -82
- data/app_generators/merb/templates/config/merb_init.rb +0 -17
- data/app_generators/merb/templates/config/plugins.yml +0 -1
- data/app_generators/merb/templates/config/router.rb +0 -35
- data/app_generators/merb/templates/config/upload.conf +0 -0
- data/app_generators/merb/templates/public/images/merb.jpg +0 -0
- data/app_generators/merb/templates/public/merb.fcgi +0 -6
- data/app_generators/merb/templates/public/stylesheets/master.css +0 -119
- data/app_generators/merb/templates/script/destroy +0 -32
- data/app_generators/merb/templates/script/generate +0 -32
- data/app_generators/merb/templates/script/stop_merb +0 -13
- data/app_generators/merb/templates/script/win_script.cmd +0 -1
- data/app_generators/merb/templates/spec/spec.opts +0 -6
- data/app_generators/merb/templates/spec/spec_helper.rb +0 -15
- data/app_generators/merb/templates/test/test_helper.rb +0 -14
- data/app_generators/merb_plugin/USAGE +0 -5
- data/app_generators/merb_plugin/merb_plugin_generator.rb +0 -68
- data/app_generators/merb_plugin/templates/LICENSE +0 -20
- data/app_generators/merb_plugin/templates/README +0 -4
- data/app_generators/merb_plugin/templates/Rakefile +0 -35
- data/app_generators/merb_plugin/templates/TODO +0 -5
- data/app_generators/merb_plugin/templates/merbtasks.rb +0 -6
- data/app_generators/merb_plugin/templates/sampleplugin.rb +0 -10
- data/app_generators/merb_plugin/templates/sampleplugin_spec.rb +0 -7
- data/app_generators/merb_plugin/templates/spec_helper.rb +0 -2
- data/bin/merb +0 -4
- data/lib/autotest/discover.rb +0 -3
- data/lib/autotest/merb_rspec.rb +0 -80
- data/lib/merb.rb +0 -188
- data/lib/merb/abstract_controller.rb +0 -399
- data/lib/merb/assets.rb +0 -160
- data/lib/merb/assets.rb.orig +0 -119
- data/lib/merb/boot_loader.rb +0 -286
- data/lib/merb/boot_loader.rb.orig +0 -235
- data/lib/merb/caching.rb +0 -5
- data/lib/merb/caching/action_cache.rb +0 -92
- data/lib/merb/caching/fragment_cache.rb +0 -39
- data/lib/merb/caching/store/file_cache.rb +0 -90
- data/lib/merb/caching/store/memory_cache.rb +0 -85
- data/lib/merb/config.rb +0 -290
- data/lib/merb/constants.rb +0 -50
- data/lib/merb/controller.rb +0 -220
- data/lib/merb/cookies.rb +0 -95
- data/lib/merb/core_ext.rb +0 -15
- data/lib/merb/core_ext/array.rb +0 -0
- data/lib/merb/core_ext/class.rb +0 -180
- data/lib/merb/core_ext/enumerable.rb +0 -49
- data/lib/merb/core_ext/get_args.rb +0 -76
- data/lib/merb/core_ext/hash.rb +0 -306
- data/lib/merb/core_ext/inflections.rb +0 -112
- data/lib/merb/core_ext/inflector.rb +0 -275
- data/lib/merb/core_ext/kernel.rb +0 -242
- data/lib/merb/core_ext/mash.rb +0 -88
- data/lib/merb/core_ext/module.rb +0 -67
- data/lib/merb/core_ext/numeric.rb +0 -72
- data/lib/merb/core_ext/object.rb +0 -183
- data/lib/merb/core_ext/string.rb +0 -53
- data/lib/merb/core_ext/symbol.rb +0 -6
- data/lib/merb/dispatcher.rb +0 -109
- data/lib/merb/drb_server.rb +0 -19
- data/lib/merb/erubis_ext.rb +0 -10
- data/lib/merb/exceptions.rb +0 -192
- data/lib/merb/generators/merb_app/merb_app.rb +0 -22
- data/lib/merb/generators/merb_generator_helpers.rb +0 -318
- data/lib/merb/generators/merb_plugin.rb +0 -22
- data/lib/merb/logger.rb +0 -78
- data/lib/merb/mail_controller.rb +0 -268
- data/lib/merb/mailer.rb +0 -87
- data/lib/merb/mixins/basic_authentication.rb +0 -35
- data/lib/merb/mixins/controller.rb +0 -160
- data/lib/merb/mixins/erubis_capture.rb +0 -68
- data/lib/merb/mixins/general_controller.rb +0 -253
- data/lib/merb/mixins/inline_partial.rb +0 -32
- data/lib/merb/mixins/render.rb +0 -465
- data/lib/merb/mixins/responder.rb +0 -449
- data/lib/merb/mixins/view_context.rb +0 -558
- data/lib/merb/mixins/web_controller.rb +0 -36
- data/lib/merb/mongrel_handler.rb +0 -168
- data/lib/merb/part_controller.rb +0 -29
- data/lib/merb/plugins.rb +0 -16
- data/lib/merb/rack_adapter.rb +0 -37
- data/lib/merb/request.rb +0 -465
- data/lib/merb/router.rb +0 -646
- data/lib/merb/server.rb +0 -169
- data/lib/merb/session.rb +0 -23
- data/lib/merb/session/cookie_store.rb +0 -118
- data/lib/merb/session/mem_cache_session.rb +0 -131
- data/lib/merb/session/memory_session.rb +0 -176
- data/lib/merb/template.rb +0 -37
- data/lib/merb/template/erubis.rb +0 -68
- data/lib/merb/template/haml.rb +0 -87
- data/lib/merb/template/markaby.rb +0 -59
- data/lib/merb/template/xml_builder.rb +0 -50
- data/lib/merb/test/fake_request.rb +0 -74
- data/lib/merb/test/helper.rb +0 -260
- data/lib/merb/test/hpricot.rb +0 -136
- data/lib/merb/test/multipart.rb +0 -66
- data/lib/merb/test/rspec.rb +0 -18
- data/lib/merb/test/rspec_matchers/controller_matchers.rb +0 -117
- data/lib/merb/test/rspec_matchers/markup_matchers.rb +0 -98
- data/lib/merb/upload_handler.rb +0 -80
- data/lib/merb/upload_progress.rb +0 -48
- data/lib/merb/version.rb +0 -49
- data/lib/merb/view_context.rb +0 -79
- data/lib/tasks.rb +0 -7
- data/lib/tasks/merb.rake +0 -54
- data/merb_default_generators/model/USAGE +0 -0
- data/merb_default_generators/model/model_generator.rb +0 -16
- data/merb_default_generators/model/templates/new_model_template.erb +0 -5
- data/merb_default_generators/resource_controller/USAGE +0 -0
- data/merb_default_generators/resource_controller/resource_controller_generator.rb +0 -26
- data/merb_default_generators/resource_controller/templates/controller.rb +0 -30
- data/merb_default_generators/resource_controller/templates/edit.html.erb +0 -1
- data/merb_default_generators/resource_controller/templates/helper.rb +0 -5
- data/merb_default_generators/resource_controller/templates/index.html.erb +0 -1
- data/merb_default_generators/resource_controller/templates/new.html.erb +0 -1
- data/merb_default_generators/resource_controller/templates/show.html.erb +0 -1
- data/merb_generators/controller/USAGE +0 -5
- data/merb_generators/controller/controller_generator.rb +0 -16
- data/merb_generators/controller/templates/controller.rb +0 -8
- data/merb_generators/controller/templates/helper.rb +0 -5
- data/merb_generators/controller/templates/index.html.erb +0 -3
- data/merb_generators/part_controller/USAGE +0 -5
- data/merb_generators/part_controller/part_controller_generator.rb +0 -27
- data/merb_generators/part_controller/templates/controller.rb +0 -8
- data/merb_generators/part_controller/templates/helper.rb +0 -5
- data/merb_generators/part_controller/templates/index.html.erb +0 -3
- data/merb_generators/resource/USAGE +0 -0
- data/merb_generators/resource/resource_generator.rb +0 -67
- data/rspec_generators/merb_controller_test/merb_controller_test_generator.rb +0 -67
- data/rspec_generators/merb_controller_test/templates/controller_spec.rb +0 -8
- data/rspec_generators/merb_controller_test/templates/edit_spec.rb +0 -12
- data/rspec_generators/merb_controller_test/templates/helper_spec.rb +0 -5
- data/rspec_generators/merb_controller_test/templates/index_spec.rb +0 -12
- data/rspec_generators/merb_controller_test/templates/new_spec.rb +0 -12
- data/rspec_generators/merb_controller_test/templates/show_spec.rb +0 -5
- data/rspec_generators/merb_model_test/merb_model_test_generator.rb +0 -26
- data/rspec_generators/merb_model_test/templates/model_spec_template.erb +0 -7
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/spec/fixtures/config/environments/environment_config_test.yml +0 -1
- data/spec/fixtures/config/merb.yml +0 -18
- data/spec/fixtures/controllers/dispatch_spec_controllers.rb +0 -235
- data/spec/fixtures/controllers/render_spec_controllers.rb +0 -184
- data/spec/fixtures/foo.rb +0 -3
- data/spec/fixtures/mailers/views/layout/application.html.erb +0 -3
- data/spec/fixtures/mailers/views/layout/application.text.erb +0 -3
- data/spec/fixtures/mailers/views/test_mail_controller/eighth.html.erb +0 -1
- data/spec/fixtures/mailers/views/test_mail_controller/eighth.text.erb +0 -1
- data/spec/fixtures/mailers/views/test_mail_controller/first.html.erb +0 -1
- data/spec/fixtures/mailers/views/test_mail_controller/first.text.erb +0 -1
- data/spec/fixtures/mailers/views/test_mail_controller/ninth.html.erb +0 -1
- data/spec/fixtures/mailers/views/test_mail_controller/ninth.text.erb +0 -1
- data/spec/fixtures/mailers/views/test_mail_controller/second.text.erb +0 -1
- data/spec/fixtures/mailers/views/test_mail_controller/third.html.erb +0 -1
- data/spec/fixtures/models/router_spec_models.rb +0 -30
- data/spec/fixtures/parts/views/layout/todo_part.html.erb +0 -3
- data/spec/fixtures/parts/views/layout/todo_part.xml.erb +0 -3
- data/spec/fixtures/parts/views/todo_part/formatted_output.html.erb +0 -1
- data/spec/fixtures/parts/views/todo_part/formatted_output.js.erb +0 -1
- data/spec/fixtures/parts/views/todo_part/formatted_output.xml.erb +0 -1
- data/spec/fixtures/parts/views/todo_part/list.html.erb +0 -3
- data/spec/fixtures/sample.txt +0 -1
- data/spec/fixtures/views/erubis.html.erb +0 -1
- data/spec/fixtures/views/examples/_erubis.html.erb +0 -1
- data/spec/fixtures/views/examples/_haml.html.haml +0 -1
- data/spec/fixtures/views/examples/_markaby.html.mab +0 -1
- data/spec/fixtures/views/examples/_throw_content.html.erb +0 -6
- data/spec/fixtures/views/examples/hello.xml.builder +0 -1
- data/spec/fixtures/views/examples/js.js.erb +0 -1
- data/spec/fixtures/views/examples/template_catch_content.html.erb +0 -15
- data/spec/fixtures/views/examples/template_catch_content_from_partial.html.erb +0 -6
- data/spec/fixtures/views/examples/template_throw_content.html.erb +0 -10
- data/spec/fixtures/views/examples/template_throw_content_without_block.html.erb +0 -3
- data/spec/fixtures/views/exceptions/admin_access_required.html.erb +0 -1
- data/spec/fixtures/views/extension_template_controller/_nested_js.js.erb +0 -1
- data/spec/fixtures/views/extension_template_controller/_nested_xml.xml.erb +0 -1
- data/spec/fixtures/views/extension_template_controller/_render_partial_multiple_times.html.erb +0 -1
- data/spec/fixtures/views/extension_template_controller/erubis_templates.html.erb +0 -1
- data/spec/fixtures/views/extension_template_controller/erubis_templates.js.erb +0 -1
- data/spec/fixtures/views/extension_template_controller/erubis_templates.rhtml +0 -1
- data/spec/fixtures/views/extension_template_controller/erubis_templates.xml.erb +0 -1
- data/spec/fixtures/views/extension_template_controller/haml_index.html.haml +0 -0
- data/spec/fixtures/views/extension_template_controller/haml_templates.html.haml +0 -1
- data/spec/fixtures/views/extension_template_controller/haml_templates.js.haml +0 -1
- data/spec/fixtures/views/extension_template_controller/haml_templates.xml.haml +0 -1
- data/spec/fixtures/views/extension_template_controller/index.html.erb +0 -0
- data/spec/fixtures/views/extension_template_controller/markaby_index.html.mab +0 -0
- data/spec/fixtures/views/extension_template_controller/markaby_templates.html.mab +0 -1
- data/spec/fixtures/views/extension_template_controller/markaby_templates.js.mab +0 -1
- data/spec/fixtures/views/extension_template_controller/markaby_templates.xml.mab +0 -1
- data/spec/fixtures/views/extension_template_controller/render_multiple_partials.html.erb +0 -4
- data/spec/fixtures/views/extension_template_controller/render_nested_js.js.erb +0 -1
- data/spec/fixtures/views/extension_template_controller/render_nested_xml.xml.erb +0 -1
- data/spec/fixtures/views/haml.html.haml +0 -1
- data/spec/fixtures/views/haml.xml.haml +0 -2
- data/spec/fixtures/views/layout/application.html.erb +0 -1
- data/spec/fixtures/views/layout/application.xml.erb +0 -1
- data/spec/fixtures/views/layout/nested/example.html.erb +0 -1
- data/spec/fixtures/views/markaby.html.mab +0 -1
- data/spec/fixtures/views/nested/example/test.html.erb +0 -1
- data/spec/fixtures/views/partials/_erubis.html.erb +0 -1
- data/spec/fixtures/views/partials/_erubis_collection.html.erb +0 -1
- data/spec/fixtures/views/partials/_erubis_collection_with_locals.html.erb +0 -1
- data/spec/fixtures/views/partials/_erubis_new.html.erb +0 -1
- data/spec/fixtures/views/partials/_haml.html.haml +0 -1
- data/spec/fixtures/views/partials/_haml_collection.html.haml +0 -1
- data/spec/fixtures/views/partials/_haml_collection_with_locals.html.haml +0 -1
- data/spec/fixtures/views/partials/_haml_new.html.haml +0 -1
- data/spec/fixtures/views/partials/_markaby.html.mab +0 -1
- data/spec/fixtures/views/partials/_markaby_collection.html.mab +0 -1
- data/spec/fixtures/views/partials/_markaby_collection_with_locals.html.mab +0 -1
- data/spec/fixtures/views/partials/_markaby_new.html.mab +0 -1
- data/spec/fixtures/views/render_object_controller/render_object_with_template.html.erb +0 -1
- data/spec/fixtures/views/render_object_controller/render_object_with_template.js.erb +0 -1
- data/spec/fixtures/views/render_object_controller/render_object_with_template.xml.erb +0 -1
- data/spec/fixtures/views/template_views/interface__buffer_erubis.html.erb +0 -4
- data/spec/fixtures/views/template_views/interface__buffer_haml.html.haml +0 -7
- data/spec/fixtures/views/template_views/interface__buffer_markaby.html.mab +0 -7
- data/spec/fixtures/views/template_views/interface_capture_erubis.html.erb +0 -15
- data/spec/fixtures/views/template_views/interface_capture_haml.html.haml +0 -15
- data/spec/fixtures/views/template_views/interface_capture_markaby.html.mab +0 -4
- data/spec/fixtures/views/template_views/interface_concat_erubis.html.erb +0 -12
- data/spec/fixtures/views/template_views/interface_concat_haml.html.haml +0 -11
- data/spec/fixtures/views/template_views/interface_concat_markaby.html.mab +0 -14
- data/spec/fixtures/views/test.dir/the_template.html.erb +0 -1
- data/spec/merb/abstract_controller_spec.rb +0 -38
- data/spec/merb/assets_spec.rb +0 -207
- data/spec/merb/caching_spec.rb +0 -102
- data/spec/merb/config_spec.rb +0 -29
- data/spec/merb/controller_filters_spec.rb +0 -253
- data/spec/merb/controller_spec.rb +0 -126
- data/spec/merb/cookie_store_spec.rb +0 -72
- data/spec/merb/cookies_spec.rb +0 -96
- data/spec/merb/core_ext/class_spec.rb +0 -97
- data/spec/merb/core_ext/enumerable_spec.rb +0 -27
- data/spec/merb/core_ext/hash_spec.rb +0 -251
- data/spec/merb/core_ext/inflector_spec.rb +0 -34
- data/spec/merb/core_ext/kernel_spec.rb +0 -25
- data/spec/merb/core_ext/numeric_spec.rb +0 -26
- data/spec/merb/core_ext/object_spec.rb +0 -47
- data/spec/merb/core_ext/string_spec.rb +0 -22
- data/spec/merb/core_ext/symbol_spec.rb +0 -7
- data/spec/merb/dependency_spec.rb +0 -22
- data/spec/merb/dispatch_spec.rb +0 -528
- data/spec/merb/fake_request_spec.rb +0 -80
- data/spec/merb/generator_spec.rb +0 -248
- data/spec/merb/handler_spec.rb +0 -169
- data/spec/merb/mail_controller_spec.rb +0 -177
- data/spec/merb/mailer_spec.rb +0 -87
- data/spec/merb/multipart_spec.rb +0 -50
- data/spec/merb/part_controller_spec.rb +0 -124
- data/spec/merb/plugins_spec.rb +0 -80
- data/spec/merb/render_spec.rb +0 -469
- data/spec/merb/request_spec.rb +0 -287
- data/spec/merb/responder_spec.rb +0 -562
- data/spec/merb/router_spec.rb +0 -900
- data/spec/merb/server_spec.rb +0 -19
- data/spec/merb/template_spec.rb +0 -41
- data/spec/merb/upload_handler_spec.rb +0 -108
- data/spec/merb/version_spec.rb +0 -33
- data/spec/merb/view_context_spec.rb +0 -366
- data/spec/spec_generator_helper.rb +0 -34
- data/spec/spec_helper.rb +0 -101
- data/spec/spec_helpers/url_shared_behaviour.rb +0 -112
- data/test_unit_generators/merb_controller_test/merb_controller_test_generator.rb +0 -53
- data/test_unit_generators/merb_controller_test/templates/functional_test.rb +0 -17
- data/test_unit_generators/merb_controller_test/templates/helper_test.rb +0 -9
- data/test_unit_generators/merb_model_test/merb_model_test_generator.rb +0 -29
- data/test_unit_generators/merb_model_test/templates/model_test_unit_template.erb +0 -9
data/lib/merb/upload_progress.rb
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
module Merb
|
2
|
-
# Keeps track of the status of all currently processing uploads
|
3
|
-
class UploadProgress
|
4
|
-
include DRbUndumped if defined?(DRbUndumped)
|
5
|
-
attr_accessor :debug
|
6
|
-
def initialize
|
7
|
-
@guard = Mutex.new
|
8
|
-
@counters = {}
|
9
|
-
end
|
10
|
-
|
11
|
-
def check(upid)
|
12
|
-
@counters[upid].last rescue nil
|
13
|
-
end
|
14
|
-
|
15
|
-
def last_checked(upid)
|
16
|
-
@counters[upid].first rescue nil
|
17
|
-
end
|
18
|
-
|
19
|
-
def update_checked_time(upid)
|
20
|
-
@guard.synchronize { @counters[upid][0] = Time.now }
|
21
|
-
end
|
22
|
-
|
23
|
-
def add(upid, size)
|
24
|
-
@guard.synchronize do
|
25
|
-
@counters[upid] = [Time.now, {:size => size, :received => 0}]
|
26
|
-
puts "#{upid}: Added" if @debug
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def mark(upid, len)
|
31
|
-
return unless status = check(upid)
|
32
|
-
puts "#{upid}: Marking" if @debug
|
33
|
-
@guard.synchronize { status[:received] = status[:size] - len }
|
34
|
-
end
|
35
|
-
|
36
|
-
def finish(upid)
|
37
|
-
@guard.synchronize do
|
38
|
-
puts "#{upid}: Finished" if @debug
|
39
|
-
@counters.delete(upid)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def list
|
44
|
-
@counters.keys.sort
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
data/lib/merb/version.rb
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
module Merb
|
2
|
-
VERSION = '0.5.3' unless defined?(::Merb::VERSION)
|
3
|
-
|
4
|
-
class << self
|
5
|
-
def svn_revision
|
6
|
-
rev = if File.directory?('.git')
|
7
|
-
`git svn log --limit 1`[/r(\d+)/, 1]
|
8
|
-
elsif File.directory?('.svn')
|
9
|
-
`svn info`[/Revision: (\d+)/, 1]
|
10
|
-
end
|
11
|
-
rev = rev.to_i if rev
|
12
|
-
end
|
13
|
-
|
14
|
-
def svn_revision_filename
|
15
|
-
'SVN_REVISION'
|
16
|
-
end
|
17
|
-
|
18
|
-
def svn_revision_from_file
|
19
|
-
begin
|
20
|
-
File.open svn_revision_file_path, 'w' do |f|
|
21
|
-
f.print svn_revision
|
22
|
-
end
|
23
|
-
# catch permissions error when packaged as gem
|
24
|
-
rescue Errno::EACCES
|
25
|
-
# ... or packaged as gem, mounted on a Read-Only filesystem
|
26
|
-
rescue Errno::EROFS
|
27
|
-
end
|
28
|
-
|
29
|
-
unless (rev = File.read(svn_revision_file_path).strip).empty?
|
30
|
-
rev.to_i
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def svn_revision_file_path
|
35
|
-
File.expand_path File.join(File.dirname(__FILE__), '..', '..', svn_revision_filename)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
# Merb::RELEASE meanings:
|
40
|
-
# 'svn' : unreleased
|
41
|
-
# 'pre' : pre-release Gem candidates
|
42
|
-
# nil : released
|
43
|
-
# You should never check in to trunk with this changed. It should
|
44
|
-
# stay 'svn'. Change it to nil in release tags.
|
45
|
-
RELEASE=nil
|
46
|
-
# unless defined?(::Merb::RELEASE)
|
47
|
-
# RELEASE = "svn#{" r#{svn_revision_from_file}" if svn_revision_from_file}"
|
48
|
-
# end
|
49
|
-
end
|
data/lib/merb/view_context.rb
DELETED
@@ -1,79 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
module Merb
|
4
|
-
PROTECTED_IVARS = %w[@_new_cookie
|
5
|
-
@method
|
6
|
-
@env
|
7
|
-
@web_controller
|
8
|
-
@_body
|
9
|
-
@_fingerprint_before
|
10
|
-
@_session
|
11
|
-
@_headers
|
12
|
-
@_cookies
|
13
|
-
@_request
|
14
|
-
@_status
|
15
|
-
@_view_context_cache
|
16
|
-
@_response
|
17
|
-
@_params
|
18
|
-
@thrown_content
|
19
|
-
@_route
|
20
|
-
@_benchmarks
|
21
|
-
@_provided_formats
|
22
|
-
@_format_value
|
23
|
-
@_content_type
|
24
|
-
@_merb_unmatched
|
25
|
-
@_provided_formats
|
26
|
-
@template]
|
27
|
-
|
28
|
-
|
29
|
-
module GlobalHelper
|
30
|
-
end
|
31
|
-
# The ViewContext is really just an empty container for us to fill with
|
32
|
-
# instance variables from the controller, include helpers into and then use as
|
33
|
-
# the context object passed to Erubis when evaluating the templates.
|
34
|
-
class ViewContext
|
35
|
-
include Merb::ViewContextMixin
|
36
|
-
include Merb::WebControllerMixin
|
37
|
-
|
38
|
-
def initialize(controller)
|
39
|
-
@web_controller = controller
|
40
|
-
@_merb_partial_locals = {}
|
41
|
-
(@web_controller.instance_variables - PROTECTED_IVARS).each do |ivar|
|
42
|
-
self.instance_variable_set(ivar, @web_controller.instance_variable_get(ivar))
|
43
|
-
end
|
44
|
-
begin
|
45
|
-
self.class.class_eval(" include Merb::GlobalHelper; include Merb::#{@web_controller.class.name}Helper")
|
46
|
-
rescue NameError
|
47
|
-
Merb.logger. debug("Missing Helper: Merb::#{@web_controller.class.name}Helper")
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
# hack so markaby doesn't dup us and lose ivars.
|
52
|
-
def dup
|
53
|
-
self
|
54
|
-
end
|
55
|
-
|
56
|
-
# accessor for the view. refers to the current @web_controller object
|
57
|
-
def controller
|
58
|
-
@web_controller
|
59
|
-
end
|
60
|
-
|
61
|
-
alias_method :old_respond_to?, :respond_to?
|
62
|
-
|
63
|
-
def respond_to?(sym, include_private=false)
|
64
|
-
old_respond_to?(sym, include_private) || @web_controller.respond_to?(sym, include_private) || @_merb_partial_locals.key?(sym)
|
65
|
-
end
|
66
|
-
|
67
|
-
# catch any method calls that the controller responds to
|
68
|
-
# and delegate them back to the controller.
|
69
|
-
def method_missing(sym, *args, &blk)
|
70
|
-
if @_merb_partial_locals.key?(sym)
|
71
|
-
@_merb_partial_locals[sym]
|
72
|
-
else
|
73
|
-
@web_controller.send(sym, *args, &blk)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
end
|
78
|
-
|
79
|
-
end
|
data/lib/tasks.rb
DELETED
data/lib/tasks/merb.rake
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
def install_merb_script
|
2
|
-
script_filepath = Merb.root / 'script/merb'
|
3
|
-
FileUtils.rm script_filepath if File.exist? script_filepath
|
4
|
-
tmpl = "#!/usr/bin/env ruby\nrequire File.expand_path(File.dirname(__FILE__)+'/../config/boot')\nrequire File.expand_path(File.dirname(__FILE__)+'/../framework/merb/server')\nMerb::Server.run\n"
|
5
|
-
File.open(script_filepath, 'wb') {|f|
|
6
|
-
f.write tmpl
|
7
|
-
f.chmod(0744)
|
8
|
-
}
|
9
|
-
end
|
10
|
-
|
11
|
-
namespace :merb do
|
12
|
-
desc "freeze the merb framework into merb for portability"
|
13
|
-
task :freeze do
|
14
|
-
FileUtils.rm_rf Merb.root / 'framework'
|
15
|
-
FileUtils.cp_r Merb::framework_root, (Merb.root / 'framework')
|
16
|
-
install_merb_script
|
17
|
-
|
18
|
-
puts " Freezing Merb Framework into framework"
|
19
|
-
puts " Use script/merb to start instead of plain merb"
|
20
|
-
end
|
21
|
-
desc "unfreeze this app from the framework and use system gem."
|
22
|
-
task :unfreeze do
|
23
|
-
FileUtils.rm_rf Merb.root / 'framework'
|
24
|
-
FileUtils.rm Merb.root / 'script/merb'
|
25
|
-
|
26
|
-
puts " Removed: "
|
27
|
-
puts " - #{Merb.root / 'framework'} (recursive) "
|
28
|
-
puts " - #{Merb.root / 'script/merb'}"
|
29
|
-
end
|
30
|
-
|
31
|
-
desc "freeze the merb framework from svn, use REVISION=# to freeze a specific revision"
|
32
|
-
task :freeze_from_svn do
|
33
|
-
install_path = Merb.root / 'framework'
|
34
|
-
revision = ENV['REVISION'] || 'HEAD'
|
35
|
-
puts " Removing old framework" if File.exist? install_path
|
36
|
-
FileUtils.rm_rf install_path
|
37
|
-
|
38
|
-
puts " Freezing Merb Framework from svn, revision #{revision}"
|
39
|
-
system "svn export -r #{revision} http://svn.devjavu.com/merb/trunk/lib #{install_path}"
|
40
|
-
install_merb_script
|
41
|
-
|
42
|
-
puts " Use script/merb to start instead of plain merb"
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
46
|
-
|
47
|
-
desc "Setup the Merb Environment by requiring merb and loading your merb_init.rb"
|
48
|
-
task :merb_env do
|
49
|
-
require 'rubygems'
|
50
|
-
require 'merb'
|
51
|
-
Merb::Config[:environment] = ENV['MERB_ENV'] if ENV['MERB_ENV']
|
52
|
-
Merb.environment = Merb::Config[:environment].nil? ? 'development' : Merb::Config[:environment]
|
53
|
-
load Merb.root+'/config/merb_init.rb'
|
54
|
-
end
|
File without changes
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'merb/generators/merb_generator_helpers'
|
2
|
-
|
3
|
-
class ModelGenerator < Merb::GeneratorHelpers::ModelGeneratorBase
|
4
|
-
|
5
|
-
def initialize( *args )
|
6
|
-
super( *args )
|
7
|
-
options[:skip_migration] = true
|
8
|
-
@model_template_name = "new_model_template.erb"
|
9
|
-
@model_test_generator_name = "merb_model_test"
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.superclass
|
13
|
-
RubiGen::Base
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
File without changes
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'merb/generators/merb_generator_helpers'
|
2
|
-
|
3
|
-
class ResourceControllerGenerator < Merb::GeneratorHelpers::ControllerGeneratorBase
|
4
|
-
|
5
|
-
def initialize(*args)
|
6
|
-
runtime_options = args.last.is_a?(Hash) ? args.pop : {}
|
7
|
-
name, *actions = args.flatten
|
8
|
-
runtime_options[:actions] = %w[index show new edit]
|
9
|
-
runtime_options[:test_stub_generator] = "merb_controller_test"
|
10
|
-
super( [name], runtime_options )
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.superclass
|
14
|
-
RubiGen::Base
|
15
|
-
end
|
16
|
-
|
17
|
-
protected
|
18
|
-
def banner
|
19
|
-
<<-EOS
|
20
|
-
Creates a Merb controller, views and specs using Active Record Models
|
21
|
-
|
22
|
-
USAGE: #{$0} #{spec.name} resource_name"
|
23
|
-
EOS
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
<% klass = class_name.singularize -%>
|
2
|
-
<% ivar = class_name.snake_case.singularize -%>
|
3
|
-
class <%= class_name %> < Application
|
4
|
-
provides :xml, :js, :yaml
|
5
|
-
|
6
|
-
def index
|
7
|
-
render
|
8
|
-
end
|
9
|
-
|
10
|
-
def show
|
11
|
-
render
|
12
|
-
end
|
13
|
-
|
14
|
-
def new
|
15
|
-
render
|
16
|
-
end
|
17
|
-
|
18
|
-
def edit
|
19
|
-
render
|
20
|
-
end
|
21
|
-
|
22
|
-
def create
|
23
|
-
end
|
24
|
-
|
25
|
-
def update
|
26
|
-
end
|
27
|
-
|
28
|
-
def destroy
|
29
|
-
end
|
30
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
Edit Action for <%= class_name %>
|
@@ -1 +0,0 @@
|
|
1
|
-
Index Action for <%= class_name %>
|
@@ -1 +0,0 @@
|
|
1
|
-
New Action for <%= class_name %>
|
@@ -1 +0,0 @@
|
|
1
|
-
Show Action for <%= class_name %>
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'merb/generators/merb_generator_helpers'
|
2
|
-
|
3
|
-
class ControllerGenerator < Merb::GeneratorHelpers::ControllerGeneratorBase
|
4
|
-
|
5
|
-
def initialize(*args)
|
6
|
-
runtime_options = args.last.is_a?(Hash) ? args.pop : {}
|
7
|
-
name, *actions = args.flatten
|
8
|
-
runtime_options[:actions] = actions.empty? ? %w[index] : actions
|
9
|
-
super( [name], runtime_options )
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.superclass
|
13
|
-
RubiGen::Base
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'merb/generators/merb_generator_helpers'
|
2
|
-
|
3
|
-
class PartControllerGenerator < Merb::GeneratorHelpers::ControllerGeneratorBase
|
4
|
-
|
5
|
-
def initialize(*args)
|
6
|
-
runtime_options = args.last.is_a?(Hash) ? args.pop : {}
|
7
|
-
name, *actions = args.flatten
|
8
|
-
name += "_part"
|
9
|
-
|
10
|
-
runtime_options[:actions] = actions.empty? ? %w[index] : actions
|
11
|
-
runtime_options[:base_dest_folder] = "app/parts"
|
12
|
-
super( [name], runtime_options )
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.superclass
|
16
|
-
RubiGen::Base
|
17
|
-
end
|
18
|
-
|
19
|
-
protected
|
20
|
-
def banner
|
21
|
-
<<-EOS
|
22
|
-
Creates a Merb part_controller
|
23
|
-
|
24
|
-
USAGE: #{$0} #{spec.name} name"
|
25
|
-
EOS
|
26
|
-
end
|
27
|
-
end
|