dietrb 0.4.5 → 0.4.6

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/Rakefile CHANGED
@@ -1,34 +1,52 @@
1
+ def ruby_bin
2
+ require 'rbconfig'
3
+ File.join(Config::CONFIG['prefix'], 'bin', Config::CONFIG['ruby_install_name'])
4
+ end
5
+
1
6
  task :default => :run
2
7
 
3
- desc "Run the specs"
8
+ desc "Run the specs (run it with a rake installed on the Ruby version you want to run the specs on)"
4
9
  task :spec do
5
- # sh "macbacon #{FileList['spec/**/*_spec.rb'].join(' ')}"
6
- bacon = `which bacon19 || which bacon`.chomp
7
- sh "#{bacon} #{FileList['spec/**/*_spec.rb'].join(' ')}"
8
- end
9
-
10
- desc "Run specs with Kicker"
11
- task :kick do
12
- sh "kicker -e 'rake spec' lib spec"
10
+ sh "#{ruby_bin} -r #{FileList['./spec/**/*_spec.rb'].join(' -r ')} -e ''"
13
11
  end
14
12
 
15
- desc "Run dietrb with ruby19"
13
+ desc "Run dietrb"
16
14
  task :run do
17
- ruby = `which ruby19 || which ruby`.chomp
18
- sh "#{ruby} -Ilib ./bin/dietrb -r irb/ext/colorize -r pp"
15
+ sh "#{ruby_bin} -I lib ./bin/dietrb -r irb/ext/colorize -r pp"
19
16
  end
20
17
 
21
- desc "AOT compile for MacRuby"
22
- task :macruby_compile do
23
- FileList["lib/**/*.rb"].each do |source|
24
- sh "macrubyc --arch i386 --arch x86_64 -C '#{source}' -o '#{source}o'"
18
+ namespace :macruby do
19
+ desc "AOT compile for MacRuby"
20
+ task :compile do
21
+ FileList["lib/**/*.rb"].each do |source|
22
+ sh "macrubyc --arch i386 --arch x86_64 -C '#{source}' -o '#{source}o'"
23
+ end
25
24
  end
26
- end
27
-
28
- desc "Clean MacRuby binaries"
29
- task :clean do
30
- FileList["lib/**/*.rbo"].each do |bin|
31
- rm bin
25
+
26
+ desc "Clean MacRuby binaries"
27
+ task :clean do
28
+ FileList["lib/**/*.rbo"].each do |bin|
29
+ rm bin
30
+ end
31
+ end
32
+
33
+ desc "Merge source into the MacRuby repo"
34
+ task :merge do
35
+ if (repo = ENV['macruby_repo']) && File.exist?(repo)
36
+ bin = File.join(repo, 'bin/irb')
37
+ lib = File.join(repo, 'lib')
38
+
39
+ rm_f bin
40
+ rm_f File.join(lib, 'irb.rb')
41
+ rm_rf File.join(lib, 'irb')
42
+
43
+ cp 'bin/dietrb', bin
44
+ cp 'lib/irb.rb', lib
45
+ cp_r 'lib/irb', lib
46
+ else
47
+ puts "[!] Set the `macruby_repo' env variable to point to the MacRuby repo checkout"
48
+ exit 1
49
+ end
32
50
  end
33
51
  end
34
52
 
data/bin/dietrb CHANGED
@@ -14,6 +14,7 @@ unless ARGV.empty?
14
14
  opt.on("-r load-lib", "Loads the given library (same as `ruby -r')") { |lib| require lib }
15
15
  opt.on("-d", "Set $DEBUG to true (same as `ruby -d')") { $DEBUG = true }
16
16
  opt.on("-I path", "Add path to $LOAD_PATH") { |path| $LOAD_PATH.unshift(path) }
17
+ opt.on("--noinspect", "Don't use inspect for output") { IRB.formatter.inspect = false }
17
18
  opt.on("--simple-prompt", "Simple prompt mode") { IRB.formatter.prompt = :simple }
18
19
  opt.on("--noprompt", "No prompt mode") { IRB.formatter.prompt = nil }
19
20
  opt.on("-v", "--version", "Print the version of #{bin}") do
