prox_gem 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/lib/prox_gem/prox_gem.rb +55 -0
- data/lib/prox_gem.rb +1 -0
- metadata +45 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 42e60f1652e9231bd690ab4a187c43bd9f407a21
|
4
|
+
data.tar.gz: ef6d67939db3802dcbae605abdfe925a60e54084
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d69c62a2b2301a25f634d4cd820cbd9a1777b7807d2916b68cbc05239c113628a9b73560e368bdf1392ed170dfd0d2531c1ea37dfe77fc6f46fe1d16986d142e
|
7
|
+
data.tar.gz: cd74606c2926af3bc3743687e1549f605ff23417e0df58cc25e264a5f1485783c30347756267350f0c536e6725f00bf975c465709db279f7071ddbfae40e6a2c
|
@@ -0,0 +1,55 @@
|
|
1
|
+
def prox_gem(gem_name, options={})
|
2
|
+
opts = _options(gem_name, options)
|
3
|
+
gem gem_name, opts
|
4
|
+
end
|
5
|
+
|
6
|
+
def _options(gem_name, options={})
|
7
|
+
mode = _prox_gem_mode
|
8
|
+
if mode == "path"
|
9
|
+
return { :path => _file_system_path(gem_name) }
|
10
|
+
elsif mode == "git"
|
11
|
+
return { :git => _git_path(gem_name, options) }.merge(options)
|
12
|
+
elsif mode == 'off'
|
13
|
+
return options
|
14
|
+
else
|
15
|
+
_print_mode_error && raise
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def _prox_gem_mode
|
20
|
+
ENV['PROX_GEM_MODE'] || "off"
|
21
|
+
end
|
22
|
+
|
23
|
+
def _gem_dir
|
24
|
+
ENV['PROX_GEM_DIR'] || (_print_gem_dir_error && raise)
|
25
|
+
end
|
26
|
+
|
27
|
+
def _prox_gem_git_uri
|
28
|
+
ENV['PROX_GEM_GIT_URI'] || (_print_git_repo_uri_error && raise)
|
29
|
+
end
|
30
|
+
|
31
|
+
def _file_system_path(gem_name)
|
32
|
+
File.join(File.expand_path(_gem_dir), gem_name)
|
33
|
+
end
|
34
|
+
|
35
|
+
def _git_path(gem_name, options)
|
36
|
+
prefix = options.delete :prefix
|
37
|
+
|
38
|
+
repo_name = gem_name.gsub '_', '-'
|
39
|
+
|
40
|
+
path = "#{_prox_gem_git_uri}/"
|
41
|
+
path << "#{prefix}/" if prefix
|
42
|
+
path << "#{repo_name}.git"
|
43
|
+
end
|
44
|
+
|
45
|
+
def _print_mode_error(mode)
|
46
|
+
puts "The PROX_GEM_MODE \"#{mode}\" environment variable is wrong. It must be one of \"path\", \"git\", or \"off\"."
|
47
|
+
end
|
48
|
+
|
49
|
+
def _print_gem_dir_error
|
50
|
+
puts 'The PROX_GEM_DIR environment variable must be set to the path that contains gem project directories'
|
51
|
+
end
|
52
|
+
|
53
|
+
def _print_git_repo_uri_error
|
54
|
+
puts 'The PROX_GEM_GIT_URI environment variable must be set to the URI of the Git repository where the gem project is housed'
|
55
|
+
end
|
data/lib/prox_gem.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'prox_gem/prox_gem'
|
metadata
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: prox_gem
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- The Sans Collective
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-01-17 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email:
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/prox_gem.rb
|
20
|
+
- lib/prox_gem/prox_gem.rb
|
21
|
+
homepage: https://github.com/Sans/prox_gem
|
22
|
+
licenses:
|
23
|
+
- MIT
|
24
|
+
metadata: {}
|
25
|
+
post_install_message:
|
26
|
+
rdoc_options: []
|
27
|
+
require_paths:
|
28
|
+
- lib
|
29
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.9.2
|
34
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ">="
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
requirements: []
|
40
|
+
rubyforge_project:
|
41
|
+
rubygems_version: 2.2.0
|
42
|
+
signing_key:
|
43
|
+
specification_version: 4
|
44
|
+
summary: Gem location switching for file system and remote gems
|
45
|
+
test_files: []
|