ripl-ripper 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gemspec ADDED
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require 'rubygems' unless Object.const_defined?(:Gem)
3
+ require File.dirname(__FILE__) + "/lib/ripl/ripper"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "ripl-ripper"
7
+ s.version = Ripl::Ripper::VERSION
8
+ s.authors = ["Gabriel Horner"]
9
+ s.email = "gabriel.horner@gmail.com"
10
+ s.homepage = "http://github.com/cldwalker/ripl-ripper"
11
+ s.summary = "A ripl plugin to make ripl multi-line with ripper"
12
+ s.description = "This ripl plugin gives ripl multi-line eval ability using ripper."
13
+ s.required_rubygems_version = ">= 1.3.6"
14
+ s.rubyforge_project = 'tagaholic'
15
+ s.add_dependency 'ripl', '>= 0.3.3'
16
+ s.files = Dir.glob(%w[{lib,test}/**/*.rb bin/* [A-Z]*.{txt,rdoc} ext/**/*.{rb,c} **/deps.rip]) + %w{Rakefile .gemspec}
17
+ s.extra_rdoc_files = ["README.rdoc", "LICENSE.txt"]
18
+ s.license = 'MIT'
19
+ end
data/CHANGELOG.rdoc ADDED
@@ -0,0 +1,3 @@
1
+ == 0.1.0
2
+
3
+ * Initial release
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ The MIT LICENSE
2
+
3
+ Copyright (c) 2011 Gabriel Horner
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,27 @@
1
+ == Description
2
+ This ripl plugin gives ripl multi-line eval ability using ripper.
3
+
4
+ == Install
5
+ If on 1.9, install the gem with:
6
+
7
+ gem install ripl-ripper
8
+
9
+ If on 1.8, install the gem with:
10
+
11
+ gem install ripl-ripper ripper
12
+
13
+ == Usage
14
+
15
+ Add to your ~/.riplrc
16
+
17
+ require 'ripl/ripper'
18
+
19
+ To customize your multi-line prompt use the :ripper_prompt option. For example,
20
+
21
+ Ripl.config[:ripper_prompt] = ' | '
22
+
23
+ == Limitations
24
+
25
+ This gem is meant to run on 1.9. 1.8 support is completely up to the ripper gem.
26
+ If that doesn't work for you, check out the {ripl-multi_line
27
+ plugin}[https://github.com/janlelis/ripl-multi_line].
data/Rakefile ADDED
@@ -0,0 +1,35 @@
1
+ require 'rake'
2
+ require 'fileutils'
3
+
4
+ def gemspec
5
+ @gemspec ||= eval(File.read('.gemspec'), binding, '.gemspec')
6
+ end
7
+
8
+ desc "Build the gem"
9
+ task :gem=>:gemspec do
10
+ sh "gem build .gemspec"
11
+ FileUtils.mkdir_p 'pkg'
12
+ FileUtils.mv "#{gemspec.name}-#{gemspec.version}.gem", 'pkg'
13
+ end
14
+
15
+ desc "Install the gem locally"
16
+ task :install => :gem do
17
+ sh %{gem install pkg/#{gemspec.name}-#{gemspec.version}}
18
+ end
19
+
20
+ desc "Generate the gemspec"
21
+ task :generate do
22
+ puts gemspec.to_ruby
23
+ end
24
+
25
+ desc "Validate the gemspec"
26
+ task :gemspec do
27
+ gemspec.validate
28
+ end
29
+
30
+ desc 'Run tests'
31
+ task :test do |t|
32
+ sh 'bacon -q -Ilib -I. test/*_test.rb'
33
+ end
34
+
35
+ task :default => :test
data/deps.rip ADDED
@@ -0,0 +1 @@
1
+ ripl >=0.3.3
@@ -0,0 +1,36 @@
1
+ require 'ripl'
2
+ # ships with 1.9 though there is a very alpha 1.8 gem
3
+ require 'ripper'
4
+
5
+ module Ripl::Ripper
6
+ VERSION = '0.1.0'
7
+
8
+ def before_loop
9
+ super
10
+ @buffer = []
11
+ end
12
+
13
+ def prompt
14
+ @buffer.empty? ? super : config[:ripper_prompt]
15
+ end
16
+
17
+ def loop_once
18
+ catch(:multiline) do
19
+ super
20
+ @buffer = []
21
+ end
22
+ end
23
+
24
+ def ripper_valid?(str)
25
+ !!Ripper::SexpBuilder.new(str).parse
26
+ end
27
+
28
+ def eval_input(input)
29
+ @buffer << input
30
+ @input = @buffer.join("\n")
31
+ ripper_valid?(@input) ? super(@input) : throw(:multiline)
32
+ end
33
+ end
34
+
35
+ Ripl::Shell.include Ripl::Ripper
36
+ Ripl.config[:ripper_prompt] = ' > '
metadata ADDED
@@ -0,0 +1,73 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ripl-ripper
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.1.0
6
+ platform: ruby
7
+ authors:
8
+ - Gabriel Horner
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-03-30 00:00:00 -04:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: ripl
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: 0.3.3
25
+ type: :runtime
26
+ version_requirements: *id001
27
+ description: This ripl plugin gives ripl multi-line eval ability using ripper.
28
+ email: gabriel.horner@gmail.com
29
+ executables: []
30
+
31
+ extensions: []
32
+
33
+ extra_rdoc_files:
34
+ - README.rdoc
35
+ - LICENSE.txt
36
+ files:
37
+ - lib/ripl/ripper.rb
38
+ - LICENSE.txt
39
+ - CHANGELOG.rdoc
40
+ - README.rdoc
41
+ - deps.rip
42
+ - Rakefile
43
+ - .gemspec
44
+ has_rdoc: true
45
+ homepage: http://github.com/cldwalker/ripl-ripper
46
+ licenses:
47
+ - MIT
48
+ post_install_message:
49
+ rdoc_options: []
50
+
51
+ require_paths:
52
+ - lib
53
+ required_ruby_version: !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: "0"
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: 1.3.6
65
+ requirements: []
66
+
67
+ rubyforge_project: tagaholic
68
+ rubygems_version: 1.6.1
69
+ signing_key:
70
+ specification_version: 3
71
+ summary: A ripl plugin to make ripl multi-line with ripper
72
+ test_files: []
73
+