data/dietrb.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{dietrb}
8
- s.version = "0.4.5"
8
+ s.version = "0.4.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Eloy Duran"]
12
- s.date = %q{2010-05-30}
12
+ s.date = %q{2010-06-24}
13
13
  s.default_executable = %q{dietrb}
14
14
  s.description = %q{IRB on a diet, for MacRuby / Ruby 1.9}
15
15
  s.email = %q{eloy.de.enige@gmail.com}
data/lib/irb.rb CHANGED
@@ -13,9 +13,9 @@ require 'irb/deprecated'
13
13
  require 'irb/ext/history'
14
14
  require 'irb/ext/completion'
15
15
 
16
- if !ENV['SPECCING'] && defined?(RUBY_ENGINE) && RUBY_ENGINE == "macruby"
17
- require 'irb/ext/macruby'
18
- end
16
+ # if !ENV['SPECCING'] && defined?(RUBY_ENGINE) && RUBY_ENGINE == "macruby"
17
+ # require 'irb/ext/macruby'
18
+ # end
19
19
 
20
20
  module IRB
21
21
  class << self
data/lib/irb/formatter.rb CHANGED
@@ -17,11 +17,13 @@ module IRB
17
17
  SYNTAX_ERROR = "SyntaxError: compile error\n(irb):%d: %s"
18
18
  SOURCE_ROOT = /^#{File.expand_path('../../../', __FILE__)}/
19
19
 
20
- attr_writer :prompt
21
- attr_reader :filter_from_backtrace
20
+ attr_writer :prompt
21
+ attr_accessor :inspect
22
+ attr_reader :filter_from_backtrace
22
23
 
23
24
  def initialize
24
- @prompt = :default
25
+ @prompt = :default
26
+ @inspect = true
25
27
  @filter_from_backtrace = [SOURCE_ROOT]
26
28
  end
27
29
 
@@ -35,7 +37,13 @@ module IRB
35
37
  end
36
38
 
37
39
  def inspect_object(object)
38
- object.respond_to?(:pretty_inspect) ? object.pretty_inspect : object.inspect
40
+ if @inspect
41
+ object.respond_to?(:pretty_inspect) ? object.pretty_inspect : object.inspect
42
+ else
43
+ address = object.__id__ * 2
44
+ address += 0x100000000 if address < 0
45
+ "#<#{object.class}:0x%x>" % address
46
+ end
39
47
  end
40
48
 
41
49
  def result(object)
data/lib/irb/version.rb CHANGED
@@ -8,9 +8,9 @@ module IRB
8
8
  module VERSION #:nodoc:
9
9
  MAJOR = 0
10
10
  MINOR = 4
11
- TINY = 5
11
+ TINY = 6
12
12
 
13
13
  STRING = [MAJOR, MINOR, TINY].join('.')
14
14
  DESCRIPTION = "#{STRING} (DietRB)"
15
15
  end
16
- end
16
+ end
@@ -60,6 +60,17 @@ describe "IRB::Formatter" do
60
60
  @formatter.result(object).should == "=> foo"
61
61
  end
62
62
 
63
+ it "prints only the class name and memory address in `no inspect' mode" do
64
+ @formatter.inspect = false
65
+
66
+ object = Object.new
67
+ def object.inspect; @inspected = true; "Never called!"; end
68
+ def object.__id__; 2158110700; end
69
+
70
+ @formatter.result(object).should == "=> #<Object:0x101444fd8>"
71
+ object.instance_variable_get(:@inspected).should.not == true
72
+ end
73
+
63
74
  it "prints that a syntax error occurred on the last line and reset the buffer to the previous line" do
64
75
  @formatter.syntax_error(2, "syntax error, unexpected '}'").should ==
65
76
  "SyntaxError: compile error\n(irb):2: syntax error, unexpected '}'"
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  require 'rubygems'
2
2
  require 'bacon'
3
3
 
4
+ Bacon.summary_on_exit
5
+
4
6
  ENV['SPECCING'] = 'true'
5
7
 
6
8
  ROOT = File.expand_path('../../', __FILE__)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dietrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eloy Duran
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-05-30 00:00:00 +02:00
12
+ date: 2010-06-24 00:00:00 +02:00
13
13
  default_executable: dietrb
14
14
  dependencies: []
15
15