rib 0.9.3 → 0.9.4

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/.travis.yml CHANGED
@@ -2,6 +2,7 @@ script: 'git submodule update --init; bundle exec rake test'
2
2
  rvm:
3
3
  - 1.8.7
4
4
  - 1.9.2
5
+ - 1.9.3
5
6
  - ruby-head
6
7
  - rbx
7
8
  - rbx-2.0
data/CHANGES.md CHANGED
@@ -1,15 +1,30 @@
1
1
  # Rib CHANGES
2
2
 
3
+ ## Rib 0.9.4 -- 2011-09-01
4
+
5
+ * [rib-rails] So now we replicated what Rails did for its console, both for
6
+ Rails 2 and Rails 3. You can now fully use `rib rails` or `rib auto` as
7
+ `rails console` or `./script/console` in respect to Rails 2 or 3. For
8
+ example, it works for:
9
+
10
+ rib auto production
11
+ rib rails production
12
+ rib auto test --debugger # remember to add ruby-debug(19)? to Gemfile
13
+ rib auto test --sandbox
14
+ rib rails test --debugger --sandbox
15
+
16
+ It should also make Rails 3 print SQL log to stdout. Thanks tka.
17
+
3
18
  ## Rib 0.9.3 -- 2011-08-28
4
19
 
5
20
  * [rib] Calling `Rib.shell` would no longer automatically `require 'rib/core'`
6
- anymore. This is too messy. We should only do this in `bin/rib`.
7
- See: commit:7a97441afeecae80f5493f4e8a4a6ba3044e2c33
21
+ anymore. This is too messy. We should only do this in `bin/rib`. See:
22
+ commit #7a97441afeecae80f5493f4e8a4a6ba3044e2c33
8
23
 
9
- require 'rib/more/anchor'
10
- Rib.anchor 123
24
+ require 'rib/more/anchor'
25
+ Rib.anchor 123
11
26
 
12
- Should no longer crashed... Thanks Andrew.
27
+ Should no longer crashed... Thanks Andrew.
13
28
 
14
29
  ## Rib 0.9.2 -- 2011-08-25
15
30
 
data/README.md CHANGED
@@ -47,6 +47,14 @@ As Rails console
47
47
 
48
48
  rib rails
49
49
 
50
+ You could also run in production and pass arguments normally as you'd do in
51
+ `rails console` or `./script/console`
52
+
53
+ rib rails production --sandbox --debugger
54
+
55
+ Note: You might need to add ruby-debug or ruby-debug19 to your Gemfile if
56
+ you're passing --debugger and using bundler together.
57
+
50
58
  As Ramaze console
51
59
 
52
60
  rib ramaze
@@ -56,6 +64,12 @@ it should be (for now, it's either Rails or Ramaze)
56
64
 
57
65
  rib auto
58
66
 
67
+ If you're trying to use `rib auto` for a Rails app, you could also pass
68
+ arguments as if you were using `rib rails`. `rib auto` is merely passing
69
+ arguments.
70
+
71
+ rib auto production --sandbox --debugger
72
+
59
73
  As a fully featured interactive Ruby shell (as ripl-rc)
60
74
 
61
75
  rib all
data/lib/rib/app/rails.rb CHANGED
@@ -16,22 +16,82 @@ module Rib::Rails
16
16
  else
17
17
  Rib::Rails.load_rails2
18
18
  end
19
-
20
- puts("Loading #{::Rails.env} environment (Rails #{::Rails.version})")
21
19
  end
22
20
 
23
21
  def load_rails2
22
+ optparse_env
23
+ Rib.silence{
24
+ # rails 2 is so badly written
25
+ require 'stringio'
26
+ stderr = $stderr
27
+ $stderr = StringIO.new
28
+ Object.const_set('RAILS_ENV', ENV['RAILS_ENV'])
29
+ $stderr = stderr
30
+ }
31
+
32
+ # copied from commands/console
24
33
  ['./config/environment',
25
34
  'console_app' ,
26
35
  'console_with_helpers'].each{ |f| require f }
36
+
37
+ optparse_rails
27
38
  end
28
39
 
29
40
  def load_rails3
30
- ['./config/application',
31
- 'rails/console/app' ,
32
- 'rails/console/helpers'].each{ |f| require f }
41
+ optparse_env
33
42
 
43
+ # copied from rails/commands
44
+ require './config/application'
34
45
  ::Rails.application.require_environment!
46
+
47
+ optparse_rails
48
+ end
49
+
50
+ # copied from rails/commands/console
51
+ def optparse_env
52
+ # Has to set the RAILS_ENV before config/application is required
53
+ if ARGV.first && !ARGV.first.index("-") && env = ARGV.shift # has to shift the env ARGV so IRB doesn't freak
54
+ ENV['RAILS_ENV'] = %w(production development test).detect {|e| e =~ /^#{env}/} || env
55
+ end
56
+ end
57
+
58
+ # copied from rails/commands/console
59
+ def optparse_rails
60
+ require 'optparse'
61
+ options = {}
62
+
63
+ OptionParser.new do |opt|
64
+ opt.banner = "Usage: console [environment] [options]"
65
+ opt.on('-s', '--sandbox', 'Rollback database modifications on exit.') { |v| options[:sandbox] = v }
66
+ opt.on("--debugger", 'Enable ruby-debugging for the console.') { |v| options[:debugger] = v }
67
+ opt.parse!(ARGV)
68
+ end
69
+
70
+ # rails 3
71
+ if ::Rails.respond_to?(:application) && (app = ::Rails.application)
72
+ app.sandbox = options[:sandbox]
73
+ app.load_console
74
+ else
75
+ # rails 2
76
+ require 'console_sandbox' if options[:sandbox]
77
+ end
78
+
79
+ if options[:debugger]
80
+ begin
81
+ require 'ruby-debug'
82
+ puts "=> Debugger enabled"
83
+ rescue Exception
84
+ puts "You need to install ruby-debug to run the console in debugging mode. With gems, use 'gem install ruby-debug'"
85
+ exit
86
+ end
87
+ end
88
+
89
+ if options[:sandbox]
90
+ puts "Loading #{Rails.env} environment in sandbox (Rails #{Rails.version})"
91
+ puts "Any modifications you make will be rolled back on exit"
92
+ else
93
+ puts "Loading #{Rails.env} environment (Rails #{Rails.version})"
94
+ end
35
95
  end
36
96
 
37
97
  def rails?
data/lib/rib/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Rib
3
- VERSION = '0.9.3'
3
+ VERSION = '0.9.4'
4
4
  end
data/rib.gemspec CHANGED
@@ -1,109 +1,100 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  Gem::Specification.new do |s|
4
- s.name = %q{rib}
5
- s.version = "0.9.3"
4
+ s.name = "rib"
5
+ s.version = "0.9.4"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
- s.authors = [%q{Lin Jen-Shin (godfat)}]
9
- s.date = %q{2011-08-28}
10
- s.description = %q{Ruby-Interactive-ruBy -- Yet another interactive Ruby shell
11
-
12
- Rib is based on the design of [ripl][] and the work of [ripl-rc][], some of
13
- the features are also inspired by [pry][]. The aim of Rib is to be fully
14
- featured and yet very easy to opt-out or opt-in other features. It shall
15
- be simple, lightweight and modular so that everyone could customize Rib.
16
-
17
- [ripl]: https://github.com/cldwalker/ripl
18
- [ripl-rc]: https://github.com/godfat/ripl-rc
19
- [pry]: https://github.com/pry/pry}
20
- s.email = [%q{godfat (XD) godfat.org}]
8
+ s.authors = ["Lin Jen-Shin (godfat)"]
9
+ s.date = "2011-09-01"
10
+ s.description = "Ruby-Interactive-ruBy -- Yet another interactive Ruby shell\n\nRib is based on the design of [ripl][] and the work of [ripl-rc][], some of\nthe features are also inspired by [pry][]. The aim of Rib is to be fully\nfeatured and yet very easy to opt-out or opt-in other features. It shall\nbe simple, lightweight and modular so that everyone could customize Rib.\n\n[ripl]: https://github.com/cldwalker/ripl\n[ripl-rc]: https://github.com/godfat/ripl-rc\n[pry]: https://github.com/pry/pry"
11
+ s.email = ["godfat (XD) godfat.org"]
21
12
  s.executables = [
22
- %q{rib},
23
- %q{rib-all},
24
- %q{rib-auto},
25
- %q{rib-min},
26
- %q{rib-rails},
27
- %q{rib-ramaze}]
13
+ "rib",
14
+ "rib-all",
15
+ "rib-auto",
16
+ "rib-min",
17
+ "rib-rails",
18
+ "rib-ramaze"]
28
19
  s.files = [
29
- %q{.gitignore},
30
- %q{.gitmodules},
31
- %q{.travis.yml},
32
- %q{CHANGES.md},
33
- %q{CONTRIBUTORS},
34
- %q{Gemfile},
35
- %q{LICENSE},
36
- %q{README.md},
37
- %q{Rakefile},
38
- %q{TODO.md},
39
- %q{bin/rib},
40
- %q{bin/rib-all},
41
- %q{bin/rib-auto},
42
- %q{bin/rib-min},
43
- %q{bin/rib-rails},
44
- %q{bin/rib-ramaze},
45
- %q{lib/rib.rb},
46
- %q{lib/rib/all.rb},
47
- %q{lib/rib/api.rb},
48
- %q{lib/rib/app/auto.rb},
49
- %q{lib/rib/app/rails.rb},
50
- %q{lib/rib/app/ramaze.rb},
51
- %q{lib/rib/config.rb},
52
- %q{lib/rib/core.rb},
53
- %q{lib/rib/core/completion.rb},
54
- %q{lib/rib/core/history.rb},
55
- %q{lib/rib/core/multiline.rb},
56
- %q{lib/rib/core/readline.rb},
57
- %q{lib/rib/core/squeeze_history.rb},
58
- %q{lib/rib/core/strip_backtrace.rb},
59
- %q{lib/rib/core/underscore.rb},
60
- %q{lib/rib/debug.rb},
61
- %q{lib/rib/extra/autoindent.rb},
62
- %q{lib/rib/extra/hirb.rb},
63
- %q{lib/rib/more.rb},
64
- %q{lib/rib/more/anchor.rb},
65
- %q{lib/rib/more/color.rb},
66
- %q{lib/rib/more/edit.rb},
67
- %q{lib/rib/more/multiline_history.rb},
68
- %q{lib/rib/more/multiline_history_file.rb},
69
- %q{lib/rib/plugin.rb},
70
- %q{lib/rib/ripl.rb},
71
- %q{lib/rib/runner.rb},
72
- %q{lib/rib/shell.rb},
73
- %q{lib/rib/test.rb},
74
- %q{lib/rib/test/multiline.rb},
75
- %q{lib/rib/version.rb},
76
- %q{rib.gemspec},
77
- %q{screenshot.png},
78
- %q{task/.gitignore},
79
- %q{task/gemgem.rb},
80
- %q{test/core/test_completion.rb},
81
- %q{test/core/test_history.rb},
82
- %q{test/core/test_multiline.rb},
83
- %q{test/core/test_readline.rb},
84
- %q{test/core/test_squeeze_history.rb},
85
- %q{test/core/test_underscore.rb},
86
- %q{test/more/test_color.rb},
87
- %q{test/more/test_multiline_history.rb},
88
- %q{test/test_api.rb},
89
- %q{test/test_plugin.rb},
90
- %q{test/test_shell.rb}]
91
- s.homepage = %q{https://github.com/godfat/rib}
92
- s.require_paths = [%q{lib}]
93
- s.rubygems_version = %q{1.8.9}
94
- s.summary = %q{Ruby-Interactive-ruBy -- Yet another interactive Ruby shell}
20
+ ".gitignore",
21
+ ".gitmodules",
22
+ ".travis.yml",
23
+ "CHANGES.md",
24
+ "CONTRIBUTORS",
25
+ "Gemfile",
26
+ "LICENSE",
27
+ "README.md",
28
+ "Rakefile",
29
+ "TODO.md",
30
+ "bin/rib",
31
+ "bin/rib-all",
32
+ "bin/rib-auto",
33
+ "bin/rib-min",
34
+ "bin/rib-rails",
35
+ "bin/rib-ramaze",
36
+ "lib/rib.rb",
37
+ "lib/rib/all.rb",
38
+ "lib/rib/api.rb",
39
+ "lib/rib/app/auto.rb",
40
+ "lib/rib/app/rails.rb",
41
+ "lib/rib/app/ramaze.rb",
42
+ "lib/rib/config.rb",
43
+ "lib/rib/core.rb",
44
+ "lib/rib/core/completion.rb",
45
+ "lib/rib/core/history.rb",
46
+ "lib/rib/core/multiline.rb",
47
+ "lib/rib/core/readline.rb",
48
+ "lib/rib/core/squeeze_history.rb",
49
+ "lib/rib/core/strip_backtrace.rb",
50
+ "lib/rib/core/underscore.rb",
51
+ "lib/rib/debug.rb",
52
+ "lib/rib/extra/autoindent.rb",
53
+ "lib/rib/extra/hirb.rb",
54
+ "lib/rib/more.rb",
55
+ "lib/rib/more/anchor.rb",
56
+ "lib/rib/more/color.rb",
57
+ "lib/rib/more/edit.rb",
58
+ "lib/rib/more/multiline_history.rb",
59
+ "lib/rib/more/multiline_history_file.rb",
60
+ "lib/rib/plugin.rb",
61
+ "lib/rib/ripl.rb",
62
+ "lib/rib/runner.rb",
63
+ "lib/rib/shell.rb",
64
+ "lib/rib/test.rb",
65
+ "lib/rib/test/multiline.rb",
66
+ "lib/rib/version.rb",
67
+ "rib.gemspec",
68
+ "screenshot.png",
69
+ "task/.gitignore",
70
+ "task/gemgem.rb",
71
+ "test/core/test_completion.rb",
72
+ "test/core/test_history.rb",
73
+ "test/core/test_multiline.rb",
74
+ "test/core/test_readline.rb",
75
+ "test/core/test_squeeze_history.rb",
76
+ "test/core/test_underscore.rb",
77
+ "test/more/test_color.rb",
78
+ "test/more/test_multiline_history.rb",
79
+ "test/test_api.rb",
80
+ "test/test_plugin.rb",
81
+ "test/test_shell.rb"]
82
+ s.homepage = "https://github.com/godfat/rib"
83
+ s.require_paths = ["lib"]
84
+ s.rubygems_version = "1.8.10"
85
+ s.summary = "Ruby-Interactive-ruBy -- Yet another interactive Ruby shell"
95
86
  s.test_files = [
96
- %q{test/core/test_completion.rb},
97
- %q{test/core/test_history.rb},
98
- %q{test/core/test_multiline.rb},
99
- %q{test/core/test_readline.rb},
100
- %q{test/core/test_squeeze_history.rb},
101
- %q{test/core/test_underscore.rb},
102
- %q{test/more/test_color.rb},
103
- %q{test/more/test_multiline_history.rb},
104
- %q{test/test_api.rb},
105
- %q{test/test_plugin.rb},
106
- %q{test/test_shell.rb}]
87
+ "test/core/test_completion.rb",
88
+ "test/core/test_history.rb",
89
+ "test/core/test_multiline.rb",
90
+ "test/core/test_readline.rb",
91
+ "test/core/test_squeeze_history.rb",
92
+ "test/core/test_underscore.rb",
93
+ "test/more/test_color.rb",
94
+ "test/more/test_multiline_history.rb",
95
+ "test/test_api.rb",
96
+ "test/test_plugin.rb",
97
+ "test/test_shell.rb"]
107
98
 
108
99
  if s.respond_to? :specification_version then
109
100
  s.specification_version = 3
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.9.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-08-28 00:00:00.000000000Z
12
+ date: 2011-09-01 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bond
16
- requirement: &2152861100 !ruby/object:Gem::Requirement
16
+ requirement: &2154274080 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *2152861100
24
+ version_requirements: *2154274080
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: hirb
27
- requirement: &2152876980 !ruby/object:Gem::Requirement
27
+ requirement: &2154273520 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2152876980
35
+ version_requirements: *2154273520
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: readline_buffer
38
- requirement: &2152876500 !ruby/object:Gem::Requirement
38
+ requirement: &2154273040 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2152876500
46
+ version_requirements: *2154273040
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bacon
49
- requirement: &2152876020 !ruby/object:Gem::Requirement
49
+ requirement: &2154272460 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2152876020
57
+ version_requirements: *2154272460
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rr
60
- requirement: &2152875540 !ruby/object:Gem::Requirement
60
+ requirement: &2154271780 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2152875540
68
+ version_requirements: *2154271780
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
- requirement: &2152875060 !ruby/object:Gem::Requirement
71
+ requirement: &2154270880 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *2152875060
79
+ version_requirements: *2154270880
80
80
  description: ! 'Ruby-Interactive-ruBy -- Yet another interactive Ruby shell
81
81
 
82
82
 
@@ -188,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
188
188
  version: '0'
189
189
  requirements: []
190
190
  rubyforge_project:
191
- rubygems_version: 1.8.9
191
+ rubygems_version: 1.8.10
192
192
  signing_key:
193
193
  specification_version: 3
194
194
  summary: Ruby-Interactive-ruBy -- Yet another interactive Ruby shell