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.
- data/CHANGELOG.rdoc +3 -0
- data/README.rdoc +3 -0
- data/lib/ripl/rails.rb +30 -22
- metadata +4 -4
data/CHANGELOG.rdoc
CHANGED
data/README.rdoc
CHANGED
data/lib/ripl/rails.rb
CHANGED
@@ -1,30 +1,38 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
VERSION = '0.1.1'
|
1
|
+
require 'ripl'
|
2
|
+
require 'pathname'
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
|
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
|
-
|
11
|
-
|
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
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
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.
|
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:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.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-
|
18
|
+
date: 2011-03-30 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|