myrurema 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1aee083a05c5bdab23da838eed8a253c29000b9a
4
+ data.tar.gz: 7100a799249c4506087b87925187bf6881d9826c
5
+ SHA512:
6
+ metadata.gz: 2010dcb887849e16c9a80b507452c63c70dd12df910bd2103692b4c20361b89526cb92e56137152ded8ef2267872ca500ede413ebed03592e412dc87e87aa208
7
+ data.tar.gz: 8fdd6b9bee100e7ea85458a3667f332aa9cf888682461e1892f51dba5dc5bbade9ddff74491f20882c0f60c0fc3a261dbd58c5b776329a16cf39d15a448a4023
data/Gemfile.lock CHANGED
@@ -1,16 +1,16 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- myrurema (0.3.0)
5
- launchy (~> 2.0.5)
4
+ myrurema (0.3.4)
5
+ launchy (~> 2.3)
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
9
9
  specs:
10
- addressable (2.2.6)
10
+ addressable (2.3.4)
11
11
  diff-lcs (1.1.3)
12
- launchy (2.0.5)
13
- addressable (~> 2.2.6)
12
+ launchy (2.3.0)
13
+ addressable (~> 2.3)
14
14
  rspec (2.8.0)
15
15
  rspec-core (~> 2.8.0)
16
16
  rspec-expectations (~> 2.8.0)
@@ -25,4 +25,4 @@ PLATFORMS
25
25
 
26
26
  DEPENDENCIES
27
27
  myrurema!
28
- rspec (> 2.0)
28
+ rspec (>= 2.0)
data/Rakefile CHANGED
@@ -1,2 +1,8 @@
1
1
  #!/usr/bin/env rake
2
2
  require 'bundler/gem_tasks'
3
+
4
+ task default: :test
5
+
6
+ task :test do
7
+ sh "bundle exec rspec spec/commands.rb"
8
+ end
data/lib/myrurema.rb CHANGED
@@ -7,14 +7,14 @@ require 'launchy'
7
7
  require 'myrurema/options'
8
8
  require 'myrurema/version'
9
9
 
10
- # Extend Pathname so that you can write
10
+ # Extend Pathname so that you can write
11
11
  # foo / "bar" #=> Pathname("foo/bar")
12
12
  # instead of
13
13
  # foo + "bar"
14
14
  class Pathname; alias / +; end
15
15
 
16
16
  class MyRurema
17
- SVN_URL = "http://jp.rubyist.net/svn/rurema"
17
+ SVN_URL = "http://jp.rubyist.net/svn/rurema"
18
18
 
19
19
  def initialize(opt=Options.new(ARGV))
20
20
  @opt = opt
@@ -30,8 +30,8 @@ class MyRurema
30
30
  else
31
31
  nil
32
32
  end
33
-
34
- case
33
+
34
+ case
35
35
  when query.empty?
36
36
  if num
37
37
  search(num, @opt.rubyver)
@@ -67,11 +67,7 @@ class MyRurema
67
67
  " #{args} -d #{db_path(ver)}"
68
68
  sh cmd, :silent => true do |txt|
69
69
  lines = txt.lines.to_a
70
- if lines.count < 10 and
71
- lines.first(2).join =~ /#{query}.*#{query}/m and
72
- lines[1] !~ /^--- / and # ad hoc :-( see Issue #2
73
- !@opt.no_ask
74
-
70
+ if candidate_list_responded?(lines, query)
75
71
  words = {}
76
72
  k = 0
