bundler-add 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f1949926acb89e43c2ddfb87f72da48f2fe2b16e
4
+ data.tar.gz: a669bef0e735ace91e341d52cccad144563b328d
5
+ SHA512:
6
+ metadata.gz: 5d7bcb02d45e1e7e8723e6dc790a52021e81e6eff7765e2e3b45730ad229231aa7b61c96b2cbd473424e474f61b7b8e0f2ec6db0c259d188ec66d634deacbda7
7
+ data.tar.gz: 3fde46240ff43f5f488edb5b5ee3de221e4de34c54f453a7b8d389a24682d014aa9dedc158d05ef928941dfe6532ec046f0b12f21d6c6dccb5dd8a3c96bceb80
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in bundler-add.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Sho Kusano
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,30 @@
1
+ # Bundler::Add
2
+
3
+ This gem provides `bundle add` command.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'bundler-add'
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```
16
+ $ bundle add rails rspec-rails
17
+ gem 'rails', '~> 4.1.6'
18
+ gem 'rspec-rails', '~> 3.1.0'
19
+ $ bundle add rails rspec-rails >> Gemfile
20
+ $ bundle add rspec -g test,development
21
+ gem 'rspec', '~> 3.1.0', group: [:test, :development]
22
+ ```
23
+
24
+ ## Contributing
25
+
26
+ 1. Fork it ( https://github.com/rosylilly/bundler-add/fork )
27
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
28
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
29
+ 4. Push to the branch (`git push origin my-new-feature`)
30
+ 5. Create a new Pull Request
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/add'
4
+ Bundler::Add.show_defines(ARGV)
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'bundler/add/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'bundler-add'
8
+ spec.version = Bundler::Add::VERSION
9
+ spec.authors = ['Sho Kusano']
10
+ spec.email = ['rosylilly@aduca.org']
11
+ spec.summary = 'provides bundler-add command'
12
+ spec.homepage = 'https://github.com/rosylilly/bundler-add'
13
+ spec.license = 'MIT'
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ['lib']
19
+
20
+ spec.add_development_dependency 'bundler', '~> 1.7'
21
+ spec.add_development_dependency 'rake', '~> 10.0'
22
+
23
+ spec.add_dependency 'thor', '~> 0.19.1'
24
+ end
@@ -0,0 +1,52 @@
1
+ require 'thor'
2
+ require 'open-uri'
3
+ require 'json'
4
+ require 'optparse'
5
+ require 'bundler/add/version'
6
+
7
+ module Bundler
8
+ module Add
9
+ class << self
10
+ def show_defines(argv)
11
+ options = parse_options(argv)
12
+
13
+ options[:gems].each do |gem|
14
+ show_define(gem, options)
15
+ end
16
+ end
17
+
18
+ def show_define(gem, options)
19
+ if options[:groups].any?
20
+ groups = options[:groups]
21
+ puts %Q{gem '#{gem}', '~> #{fetch_version(gem)}', group: [#{groups.map{|g| g.sub(/^/, ':') }.join(', ')}]}
22
+ else
23
+ puts %Q{gem '#{gem}', '~> #{fetch_version(gem)}'}
24
+ end
25
+ end
26
+
27
+ def fetch_version(gem)
28
+ gemspec = JSON.parse(open("https://rubygems.org/api/v1/gems/#{gem}.json", &:read))
29
+
30
+ gemspec['version']
31
+ rescue OpenURI::HTTPError
32
+ '0.0.0'
33
+ end
34
+
35
+ def parse_options(argv)
36
+ groups = []
37
+ req = nil
38
+
39
+ opts = OptionParser.new
40
+ opts.on('-g GROUP', '--group GROUP', Array) do |group|
41
+ groups = group
42
+ end
43
+ gems = opts.parse!(argv)
44
+
45
+ {
46
+ gems: gems,
47
+ groups: groups
48
+ }
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,5 @@
1
+ module Bundler
2
+ module Add
3
+ VERSION = '0.0.1'
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bundler-add
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Sho Kusano
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-10-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: thor
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.19.1
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.19.1
55
+ description:
56
+ email:
57
+ - rosylilly@aduca.org
58
+ executables:
59
+ - bundler-add
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - bin/bundler-add
69
+ - bundler-add.gemspec
70
+ - lib/bundler/add.rb
71
+ - lib/bundler/add/version.rb
72
+ homepage: https://github.com/rosylilly/bundler-add
73
+ licenses:
74
+ - MIT
75
+ metadata: {}
76
+ post_install_message:
77
+ rdoc_options: []
78
+ require_paths:
79
+ - lib
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ requirements: []
91
+ rubyforge_project:
92
+ rubygems_version: 2.4.2
93
+ signing_key:
94
+ specification_version: 4
95
+ summary: provides bundler-add command
96
+ test_files: []