path_gem 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/path_gem/gemfile_ext.rb +53 -0
- data/lib/path_gem.rb +1 -0
- metadata +46 -0
@@ -0,0 +1,53 @@
|
|
1
|
+
def path_gem(gem_name, options={})
|
2
|
+
gem gem_name, path_options(gem_name, options)
|
3
|
+
end
|
4
|
+
|
5
|
+
def path_options(gem_name, options)
|
6
|
+
if path_gem_env != "development"
|
7
|
+
return { :git => git_path(gem_name, options) }.merge(options)
|
8
|
+
else
|
9
|
+
return { :path => file_system_path(gem_name) }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def file_system_path(gem_name)
|
14
|
+
File.join(File.expand_path(gem_dir), gem_name)
|
15
|
+
end
|
16
|
+
|
17
|
+
def git_path(gem_name, options)
|
18
|
+
prefix = options.delete :prefix
|
19
|
+
|
20
|
+
repo_name = gem_name.gsub '_', '-'
|
21
|
+
|
22
|
+
path = "#{path_gem_git}/"
|
23
|
+
path << "#{prefix}/" if prefix
|
24
|
+
path << "#{repo_name}.git"
|
25
|
+
end
|
26
|
+
|
27
|
+
def gem_dir
|
28
|
+
if respond_to? :path_gem_dir
|
29
|
+
send :path_gem_dir
|
30
|
+
else
|
31
|
+
ENV['PATH_GEM_DIR'] || (print_gem_dir_error && raise)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def path_gem_git
|
36
|
+
if respond_to? :path_gem_git
|
37
|
+
send :path_gem_git
|
38
|
+
else
|
39
|
+
ENV['PATH_GEM_GIT']
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def path_gem_env
|
44
|
+
if respond_to? :path_gem_env
|
45
|
+
send :path_gem_env
|
46
|
+
else
|
47
|
+
ENV['PATH_GEM_ENV'] || "production"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def print_gem_dir_error
|
52
|
+
puts "The PATH_GEM_DIR environment variable must be set to the path that contains gem project directories"
|
53
|
+
end
|
data/lib/path_gem.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'path_gem/gemfile_ext'
|
metadata
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: path_gem
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.7
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- The Sans Collective
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-04-04 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description:
|
15
|
+
email:
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- lib/path_gem/gemfile_ext.rb
|
21
|
+
- lib/path_gem.rb
|
22
|
+
homepage: https://github.com/Sans/path_gem
|
23
|
+
licenses: []
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.9.2
|
34
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
35
|
+
none: false
|
36
|
+
requirements:
|
37
|
+
- - ! '>='
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
requirements: []
|
41
|
+
rubyforge_project:
|
42
|
+
rubygems_version: 1.8.24
|
43
|
+
signing_key:
|
44
|
+
specification_version: 3
|
45
|
+
summary: Gem location switching for file system and remote gems
|
46
|
+
test_files: []
|