77
73
  puts lines.map{|line|
@@ -160,9 +156,20 @@ class MyRurema
160
156
  sh "cd #{doctree_path/'refm/api/src'}"
161
157
  end
162
158
  end
163
-
159
+
164
160
  private
165
161
 
162
+ def candidate_list_responded?(lines, query)
163
+ return false if @opt.no_ask
164
+
165
+ # if first several words are results of AND search
166
+ lines.first(2).join.split(/\s+/).all? do |word|
167
+ query.all? do |q|
168
+ word =~ Regexp.new(q, 'i')
169
+ end
170
+ end
171
+ end
172
+
166
173
  def default_port(ver)
167
174
  "10" + ver.scan(/\d/).join
168
175
  end
@@ -1,4 +1,4 @@
1
1
  class MyRurema
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
4
4
 
data/myrurema.gemspec CHANGED
@@ -14,6 +14,6 @@ Gem::Specification.new do |gem|
14
14
  gem.require_paths = ['lib']
15
15
  gem.version = MyRurema::VERSION
16
16
 
17
- gem.add_dependency("launchy", "~> 2.0.5")
17
+ gem.add_dependency("launchy", "~> 2.3")
18
18
  gem.add_development_dependency("rspec", ">= 2.0")
19
19
  end
data/spec/commands.rb CHANGED
@@ -19,16 +19,22 @@ CASES = {
19
19
  "rurema --init" => [
20
20
  %r{svn co -rHEAD .*/doctree/trunk .*},
21
21
  %r{svn co -rHEAD .*/bitclust/trunk .*},
22
- %r{.*/bin/bitclust -d .* init version=.* encoding=euc-jp},
22
+ %r{.*/bin/bitclust -d .* init version=.* encoding=utf-8},
23
23
  %r{.*/bin/bitclust -d .* update --stdlibtree=.*/refm/api/src},
24
24
  ],
25
25
 
26
26
  "rurema --init --rubyver=1.8.7" => [
27
- %r{bitclust.*init version=1.8.7}
27
+ %r{.},
28
+ %r{.},
29
+ %r{bitclust.*init version=1.8.7},
30
+ %r{.},
28
31
  ],
29
32
 
30
33
  "rurema --init --ruremadir=/tmp" => [
31
- %r{svn co .*/tmp}
34
+ %r{svn co .*/tmp},
35
+ %r{.},
36
+ %r{.},
37
+ %r{.},
32
38
  ],
33
39
 
34
40
  "rurema --update" => [
@@ -85,14 +91,9 @@ describe MyRurema do
85
91
  my = MyRurema.new(opt)
86
92
  my.run
87
93
 
88
- cmds = my.cmds
89
- i = 0
90
- expects.each do |pattern|
91
- cmds[i..-1].should satisfy{|ary|
92
- ary.any?{|s| pattern =~ s}
93
- }
94
-
95
- i = cmds[i..-1].index{|cmd| pattern =~ cmd} + 1
94
+ # Get commands executed with `sh()`
95
+ my.cmds.zip(expects).each do |cmd, pattern|
96
+ cmd.should match(pattern)
96
97
  end
97
98
  end
98
99
  end
metadata CHANGED
@@ -1,38 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: myrurema
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
5
- prerelease:
4
+ version: 0.3.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - Yutaka HARA
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-06-01 00:00:00.000000000 Z
11
+ date: 2013-06-26 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: launchy
16
- requirement: &2153563060 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
21
- version: 2.0.5
19
+ version: '2.3'
22
20
  type: :runtime
23
21
  prerelease: false
24
- version_requirements: *2153563060
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '2.3'
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: rspec
27
- requirement: &2153562560 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
- - - ! '>='
31
+ - - '>='
31
32
  - !ruby/object:Gem::Version
32
33
  version: '2.0'
33
34
  type: :development
34
35
  prerelease: false
35
- version_requirements: *2153562560
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '2.0'
36
41
  description: myrurema provides a command 'rurema', which helps searching/browsing/writing
37
42
  the Japanese Ruby documents (a.k.a Rurema http://bugs.ruby-lang.org/projects/rurema/wiki
38
43
  .)
@@ -58,27 +63,26 @@ files:
58
63
  - spec/commands.rb
59
64
  homepage: http://github.com/yhara/myrurema
60
65
  licenses: []
66
+ metadata: {}
61
67
  post_install_message:
62
68
  rdoc_options: []
63
69
  require_paths:
64
70
  - lib
65
71
  required_ruby_version: !ruby/object:Gem::Requirement
66
- none: false
67
72
  requirements:
68
- - - ! '>='
73
+ - - '>='
69
74
  - !ruby/object:Gem::Version
70
75
  version: '0'
71
76
  required_rubygems_version: !ruby/object:Gem::Requirement
72
- none: false
73
77
  requirements:
74
- - - ! '>='
78
+ - - '>='
75
79
  - !ruby/object:Gem::Version
76
80
  version: '0'
77
81
  requirements: []
78
82
  rubyforge_project:
79
- rubygems_version: 1.8.11
83
+ rubygems_version: 2.0.0
80
84
  signing_key:
81
- specification_version: 3
85
+ specification_version: 4
82
86
  summary: A tool for Rurema (the new Japanese Ruby reference manual)
83
87
  test_files:
84
88
  - features/basic_commands.feature