ripl 0.4.2 → 0.5.0

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/.gemspec CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.add_development_dependency 'bacon-bits'
20
20
  s.add_development_dependency 'bacon-rr'
21
21
  s.files = Dir.glob(%w[{lib,test}/**/*.rb bin/* [A-Z]*.{txt,rdoc} ext/**/*.{rb,c} **/deps.rip]) + %w{Rakefile .gemspec}
22
- s.files += Dir.glob('man/*')
22
+ s.files += Dir.glob(['man/*', '*.gemspec'])
23
23
  s.extra_rdoc_files = ["README.rdoc", "LICENSE.txt"]
24
24
  s.license = 'MIT'
25
25
  end
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,6 @@
1
+ == 0.5.0
2
+ * Minor changes to History#read_history
3
+
1
4
  == 0.4.2
2
5
  * Make Shell#input= and Shell#in_loop available
3
6
 
data/README.rdoc CHANGED
@@ -155,6 +155,12 @@ see {ripl-rails}[http://github.com/cldwalker/ripl-rails].
155
155
  * janlelis and godfat for bug fix and tweaks
156
156
  * JoshCheek for bug fixes
157
157
 
158
+ == Bugs/Issues
159
+ Please report them {on github}[http://github.com/cldwalker/ripl/issues].
160
+
161
+ == Contributing
162
+ {See here}[http://tagaholic.me/contributing.html]
163
+
158
164
  == Ripl Plugins
159
165
 
160
166
  * {ripl-multi_line}[http://github.com/janlelis/ripl-multi_line] : evaluate multiple lines
data/lib/ripl/history.rb CHANGED
@@ -9,15 +9,15 @@ module Ripl::History
9
9
  (@history << super)[-1]
10
10
  end
11
11
 
12
- def before_loop
13
- super
14
- File.exists?(history_file) &&
12
+ def read_history
13
+ File.exists?(history_file) && history.empty? &&
15
14
  IO.readlines(history_file).each {|e| history << e.chomp }
16
15
  end
17
16
 
18
17
  def write_history
19
18
  File.open(history_file, 'w') {|f| f.write Array(history).join("\n") }
20
19
  end
20
+ def before_loop() read_history end
21
21
  def after_loop() write_history end
22
22
  end
23
23
  Ripl::Shell.include Ripl::History
data/lib/ripl/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ripl
2
- VERSION = '0.4.2'
2
+ VERSION = '0.5.0'
3
3
  end
data/ripl.gemspec ADDED
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require 'rubygems' unless Object.const_defined?(:Gem)
3
+ require File.dirname(__FILE__) + "/lib/ripl/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "ripl"
7
+ s.version = Ripl::VERSION
8
+ s.authors = ["Gabriel Horner"]
9
+ s.email = "gabriel.horner@gmail.com"
10
+ s.homepage = "http://github.com/cldwalker/ripl"
11
+ s.summary = "ruby interactive print loop - A light, modular alternative to irb and a shell framework"
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
+ s.required_rubygems_version = ">= 1.3.6"
14
+ s.rubyforge_project = 'tagaholic'
15
+ s.executables = %w(ripl)
16
+ s.add_dependency 'bond', '~> 0.4.0'
17
+ s.add_development_dependency 'bacon', '>= 1.1.0'
18
+ s.add_development_dependency 'rr', '>= 1.0.0'
19
+ s.add_development_dependency 'bacon-bits'
20
+ s.add_development_dependency 'bacon-rr'
21
+ s.files = Dir.glob(%w[{lib,test}/**/*.rb bin/* [A-Z]*.{txt,rdoc} ext/**/*.{rb,c} **/deps.rip]) + %w{Rakefile .gemspec}
22
+ s.files += Dir.glob(['man/*', '*.gemspec'])
23
+ s.extra_rdoc_files = ["README.rdoc", "LICENSE.txt"]
24
+ s.license = 'MIT'
25
+ end
data/test/history_test.rb CHANGED
@@ -31,12 +31,29 @@ describe "History with readline" do
31
31
  shell.history.to_a.should == %w{check the mike}
32
32
  end
33
33
 
34
+ it "#before_loop loads previous history only when it's empty" do
35
+ File.open(HISTORY_FILE, 'w') {|f| f.write "check\nthe\nmike" }
36
+ stub(Ripl::Runner).load_rc
37
+ history = %w{already there}
38
+ shell.instance_variable_set(:@history, history.dup)
39
+ shell.before_loop
40
+ shell.history.to_a.should == history
41
+ end
42
+
34
43
  it "#before_loop has empty history if no history file exists" do
35
44
  stub(Ripl::Runner).load_rc
36
45
  shell.before_loop
37
46
  shell.history.to_a.should == []
38
47
  end
39
48
 
49
+ it "#read_history is accessible to plugins in #before_loop" do
50
+ mod = Object.const_set "Ping_read_history", Module.new
51
+ mod.send(:define_method, 'read_history') { @history = ['pong_read_history'] }
52
+ Shell.send :include, mod
53
+ shell.before_loop
54
+ shell.history.should == ['pong_read_history']
55
+ end
56
+
40
57
  it "#write_history is accessible to plugins in #after_loop" do
41
58
  mod = Object.const_set "Ping_write_history", Module.new
42
59
  mod.send(:define_method, 'write_history') { @history = ['pong_write_history'] }
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: ripl
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.4.2
5
+ version: 0.5.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Gabriel Horner
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-06-12 00:00:00 -04:00
13
+ date: 2011-08-08 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -101,6 +101,7 @@ files:
101
101
  - man/ripl.1
102
102
  - man/ripl.1.html
103
103
  - man/ripl.1.ronn
104
+ - ripl.gemspec
104
105
  has_rdoc: true
105
106
  homepage: http://github.com/cldwalker/ripl
106
107
  licenses: