ripl 0.3.4 → 0.3.5

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/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,6 @@
1
+ == 0.3.5
2
+ * Fix subclassed runner printing version
3
+
1
4
  == 0.3.4
2
5
  * Rescue failure while printing result
3
6
 
data/lib/ripl/runner.rb CHANGED
@@ -51,7 +51,7 @@ class Ripl::Runner
51
51
  $LOAD_PATH.unshift(*($1.empty? ? argv.shift.to_s : $1).split(":"))
52
52
  when /-r=?(.*)/ then require($1.empty? ? argv.shift.to_s : $1)
53
53
  when '-d' then $DEBUG = true
54
- when '-v', '--version' then puts(Ripl::VERSION); exit
54
+ when '-v', '--version' then puts(Object.const_get(app.capitalize)::VERSION); exit
55
55
  when '-f' then Ripl.config[:irbrc] = false
56
56
  when '-h', '--help' then puts(help); exit
57
57
  when /^(--?[^-]+)/ then parse_option($1, argv)
data/lib/ripl/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ripl
2
- VERSION = '0.3.4'
2
+ VERSION = '0.3.5'
3
3
  end
data/test/runner_test.rb CHANGED
@@ -1,6 +1,12 @@
1
1
  require File.join(File.dirname(__FILE__), 'test_helper')
2
2
 
3
3
  describe "Runner" do
4
+ def set_dollar_zero(val)
5
+ $progname = $0
6
+ alias $0 $progname
7
+ $0 = val
8
+ end
9
+
4
10
  describe ".start" do
5
11
  before_all { ARGV.replace [] }
6
12
  before { reset_ripl }
@@ -72,12 +78,6 @@ describe "Runner" do
72
78
  end
73
79
 
74
80
  describe "with subcommand" do
75
- def set_dollar_zero(val)
76
- $progname = $0
77
- alias $0 $progname
78
- $0 = val
79
- end
80
-
81
81
  def mock_exec(*args)
82
82
  mock(Runner).exec('ripl-rails', *args) do
83
83
  set_dollar_zero 'ripl-rails'
@@ -266,6 +266,25 @@ describe "Runner" do
266
266
  end
267
267
  end
268
268
 
269
+ describe "subclass" do
270
+ before_all {
271
+ Tuxedo = Class.new(Ripl::Runner)
272
+ Tuxedo.app = 'tuxedo'
273
+ Tuxedo.const_set(:VERSION, '0.0.1')
274
+ set_dollar_zero 'tuxedo'
275
+ }
276
+
277
+ it "with -v option prints version" do
278
+ mock(Tuxedo).exit
279
+ mock(Tuxedo).load_rc(Ripl.config[:riplrc])
280
+ mock(Ripl.shell).loop
281
+ capture_stdout {
282
+ Tuxedo.run(['-v'])
283
+ }.chomp.should == Tuxedo::VERSION
284
+ end
285
+ after_all { set_dollar_zero 'ripl' }
286
+ end
287
+
269
288
  describe "API" do
270
289
  Runner::API.instance_methods.each do |meth|
271
290
  it "##{meth} is accessible to plugins" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ripl
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 4
10
- version: 0.3.4
9
+ - 5
10
+ version: 0.3.5
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-03-30 00:00:00 -04:00
18
+ date: 2011-04-05 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency