ripl-rails 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/CHANGELOG.rdoc +3 -0
  2. data/README.rdoc +3 -0
  3. data/lib/ripl/rails.rb +30 -22
  4. metadata +4 -4
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,6 @@
1
+ == 0.1.2
2
+ * Call ripl-rails from an app's subdirectory
3
+
1
4
  = 0.1.1
2
5
  * Fix argument bug preventing global options from being passed
3
6
  * Fix rails3 loading irb
data/README.rdoc CHANGED
@@ -26,3 +26,6 @@ The ripl plugin can be used to create Rails app-specific shells:
26
26
  require 'ripl/rails'
27
27
  # App specific setup
28
28
  Ripl.start
29
+
30
+ == Credits
31
+ * janlelis
data/lib/ripl/rails.rb CHANGED
@@ -1,30 +1,38 @@
1
- module Ripl
2
- module Rails
3
- VERSION = '0.1.1'
1
+ require 'ripl'
2
+ require 'pathname'
4
3
 
5
- def before_loop
6
- load_rails
7
- super
4
+ module Ripl::Rails
5
+ VERSION = '0.1.2'
6
+
7
+ def self.find_rails_root!
8
+ until Pathname.pwd.join('config', 'boot.rb').exist?
9
+ abort "Not in a Rails environment" if Pathname.pwd.root?
10
+ Dir.chdir '..'
8
11
  end
12
+ end
9
13
 
10
- def load_rails
11
- abort "Not in a Rails environment" unless File.exists?("#{Dir.pwd}/config/boot.rb")
12
- ENV['RAILS_ENV'] = ARGV[0] if ARGV[0].to_s[/^[^-]/]
14
+ def self.load_rails
15
+ ENV['RAILS_ENV'] = ARGV[0] if ARGV[0].to_s[/^[^-]/]
13
16
 
14
- require "#{Dir.pwd}/config/boot"
15
- require 'rails' unless defined? ::Rails
16
- if ::Rails.version >= '3.0'
17
- Object.const_set :APP_PATH, File.expand_path("#{Dir.pwd}/config/application")
18
- require 'rails/console/app'
19
- require 'rails/console/helpers'
20
- require APP_PATH
21
- ::Rails.application.require_environment!
22
- else
23
- ["#{Dir.pwd}/config/environment", 'console_app', 'console_with_helpers'].each {|e| require e }
24
- end
25
- puts "Loading #{::Rails.env} environment (Rails #{::Rails.version})"
17
+ require "#{Dir.pwd}/config/boot"
18
+ require 'rails' unless defined? ::Rails
19
+ if ::Rails.version >= '3.0'
20
+ Object.const_set :APP_PATH, File.expand_path("#{Dir.pwd}/config/application")
21
+ require 'rails/console/app'
22
+ require 'rails/console/helpers'
23
+ require APP_PATH
24
+ ::Rails.application.require_environment!
25
+ else
26
+ ["#{Dir.pwd}/config/environment", 'console_app', 'console_with_helpers'].each {|e| require e }
26
27
  end
28
+ puts "Loading #{::Rails.env} environment (Rails #{::Rails.version})"
29
+ end
30
+
31
+ def before_loop
32
+ Ripl::Rails.find_rails_root!
33
+ Ripl::Rails.load_rails
34
+ super
27
35
  end
28
36
  end
29
37
 
30
- Ripl::Shell.send :include, Ripl::Rails if defined? Ripl::Shell
38
+ Ripl::Shell.include Ripl::Rails
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ripl-rails
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Gabriel Horner
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-05 00:00:00 -05:00
18
+ date: 2011-03-30 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency