gem_source 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/Gemfile +4 -0
- data/README.md +88 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/gem_source.gemspec +23 -0
- data/lib/gem_source.rb +27 -0
- data/lib/gem_source/version.rb +3 -0
- metadata +81 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b090b81a12407b0ca9a143edac84c61a6b2c2012
|
4
|
+
data.tar.gz: 101bd4ee98e89cfb032be4b869eb5bdc9c4e80be
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8a7264006a3e398c96170bddab6c35e8e07c07e802b838723b59885c5cf78b661fde692d38acf449fe9a2e2df1f67466db26e7bc79740e0aa1d3ae1b172a4a43
|
7
|
+
data.tar.gz: 19c54c33448f71edfe130666d2385e16d5edff332b0d54599e5670a0df32673d77ad4851e6a7e9278e66041f0dc6261aac1d8500881369f664fe8ea2b67a1b8f
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
# GemSource
|
2
|
+
|
3
|
+
Provides an opinionated way to quickly switch bundler between using gems locally on your filesystem or github. The settings are configured through ~/.gem_source.yml config file.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
You'll need to install the gem outside of bundler.
|
8
|
+
|
9
|
+
```
|
10
|
+
gem install gem_source
|
11
|
+
```
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
Add this line to your the top of your Gemfile:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
require 'gem_source'
|
19
|
+
```
|
20
|
+
|
21
|
+
### Example 1 - use gems on local filesystem
|
22
|
+
|
23
|
+
If you want bundler to load gems on your local system at ~/src.
|
24
|
+
|
25
|
+
`~/.gem_source.yml`:
|
26
|
+
|
27
|
+
```yaml
|
28
|
+
where: local
|
29
|
+
path: ~/src
|
30
|
+
```
|
31
|
+
|
32
|
+
Example `Gemfile`
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
require "gem_source"
|
36
|
+
source 'https://rubygems.org'
|
37
|
+
|
38
|
+
gem 'lono', GemSource.gem('tongueroo/lono')
|
39
|
+
```
|
40
|
+
|
41
|
+
Bundler will use the lono gem at `~/src/tongueroo/lono`.
|
42
|
+
|
43
|
+
### Example 2 - use gems on github
|
44
|
+
|
45
|
+
If you want bundler to load from github
|
46
|
+
|
47
|
+
`~/.gem_source.yml`:
|
48
|
+
|
49
|
+
```yaml
|
50
|
+
where: github
|
51
|
+
path: ~/src # gets ignored
|
52
|
+
```
|
53
|
+
|
54
|
+
Example `Gemfile`
|
55
|
+
|
56
|
+
```
|
57
|
+
require "gem_source"
|
58
|
+
source 'https://rubygems.org'
|
59
|
+
|
60
|
+
gem 'lono', GemSource.gem('tongueroo/lono')
|
61
|
+
```
|
62
|
+
|
63
|
+
### Example 3 - use gems on rubygems
|
64
|
+
|
65
|
+
If you want bundler to load from github
|
66
|
+
|
67
|
+
`~/.gem_source.yml`:
|
68
|
+
|
69
|
+
```yaml
|
70
|
+
where: rubygems
|
71
|
+
path: ~/src # gets ignored
|
72
|
+
```
|
73
|
+
|
74
|
+
Example `Gemfile`
|
75
|
+
|
76
|
+
```
|
77
|
+
require "gem_source"
|
78
|
+
source 'https://rubygems.org'
|
79
|
+
|
80
|
+
gem 'lono', GemSource.gem('tongueroo/lono')
|
81
|
+
```
|
82
|
+
|
83
|
+
Bundler will use the lono gem at [https://github.com/tongueroo/lono](https://github.com/tongueroo/lono).
|
84
|
+
|
85
|
+
## Contributing
|
86
|
+
|
87
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/tongueroo/gem_source.
|
88
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "gem_source"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/gem_source.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'gem_source/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "gem_source"
|
8
|
+
spec.version = GemSource::VERSION
|
9
|
+
spec.authors = ["Tung Nguyen"]
|
10
|
+
spec.email = ["tongueroo@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Quick way to switch between gems locally and github in your Gemfile}
|
13
|
+
spec.description = %q{Quick way to switch between gems locally and github in your Gemfile}
|
14
|
+
spec.homepage = "http://github.com/tongueroo/gem_source."
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = "exe"
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
end
|
data/lib/gem_source.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require "gem_source/version"
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
module GemSource
|
5
|
+
def self.gem(name, options={})
|
6
|
+
base = case settings['where']
|
7
|
+
when 'local'
|
8
|
+
path = File.join(settings['path'], name)
|
9
|
+
{path: path}
|
10
|
+
when 'github'
|
11
|
+
{github: name}
|
12
|
+
else
|
13
|
+
{}
|
14
|
+
end
|
15
|
+
base.merge(options)
|
16
|
+
end
|
17
|
+
|
18
|
+
@@settings = nil
|
19
|
+
def self.settings
|
20
|
+
path = "#{ENV['HOME']}/.gem_source.yml"
|
21
|
+
@@settings ||= YAML.load(IO.read(path))
|
22
|
+
rescue
|
23
|
+
{
|
24
|
+
'settings': nil
|
25
|
+
}
|
26
|
+
end
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gem_source
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tung Nguyen
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-07-10 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.12'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.12'
|
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
|
+
description: Quick way to switch between gems locally and github in your Gemfile
|
42
|
+
email:
|
43
|
+
- tongueroo@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- Gemfile
|
50
|
+
- README.md
|
51
|
+
- Rakefile
|
52
|
+
- bin/console
|
53
|
+
- bin/setup
|
54
|
+
- gem_source.gemspec
|
55
|
+
- lib/gem_source.rb
|
56
|
+
- lib/gem_source/version.rb
|
57
|
+
homepage: http://github.com/tongueroo/gem_source.
|
58
|
+
licenses: []
|
59
|
+
metadata: {}
|
60
|
+
post_install_message:
|
61
|
+
rdoc_options: []
|
62
|
+
require_paths:
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
requirements: []
|
75
|
+
rubyforge_project:
|
76
|
+
rubygems_version: 2.6.4
|
77
|
+
signing_key:
|
78
|
+
specification_version: 4
|
79
|
+
summary: Quick way to switch between gems locally and github in your Gemfile
|
80
|
+
test_files: []
|
81
|
+
has_rdoc:
|