richrc 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +3 -0
- data/Gemfile +4 -0
- data/Rakefile +2 -0
- data/bin/richrc +13 -0
- data/lib/richrc/ext_loader.rb +28 -0
- data/lib/richrc/rails_loader.rb +36 -0
- data/lib/richrc/version.rb +3 -0
- data/lib/richrc.rb +4 -0
- data/richrc.gemspec +21 -0
- metadata +76 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
data/bin/richrc
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
module Richrc
|
2
|
+
class << self
|
3
|
+
def wirble!
|
4
|
+
require "irb"
|
5
|
+
begin
|
6
|
+
gem 'wirble'
|
7
|
+
require 'wirble'
|
8
|
+
Wirble.init
|
9
|
+
Wirble.colorize
|
10
|
+
puts "Wirble is loaded"
|
11
|
+
rescue LoadError
|
12
|
+
puts "Wirble is not loaded!!(Did you install wirble gem?)"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def hirb!
|
17
|
+
begin
|
18
|
+
gem 'hirb'
|
19
|
+
require 'hirb'
|
20
|
+
Hirb.enable
|
21
|
+
puts "Hirb is loaded"
|
22
|
+
rescue LoadError
|
23
|
+
puts "Hirb is not loaded!!(Did you install hirb gem?)"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Richrc
|
2
|
+
class RailsLoader
|
3
|
+
|
4
|
+
SCRIPT_RAILS = File.join('script', 'rails')
|
5
|
+
|
6
|
+
def app_path
|
7
|
+
@app_path ||= find_app_path
|
8
|
+
end
|
9
|
+
|
10
|
+
def find_app_path
|
11
|
+
last_dir = Dir.pwd
|
12
|
+
until in_app_path?
|
13
|
+
Dir.chdir("..")
|
14
|
+
return nil if Dir.pwd==last_dir
|
15
|
+
last_dir = Dir.pwd
|
16
|
+
end
|
17
|
+
Dir.pwd
|
18
|
+
rescue SystemCallError # Recure from chdir failure
|
19
|
+
nil
|
20
|
+
end
|
21
|
+
|
22
|
+
def in_app_path?
|
23
|
+
File.exists?(SCRIPT_RAILS)
|
24
|
+
end
|
25
|
+
|
26
|
+
def start_console!
|
27
|
+
require File.expand_path(File.join(app_path, "config/boot"))
|
28
|
+
require 'rails/commands/console'
|
29
|
+
require File.expand_path(File.join(app_path, "config/application"))
|
30
|
+
|
31
|
+
Rails.application.require_environment!
|
32
|
+
Rails::Console.start(Rails.application)
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
data/lib/richrc.rb
ADDED
data/richrc.gemspec
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "richrc/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "richrc"
|
7
|
+
s.version = Richrc::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["miaout17"]
|
10
|
+
s.email = ["miaout17 at gmail.com"]
|
11
|
+
s.homepage = ""
|
12
|
+
s.summary = %q{Load Wirble and Hirb in Rails 3 without editing Gemfile}
|
13
|
+
s.description = %q{Load Wirble and Hirb in Rails 3 without editing Gemfile}
|
14
|
+
|
15
|
+
s.rubyforge_project = "richrc"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: richrc
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- miaout17
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-02-09 00:00:00 +08:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description: Load Wirble and Hirb in Rails 3 without editing Gemfile
|
23
|
+
email:
|
24
|
+
- miaout17 at gmail.com
|
25
|
+
executables:
|
26
|
+
- richrc
|
27
|
+
extensions: []
|
28
|
+
|
29
|
+
extra_rdoc_files: []
|
30
|
+
|
31
|
+
files:
|
32
|
+
- .gitignore
|
33
|
+
- Gemfile
|
34
|
+
- Rakefile
|
35
|
+
- bin/richrc
|
36
|
+
- lib/richrc.rb
|
37
|
+
- lib/richrc/ext_loader.rb
|
38
|
+
- lib/richrc/rails_loader.rb
|
39
|
+
- lib/richrc/version.rb
|
40
|
+
- richrc.gemspec
|
41
|
+
has_rdoc: true
|
42
|
+
homepage: ""
|
43
|
+
licenses: []
|
44
|
+
|
45
|
+
post_install_message:
|
46
|
+
rdoc_options: []
|
47
|
+
|
48
|
+
require_paths:
|
49
|
+
- lib
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
hash: 3
|
56
|
+
segments:
|
57
|
+
- 0
|
58
|
+
version: "0"
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
hash: 3
|
65
|
+
segments:
|
66
|
+
- 0
|
67
|
+
version: "0"
|
68
|
+
requirements: []
|
69
|
+
|
70
|
+
rubyforge_project: richrc
|
71
|
+
rubygems_version: 1.3.7
|
72
|
+
signing_key:
|
73
|
+
specification_version: 3
|
74
|
+
summary: Load Wirble and Hirb in Rails 3 without editing Gemfile
|
75
|
+
test_files: []
|
76
|
+
|