gems-cli 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +35 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +30 -0
- data/LICENSE +21 -0
- data/NOTES +14 -0
- data/README.md +24 -0
- data/README.rdoc +6 -0
- data/Rakefile +44 -0
- data/bin/gems +83 -0
- data/gems-cli.gemspec +29 -0
- data/gems-cli.rdoc +5 -0
- data/lib/gems-cli/version.rb +3 -0
- data/lib/gems-cli.rb +8 -0
- data/test/default_test.rb +14 -0
- data/test/test_helper.rb +9 -0
- metadata +167 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 757040e3c13d5e67a926edffdc50dab7c98d46f8
|
4
|
+
data.tar.gz: f0424fdbb72efd5e8b2ecf83f59157a3231b16e7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4579840628d4f1fc7805f5fb63866f4e8920d0386269d1c8b8c7ad798b0d0b3edf135ea823ee240a248f22adf31195f92e193789f451d31acb4b4ffe86e85ca3
|
7
|
+
data.tar.gz: ceafb36ac2df6cea2ced6688477b6029c62d33ec68e507ccdb94abd81857b2041ca635432ede4958f7ba9dadab9cdf1225783f49319ff20c766b9dc18eb2aa6f
|
data/.gitignore
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/test/tmp/
|
9
|
+
/test/version_tmp/
|
10
|
+
/tmp/
|
11
|
+
|
12
|
+
## Specific to RubyMotion:
|
13
|
+
.dat*
|
14
|
+
.repl_history
|
15
|
+
build/
|
16
|
+
|
17
|
+
## Documentation cache and generated files:
|
18
|
+
/.yardoc/
|
19
|
+
/_yardoc/
|
20
|
+
/doc/
|
21
|
+
/rdoc/
|
22
|
+
|
23
|
+
## Environment normalisation:
|
24
|
+
/.bundle/
|
25
|
+
/lib/bundler/man/
|
26
|
+
|
27
|
+
# for a library or gem, you might want to ignore these files since the code is
|
28
|
+
# intended to run in multiple environments; otherwise, check them in:
|
29
|
+
# Gemfile.lock
|
30
|
+
# .ruby-version
|
31
|
+
# .ruby-gemset
|
32
|
+
|
33
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
34
|
+
.rvmrc
|
35
|
+
.DS_Store
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
gems-cli (0.0.1)
|
5
|
+
clipboard (= 1.0.5)
|
6
|
+
gems (= 0.8.3)
|
7
|
+
gli (= 2.12.0)
|
8
|
+
highline (= 1.6.21)
|
9
|
+
rainbow (= 2.0.0)
|
10
|
+
|
11
|
+
GEM
|
12
|
+
remote: https://rubygems.org/
|
13
|
+
specs:
|
14
|
+
clipboard (1.0.5)
|
15
|
+
gems (0.8.3)
|
16
|
+
gli (2.12.0)
|
17
|
+
highline (1.6.21)
|
18
|
+
json (1.8.1)
|
19
|
+
rainbow (2.0.0)
|
20
|
+
rake (10.3.2)
|
21
|
+
rdoc (4.1.1)
|
22
|
+
json (~> 1.4)
|
23
|
+
|
24
|
+
PLATFORMS
|
25
|
+
ruby
|
26
|
+
|
27
|
+
DEPENDENCIES
|
28
|
+
gems-cli!
|
29
|
+
rake
|
30
|
+
rdoc
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Chase Southard
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/NOTES
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
NOTES
|
2
|
+
|
3
|
+
Replace for development in bin/gems after require 'gli'
|
4
|
+
|
5
|
+
```
|
6
|
+
begin # XXX: Remove this begin/rescue before distributing your app
|
7
|
+
require 'gems-cli'
|
8
|
+
rescue LoadError
|
9
|
+
STDERR.puts "In development, you need to use `bundle exec bin/gems-cli` to run your app"
|
10
|
+
STDERR.puts "At install-time, RubyGems will make sure lib, etc. are in the load path"
|
11
|
+
STDERR.puts "Feel free to remove this message from bin/gems-cli now"
|
12
|
+
exit 64
|
13
|
+
end
|
14
|
+
```
|
data/README.md
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
gems-cli
|
2
|
+
========
|
3
|
+
|
4
|
+
Using the [gems](https://github.com/rubygems/gems) gem to lookup Ruby Gems on
|
5
|
+
the command line. Copy formatted gem details for your project's Gemfile.
|
6
|
+
|
7
|
+
## Usage
|
8
|
+
|
9
|
+
`gems search chase` or `gems s chase`
|
10
|
+
|
11
|
+
```
|
12
|
+
running search for chase...
|
13
|
+
0: gem 'purchase', '~> 1.0.15'
|
14
|
+
1: gem 'fuel_purchase', '~> 0.0.14'
|
15
|
+
2: gem 'enju_purchase_request', '~> 0.0.14'
|
16
|
+
3: gem 'chaser', '~> 0.0.3'
|
17
|
+
4: gem 'zombie-chaser', '~> 0.1.0'
|
18
|
+
5: gem 'exemplor-chaser', '~> 0.0.2'
|
19
|
+
6: gem 'rail_chaser', '~> 0.0.3'
|
20
|
+
7: gem 'rack-in-app-purchase', '~> 0.1.1'
|
21
|
+
select from 0..7, or q(uit)
|
22
|
+
```
|
23
|
+
|
24
|
+
`Copied to clipboard!`
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'rake/clean'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'rubygems/package_task'
|
4
|
+
require 'rdoc/task'
|
5
|
+
require 'cucumber'
|
6
|
+
require 'cucumber/rake/task'
|
7
|
+
Rake::RDocTask.new do |rd|
|
8
|
+
rd.main = "README.rdoc"
|
9
|
+
rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
|
10
|
+
rd.title = 'Your application title'
|
11
|
+
end
|
12
|
+
|
13
|
+
spec = eval(File.read('gems-cli.gemspec'))
|
14
|
+
|
15
|
+
Gem::PackageTask.new(spec) do |pkg|
|
16
|
+
end
|
17
|
+
CUKE_RESULTS = 'results.html'
|
18
|
+
CLEAN << CUKE_RESULTS
|
19
|
+
desc 'Run features'
|
20
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
21
|
+
opts = "features --format html -o #{CUKE_RESULTS} --format progress -x"
|
22
|
+
opts += " --tags #{ENV['TAGS']}" if ENV['TAGS']
|
23
|
+
t.cucumber_opts = opts
|
24
|
+
t.fork = false
|
25
|
+
end
|
26
|
+
|
27
|
+
desc 'Run features tagged as work-in-progress (@wip)'
|
28
|
+
Cucumber::Rake::Task.new('features:wip') do |t|
|
29
|
+
tag_opts = ' --tags ~@pending'
|
30
|
+
tag_opts = ' --tags @wip'
|
31
|
+
t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty -x -s#{tag_opts}"
|
32
|
+
t.fork = false
|
33
|
+
end
|
34
|
+
|
35
|
+
task :cucumber => :features
|
36
|
+
task 'cucumber:wip' => 'features:wip'
|
37
|
+
task :wip => 'features:wip'
|
38
|
+
require 'rake/testtask'
|
39
|
+
Rake::TestTask.new do |t|
|
40
|
+
t.libs << "test"
|
41
|
+
t.test_files = FileList['test/*_test.rb']
|
42
|
+
end
|
43
|
+
|
44
|
+
task :default => [:test,:features]
|
data/bin/gems
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'gli'
|
3
|
+
require 'gems-cli'
|
4
|
+
|
5
|
+
include GLI::App
|
6
|
+
|
7
|
+
program_desc 'Interact with Rubygems.org from the command line'
|
8
|
+
|
9
|
+
version GemsCli::VERSION
|
10
|
+
|
11
|
+
# Use argument validation
|
12
|
+
arguments :strict
|
13
|
+
|
14
|
+
desc 'Search Rubygems.org for a gem'
|
15
|
+
arg_name 'Name of a gem'
|
16
|
+
command [:search, :s] do |c|
|
17
|
+
c.desc 'Feeling lucky, punk?'
|
18
|
+
c.switch [:l, :lucky]
|
19
|
+
|
20
|
+
c.desc 'Number of results returned'
|
21
|
+
c.default_value 10
|
22
|
+
c.flag :n
|
23
|
+
|
24
|
+
c.action do |global_options,options,args|
|
25
|
+
|
26
|
+
# raise "that command made no sense"
|
27
|
+
if args[0].nil? || args[0].empty?
|
28
|
+
raise ArgumentError, 'Please supply a search term.'
|
29
|
+
end
|
30
|
+
|
31
|
+
result_limit = options[:l] ? 0 : options[:n].to_i
|
32
|
+
|
33
|
+
puts "Running your search for #{args[0]}...".color(:green)
|
34
|
+
search_results = Gems.search args[0]
|
35
|
+
iteration = 0
|
36
|
+
search_results[0..result_limit].each do |result|
|
37
|
+
puts "#{iteration}: gem '#{result['name']}', '~> #{result['version']}'"
|
38
|
+
iteration += 1
|
39
|
+
end
|
40
|
+
choices = "select from 0..#{search_results.size - 1} or (q)uit \n".color(:green)
|
41
|
+
answer = ask(choices, String) do |q|
|
42
|
+
q.case = :downcase
|
43
|
+
q.validate = /\A\d|q\Z/
|
44
|
+
end
|
45
|
+
|
46
|
+
case answer
|
47
|
+
when /\d/
|
48
|
+
if search_results[answer.to_i]
|
49
|
+
Clipboard.copy "gem '#{search_results[answer.to_i]['name']}', '~> #{search_results[answer.to_i]['version']}'"
|
50
|
+
puts "Copied to clipboard!".color(:green)
|
51
|
+
else
|
52
|
+
puts "Your choice, #{answer}, is not in the list 0..#{search_results.size - 1}"
|
53
|
+
end
|
54
|
+
when 'q'
|
55
|
+
puts 'Later.'
|
56
|
+
else
|
57
|
+
puts "Sorry. Unknown option: #{answer.chomp}"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
pre do |global,command,options,args|
|
63
|
+
# Pre logic here
|
64
|
+
# Return true to proceed; false to abort and not call the
|
65
|
+
# chosen command
|
66
|
+
# Use skips_pre before a command to skip this block
|
67
|
+
# on that command only
|
68
|
+
true
|
69
|
+
end
|
70
|
+
|
71
|
+
post do |global,command,options,args|
|
72
|
+
# Post logic here
|
73
|
+
# Use skips_post before a command to skip this
|
74
|
+
# block on that command only
|
75
|
+
end
|
76
|
+
|
77
|
+
on_error do |exception|
|
78
|
+
# Error logic here
|
79
|
+
# return false to skip default error handling
|
80
|
+
true
|
81
|
+
end
|
82
|
+
|
83
|
+
exit run(ARGV)
|
data/gems-cli.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Ensure we require the local version and not one we might have installed already
|
2
|
+
require File.join([File.dirname(__FILE__),'lib','gems-cli','version.rb'])
|
3
|
+
spec = Gem::Specification.new do |s|
|
4
|
+
s.name = 'gems-cli'
|
5
|
+
s.version = GemsCli::VERSION
|
6
|
+
s.authors = ['Chase Southard']
|
7
|
+
s.email = 'chase.southard@gmail.com'
|
8
|
+
s.homepage = 'https://github.com/chaserx/gems-cli'
|
9
|
+
s.platform = Gem::Platform::RUBY
|
10
|
+
s.summary = 'Search rubygems.org from the command line. Copy formatted gem details for your Gemfile.'
|
11
|
+
s.description = 'Search rubygems.org from the command line. Then you can copy formatted gem details for your Gemfile.'
|
12
|
+
s.license = 'MIT'
|
13
|
+
s.files = `git ls-files`.split("
|
14
|
+
")
|
15
|
+
s.require_paths << 'lib'
|
16
|
+
s.has_rdoc = true
|
17
|
+
s.extra_rdoc_files = ['README.rdoc','gems-cli.rdoc']
|
18
|
+
s.rdoc_options << '--title' << 'gems-cli' << '--main' << 'README.rdoc' << '-ri'
|
19
|
+
s.bindir = 'bin'
|
20
|
+
s.executables << 'gems'
|
21
|
+
s.add_development_dependency('rake', '~> 0')
|
22
|
+
s.add_development_dependency('rdoc', '~> 0')
|
23
|
+
|
24
|
+
s.add_runtime_dependency('gli','2.12.0')
|
25
|
+
s.add_runtime_dependency('gems','0.8.3')
|
26
|
+
s.add_runtime_dependency('highline', '1.6.21')
|
27
|
+
s.add_runtime_dependency('clipboard', '1.0.5')
|
28
|
+
s.add_runtime_dependency('rainbow', '2.0.0')
|
29
|
+
end
|
data/gems-cli.rdoc
ADDED
data/lib/gems-cli.rb
ADDED
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,167 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gems-cli
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Chase Southard
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-08-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rdoc
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: gli
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.12.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.12.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: gems
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.8.3
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.8.3
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: highline
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.6.21
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.6.21
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: clipboard
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 1.0.5
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 1.0.5
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rainbow
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 2.0.0
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 2.0.0
|
111
|
+
description: Search rubygems.org from the command line. Then you can copy formatted
|
112
|
+
gem details for your Gemfile.
|
113
|
+
email: chase.southard@gmail.com
|
114
|
+
executables:
|
115
|
+
- gems
|
116
|
+
extensions: []
|
117
|
+
extra_rdoc_files:
|
118
|
+
- README.rdoc
|
119
|
+
- gems-cli.rdoc
|
120
|
+
files:
|
121
|
+
- ".gitignore"
|
122
|
+
- Gemfile
|
123
|
+
- Gemfile.lock
|
124
|
+
- LICENSE
|
125
|
+
- NOTES
|
126
|
+
- README.md
|
127
|
+
- README.rdoc
|
128
|
+
- Rakefile
|
129
|
+
- bin/gems
|
130
|
+
- gems-cli.gemspec
|
131
|
+
- gems-cli.rdoc
|
132
|
+
- lib/gems-cli.rb
|
133
|
+
- lib/gems-cli/version.rb
|
134
|
+
- test/default_test.rb
|
135
|
+
- test/test_helper.rb
|
136
|
+
homepage: https://github.com/chaserx/gems-cli
|
137
|
+
licenses:
|
138
|
+
- MIT
|
139
|
+
metadata: {}
|
140
|
+
post_install_message:
|
141
|
+
rdoc_options:
|
142
|
+
- "--title"
|
143
|
+
- gems-cli
|
144
|
+
- "--main"
|
145
|
+
- README.rdoc
|
146
|
+
- "-ri"
|
147
|
+
require_paths:
|
148
|
+
- lib
|
149
|
+
- lib
|
150
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
151
|
+
requirements:
|
152
|
+
- - ">="
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: '0'
|
155
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
requirements: []
|
161
|
+
rubyforge_project:
|
162
|
+
rubygems_version: 2.2.2
|
163
|
+
signing_key:
|
164
|
+
specification_version: 4
|
165
|
+
summary: Search rubygems.org from the command line. Copy formatted gem details for
|
166
|
+
your Gemfile.
|
167
|
+
test_files: []
|