add_gem 0.0.1 → 1.0.0
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.
- checksums.yaml +7 -0
- data/Gemfile +0 -1
- data/README.md +26 -6
- data/add_gem.gemspec +4 -2
- data/bin/add_gem +5 -1
- data/lib/add_gem.rb +2 -2
- data/lib/add_gem/add_gem.rb +4 -3
- data/lib/add_gem/version.rb +1 -1
- metadata +26 -12
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 51710ceae0b53eee14e5f57ea8e6f9fce127ba54
|
4
|
+
data.tar.gz: 9e0206f397b4955e89667482d01f90c95ce36d0b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 34deca797634e703e43db3bc40c49f72a04c6d282105e09b295015db2517c7d0fa40e9d6ccd7802f81185cae9d988bf2b441bd50730cc9ae8c91d3cda8f12648
|
7
|
+
data.tar.gz: 5ef4094e3e04c9506a4f33f3c3fc63632435c6d63cc526abb1f98bf3195159fc889f6e18cb4d1db2eb46499e53f01f610128698b16e208e59354523a6cdba246
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,13 +1,28 @@
|
|
1
1
|
# AddGem
|
2
2
|
|
3
|
-
Command-line tool to append new gems to your Gemfile.
|
3
|
+
Command-line tool to append new gems to your Gemfile with pessimistic version constrain.
|
4
4
|
|
5
5
|
## Problem
|
6
6
|
When adding a new gem to my Gemfile I found myself visiting
|
7
7
|
http://rubygems.org/gems/GEM_NAME and checking the latest version.
|
8
8
|
|
9
|
-
I
|
10
|
-
|
9
|
+
I like to use pessimistic version constrain to avoid headaches. I have
|
10
|
+
seen projects getting broken because major version updates, and people
|
11
|
+
wasting their time trying to figure it out what it was.
|
12
|
+
|
13
|
+
I built this tool which receives the name of the gem and then adds a
|
14
|
+
new entry to your Gemfile including the version with the pessimistic
|
15
|
+
operator (`~>`).
|
16
|
+
|
17
|
+
$ cat Gemfile
|
18
|
+
source 'https://rubygems.org'
|
19
|
+
|
20
|
+
$ add_gem rails
|
21
|
+
$ Added gem "rails", "~> 3.2.8" to your Gemfile.
|
22
|
+
|
23
|
+
$ cat Gemfile
|
24
|
+
source 'https://rubygems.org'
|
25
|
+
gem "rails", "~> 3.2.8"
|
11
26
|
|
12
27
|
What's wrong with `gem search rails -r` you might be thinking? the
|
13
28
|
answer is nothing, but why do something in more than one step when it
|
@@ -16,11 +31,16 @@ can be done in one. :)
|
|
16
31
|
|
17
32
|
## Usage
|
18
33
|
|
19
|
-
Install
|
34
|
+
Install with rubygems:
|
20
35
|
|
21
|
-
gem
|
36
|
+
gem install add_gem
|
22
37
|
|
23
|
-
And then execute on your
|
38
|
+
And then execute on your working directory:
|
24
39
|
|
25
40
|
$ add_gem rails
|
26
41
|
$ Added gem "rails", "~> 3.2.8" to your Gemfile.
|
42
|
+
|
43
|
+
|
44
|
+
## TODO
|
45
|
+
|
46
|
+
- Take as parameter a group and then add the gem under the given group.
|
data/add_gem.gemspec
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
require File.expand_path('../lib/add_gem/version', __FILE__)
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
|
-
gem.authors = ["Adolfo Builes"]
|
5
|
-
gem.email = ["builes.adolfo@gmail.com"]
|
4
|
+
gem.authors = ["Adolfo Builes", "Nicolas Hock"]
|
5
|
+
gem.email = ["builes.adolfo@gmail.com", "nhocki@gmail.com"]
|
6
6
|
gem.description = %q{"Command-line tool to append new gems to your Gemfile."}
|
7
7
|
gem.summary = %q{"Command-line tool to append new gems to your Gemfile."}
|
8
8
|
gem.homepage = "https://github.com/abuiles/add_gem"
|
@@ -13,4 +13,6 @@ Gem::Specification.new do |gem|
|
|
13
13
|
gem.name = "add_gem"
|
14
14
|
gem.require_paths = ["lib"]
|
15
15
|
gem.version = AddGem::VERSION
|
16
|
+
|
17
|
+
gem.add_development_dependency('rake', '~> 10.3.2')
|
16
18
|
end
|
data/bin/add_gem
CHANGED
@@ -7,12 +7,16 @@ options = {}
|
|
7
7
|
|
8
8
|
opt_parser = OptionParser.new do |opt|
|
9
9
|
opt.banner = "Usage: add_gem GEM_NAME"
|
10
|
+
|
11
|
+
opt.on("-g", "--group [GROUP]", "Group for the gem being added.") do |g|
|
12
|
+
options[:group] = g
|
13
|
+
end
|
10
14
|
end
|
11
15
|
|
12
16
|
opt_parser.parse!
|
13
17
|
|
14
18
|
if not (gem_name =ARGV[0]).nil?
|
15
|
-
AddGem.add(gem_name)
|
19
|
+
AddGem.add(gem_name, options)
|
16
20
|
else
|
17
21
|
puts opt_parser
|
18
22
|
end
|
data/lib/add_gem.rb
CHANGED
data/lib/add_gem/add_gem.rb
CHANGED
@@ -5,13 +5,14 @@ module AddGem
|
|
5
5
|
extend self
|
6
6
|
BASE_URL = "https://rubygems.org/api/v1/gems"
|
7
7
|
|
8
|
-
def add(gem_name)
|
8
|
+
def add(gem_name, options = {})
|
9
9
|
url = "#{BASE_URL}/#{gem_name}.json"
|
10
10
|
gem_info = get_gem(url)
|
11
11
|
|
12
12
|
if gem_info
|
13
|
-
|
14
|
-
|
13
|
+
group = !!options[:group] ? ", group: :#{options[:group]}" : ""
|
14
|
+
gem_entry = %Q[gem "#{gem_name}", "~> #{gem_info["version"]}"#{group}]
|
15
|
+
f = File.open('Gemfile', 'a+'){ |f| f.puts gem_entry }
|
15
16
|
puts "Added #{gem_entry} to your Gemfile."
|
16
17
|
else
|
17
18
|
puts "Opps something went wrong fetching the gem information.\nTry curl #{url}"
|
data/lib/add_gem/version.rb
CHANGED
metadata
CHANGED
@@ -1,19 +1,34 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: add_gem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Adolfo Builes
|
8
|
+
- Nicolas Hock
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
dependencies:
|
14
|
-
|
12
|
+
date: 2014-11-25 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ~>
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 10.3.2
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ~>
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 10.3.2
|
28
|
+
description: '"Command-line tool to append new gems to your Gemfile."'
|
15
29
|
email:
|
16
30
|
- builes.adolfo@gmail.com
|
31
|
+
- nhocki@gmail.com
|
17
32
|
executables:
|
18
33
|
- add_gem
|
19
34
|
extensions: []
|
@@ -32,27 +47,26 @@ files:
|
|
32
47
|
- test/test_add_gem.rb
|
33
48
|
homepage: https://github.com/abuiles/add_gem
|
34
49
|
licenses: []
|
50
|
+
metadata: {}
|
35
51
|
post_install_message:
|
36
52
|
rdoc_options: []
|
37
53
|
require_paths:
|
38
54
|
- lib
|
39
55
|
required_ruby_version: !ruby/object:Gem::Requirement
|
40
|
-
none: false
|
41
56
|
requirements:
|
42
|
-
- -
|
57
|
+
- - '>='
|
43
58
|
- !ruby/object:Gem::Version
|
44
59
|
version: '0'
|
45
60
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
|
-
none: false
|
47
61
|
requirements:
|
48
|
-
- -
|
62
|
+
- - '>='
|
49
63
|
- !ruby/object:Gem::Version
|
50
64
|
version: '0'
|
51
65
|
requirements: []
|
52
66
|
rubyforge_project:
|
53
|
-
rubygems_version: 1.
|
67
|
+
rubygems_version: 2.1.11
|
54
68
|
signing_key:
|
55
|
-
specification_version:
|
56
|
-
summary:
|
69
|
+
specification_version: 4
|
70
|
+
summary: '"Command-line tool to append new gems to your Gemfile."'
|
57
71
|
test_files:
|
58
72
|
- test/test_add_gem.rb
|