rango 0.2.3 → 0.2.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -2
- data/CHANGELOG +9 -0
- data/CONTRIBUTORS +0 -1
- data/Gemfile +2 -6
- data/lib/rango.rb +10 -7
- data/lib/rango/cli.rb +1 -1
- data/lib/rango/contrib/pagination/adapters/sequel.rb +6 -2
- data/lib/rango/controller.rb +24 -20
- data/lib/rango/core_ext.rb +54 -59
- data/lib/rango/exceptions.rb +2 -2
- data/lib/rango/gv/router.rb +1 -1
- data/lib/rango/gv/scaffolding.rb +0 -1
- data/lib/rango/mailer.rb +20 -40
- data/lib/rango/mixins/action_args.rb +8 -7
- data/lib/rango/mixins/filters.rb +1 -0
- data/lib/rango/mixins/message.rb +37 -33
- data/lib/rango/mixins/rack-flash.rb +44 -0
- data/{benchmarks/stubs/merb-app/spec/spec.opts → lib/rango/orm/tasks/ripple.nake} +0 -0
- data/lib/rango/rack/request.rb +12 -15
- data/lib/rango/router.rb +7 -3
- data/lib/rango/router/adapters/crudtree.rb +8 -1
- data/lib/rango/router/adapters/rack_mount.rb +5 -1
- data/lib/rango/router/adapters/usher.rb +5 -2
- data/lib/rango/stacks/controller.rb +0 -1
- data/lib/rango/templates/exts/haml.rb +14 -15
- data/lib/rango/templates/exts/tilt.rb +16 -23
- data/lib/rango/templates/helpers.rb +10 -1
- data/lib/rango/templates/template.rb +4 -4
- data/lib/rango/utils.rb +4 -2
- data/lib/rango/version.rb +5 -0
- data/rango.gemspec +3 -2
- data/{benchmarks/stubs/merb-core/spec/spec.opts → spec/rango/cli_spec.rb} +0 -0
- data/{benchmarks/stubs/rails/log/development.log → spec/rango/contrib/pagination/adapters/sequel_spec.rb} +0 -0
- data/spec/rango/controller_spec.rb +12 -0
- data/spec/rango/core_ext_spec.rb +61 -0
- data/spec/rango/environments_spec.rb +1 -0
- data/spec/rango/exceptions_spec.rb +1 -28
- data/{benchmarks/stubs/rails/log/production.log → spec/rango/mailer_spec.rb} +0 -0
- data/spec/rango/mixins/action_args_spec.rb +0 -4
- data/spec/rango/mixins/message_spec.rb +20 -10
- data/{benchmarks/stubs/rails/log/server.log → spec/rango/mixins/rack-flash_spec.rb} +0 -0
- data/spec/rango/rack/request_spec.rb +11 -0
- data/{benchmarks/stubs/rails/log/test.log → spec/rango/router/adapters/crudtree_spec.rb} +0 -0
- data/spec/rango/templates/helpers_spec.rb +19 -5
- data/spec/rango/templates/template_spec.rb +1 -20
- data/{benchmarks/stubs/rails/public/favicon.ico → spec/rango/version_spec.rb} +0 -0
- data/spec/spec_helper.rb +18 -4
- data/stubs/stack/content/%name%.gemspec.rbt +0 -0
- data/stubs/stack/content/%name%.pre.gemspec.rbt +1 -2
- data/stubs/stack/content/.gitignore +2 -5
- data/stubs/stack/content/Gemfile.rbt +23 -46
- data/stubs/stack/content/config.ru.rbt +9 -21
- data/stubs/stack/content/init.rb.rbt +10 -10
- data/stubs/stack/content/lib/%name%.rb.rbt +37 -4
- data/stubs/stack/content/lib/%name%/initializers/01_database.rb.rbt +16 -0
- data/stubs/stack/content/lib/%name%/initializers/05_templates.rb.rbt +13 -0
- data/stubs/stack/content/lib/%name%/initializers/10_pagination.rb.rbt +8 -0
- data/stubs/stack/content/lib/%name%/initializers/15_warden.rb.rbt +26 -0
- data/stubs/stack/content/lib/%name%/initializers/45_middlewares.rb.rbt +17 -0
- data/stubs/stack/content/lib/%name%/initializers/50_router.rb.rbt +7 -0
- data/stubs/stack/content/lib/%name%/{initializers/urls.rb.rbt → urls.rb.rbt} +3 -0
- data/stubs/stack/content/lib/%name%/views.rb.rbt +4 -1
- data/stubs/stack/content/templates/index.html.haml +1 -1
- data/{gems → vendor}/cache/abstract-1.0.0.gem +0 -0
- data/vendor/cache/code-cleaner-0.8.2.gem +0 -0
- data/{gems → vendor}/cache/erubis-2.6.5.gem +0 -0
- data/vendor/cache/haml-2.2.21.gem +0 -0
- data/{gems → vendor}/cache/nake-0.0.8.gem +0 -0
- data/vendor/cache/rack-1.1.0.gem +0 -0
- data/{gems → vendor}/cache/rspec-1.3.0.gem +0 -0
- data/vendor/cache/term-ansicolor-1.0.5.gem +0 -0
- data/vendor/cache/tilt-0.8.gem +0 -0
- metadata +63 -239
- data/benchmarks/stubs/merb-app/.gitignore +0 -21
- data/benchmarks/stubs/merb-app/Rakefile +0 -35
- data/benchmarks/stubs/merb-app/app/controllers/application.rb +0 -4
- data/benchmarks/stubs/merb-app/app/controllers/exceptions.rb +0 -15
- data/benchmarks/stubs/merb-app/app/helpers/global_helpers.rb +0 -7
- data/benchmarks/stubs/merb-app/app/models/user.rb +0 -19
- data/benchmarks/stubs/merb-app/app/views/exceptions/not_acceptable.html.erb +0 -63
- data/benchmarks/stubs/merb-app/app/views/exceptions/not_found.html.erb +0 -47
- data/benchmarks/stubs/merb-app/app/views/layout/application.html.erb +0 -12
- data/benchmarks/stubs/merb-app/autotest/discover.rb +0 -4
- data/benchmarks/stubs/merb-app/autotest/merb.rb +0 -154
- data/benchmarks/stubs/merb-app/autotest/merb_rspec.rb +0 -167
- data/benchmarks/stubs/merb-app/config/database.yml +0 -33
- data/benchmarks/stubs/merb-app/config/dependencies.rb +0 -36
- data/benchmarks/stubs/merb-app/config/environments/development.rb +0 -17
- data/benchmarks/stubs/merb-app/config/environments/production.rb +0 -12
- data/benchmarks/stubs/merb-app/config/environments/rake.rb +0 -13
- data/benchmarks/stubs/merb-app/config/environments/staging.rb +0 -12
- data/benchmarks/stubs/merb-app/config/environments/test.rb +0 -14
- data/benchmarks/stubs/merb-app/config/init.rb +0 -26
- data/benchmarks/stubs/merb-app/config/rack.rb +0 -13
- data/benchmarks/stubs/merb-app/config/router.rb +0 -46
- data/benchmarks/stubs/merb-app/doc/rdoc/generators/merb_generator.rb +0 -1364
- data/benchmarks/stubs/merb-app/doc/rdoc/generators/template/merb/api_grease.js +0 -640
- data/benchmarks/stubs/merb-app/doc/rdoc/generators/template/merb/index.html.erb +0 -37
- data/benchmarks/stubs/merb-app/doc/rdoc/generators/template/merb/merb.css +0 -252
- data/benchmarks/stubs/merb-app/doc/rdoc/generators/template/merb/merb.rb +0 -353
- data/benchmarks/stubs/merb-app/doc/rdoc/generators/template/merb/merb_doc_styles.css +0 -492
- data/benchmarks/stubs/merb-app/doc/rdoc/generators/template/merb/prototype.js +0 -2515
- data/benchmarks/stubs/merb-app/merb/merb-auth/setup.rb +0 -46
- data/benchmarks/stubs/merb-app/merb/merb-auth/strategies.rb +0 -13
- data/benchmarks/stubs/merb-app/merb/session/session.rb +0 -11
- data/benchmarks/stubs/merb-app/public/.htaccess +0 -17
- data/benchmarks/stubs/merb-app/public/favicon.ico +0 -0
- data/benchmarks/stubs/merb-app/public/images/merb.jpg +0 -0
- data/benchmarks/stubs/merb-app/public/javascripts/application.js +0 -1
- data/benchmarks/stubs/merb-app/public/javascripts/jquery.js +0 -19
- data/benchmarks/stubs/merb-app/public/merb.fcgi +0 -22
- data/benchmarks/stubs/merb-app/public/robots.txt +0 -5
- data/benchmarks/stubs/merb-app/public/stylesheets/master.css +0 -119
- data/benchmarks/stubs/merb-app/spec/spec_helper.rb +0 -27
- data/benchmarks/stubs/merb-app/tasks/doc.thor +0 -151
- data/benchmarks/stubs/merb-app/tasks/merb.thor/app_script.rb +0 -33
- data/benchmarks/stubs/merb-app/tasks/merb.thor/common.rb +0 -70
- data/benchmarks/stubs/merb-app/tasks/merb.thor/gem_ext.rb +0 -127
- data/benchmarks/stubs/merb-app/tasks/merb.thor/main.thor +0 -152
- data/benchmarks/stubs/merb-app/tasks/merb.thor/ops.rb +0 -95
- data/benchmarks/stubs/merb-app/tasks/merb.thor/utils.rb +0 -42
- data/benchmarks/stubs/merb-core/.gitignore +0 -21
- data/benchmarks/stubs/merb-core/Rakefile +0 -35
- data/benchmarks/stubs/merb-core/app/controllers/application.rb +0 -4
- data/benchmarks/stubs/merb-core/app/controllers/exceptions.rb +0 -15
- data/benchmarks/stubs/merb-core/app/helpers/global_helpers.rb +0 -7
- data/benchmarks/stubs/merb-core/app/views/exceptions/not_acceptable.html.erb +0 -63
- data/benchmarks/stubs/merb-core/app/views/exceptions/not_found.html.erb +0 -47
- data/benchmarks/stubs/merb-core/app/views/layout/application.html.erb +0 -12
- data/benchmarks/stubs/merb-core/autotest/discover.rb +0 -1
- data/benchmarks/stubs/merb-core/autotest/merb.rb +0 -151
- data/benchmarks/stubs/merb-core/autotest/merb_rspec.rb +0 -167
- data/benchmarks/stubs/merb-core/config/environments/development.rb +0 -17
- data/benchmarks/stubs/merb-core/config/environments/production.rb +0 -12
- data/benchmarks/stubs/merb-core/config/environments/rake.rb +0 -13
- data/benchmarks/stubs/merb-core/config/environments/staging.rb +0 -12
- data/benchmarks/stubs/merb-core/config/environments/test.rb +0 -14
- data/benchmarks/stubs/merb-core/config/init.rb +0 -27
- data/benchmarks/stubs/merb-core/config/rack.rb +0 -13
- data/benchmarks/stubs/merb-core/config/router.rb +0 -43
- data/benchmarks/stubs/merb-core/doc/rdoc/generators/merb_generator.rb +0 -1364
- data/benchmarks/stubs/merb-core/doc/rdoc/generators/template/merb/api_grease.js +0 -640
- data/benchmarks/stubs/merb-core/doc/rdoc/generators/template/merb/index.html.erb +0 -37
- data/benchmarks/stubs/merb-core/doc/rdoc/generators/template/merb/merb.css +0 -252
- data/benchmarks/stubs/merb-core/doc/rdoc/generators/template/merb/merb.rb +0 -353
- data/benchmarks/stubs/merb-core/doc/rdoc/generators/template/merb/merb_doc_styles.css +0 -492
- data/benchmarks/stubs/merb-core/doc/rdoc/generators/template/merb/prototype.js +0 -2515
- data/benchmarks/stubs/merb-core/public/.htaccess +0 -17
- data/benchmarks/stubs/merb-core/public/favicon.ico +0 -0
- data/benchmarks/stubs/merb-core/public/images/merb.jpg +0 -0
- data/benchmarks/stubs/merb-core/public/javascripts/application.js +0 -1
- data/benchmarks/stubs/merb-core/public/merb.fcgi +0 -22
- data/benchmarks/stubs/merb-core/public/robots.txt +0 -5
- data/benchmarks/stubs/merb-core/public/stylesheets/master.css +0 -119
- data/benchmarks/stubs/merb-core/spec/spec_helper.rb +0 -22
- data/benchmarks/stubs/merb-core/tasks/merb.thor/app_script.rb +0 -33
- data/benchmarks/stubs/merb-core/tasks/merb.thor/common.rb +0 -70
- data/benchmarks/stubs/merb-core/tasks/merb.thor/gem_ext.rb +0 -127
- data/benchmarks/stubs/merb-core/tasks/merb.thor/main.thor +0 -152
- data/benchmarks/stubs/merb-core/tasks/merb.thor/ops.rb +0 -95
- data/benchmarks/stubs/merb-core/tasks/merb.thor/utils.rb +0 -42
- data/benchmarks/stubs/merb-flat/.gitignore +0 -21
- data/benchmarks/stubs/merb-flat/README.txt +0 -10
- data/benchmarks/stubs/merb-flat/Rakefile +0 -35
- data/benchmarks/stubs/merb-flat/application.rb +0 -17
- data/benchmarks/stubs/merb-flat/config/framework.rb +0 -9
- data/benchmarks/stubs/merb-flat/config/init.rb +0 -42
- data/benchmarks/stubs/merb-flat/spec/spec_helper.rb +0 -26
- data/benchmarks/stubs/merb-flat/tasks/merb.thor/app_script.rb +0 -33
- data/benchmarks/stubs/merb-flat/tasks/merb.thor/common.rb +0 -70
- data/benchmarks/stubs/merb-flat/tasks/merb.thor/gem_ext.rb +0 -127
- data/benchmarks/stubs/merb-flat/tasks/merb.thor/main.thor +0 -152
- data/benchmarks/stubs/merb-flat/tasks/merb.thor/ops.rb +0 -95
- data/benchmarks/stubs/merb-flat/tasks/merb.thor/utils.rb +0 -42
- data/benchmarks/stubs/merb-flat/views/foo.html.erb +0 -3
- data/benchmarks/stubs/merb-very-flat/.gitignore +0 -21
- data/benchmarks/stubs/merb-very-flat/Rakefile +0 -35
- data/benchmarks/stubs/merb-very-flat/merb-very-flat.rb +0 -61
- data/benchmarks/stubs/merb-very-flat/spec/spec_helper.rb +0 -26
- data/benchmarks/stubs/merb-very-flat/tasks/merb.thor/app_script.rb +0 -33
- data/benchmarks/stubs/merb-very-flat/tasks/merb.thor/common.rb +0 -70
- data/benchmarks/stubs/merb-very-flat/tasks/merb.thor/gem_ext.rb +0 -127
- data/benchmarks/stubs/merb-very-flat/tasks/merb.thor/main.thor +0 -152
- data/benchmarks/stubs/merb-very-flat/tasks/merb.thor/ops.rb +0 -95
- data/benchmarks/stubs/merb-very-flat/tasks/merb.thor/utils.rb +0 -42
- data/benchmarks/stubs/rails/README +0 -243
- data/benchmarks/stubs/rails/Rakefile +0 -10
- data/benchmarks/stubs/rails/app/controllers/application_controller.rb +0 -12
- data/benchmarks/stubs/rails/app/helpers/application_helper.rb +0 -5
- data/benchmarks/stubs/rails/config/boot.rb +0 -112
- data/benchmarks/stubs/rails/config/database.yml +0 -22
- data/benchmarks/stubs/rails/config/environment.rb +0 -43
- data/benchmarks/stubs/rails/config/environments/development.rb +0 -19
- data/benchmarks/stubs/rails/config/environments/production.rb +0 -30
- data/benchmarks/stubs/rails/config/environments/test.rb +0 -30
- data/benchmarks/stubs/rails/config/initializers/backtrace_silencers.rb +0 -9
- data/benchmarks/stubs/rails/config/initializers/inflections.rb +0 -12
- data/benchmarks/stubs/rails/config/initializers/mime_types.rb +0 -7
- data/benchmarks/stubs/rails/config/initializers/new_rails_defaults.rb +0 -21
- data/benchmarks/stubs/rails/config/initializers/session_store.rb +0 -17
- data/benchmarks/stubs/rails/config/locales/en.yml +0 -5
- data/benchmarks/stubs/rails/config/routes.rb +0 -45
- data/benchmarks/stubs/rails/doc/README_FOR_APP +0 -2
- data/benchmarks/stubs/rails/public/404.html +0 -30
- data/benchmarks/stubs/rails/public/422.html +0 -30
- data/benchmarks/stubs/rails/public/500.html +0 -30
- data/benchmarks/stubs/rails/public/images/rails.png +0 -0
- data/benchmarks/stubs/rails/public/index.html +0 -275
- data/benchmarks/stubs/rails/public/javascripts/application.js +0 -2
- data/benchmarks/stubs/rails/public/javascripts/controls.js +0 -963
- data/benchmarks/stubs/rails/public/javascripts/dragdrop.js +0 -973
- data/benchmarks/stubs/rails/public/javascripts/effects.js +0 -1128
- data/benchmarks/stubs/rails/public/javascripts/prototype.js +0 -4320
- data/benchmarks/stubs/rails/public/robots.txt +0 -5
- data/benchmarks/stubs/rails/script/about +0 -4
- data/benchmarks/stubs/rails/script/console +0 -3
- data/benchmarks/stubs/rails/script/dbconsole +0 -3
- data/benchmarks/stubs/rails/script/destroy +0 -3
- data/benchmarks/stubs/rails/script/generate +0 -3
- data/benchmarks/stubs/rails/script/performance/benchmarker +0 -3
- data/benchmarks/stubs/rails/script/performance/profiler +0 -3
- data/benchmarks/stubs/rails/script/plugin +0 -3
- data/benchmarks/stubs/rails/script/runner +0 -3
- data/benchmarks/stubs/rails/script/server +0 -3
- data/benchmarks/stubs/rails/test/performance/browsing_test.rb +0 -11
- data/benchmarks/stubs/rails/test/test_helper.rb +0 -40
- data/benchmarks/stubs/ramaze.rb +0 -0
- data/benchmarks/stubs/sinatra.rb +0 -11
- data/gems/cache/code-cleaner-0.1.gem +0 -0
- data/gems/cache/code-cleaner-0.2.gem +0 -0
- data/gems/cache/code-cleaner-0.3.gem +0 -0
- data/gems/cache/code-cleaner-0.4.gem +0 -0
- data/gems/cache/code-cleaner-0.5.gem +0 -0
- data/gems/cache/code-cleaner-0.6.gem +0 -0
- data/gems/cache/code-cleaner-0.7.gem +0 -0
- data/gems/cache/code-cleaner-0.8.1.gem +0 -0
- data/gems/cache/code-cleaner-0.8.gem +0 -0
- data/gems/cache/extlib-0.9.14.gem +0 -0
- data/gems/cache/haml-2.2.16.gem +0 -0
- data/gems/cache/haml-2.2.17.gem +0 -0
- data/gems/cache/nake-0.0.2.gem +0 -0
- data/gems/cache/nake-0.0.3.gem +0 -0
- data/gems/cache/nake-0.0.5.gem +0 -0
- data/gems/cache/nake-0.0.6.gem +0 -0
- data/gems/cache/rack-1.0.1.gem +0 -0
- data/gems/cache/rack-1.1.0.gem +0 -0
- data/gems/cache/rspec-1.2.9.gem +0 -0
- data/gems/cache/term-ansicolor-1.0.4.gem +0 -0
- data/gems/cache/tilt-0.4.gem +0 -0
- data/gems/cache/tilt-0.5.gem +0 -0
- data/lib/rango/forms/form.rb +0 -30
- data/lib/rango/helpers.rb +0 -31
- data/lib/rango/helpers/assets.rb +0 -46
- data/lib/rango/helpers/general.rb +0 -53
- data/lib/rango/helpers/syntax.rb +0 -30
- data/lib/rango/mixins/chainable.rb +0 -66
- data/lib/rango/mixins/http_caching.rb +0 -78
- data/lib/rango/router/adapters/rack_router.rb +0 -7
- data/lib/rango/templates/exts/erubis.rb +0 -65
- data/spec/rango/forms/form_spec.rb +0 -0
- data/spec/rango/helpers/assets_spec.rb +0 -0
- data/spec/rango/helpers/general_spec.rb +0 -0
- data/spec/rango/helpers/syntax_spec.rb +0 -0
- data/spec/rango/helpers_spec.rb +0 -0
- data/spec/rango/rack/middlewares/email_obfuscator_spec.rb +0 -0
- data/spec/rango/router/adapters/rack_router_spec.rb +0 -0
- data/spec/rango/templates/exts/erubis_spec.rb +0 -0
- data/spec/stubs/templates/_basic.html.erb +0 -6
- data/spec/stubs/templates/basic.html.erb +0 -6
- data/spec/stubs/templates/capture.html.erb +0 -11
- data/spec/stubs/templates/context.html.erb +0 -6
- data/spec/stubs/templates/erubis.html.erubis +0 -2
- data/spec/stubs/templates/exception.html.erb +0 -1
- data/spec/stubs/templates/inheritance/capture/erb/base.html.erb +0 -3
- data/spec/stubs/templates/inheritance/capture/erb/index.html.erb +0 -4
- data/spec/stubs/templates/inheritance/capture/erubis/base.html.erubis +0 -3
- data/spec/stubs/templates/inheritance/capture/erubis/index.html.erubis +0 -4
- data/stubs/stack/content/lib/%name%/config.rb.rbt +0 -0
- data/stubs/stack/content/lib/%name%/initializers/middlewares.rb.rbt +0 -5
- data/stubs/stack/content/rackup.rb.rbt +0 -41
- data/support/hooks/pre-commit +0 -12
@@ -1,152 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require "rubygems"
|
4
|
-
require "rubygems/source_index"
|
5
|
-
require "rubygems/dependency_installer"
|
6
|
-
require "rubygems/uninstaller"
|
7
|
-
require "fileutils"
|
8
|
-
require File.join(File.dirname(__FILE__), "utils")
|
9
|
-
require File.join(File.dirname(__FILE__), "gem_ext")
|
10
|
-
require File.join(File.dirname(__FILE__), "ops")
|
11
|
-
|
12
|
-
$INSTALLING = []
|
13
|
-
|
14
|
-
module Merb
|
15
|
-
|
16
|
-
class Gem < Thor
|
17
|
-
extend ColorfulMessages
|
18
|
-
|
19
|
-
def initialize
|
20
|
-
dirs = [Dir.pwd, File.dirname(__FILE__) / ".."]
|
21
|
-
root = dirs.find {|d| File.file?(d / "config" / "dependencies.rb")}
|
22
|
-
|
23
|
-
if root
|
24
|
-
@depsrb = root / "config" / "dependencies.rb"
|
25
|
-
else
|
26
|
-
self.class.error "dependencies.rb was not found"
|
27
|
-
exit!
|
28
|
-
end
|
29
|
-
|
30
|
-
FileUtils.mkdir_p(Dir.pwd / "gems")
|
31
|
-
|
32
|
-
@list = Collector.collect(File.read(@depsrb))
|
33
|
-
@idx = ::Gem::SourceIndex.new.load_gems_in("gems/specifications")
|
34
|
-
end
|
35
|
-
|
36
|
-
def list
|
37
|
-
require "pp"
|
38
|
-
pp @list
|
39
|
-
end
|
40
|
-
|
41
|
-
desc "redeploy", "Syncs up gems/cache with gems/gems. All gems in the cache " \
|
42
|
-
"that are not already installed will be installed from the " \
|
43
|
-
"cache. All installed gems that are not in the cache will " \
|
44
|
-
"be uninstalled."
|
45
|
-
def redeploy
|
46
|
-
gem_dir = Dir.pwd / "gems" / "gems"
|
47
|
-
cache_dir = Dir.pwd / "gems" / "cache"
|
48
|
-
|
49
|
-
gems = Dir[gem_dir / "*"].map! {|n| File.basename(n)}
|
50
|
-
cache = Dir[cache_dir / "*.gem"].map! {|n| File.basename(n, ".gem")}
|
51
|
-
new_gems = cache - gems
|
52
|
-
outdated = gems - cache
|
53
|
-
idx = ::Gem::SourceIndex.new
|
54
|
-
idx.load_gems_in(Dir.pwd / "gems" / "specifications")
|
55
|
-
|
56
|
-
new_gems.each do |g|
|
57
|
-
installer = ::Gem::Installer.new(cache_dir / "#{g}.gem",
|
58
|
-
:bin_dir => Dir.pwd / "bin",
|
59
|
-
:install_dir => Dir.pwd / "gems",
|
60
|
-
:ignore_dependencies => true,
|
61
|
-
:user_install => false,
|
62
|
-
:wrappers => true,
|
63
|
-
:source_index => idx)
|
64
|
-
|
65
|
-
installer.install
|
66
|
-
end
|
67
|
-
|
68
|
-
outdated.each do |g|
|
69
|
-
/(.*)\-(.*)/ =~ g
|
70
|
-
name, version = $1, $2
|
71
|
-
uninstaller = ::Gem::Uninstaller.new(name,
|
72
|
-
:version => version,
|
73
|
-
:bin_dir => Dir.pwd / "bin",
|
74
|
-
:install_dir => Dir.pwd / "gems",
|
75
|
-
:ignore => true,
|
76
|
-
:executables => true
|
77
|
-
)
|
78
|
-
uninstaller.uninstall
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
desc "confirm", "Confirm the current setup. merb:gem:install will " \
|
83
|
-
"automatically run this task before committing the " \
|
84
|
-
"changes it makes."
|
85
|
-
def confirm(gems = @list)
|
86
|
-
::Gem.path.replace([Dir.pwd / "gems"])
|
87
|
-
::Gem.source_index.load_gems_in(Dir.pwd / "gems" / "specifications")
|
88
|
-
|
89
|
-
self.class.info "Confirming configuration..."
|
90
|
-
|
91
|
-
::Gem.loaded_specs.clear
|
92
|
-
|
93
|
-
begin
|
94
|
-
gems.each do |name, versions|
|
95
|
-
versions ||= []
|
96
|
-
::Gem.activate name, *versions
|
97
|
-
end
|
98
|
-
rescue ::Gem::LoadError => e
|
99
|
-
self.class.error "Configuration could not be confirmed: #{e.message}"
|
100
|
-
self.class.rollback_trans
|
101
|
-
end
|
102
|
-
self.class.info "Confirmed"
|
103
|
-
end
|
104
|
-
|
105
|
-
desc 'install', 'Sync up your bundled gems with the list in config/dependencies.rb'
|
106
|
-
def install(*gems)
|
107
|
-
if gems.empty?
|
108
|
-
gems = @list
|
109
|
-
else
|
110
|
-
gems = gems.map {|desc| name, *versions = desc.split(" ") }
|
111
|
-
end
|
112
|
-
|
113
|
-
$GEMS = gems
|
114
|
-
|
115
|
-
self.class.begin_trans
|
116
|
-
|
117
|
-
gems.each do |name, versions|
|
118
|
-
dep = ::Gem::Dependency.new(name, versions || [])
|
119
|
-
unless @idx.search(dep).empty?
|
120
|
-
next
|
121
|
-
end
|
122
|
-
|
123
|
-
rescue_failures do
|
124
|
-
$INSTALLING = dep
|
125
|
-
_install(dep)
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
gem_dir = Dir.pwd / "gems" / "gems"
|
130
|
-
installed_gems = Dir[gem_dir / "*"].map! {|n| File.basename(n)}
|
131
|
-
|
132
|
-
list = full_list.map {|x| x.full_name}.compact
|
133
|
-
|
134
|
-
(installed_gems - list).each do |g|
|
135
|
-
/^(.*)\-(.*)$/ =~ g
|
136
|
-
name, version = $1, $2
|
137
|
-
uninstaller = ::Gem::Uninstaller.new(name,
|
138
|
-
:version => version,
|
139
|
-
:bin_dir => (Dir.pwd / "bin").to_s,
|
140
|
-
:install_dir => (Dir.pwd / "gems").to_s,
|
141
|
-
:ignore => true,
|
142
|
-
:executables => true
|
143
|
-
)
|
144
|
-
uninstaller.uninstall
|
145
|
-
end
|
146
|
-
|
147
|
-
confirm(gems)
|
148
|
-
|
149
|
-
self.class.commit_trans
|
150
|
-
end
|
151
|
-
end
|
152
|
-
end
|
@@ -1,95 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
module Thor::Tasks
|
4
|
-
module Merb
|
5
|
-
class Collector
|
6
|
-
attr_reader :dependencies
|
7
|
-
|
8
|
-
def self.collect(str)
|
9
|
-
collector = new
|
10
|
-
collector.instance_eval(str)
|
11
|
-
collector.dependencies
|
12
|
-
end
|
13
|
-
|
14
|
-
def initialize
|
15
|
-
@dependencies = []
|
16
|
-
end
|
17
|
-
|
18
|
-
def dependency(name, *versions)
|
19
|
-
versions.pop if versions.last.is_a?(Hash)
|
20
|
-
@dependencies << [name, versions]
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
class Gem < Thor
|
25
|
-
def full_list
|
26
|
-
@idx.load_gems_in("gems/specifications")
|
27
|
-
|
28
|
-
@list.map do |name, versions|
|
29
|
-
dep = ::Gem::Dependency.new(name, versions)
|
30
|
-
spec = @idx.search(dep).last
|
31
|
-
unless spec
|
32
|
-
self.class.error "A required dependency #{dep} was not found"
|
33
|
-
self.class.rollback_trans
|
34
|
-
end
|
35
|
-
deps = spec.recursive_dependencies(dep, @idx)
|
36
|
-
[spec] + deps
|
37
|
-
end.flatten.uniq
|
38
|
-
end
|
39
|
-
|
40
|
-
def rescue_failures(error = StandardError, prc = nil)
|
41
|
-
begin
|
42
|
-
yield
|
43
|
-
rescue error => e
|
44
|
-
if prc
|
45
|
-
prc.call(e)
|
46
|
-
else
|
47
|
-
puts e.message
|
48
|
-
puts e.backtrace
|
49
|
-
end
|
50
|
-
self.class.rollback_trans
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
def self.begin_trans
|
55
|
-
note "Beginning transaction"
|
56
|
-
FileUtils.cp_r(Dir.pwd / "gems", Dir.pwd / ".original_gems")
|
57
|
-
end
|
58
|
-
|
59
|
-
def self.commit_trans
|
60
|
-
note "Committing transaction"
|
61
|
-
FileUtils.rm_rf(Dir.pwd / ".original_gems")
|
62
|
-
end
|
63
|
-
|
64
|
-
def self.rollback_trans
|
65
|
-
if File.exist?(Dir.pwd / ".original_gems")
|
66
|
-
note "Rolling back transaction"
|
67
|
-
FileUtils.rm_rf(Dir.pwd / "gems")
|
68
|
-
FileUtils.mv(Dir.pwd / ".original_gems", Dir.pwd / "gems")
|
69
|
-
end
|
70
|
-
exit!
|
71
|
-
end
|
72
|
-
|
73
|
-
private
|
74
|
-
def _install(dep)
|
75
|
-
@idx.load_gems_in("gems/specifications")
|
76
|
-
return if @idx.search(dep).last
|
77
|
-
|
78
|
-
installer = ::Gem::DependencyInstaller.new(
|
79
|
-
:bin_dir => Dir.pwd / "bin",
|
80
|
-
:install_dir => Dir.pwd / "gems",
|
81
|
-
:user_install => false)
|
82
|
-
|
83
|
-
begin
|
84
|
-
installer.install dep.name, dep.version_requirements
|
85
|
-
rescue ::Gem::GemNotFoundException => e
|
86
|
-
puts "Cannot find #{dep}"
|
87
|
-
rescue ::Gem::RemoteFetcher::FetchError => e
|
88
|
-
puts e.message
|
89
|
-
puts "Retrying..."
|
90
|
-
retry
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
class String
|
4
|
-
def /(other)
|
5
|
-
(Pathname.new(self) + other).to_s
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
module ColorfulMessages
|
10
|
-
|
11
|
-
# red
|
12
|
-
def error(*messages)
|
13
|
-
puts messages.map { |msg| "\033[1;31m#{msg}\033[0m" }
|
14
|
-
end
|
15
|
-
|
16
|
-
# yellow
|
17
|
-
def warning(*messages)
|
18
|
-
puts messages.map { |msg| "\033[1;33m#{msg}\033[0m" }
|
19
|
-
end
|
20
|
-
|
21
|
-
# green
|
22
|
-
def success(*messages)
|
23
|
-
puts messages.map { |msg| "\033[1;32m#{msg}\033[0m" }
|
24
|
-
end
|
25
|
-
|
26
|
-
alias_method :message, :success
|
27
|
-
|
28
|
-
# magenta
|
29
|
-
def note(*messages)
|
30
|
-
puts messages.map { |msg| "\033[1;35m#{msg}\033[0m" }
|
31
|
-
end
|
32
|
-
|
33
|
-
# blue
|
34
|
-
def info(*messages)
|
35
|
-
puts messages.map { |msg| "\033[1;34m#{msg}\033[0m" }
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
|
40
|
-
module ThorUI
|
41
|
-
extend ColorfulMessages
|
42
|
-
end
|
@@ -1,21 +0,0 @@
|
|
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
|
-
merb_profile_results
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rake/rdoctask'
|
3
|
-
|
4
|
-
require 'merb-core'
|
5
|
-
require 'merb-core/tasks/merb'
|
6
|
-
|
7
|
-
include FileUtils
|
8
|
-
|
9
|
-
# Load the basic runtime dependencies; this will include
|
10
|
-
# any plugins and therefore plugin rake tasks.
|
11
|
-
init_env = ENV['MERB_ENV'] || 'rake'
|
12
|
-
Merb.load_dependencies(:environment => init_env)
|
13
|
-
|
14
|
-
# Get Merb plugins and dependencies
|
15
|
-
Merb::Plugins.rakefiles.each { |r| require r }
|
16
|
-
|
17
|
-
# Load any app level custom rakefile extensions from lib/tasks
|
18
|
-
tasks_path = File.join(File.dirname(__FILE__), "lib", "tasks")
|
19
|
-
rake_files = Dir["#{tasks_path}/*.rake"]
|
20
|
-
rake_files.each{|rake_file| load rake_file }
|
21
|
-
|
22
|
-
desc "Start runner environment"
|
23
|
-
task :merb_env do
|
24
|
-
Merb.start_environment(:environment => init_env, :adapter => 'runner')
|
25
|
-
end
|
26
|
-
|
27
|
-
require 'spec/rake/spectask'
|
28
|
-
require 'merb-core/test/tasks/spectasks'
|
29
|
-
desc 'Default: run spec examples'
|
30
|
-
task :default => 'spec'
|
31
|
-
|
32
|
-
##############################################################################
|
33
|
-
# ADD YOUR CUSTOM TASKS IN /lib/tasks
|
34
|
-
# NAME YOUR RAKE FILES file_name.rake
|
35
|
-
##############################################################################
|
@@ -1,61 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
# run very flat apps with merb -I <app file>.
|
4
|
-
|
5
|
-
# Uncomment for DataMapper ORM
|
6
|
-
# use_orm :datamapper
|
7
|
-
|
8
|
-
# Uncomment for ActiveRecord ORM
|
9
|
-
# use_orm :activerecord
|
10
|
-
|
11
|
-
# Uncomment for Sequel ORM
|
12
|
-
# use_orm :sequel
|
13
|
-
|
14
|
-
|
15
|
-
#
|
16
|
-
# ==== Pick what you test with
|
17
|
-
#
|
18
|
-
|
19
|
-
# This defines which test framework the generators will use.
|
20
|
-
# RSpec is turned on by default.
|
21
|
-
#
|
22
|
-
# To use Test::Unit, you need to install the merb_test_unit gem.
|
23
|
-
# To use RSpec, you don't have to install any additional gems, since
|
24
|
-
# merb-core provides support for RSpec.
|
25
|
-
#
|
26
|
-
# use_test :test_unit
|
27
|
-
use_test :rspec
|
28
|
-
|
29
|
-
#
|
30
|
-
# ==== Choose which template engine to use by default
|
31
|
-
#
|
32
|
-
|
33
|
-
# Merb can generate views for different template engines, choose your favourite as the default.
|
34
|
-
|
35
|
-
use_template_engine :erb
|
36
|
-
# use_template_engine :haml
|
37
|
-
|
38
|
-
Merb::Config.use { |c|
|
39
|
-
c[:framework] = { :public => [Merb.root / "public", nil] }
|
40
|
-
c[:session_store] = 'none'
|
41
|
-
c[:exception_details] = true
|
42
|
-
c[:log_level] = :debug # or error, warn, info or fatal
|
43
|
-
c[:log_stream] = STDOUT
|
44
|
-
# or use file for loggine:
|
45
|
-
# c[:log_file] = Merb.root / "log" / "merb.log"
|
46
|
-
|
47
|
-
c[:reload_classes] = true
|
48
|
-
c[:reload_templates] = true
|
49
|
-
}
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
Merb::Router.prepare do
|
54
|
-
match('/').to(:controller => 'merb-very-flat', :action =>'index')
|
55
|
-
end
|
56
|
-
|
57
|
-
class MerbVeryFlat < Merb::Controller
|
58
|
-
def index
|
59
|
-
"Hi, I am 'very flat' Merb application. I have everything in one single file and well suited for dynamic stub pages."
|
60
|
-
end
|
61
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require "rubygems"
|
4
|
-
|
5
|
-
# Add the local gems dir if found within the app root; any dependencies loaded
|
6
|
-
# hereafter will try to load from the local gems before loading system gems.
|
7
|
-
if (local_gem_dir = File.join(File.dirname(__FILE__), '..', 'gems')) && $BUNDLE.nil?
|
8
|
-
$BUNDLE = true; Gem.clear_paths; Gem.path.unshift(local_gem_dir)
|
9
|
-
end
|
10
|
-
|
11
|
-
require "spec"
|
12
|
-
require "merb-core"
|
13
|
-
|
14
|
-
Merb::Config.use do |c|
|
15
|
-
c[:session_store] = "memory"
|
16
|
-
end
|
17
|
-
|
18
|
-
Merb.start_environment(:testing => true,
|
19
|
-
:adapter => 'runner',
|
20
|
-
:environment => ENV['MERB_ENV'] || 'test')
|
21
|
-
|
22
|
-
Spec::Runner.configure do |config|
|
23
|
-
config.include(Merb::Test::ViewHelper)
|
24
|
-
config.include(Merb::Test::RouteHelper)
|
25
|
-
config.include(Merb::Test::ControllerHelper)
|
26
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
#!/usr/bin/env ruby
|
4
|
-
|
5
|
-
# This was added by Merb's bundler
|
6
|
-
|
7
|
-
require "rubygems"
|
8
|
-
require File.join(File.dirname(__FILE__), "common")
|
9
|
-
|
10
|
-
gems_dir = File.join(File.dirname(__FILE__), '..', 'gems')
|
11
|
-
|
12
|
-
if File.directory?(gems_dir)
|
13
|
-
$BUNDLE = true
|
14
|
-
Gem.clear_paths
|
15
|
-
Gem.path.replace([File.expand_path(gems_dir)])
|
16
|
-
ENV["PATH"] = "#{File.dirname(__FILE__)}:#{ENV["PATH"]}"
|
17
|
-
|
18
|
-
gem_file = File.join(gems_dir, "specifications", "<%= spec.name %>-*.gemspec")
|
19
|
-
|
20
|
-
if local_gem = Dir[gem_file].last
|
21
|
-
version = File.basename(local_gem)[/-([\.\d]+)\.gemspec$/, 1]
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
version ||= "<%= Gem::Requirement.default %>"
|
26
|
-
|
27
|
-
if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
|
28
|
-
version = $1
|
29
|
-
ARGV.shift
|
30
|
-
end
|
31
|
-
|
32
|
-
gem '<%= @spec.name %>', version
|
33
|
-
load '<%= bin_file_name %>'
|