ripl 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gemspec CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
7
7
  s.version = Ripl::VERSION
8
8
  s.authors = ["Gabriel Horner"]
9
9
  s.email = "gabriel.horner@gmail.com"
10
- s.homepage = "http://github.com/cldwlaker/ripl"
10
+ s.homepage = "http://github.com/cldwalker/ripl"
11
11
  s.summary = "ruby interactive print loop - A light, modular alternative to irb and a shell framework"
12
12
  s.description = "ripl is a light, modular alternative to irb. Like irb, it loads ~/.irbrc, has autocompletion and keeps history in ~/.irb_history. Unlike irb, it is highly customizable via plugins and supports commands i.e. ripl-play. This customizability makes it easy to build custom shells (i.e. for a gem or application) and complex shells (i.e. for the web). In other words, ripl is also a shell framework."
13
13
  s.required_rubygems_version = ">= 1.3.6"
@@ -1,3 +1,8 @@
1
+ == 0.3.2
2
+ * Open #write_history to plugins
3
+ * Fix 1.9 tests
4
+ * Fix Ctrl-D for non-readline
5
+
1
6
  == 0.3.1
2
7
  * Allow :readline option to take a string
3
8
 
@@ -1,6 +1,6 @@
1
1
  The MIT LICENSE
2
2
 
3
- Copyright (c) 2010 Gabriel Horner
3
+ Copyright (c) 2011 Gabriel Horner
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
@@ -152,6 +152,7 @@ see {ripl-rails}[http://github.com/cldwalker/ripl-rails].
152
152
 
153
153
  == Credits
154
154
  * janlelis for bug fix and tweaks
155
+ * godfat and JoshCheek for bug fixes
155
156
 
156
157
  == Ripl Plugins
157
158
 
@@ -175,6 +176,7 @@ see {ripl-rails}[http://github.com/cldwalker/ripl-rails].
175
176
  display short backtrace
176
177
  * {ripl-rocket}[https://github.com/janlelis/ripl-rocket]: outputs ripl result as a hash rocket
177
178
  * {ripl-padrino}[https://github.com/achiu/ripl-padrino]: console for padrino
179
+ * {ripltools}[https://github.com/janlelis/ripltools]: a collection of ripl plugins
178
180
 
179
181
  == Ripl Shells
180
182
  Shells built on top of ripl:
@@ -19,7 +19,7 @@ module Ripl::History
19
19
  def write_history
20
20
  File.open(history_file, 'w') {|f| f.write Array(history).join("\n") }
21
21
  end
22
- alias_method :after_loop, :write_history
22
+ def after_loop; write_history; end
23
23
  end
24
24
  Ripl::Shell.include Ripl::History
25
25
  Ripl.config[:history] = '~/.irb_history'
@@ -77,7 +77,7 @@ class Ripl::Shell
77
77
  # @return [String, nil] Prints #prompt and returns input given by user
78
78
  def get_input
79
79
  print prompt
80
- $stdin.gets.chomp
80
+ (input = $stdin.gets) ? input.chomp : input
81
81
  end
82
82
 
83
83
  # @return [String]
@@ -1,3 +1,3 @@
1
1
  module Ripl
2
- VERSION = '0.3.1'
2
+ VERSION = '0.3.2'
3
3
  end
@@ -4,10 +4,11 @@ require 'fileutils'
4
4
  HISTORY_FILE = File.dirname(__FILE__) + '/ripl_history'
5
5
 
6
6
  describe "History with readline" do
7
- def shell(options={})
8
- Ripl.shell(options.merge(:history => HISTORY_FILE))
7
+ def shell
8
+ Ripl.shell(:history => HISTORY_FILE, :readline => false, :completion => false)
9
9
  end
10
10
 
11
+ before_all { reset_shell }
11
12
  before do
12
13
  reset_ripl
13
14
  if defined? Readline
@@ -18,7 +19,7 @@ describe "History with readline" do
18
19
 
19
20
  it "#after_loop saves history" do
20
21
  inputs = %w{blih blah}
21
- inputs.each {|e| shell.history << e }
22
+ shell.instance_variable_set '@history', inputs
22
23
  shell.after_loop
23
24
  File.read(HISTORY_FILE).should == inputs.join("\n")
24
25
  end
@@ -35,4 +36,12 @@ describe "History with readline" do
35
36
  shell.before_loop
36
37
  shell.history.to_a.should == []
37
38
  end
39
+
40
+ it "#write_history is accessible to plugins in #after_loop" do
41
+ mod = Object.const_set "Ping_write_history", Module.new
42
+ mod.send(:define_method, 'write_history') { @history = ['pong_write_history'] }
43
+ Shell.send :include, mod
44
+ shell.after_loop
45
+ shell.history.should == ['pong_write_history']
46
+ end
38
47
  end
@@ -106,7 +106,7 @@ describe "Shell" do
106
106
  }
107
107
 
108
108
  it "prints it" do
109
- @stderr.should =~ /^SyntaxError: compile error/
109
+ @stderr.should =~ /^SyntaxError:/
110
110
  end
111
111
 
112
112
  it "sets @error_raised" do
@@ -30,6 +30,13 @@ module Helpers
30
30
  Ripl.instance_eval "@config = @shell = @riplrc = nil"
31
31
  end
32
32
 
33
+ def reset_shell
34
+ Ripl.send(:remove_const, :Shell)
35
+ $".delete $".grep(/shell\.rb/)[0]
36
+ require 'ripl/shell'
37
+ Ripl::Shell.include Ripl::History
38
+ end
39
+
33
40
  def reset_config
34
41
  Ripl.config.merge! :history => '~/.irb_history', :completion => {}
35
42
  end
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: 17
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 1
10
- version: 0.3.1
9
+ - 2
10
+ version: 0.3.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-01-11 00:00:00 -05:00
18
+ date: 2011-02-21 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -128,7 +128,7 @@ files:
128
128
  - man/ripl.1.html
129
129
  - man/ripl.1.ronn
130
130
  has_rdoc: true
131
- homepage: http://github.com/cldwlaker/ripl
131
+ homepage: http://github.com/cldwalker/ripl
132
132
  licenses:
133
133
  - MIT
134
134
  post_install_message: