gem-search 0.0.3 → 0.0.5

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/bin/gem-search CHANGED
@@ -22,7 +22,7 @@ OPT_SORT = {
22
22
  'a' => 'downloads',
23
23
  }
24
24
 
25
- puts opts and exit if (ARGV.size == 0)
25
+ puts opts and exit if (ARGV.size == 0) && (!opts.to_hash.values.include?(true))
26
26
  exit if opts['h']
27
27
 
28
28
  $:.unshift File.dirname(__FILE__) + '/../lib'
@@ -1,3 +1,3 @@
1
1
  module Gem::Search
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -0,0 +1,40 @@
1
+ require 'spec_helper'
2
+
3
+ BIN = 'bin/gem-search'
4
+ USAGE = <<-EOS
5
+ Usage: gem-search gem_name [options]
6
+
7
+ -s, --sort Sort by name of item.
8
+ [n]ame (default)
9
+ [v]er (displayed name: DL(ver))
10
+ [a]ll (displayed name: DL(all))
11
+ -v, --version Display the version.
12
+ -h, --help Display this help message.
13
+ EOS
14
+
15
+
16
+ shared_examples 'display an usage' do
17
+ it 'should display an usage' do
18
+ should == USAGE
19
+ end
20
+ end
21
+
22
+ describe 'bin/gem-search' do
23
+ context 'with no argument' do
24
+ subject { `#{BIN}` }
25
+ it_behaves_like 'display an usage'
26
+ end
27
+
28
+ context 'with -h' do
29
+ subject { `#{BIN} -h` }
30
+ it_behaves_like 'display an usage'
31
+ end
32
+
33
+ context 'with -v' do
34
+ subject { `#{BIN} -v` }
35
+ it 'should display an usage' do
36
+ should == "gem-search #{Gem::Search::VERSION}\n"
37
+ end
38
+ end
39
+
40
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem-search
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -109,6 +109,7 @@ files:
109
109
  - lib/gem-search.rb
110
110
  - lib/gem-search/cli.rb
111
111
  - lib/gem-search/version.rb
112
+ - spec/bin/gem-search_spec.rb
112
113
  - spec/cli_spec.rb
113
114
  - spec/spec_helper.rb
114
115
  homepage: https://github.com/rochefort/gem-search
@@ -136,5 +137,6 @@ signing_key:
136
137
  specification_version: 3
137
138
  summary: search gems with using rubygems.org API
138
139
  test_files:
140
+ - spec/bin/gem-search_spec.rb
139
141
  - spec/cli_spec.rb
140
142
  - spec/spec_helper.rb