mongo_translatable 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. data/.document +5 -0
  2. data/.gitignore +26 -0
  3. data/.gitmodules +3 -0
  4. data/LICENSE +295 -0
  5. data/README.rdoc +131 -0
  6. data/Rakefile +55 -0
  7. data/VERSION +1 -0
  8. data/app/controllers/translations_controller.rb +150 -0
  9. data/app/helpers/translations_helper.rb +71 -0
  10. data/app/views/layouts/translations.html.erb +18 -0
  11. data/app/views/translations/_form.html.erb +50 -0
  12. data/app/views/translations/_translatable_value.html.erb +17 -0
  13. data/app/views/translations/_translation_field.html.erb +34 -0
  14. data/app/views/translations/_translation_field_input.html.erb +8 -0
  15. data/app/views/translations/edit.html.erb +8 -0
  16. data/app/views/translations/index.html.erb +22 -0
  17. data/app/views/translations/new.html.erb +7 -0
  18. data/app/views/translations/show.html.erb +12 -0
  19. data/config/locales/en.yml +33 -0
  20. data/config/locales/fr.yml +18 -0
  21. data/lib/mongo_translatable.rb +336 -0
  22. data/lib/mongo_translatable_configuration.rb +5 -0
  23. data/lib/translatables_helper.rb +227 -0
  24. data/lib/translations_controller_helpers.rb +37 -0
  25. data/rails/init.rb +3 -0
  26. data/test/full_2_3_5_app_with_tests/.gitignore +27 -0
  27. data/test/full_2_3_5_app_with_tests/README +1 -0
  28. data/test/full_2_3_5_app_with_tests/Rakefile +10 -0
  29. data/test/full_2_3_5_app_with_tests/app/controllers/application_controller.rb +26 -0
  30. data/test/full_2_3_5_app_with_tests/app/controllers/items_controller.rb +85 -0
  31. data/test/full_2_3_5_app_with_tests/app/helpers/application_helper.rb +3 -0
  32. data/test/full_2_3_5_app_with_tests/app/helpers/items_helper.rb +2 -0
  33. data/test/full_2_3_5_app_with_tests/app/models/comment.rb +3 -0
  34. data/test/full_2_3_5_app_with_tests/app/models/item.rb +5 -0
  35. data/test/full_2_3_5_app_with_tests/app/models/not_swapped_in_record.rb +3 -0
  36. data/test/full_2_3_5_app_with_tests/app/models/person.rb +3 -0
  37. data/test/full_2_3_5_app_with_tests/app/models/recipe.rb +21 -0
  38. data/test/full_2_3_5_app_with_tests/app/views/items/edit.html.erb +24 -0
  39. data/test/full_2_3_5_app_with_tests/app/views/items/index.html.erb +24 -0
  40. data/test/full_2_3_5_app_with_tests/app/views/items/new.html.erb +23 -0
  41. data/test/full_2_3_5_app_with_tests/app/views/items/show.html.erb +21 -0
  42. data/test/full_2_3_5_app_with_tests/app/views/layouts/items.html.erb +19 -0
  43. data/test/full_2_3_5_app_with_tests/config/boot.rb +110 -0
  44. data/test/full_2_3_5_app_with_tests/config/database.yml +22 -0
  45. data/test/full_2_3_5_app_with_tests/config/environment.rb +54 -0
  46. data/test/full_2_3_5_app_with_tests/config/environments/development.rb +17 -0
  47. data/test/full_2_3_5_app_with_tests/config/environments/production.rb +28 -0
  48. data/test/full_2_3_5_app_with_tests/config/environments/test.rb +28 -0
  49. data/test/full_2_3_5_app_with_tests/config/initializers/backtrace_silencers.rb +7 -0
  50. data/test/full_2_3_5_app_with_tests/config/initializers/inflections.rb +10 -0
  51. data/test/full_2_3_5_app_with_tests/config/initializers/mime_types.rb +5 -0
  52. data/test/full_2_3_5_app_with_tests/config/initializers/new_rails_defaults.rb +21 -0
  53. data/test/full_2_3_5_app_with_tests/config/initializers/session_store.rb +15 -0
  54. data/test/full_2_3_5_app_with_tests/config/locales.yml +5 -0
  55. data/test/full_2_3_5_app_with_tests/config/locales/en.yml +4 -0
  56. data/test/full_2_3_5_app_with_tests/config/locales/fr.yml +4 -0
  57. data/test/full_2_3_5_app_with_tests/config/locales/zh.yml +4 -0
  58. data/test/full_2_3_5_app_with_tests/config/routes.rb +4 -0
  59. data/test/full_2_3_5_app_with_tests/db/migrate/20100407010602_create_items.rb +14 -0
  60. data/test/full_2_3_5_app_with_tests/db/migrate/20100504234216_create_not_swapped_in_records.rb +15 -0
  61. data/test/full_2_3_5_app_with_tests/db/migrate/20100509011052_create_people.rb +13 -0
  62. data/test/full_2_3_5_app_with_tests/db/migrate/20100509042718_create_comments.rb +14 -0
  63. data/test/full_2_3_5_app_with_tests/db/migrate/20110112023516_create_recipes.rb +14 -0
  64. data/test/full_2_3_5_app_with_tests/db/schema.rb +56 -0
  65. data/test/full_2_3_5_app_with_tests/db/seeds.rb +7 -0
  66. data/test/full_2_3_5_app_with_tests/doc/README_FOR_APP +2 -0
  67. data/test/full_2_3_5_app_with_tests/public/404.html +30 -0
  68. data/test/full_2_3_5_app_with_tests/public/422.html +30 -0
  69. data/test/full_2_3_5_app_with_tests/public/500.html +30 -0
  70. data/test/full_2_3_5_app_with_tests/public/favicon.ico +0 -0
  71. data/test/full_2_3_5_app_with_tests/public/images/rails.png +0 -0
  72. data/test/full_2_3_5_app_with_tests/public/index.html +275 -0
  73. data/test/full_2_3_5_app_with_tests/public/javascripts/application.js +2 -0
  74. data/test/full_2_3_5_app_with_tests/public/javascripts/controls.js +963 -0
  75. data/test/full_2_3_5_app_with_tests/public/javascripts/dragdrop.js +973 -0
  76. data/test/full_2_3_5_app_with_tests/public/javascripts/effects.js +1128 -0
  77. data/test/full_2_3_5_app_with_tests/public/javascripts/prototype.js +4320 -0
  78. data/test/full_2_3_5_app_with_tests/public/robots.txt +5 -0
  79. data/test/full_2_3_5_app_with_tests/public/stylesheets/scaffold.css +54 -0
  80. data/test/full_2_3_5_app_with_tests/script/about +4 -0
  81. data/test/full_2_3_5_app_with_tests/script/console +3 -0
  82. data/test/full_2_3_5_app_with_tests/script/dbconsole +3 -0
  83. data/test/full_2_3_5_app_with_tests/script/destroy +3 -0
  84. data/test/full_2_3_5_app_with_tests/script/generate +3 -0
  85. data/test/full_2_3_5_app_with_tests/script/performance/benchmarker +3 -0
  86. data/test/full_2_3_5_app_with_tests/script/performance/profiler +3 -0
  87. data/test/full_2_3_5_app_with_tests/script/plugin +3 -0
  88. data/test/full_2_3_5_app_with_tests/script/runner +3 -0
  89. data/test/full_2_3_5_app_with_tests/script/server +3 -0
  90. data/test/full_2_3_5_app_with_tests/test/factories.rb +18 -0
  91. data/test/full_2_3_5_app_with_tests/test/functional/translations_controller_test.rb +66 -0
  92. data/test/full_2_3_5_app_with_tests/test/integration/translation_test.rb +72 -0
  93. data/test/full_2_3_5_app_with_tests/test/performance/browsing_test.rb +9 -0
  94. data/test/full_2_3_5_app_with_tests/test/selenium.rb +83 -0
  95. data/test/full_2_3_5_app_with_tests/test/test_helper.rb +86 -0
  96. data/test/full_2_3_5_app_with_tests/test/unit/helpers/translatables_helper_test.rb +37 -0
  97. data/test/full_2_3_5_app_with_tests/test/unit/helpers/translations_helper_test.rb +62 -0
  98. data/test/full_2_3_5_app_with_tests/test/unit/mongo_translatable_test.rb +342 -0
  99. data/test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/init.rb +1 -0
  100. data/test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/lib/routing_filter.rb +94 -0
  101. data/test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/lib/routing_filter/base.rb +31 -0
  102. data/test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/lib/routing_filter/force_extension.rb +57 -0
  103. data/test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/lib/routing_filter/locale.rb +70 -0
  104. data/test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/lib/routing_filter/pagination.rb +33 -0
  105. data/test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/lib/routing_filter/uuid_token.rb +78 -0
  106. data/test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/spec/force_extension_spec.rb +65 -0
  107. data/test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/spec/generation_spec.rb +367 -0
  108. data/test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/spec/pagination_extension_spec.rb +19 -0
  109. data/test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/spec/recognition_spec.rb +76 -0
  110. data/test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/spec/routing_filter_spec.rb +114 -0
  111. data/test/full_2_3_5_app_with_tests/vendor/plugins/routing-filter/spec/spec_helper.rb +108 -0
  112. metadata +309 -0
