rink 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,14 @@
1
+ # Passes arguments to bundle install (http://gembundler.com/man/bundle-install.1.html)
2
+ # bundler_args: --binstubs
3
+
4
+ # Specify which versions of Ruby to run the tests on; each version will be used
5
+ rvm:
6
+ - 1.8.7
7
+ - 1.9.2
8
+ - 1.9.3
9
+ - ree
10
+ - jruby
11
+ - ruby-head
12
+ - rbx-2.0
13
+
14
+ env: "WITHOUT_RCOV=1 "
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in jax.gemspec
4
+ gemspec
@@ -0,0 +1,28 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rink (1.0.2)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+ diff-lcs (1.1.3)
10
+ rake (0.9.2.2)
11
+ rcov (0.9.11)
12
+ rspec (2.6.0)
13
+ rspec-core (~> 2.6.0)
14
+ rspec-expectations (~> 2.6.0)
15
+ rspec-mocks (~> 2.6.0)
16
+ rspec-core (2.6.4)
17
+ rspec-expectations (2.6.0)
18
+ diff-lcs (~> 1.1.2)
19
+ rspec-mocks (2.6.0)
20
+
21
+ PLATFORMS
22
+ ruby
23
+
24
+ DEPENDENCIES
25
+ rake (~> 0.9.2)
26
+ rcov (~> 0.9.11)
27
+ rink!
28
+ rspec (~> 2.6.0)
data/Rakefile CHANGED
@@ -1,39 +1,25 @@
1
1
  require 'rubygems'
2
- require 'rake'
3
2
 
4
3
  begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "rink"
8
- gem.summary = %Q{Makes interactive consoles awesome.}
9
- gem.description = %Q{Makes interactive consoles awesome.}
10
- gem.email = "sinisterchipmunk@gmail.com"
11
- gem.homepage = "http://www.thoughtsincomputation.com"
12
- gem.authors = ["Colin MacKenzie IV"]
13
-
14
- gem.add_development_dependency "rspec", ">= 1.3.0"
15
-
16
- gem.test_files = FileList['spec/**/*']
17
- end
18
- Jeweler::GemcutterTasks.new
4
+ require 'bundler'
19
5
  rescue LoadError
20
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
6
+ raise "Bundler is required. Install it with: gem install bundler"
21
7
  end
22
8
 
23
- require 'spec/rake/spectask'
24
- Spec::Rake::SpecTask.new(:spec) do |spec|
25
- spec.libs << 'lib' << 'spec'
26
- spec.spec_files = FileList['spec/**/*_spec.rb']
9
+ Bundler::GemHelper.install_tasks
10
+ Bundler.setup
11
+
12
+ require 'rspec/core/rake_task'
13
+ RSpec::Core::RakeTask.new(:spec) do |spec|
14
+ spec.pattern = 'spec/**/*_spec.rb'
27
15
  end
28
16
 
29
- Spec::Rake::SpecTask.new(:rcov) do |spec|
30
- spec.libs << 'lib' << 'spec'
17
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
31
18
  spec.pattern = 'spec/**/*_spec.rb'
32
19
  spec.rcov = true
20
+ spec.rcov_opts = %w{--rails --exclude osx\/objc,gems\/,spec\/,features\/}
33
21
  end
34
22
 
35
- task :spec => :check_dependencies
36
-
37
23
  task :default => :spec
38
24
 
39
25
  require 'rake/rdoctask'
@@ -1,14 +1,11 @@
1
- #require 'sc-ansi'
2
-
3
1
  require File.expand_path(File.join(File.dirname(__FILE__), "core_ext/object"))
4
- require File.expand_path(File.join(File.dirname(__FILE__), "rink/delegation"))
5
- require File.expand_path(File.join(File.dirname(__FILE__), 'rink/namespace'))
6
- require File.expand_path(File.join(File.dirname(__FILE__), "rink/lexer"))
7
- require File.expand_path(File.join(File.dirname(__FILE__), 'rink/io_methods'))
8
- require File.expand_path(File.join(File.dirname(__FILE__), "rink/line_processor/base"))
9
- require File.expand_path(File.join(File.dirname(__FILE__), "rink/line_processor/pure_ruby"))
10
- require File.expand_path(File.join(File.dirname(__FILE__), "rink/console"))
11
2
 
