gemline 0.0.1
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/.gitignore +17 -0
- data/Gemfile +4 -0
- data/README.rdoc +13 -0
- data/Rakefile +2 -0
- data/bin/gemline +4 -0
- data/gemline.gemspec +20 -0
- data/lib/gemline.rb +35 -0
- metadata +64 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.rdoc
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
= gemline
|
2
|
+
|
3
|
+
Create a tilde-arrow Gemfile line for a gem on rubygems.org using the latest version number available according to the rubygems api.
|
4
|
+
|
5
|
+
If possible, we'll also copy that Gemfile line into the clipboard using pbcopy.
|
6
|
+
|
7
|
+
== Install
|
8
|
+
|
9
|
+
# gem install gemline
|
10
|
+
|
11
|
+
== Usage
|
12
|
+
|
13
|
+
# gemline [GEM NAME]
|
data/Rakefile
ADDED
data/bin/gemline
ADDED
data/gemline.gemspec
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/gemline', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Joseph Alba"]
|
6
|
+
gem.email = ["joe@joealba.com"]
|
7
|
+
gem.description = %q{Grab the latest Gemfile 'gem' line for a specific Ruby gem}
|
8
|
+
gem.summary = %q{}
|
9
|
+
gem.homepage = "http://github.com/joealba/gemline"
|
10
|
+
|
11
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
12
|
+
gem.files = `git ls-files`.split("\n")
|
13
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
14
|
+
gem.name = "gemline"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = Gemline::VERSION
|
17
|
+
|
18
|
+
gem.add_dependency('crack')
|
19
|
+
# gem.add_development_dependency(%q<rspec>, [">= 2.7.0"])
|
20
|
+
end
|
data/lib/gemline.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'crack/json'
|
2
|
+
require 'net/http'
|
3
|
+
|
4
|
+
class Gemline
|
5
|
+
VERSION = "0.0.1"
|
6
|
+
|
7
|
+
def self.start
|
8
|
+
gem = ARGV[0].to_s.gsub(/[^\w\-]+/,'')
|
9
|
+
if (gem.empty?)
|
10
|
+
puts "Usage: gemline [GEM NAME]"
|
11
|
+
exit
|
12
|
+
end
|
13
|
+
|
14
|
+
doc = Net::HTTP.get(URI.parse("http://rubygems.org/api/v1/gems/#{gem}.json"))
|
15
|
+
|
16
|
+
if doc.match(/could not be found/)
|
17
|
+
puts "Rubygem #{gem} was not found on rubygems.org"
|
18
|
+
exit
|
19
|
+
else
|
20
|
+
response = Crack::JSON.parse(doc)
|
21
|
+
gemline = %Q{gem "#{gem}", "~> #{response['version']}"}
|
22
|
+
|
23
|
+
puts gemline
|
24
|
+
|
25
|
+
begin
|
26
|
+
if clipboard = IO.popen('pbcopy', 'r+')
|
27
|
+
clipboard.puts gemline
|
28
|
+
puts " Gem line copied to your clipboard. Ready to paste into your Gemfile"
|
29
|
+
end
|
30
|
+
rescue
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
metadata
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gemline
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Joseph Alba
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-10-28 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: crack
|
16
|
+
requirement: &70122338398480 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70122338398480
|
25
|
+
description: Grab the latest Gemfile 'gem' line for a specific Ruby gem
|
26
|
+
email:
|
27
|
+
- joe@joealba.com
|
28
|
+
executables:
|
29
|
+
- gemline
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- .gitignore
|
34
|
+
- Gemfile
|
35
|
+
- README.rdoc
|
36
|
+
- Rakefile
|
37
|
+
- bin/gemline
|
38
|
+
- gemline.gemspec
|
39
|
+
- lib/gemline.rb
|
40
|
+
homepage: http://github.com/joealba/gemline
|
41
|
+
licenses: []
|
42
|
+
post_install_message:
|
43
|
+
rdoc_options: []
|
44
|
+
require_paths:
|
45
|
+
- lib
|
46
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
+
none: false
|
48
|
+
requirements:
|
49
|
+
- - ! '>='
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ! '>='
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0'
|
58
|
+
requirements: []
|
59
|
+
rubyforge_project:
|
60
|
+
rubygems_version: 1.8.11
|
61
|
+
signing_key:
|
62
|
+
specification_version: 3
|
63
|
+
summary: ''
|
64
|
+
test_files: []
|