@@ -0,0 +1,37 @@
1
+ module TranslationsControllerHelpers
2
+ unless included_modules.include? TranslationsControllerHelpers
3
+ def self.included(klass)
4
+ klass.send :helper_method, :url_for_translated, :target_action, :target_locale
5
+ end
6
+
7
+ def target_locale(options = {})
8
+ translation = options.delete(:translation) || @translation
9
+ options.delete(:locale) || (translation.locale if translation) || I18n.locale
10
+ end
11
+
12
+ def target_controller(options = {})
13
+ translatable_params_name = options.delete(:translatable_params_name) || @translatable_params_name
14
+ options.delete(:controller) || translatable_params_name.pluralize || params[:controller]
15
+ end
16
+
17
+ def target_action(options = {})
18
+ options.delete(:action) || 'show'
19
+ end
20
+
21
+ def target_id(options = {})
22
+ translated = options.delete(:translated) || @translated || options.delete(:translatable) || @translatable
23
+ options.delete(:id) || translated
24
+ end
25
+
26
+ def url_for_translated(options = { })
27
+ defaults = {
28
+ :locale => target_locale(options),
29
+ :controller => target_controller(options),
30
+ :action => target_action(options),
31
+ :id => target_id(options)
32
+ }
33
+
34
+ url_for(defaults.merge(options))
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,3 @@
1
+ require 'mongo_translatable_configuration'
2
+ require 'mongo_translatable'
3
+
@@ -0,0 +1,27 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
22
+ webrat*
23
+ test.sqlite3
24
+ test/debug.log
25
+ db/development.sqlite3
26
+ db/test.sqlite3
27
+ log/*.log
@@ -0,0 +1 @@
1
+ This is a full Rails app used to test the gem's functionality.
@@ -0,0 +1,10 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require(File.join(File.dirname(__FILE__), 'config', 'boot'))
5
+
6
+ require 'rake'
7
+ require 'rake/testtask'
8
+ require 'rake/rdoctask'
9
+
10
+ require 'tasks/rails'
@@ -0,0 +1,26 @@
1
+ # Filters added to this controller apply to all controllers in the application.
2
+ # Likewise, all the methods added will be available for all controllers.
3
+
4
+ class ApplicationController < ActionController::Base
5
+ helper :all # include all helpers, all the time
6
+ protect_from_forgery # See ActionController::RequestForgeryProtection for details
7
+
8
+ # Scrub sensitive parameters from your log
9
+ # filter_parameter_logging :password
10
+
11
+ # borrowed from kete application (http://github.com/kete/kete)
12
+ # modified to not rely only on mongo_translatable helpers
13
+ before_filter :set_locale
14
+ # first take the locale in the url, then the session[:locale],
15
+ # then the users locale, finally the default site locale
16
+ def set_locale
17
+ if params[:locale] && TranslationsHelper.available_locales.include?(params[:locale])
18
+ I18n.locale = params[:locale]
19
+ elsif session[:locale] && TranslationsHelper.available_locales.include?(session[:locale])
20
+ I18n.locale = session[:locale]
21
+ else
22
+ I18n.locale = I18n.default_locale
23
+ end
24
+ session[:locale] = I18n.locale # need to make sure this persists
25
+ end
26
+ end
@@ -0,0 +1,85 @@
1
+ class ItemsController < ApplicationController
2
+ # GET /items
3
+ # GET /items.xml
4
+ def index
5
+ @items = Item.all
6
+
7
+ respond_to do |format|
8
+ format.html # index.html.erb
9
+ format.xml { render :xml => @items }
10
+ end
11
+ end
12
+
13
+ # GET /items/1
14
+ # GET /items/1.xml
15
+ def show
16
+ @item = Item.find(params[:id])
17
+
18
+ respond_to do |format|
19
+ format.html # show.html.erb
20
+ format.xml { render :xml => @item }
21
+ end
22
+ end
23
+
24
+ # GET /items/new
25
+ # GET /items/new.xml
26
+ def new
27
+ @item = Item.new
28
+
29
+ respond_to do |format|
30
+ format.html # new.html.erb
31
+ format.xml { render :xml => @item }
32
+ end
33
+ end
34
+
35
+ # GET /items/1/edit
36
+ def edit
37
+ @item = Item.find(params[:id])
38
+ end
39
+
40
+ # POST /items
41
+ # POST /items.xml
42
+ def create
43
+ @item = Item.new(params[:item])
44
+
45
+ respond_to do |format|
46
+ if @item.save
47
+ flash[:notice] = 'Item was successfully created.'
48
+ format.html { redirect_to(@item) }
49
+ format.xml { render :xml => @item, :status => :created, :location => @item }
50
+ else
51
+ format.html { render :action => "new" }
52
+ format.xml { render :xml => @item.errors, :status => :unprocessable_entity }
53
+ end
54
+ end
55
+ end
56
+
57
+ # PUT /items/1
58
+ # PUT /items/1.xml
59
+ def update
60
+ @item = Item.find(params[:id])
61
+
62
+ respond_to do |format|
63
+ if @item.update_attributes(params[:item])
64
+ flash[:notice] = 'Item was successfully updated.'
65
+ format.html { redirect_to(@item) }
66
+ format.xml { head :ok }
67
+ else
68
+ format.html { render :action => "edit" }
69
+ format.xml { render :xml => @item.errors, :status => :unprocessable_entity }
70
+ end
71
+ end
72
+ end
73
+
74
+ # DELETE /items/1
75
+ # DELETE /items/1.xml
76
+ def destroy
77
+ @item = Item.find(params[:id])
78
+ @item.destroy
79
+
80
+ respond_to do |format|
81
+ format.html { redirect_to(items_url) }
82
+ format.xml { head :ok }
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,3 @@
1
+ # Methods added to this helper will be available to all templates in the application.
2
+ module ApplicationHelper
3
+ end
@@ -0,0 +1,2 @@
1
+ module ItemsHelper
2
+ end
@@ -0,0 +1,3 @@
1
+ class Comment < ActiveRecord::Base
2
+ belongs_to :item
3
+ end
@@ -0,0 +1,5 @@
1
+ class Item < ActiveRecord::Base
2
+ belongs_to :person
3
+ has_many :comments
4
+ mongo_translate :label, :description
5
+ end
@@ -0,0 +1,3 @@
1
+ class NotSwappedInRecord < ActiveRecord::Base
2
+ mongo_translate :name, :redefine_find => false
3
+ end
@@ -0,0 +1,3 @@
1
+ class Person < ActiveRecord::Base
2
+ has_many :items
3
+ end
@@ -0,0 +1,21 @@
1
+ class Recipe < ActiveRecord::Base
2
+ # mongo_translate :name, :ingredients, :steps
3
+ mongo_translate :name, [:ingredients, Array], [:steps, Array]
4
+
5
+ def steps=(value)
6
+ super(YAML.dump(value))
7
+ end
8
+
9
+ def ingredients=(value)
10
+ super(YAML.dump(value))
11
+ end
12
+
13
+ def steps
14
+ YAML.load(super)
15
+ end
16
+
17
+ def ingredients
18
+ YAML.load(super)
19
+ end
20
+
21
+ end
@@ -0,0 +1,24 @@
1
+ <h1>Editing item</h1>
2
+
3
+ <% form_for(@item) do |f| %>
4
+ <%= f.error_messages %>
5
+
6
+ <p>
7
+ <%= f.label :label %><br />
8
+ <%= f.text_field :label %>
9
+ </p>
10
+ <p>
11
+ <%= f.label :value %><br />
12
+ <%= f.text_field :value %>
13
+ </p>
14
+ <p>
15
+ <%= f.label :locale %><br />
16
+ <%= f.text_field :locale %>
17
+ </p>
18
+ <p>
19
+ <%= f.submit 'Update' %>
20
+ </p>
21
+ <% end %>
22
+
23
+ <%= link_to 'Show', @item %> |
24
+ <%= link_to 'Back', items_path %>
@@ -0,0 +1,24 @@
1
+ <h1>Listing items</h1>
2
+
3
+ <table>
4
+ <tr>
5
+ <th>Label</th>
6
+ <th>Value</th>
7
+ <th>Locale</th>
8
+ </tr>
9
+
10
+ <% @items.each do |item| %>
11
+ <tr>
12
+ <td><%=h item.label %></td>
13
+ <td><%=h item.value %></td>
14
+ <td><%=h item.locale %></td>
15
+ <td><%= link_to 'Show', item %></td>
16
+ <td><%= link_to 'Edit', edit_item_path(item) %></td>
17
+ <td><%= link_to 'Destroy', item, :confirm => 'Are you sure?', :method => :delete %></td>
18
+ </tr>
19
+ <% end %>
20
+ </table>
21
+
22
+ <br />
23
+
24
+ <%= link_to 'New item', new_item_path %>
@@ -0,0 +1,23 @@
1
+ <h1>New item</h1>
2
+
3
+ <% form_for(@item) do |f| %>
4
+ <%= f.error_messages %>
5
+
6
+ <p>
7
+ <%= f.label :label %><br />
8
+ <%= f.text_field :label %>
9
+ </p>
10
+ <p>
11
+ <%= f.label :value %><br />
12
+ <%= f.text_field :value %>
13
+ </p>
14
+ <p>
15
+ <%= f.label :locale %><br />
16
+ <%= f.text_field :locale %>
17
+ </p>
18
+ <p>
19
+ <%= f.submit 'Create' %>
20
+ </p>
21
+ <% end %>
22
+
23
+ <%= link_to 'Back', items_path %>
@@ -0,0 +1,21 @@
1
+ <%= available_in_locales_for(@item) %>
2
+ <%= needed_in_locales_for(@item, :lightbox => true) %>
3
+
4
+ <p>
5
+ <b>Label:</b>
6
+ <%=h @item.label %>
7
+ </p>
8
+
9
+ <p>
10
+ <b>Value:</b>
11
+ <%=h @item.value %>
12
+ </p>
13
+
14
+ <p>
15
+ <b>Locale:</b>
16
+ <%=h @item.locale %>
17
+ </p>
18
+
19
+
20
+ <%= link_to 'Edit', edit_item_path(@item) %> |
21
+ <%= link_to 'Back', items_path %>
@@ -0,0 +1,19 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
7
+ <title>Items: <%= controller.action_name %></title>
8
+ <%= yield :add_on_scripts_and_links %>
9
+ <%= stylesheet_link_tag 'scaffold' %>
10
+ <%= javascript_include_tag :defaults %>
11
+ </head>
12
+ <body>
13
+
14
+ <p style="color: green"><%= flash[:notice] %></p>
15
+
16
+ <%= yield %>
17
+
18
+ </body>
19
+ </html>
@@ -0,0 +1,110 @@
1
+ # Don't change this file!
2
+ # Configure your app in config/environment.rb and config/environments/*.rb
3
+
4
+ RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
5
+
6
+ module Rails
7
+ class << self
8
+ def boot!
9
+ unless booted?
10
+ preinitialize
11
+ pick_boot.run
12
+ end
13
+ end
14
+
15
+ def booted?
16
+ defined? Rails::Initializer
17
+ end
18
+
19
+ def pick_boot
20
+ (vendor_rails? ? VendorBoot : GemBoot).new
21
+ end
22
+
23
+ def vendor_rails?
24
+ File.exist?("#{RAILS_ROOT}/vendor/rails")
25
+ end
26
+
27
+ def preinitialize
28
+ load(preinitializer_path) if File.exist?(preinitializer_path)
29
+ end
30
+
31
+ def preinitializer_path
32
+ "#{RAILS_ROOT}/config/preinitializer.rb"
33
+ end
34
+ end
35
+
36
+ class Boot
37
+ def run
38
+ load_initializer
39
+ Rails::Initializer.run(:set_load_path)
40
+ end
41
+ end
42
+
43
+ class VendorBoot < Boot
44
+ def load_initializer
45
+ require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
46
+ Rails::Initializer.run(:install_gem_spec_stubs)
47
+ Rails::GemDependency.add_frozen_gem_path
48
+ end
49
+ end
50
+
51
+ class GemBoot < Boot
52
+ def load_initializer
53
+ self.class.load_rubygems
54
+ load_rails_gem
55
+ require 'initializer'
56
+ end
57
+
58
+ def load_rails_gem
59
+ if version = self.class.gem_version
60
+ gem 'rails', version
61
+ else
62
+ gem 'rails'
63
+ end
64
+ rescue Gem::LoadError => load_error
65
+ $stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
66
+ exit 1
67
+ end
68
+
69
+ class << self
70
+ def rubygems_version
71
+ Gem::RubyGemsVersion rescue nil
72
+ end
73
+
74
+ def gem_version
75
+ if defined? RAILS_GEM_VERSION
76
+ RAILS_GEM_VERSION
77
+ elsif ENV.include?('RAILS_GEM_VERSION')
78
+ ENV['RAILS_GEM_VERSION']
79
+ else
80
+ parse_gem_version(read_environment_rb)
81
+ end
82
+ end
83
+
84
+ def load_rubygems
85
+ min_version = '1.3.2'
86
+ require 'rubygems'
87
+ unless rubygems_version >= min_version
88
+ $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
89
+ exit 1
90
+ end
91
+
92
+ rescue LoadError
93
+ $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
94
+ exit 1
95
+ end
96
+
97
+ def parse_gem_version(text)
98
+ $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
99
+ end
100
+
101
+ private
102
+ def read_environment_rb
103
+ File.read("#{RAILS_ROOT}/config/environment.rb")
104
+ end
105
+ end
106
+ end
107
+ end
108
+
109
+ # All that for this:
110
+ Rails.boot!