12
3
  module Rink
13
-
4
+ autoload :Delegation, "rink/delegation"
5
+ autoload :Namespace, "rink/namespace"
6
+ autoload :Lexer, "rink/lexer"
7
+ autoload :IOMethods, "rink/io_methods"
8
+ autoload :LineProcessor, "rink/line_processor"
9
+ autoload :Console, "rink/console"
10
+ autoload :Version, "rink/version"
14
11
  end
@@ -308,7 +308,7 @@ module Rink
308
308
  # Runs the autocomplete method from the line processor, then reformats its result to be an array.
309
309
  def autocomplete(line)
310
310
  return [] unless @line_processor
311
- result = @line_processor.autocomplete(line, namespace.ns)
311
+ result = @line_processor.autocomplete(line, namespace)
312
312
  case result
313
313
  when String
314
314
  [result]
@@ -0,0 +1,4 @@
1
+ module Rink::LineProcessor
2
+ autoload :Base, "rink/line_processor/base"
3
+ autoload :PureRuby, "rink/line_processor/pure_ruby"
4
+ end
@@ -158,7 +158,7 @@ module Rink
158
158
  # unknown(maybe String)
159
159
  autocomplete_for_string(Regexp.quote($1))
160
160
  else
161
- candidates = eval("methods | private_methods | local_variables | self.class.constants", namespace.send(:binding))
161
+ candidates = namespace.instance_eval { methods | private_methods | local_variables | self.class.constants }
162
162
  (candidates|RESERVED_WORDS).grep(/^#{Regexp.quote(line)}/)
163
163
  end
164
164
  result.kind_of?(Array) ?
@@ -0,0 +1,10 @@
1
+ module Rink
2
+ module Version
3
+ MAJOR = 1
4
+ MINOR = 0
5
+ PATCH = 2
6
+ STRING = [MAJOR, MINOR, PATCH].join(".")
7
+ end
8
+
9
+ VERSION = Rink::Version::STRING
10
+ end
@@ -1,86 +1,26 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
1
  # -*- encoding: utf-8 -*-
5
2
 
3
+ require File.expand_path("lib/rink/version", File.dirname(__FILE__))
4
+
6
5
  Gem::Specification.new do |s|
7
6
  s.name = %q{rink}
8
- s.version = "1.0.1"
7
+ s.version = Rink::Version::STRING
9
8
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
9
  s.authors = ["Colin MacKenzie IV"]
12
10
  s.date = %q{2010-08-07}
13
- s.default_executable = %q{rink}
14
11
  s.description = %q{Makes interactive consoles awesome.}
15
12
  s.email = %q{sinisterchipmunk@gmail.com}
16
- s.executables = ["rink"]
17
- s.extra_rdoc_files = [
18
- "LICENSE",
19
- "README.rdoc"
20
- ]
21
- s.files = [
22
- ".document",
23
- ".gitignore",
24
- "LICENSE",
25
- "README.rdoc",
26
- "Rakefile",
27
- "VERSION",
28
- "bin/rink",
29
- "lib/core_ext/object.rb",
30
- "lib/rink.rb",
31
- "lib/rink/console.rb",
32
- "lib/rink/delegation.rb",
33
- "lib/rink/input_method/base.rb",
34
- "lib/rink/input_method/file.rb",
35
- "lib/rink/input_method/io.rb",
36
- "lib/rink/input_method/readline.rb",
37
- "lib/rink/io_methods.rb",
38
- "lib/rink/lexer.rb",
39
- "lib/rink/line_processor/base.rb",
40
- "lib/rink/line_processor/pure_ruby.rb",
41
- "lib/rink/namespace.rb",
42
- "lib/rink/output_method/base.rb",
43
- "lib/rink/output_method/io.rb",
44
- "rink.gemspec",
45
- "spec/lib/core_ext/object_spec.rb",
46
- "spec/lib/rink/console_spec.rb",
47
- "spec/lib/rink/io_methods_spec.rb",
48
- "spec/lib/rink/namespace_spec.rb",
49
- "spec/lib/rink/pure_ruby_line_processor_spec.rb",
50
- "spec/lib/rink_spec.rb",
51
- "spec/spec.opts",
52
- "spec/spec_helper.rb"
53
- ]
13
+ s.extra_rdoc_files = [ "LICENSE", "README.rdoc" ]
54
14
  s.homepage = %q{http://www.thoughtsincomputation.com}
55
- s.rdoc_options = ["--charset=UTF-8"]
56
- s.require_paths = ["lib"]
57
- s.rubygems_version = %q{1.3.6}
58
15
  s.summary = %q{Makes interactive consoles awesome.}
59
- s.test_files = [
60
- "spec/lib",
61
- "spec/lib/core_ext",
62
- "spec/lib/core_ext/object_spec.rb",
63
- "spec/lib/rink",
64
- "spec/lib/rink/console_spec.rb",
65
- "spec/lib/rink/io_methods_spec.rb",
66
- "spec/lib/rink/namespace_spec.rb",
67
- "spec/lib/rink/pure_ruby_line_processor_spec.rb",
68
- "spec/lib/rink_spec.rb",
69
- "spec/spec.opts",
70
- "spec/spec_helper.rb"
71
- ]
72
16
 
73
- if s.respond_to? :specification_version then
74
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
75
- s.specification_version = 3
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
76
21
 
77
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
78
- s.add_development_dependency(%q<rspec>, [">= 1.3.0"])
79
- else
80
- s.add_dependency(%q<rspec>, [">= 1.3.0"])
81
- end
82
- else
83
- s.add_dependency(%q<rspec>, [">= 1.3.0"])
84
- end
22
+ s.add_development_dependency 'rspec', "~> 2.6.0"
23
+ s.add_development_dependency 'rcov', '~> 0.9.11' unless ENV['WITHOUT_RCOV']
24
+ s.add_development_dependency 'rake', '~> 0.9.2'
85
25
  end
86
26
 
@@ -1,3 +1,5 @@
1
+ require 'spec_helper'
2
+
1
3
  describe Object do
2
4
  context "#instance_exec" do
3
5
  class Dummy
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+
3
+ describe "the 'person' namespace example" do
4
+ class Person
5
+ attr_reader :first_name
6
+ def initialize
7
+ @first_name = "Colin"
8
+ end
9
+ end
10
+
11
+ class MyConsole < Rink::Console
12
+ option :namespace => Person.new
13
+ end
14
+
15
+ subject { MyConsole.new(:input => StringIO.new(""), :output => StringIO.new("")) }
16
+
17
+ it "should autocomplete properly" do
18
+ subject.send(:autocomplete, "firs").should == ['first_name']
19
+ end
20
+ end
@@ -1,12 +1,5 @@
1
1
  require 'rubygems'
2
2
  require 'tmpdir'
3
3
 
4
- $LOAD_PATH.unshift(File.dirname(__FILE__))
5
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
4
  require 'rink'
7
- require 'spec'
8
- require 'spec/autorun'
9
-
10
- Spec::Runner.configure do |config|
11
-
12
- end
5
+ require 'rspec'
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rink
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 1
7
- - 0
8
- - 1
9
- version: 1.0.1
4
+ prerelease:
5
+ version: 1.0.2
10
6
  platform: ruby
11
7
  authors:
12
8
  - Colin MacKenzie IV
@@ -14,23 +10,41 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2010-08-07 00:00:00 -04:00
18
- default_executable: rink
13
+ date: 2010-08-07 00:00:00 Z
19
14
  dependencies:
20
15
  - !ruby/object:Gem::Dependency
21
16
  name: rspec
22
- prerelease: false
23
17
  requirement: &id001 !ruby/object:Gem::Requirement
18
+ none: false
24
19
  requirements:
25
- - - ">="
20
+ - - ~>
26
21
  - !ruby/object:Gem::Version
27
- segments:
28
- - 1
29
- - 3
30
- - 0
31
- version: 1.3.0
22
+ version: 2.6.0
32
23
  type: :development
24
+ prerelease: false
33
25
  version_requirements: *id001
26
+ - !ruby/object:Gem::Dependency
27
+ name: rcov
28
+ requirement: &id002 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 0.9.11
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: *id002
37
+ - !ruby/object:Gem::Dependency
38
+ name: rake
39
+ requirement: &id003 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ version: 0.9.2
45
+ type: :development
46
+ prerelease: false
47
+ version_requirements: *id003
34
48
  description: Makes interactive consoles awesome.
35
49
  email: sinisterchipmunk@gmail.com
36
50
  executables:
@@ -43,6 +57,9 @@ extra_rdoc_files:
43
57
  files:
44
58
  - .document
45
59
  - .gitignore
60
+ - .travis.yml
61
+ - Gemfile
62
+ - Gemfile.lock
46
63
  - LICENSE
47
64
  - README.rdoc
48
65
  - Rakefile
@@ -58,13 +75,16 @@ files:
58
75
  - lib/rink/input_method/readline.rb
59
76
  - lib/rink/io_methods.rb
60
77
  - lib/rink/lexer.rb
78
+ - lib/rink/line_processor.rb
61
79
  - lib/rink/line_processor/base.rb
62
80
  - lib/rink/line_processor/pure_ruby.rb
63
81
  - lib/rink/namespace.rb
64
82
  - lib/rink/output_method/base.rb
65
83
  - lib/rink/output_method/io.rb
84
+ - lib/rink/version.rb
66
85
  - rink.gemspec
67
86
  - spec/lib/core_ext/object_spec.rb
87
+ - spec/lib/documentation/person_namespace_spec.rb
68
88
  - spec/lib/rink/console_spec.rb
69
89
  - spec/lib/rink/io_methods_spec.rb
70
90
  - spec/lib/rink/namespace_spec.rb
@@ -72,38 +92,42 @@ files:
72
92
  - spec/lib/rink_spec.rb
73
93
  - spec/spec.opts
74
94
  - spec/spec_helper.rb
75
- has_rdoc: true
76
95
  homepage: http://www.thoughtsincomputation.com
77
96
  licenses: []
78
97
 
79
98
  post_install_message:
80
- rdoc_options:
81
- - --charset=UTF-8
99
+ rdoc_options: []
100
+
82
101
  require_paths:
83
102
  - lib
84
103
  required_ruby_version: !ruby/object:Gem::Requirement
104
+ none: false
85
105
  requirements:
86
106
  - - ">="
87
107
  - !ruby/object:Gem::Version
108
+ hash: -2760265198172280148
88
109
  segments:
89
110
  - 0
90
111
  version: "0"
91
112
  required_rubygems_version: !ruby/object:Gem::Requirement
113
+ none: false
92
114
  requirements:
93
115
  - - ">="
94
116
  - !ruby/object:Gem::Version
117
+ hash: -2760265198172280148
95
118
  segments:
96
119
  - 0
97
120
  version: "0"
98
121
  requirements: []
99
122
 
100
123
  rubyforge_project:
101
- rubygems_version: 1.3.6
124
+ rubygems_version: 1.8.10
102
125
  signing_key:
103
126
  specification_version: 3
104
127
  summary: Makes interactive consoles awesome.
105
128
  test_files:
106
129
  - spec/lib/core_ext/object_spec.rb
130
+ - spec/lib/documentation/person_namespace_spec.rb
107
131
  - spec/lib/rink/console_spec.rb
108
132
  - spec/lib/rink/io_methods_spec.rb
109
133
  - spec/lib/rink/namespace_spec.rb