gem-install-branch 0.0.1
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/.gitignore +17 -0
- data/Gemfile +3 -0
- data/Rakefile +11 -0
- data/VERSION +1 -0
- data/gem-install-branch-test.gemspec +17 -0
- data/gem-install-branch.gemspec +24 -0
- data/lib/gem_install_branch/version.rb +3 -0
- data/lib/gem_install_branch.rb +27 -0
- data/lib/gem_install_branch_test.rb +3 -0
- data/lib/rubygems/commands/install_branch_command.rb +27 -0
- data/lib/rubygems_plugin.rb +1 -0
- data/test/gem_install_branch_test.rb +27 -0
- metadata +99 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b9fe514525cb01bc1c3ec8e5d2a5c733dd8f6ec6
|
4
|
+
data.tar.gz: 6f4a4ece841e4cc4727f82fb893aa929de4e7c02
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b0179da253caca60fbdcfb8ac2f2ceb6dc24081c4566ae2f4c9a03c20877187fa33ee69510a85585f546b7b2af2dfa6eb1cb932a0c0608c5f316f056a7cfa157
|
7
|
+
data.tar.gz: 72671cd9e9116d3fb7e177e1d31e7e4980408b624a2a1abd58450d415667ce66e2adb96aac249d4c6e0119575bad55f323e00406787c0a66011e2cba85d86d94
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'gem_install_branch_test'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "gem-install-branch-test"
|
8
|
+
spec.version = GemInstallBranchTest::VERSION
|
9
|
+
spec.authors = ["Wojciech Mach"]
|
10
|
+
spec.email = ["wojtek@wojtekmach.pl"]
|
11
|
+
spec.description = "gem-install-branch test gem"
|
12
|
+
spec.summary = "Used for testing gem-install-branch"
|
13
|
+
spec.homepage = "https://github.com/wojtekmach/gem-install-branch"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = ['gem-install-branch-test.gemspec', 'lib/gem_install_branch_test.rb']
|
17
|
+
end
|
@@ -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 'gem_install_branch/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "gem-install-branch"
|
8
|
+
spec.version = GemInstallBranch::VERSION
|
9
|
+
spec.authors = ["Wojciech Mach"]
|
10
|
+
spec.email = ["wojtek@wojtekmach.pl"]
|
11
|
+
spec.description = "Allows to install gem straight from github branch"
|
12
|
+
spec.summary = "Allows to install gem straight from github branch"
|
13
|
+
spec.homepage = "https://github.com/wojtekmach/gem-install-branch"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "minitest", "~> 5.0.0"
|
24
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'json'
|
3
|
+
require 'tmpdir'
|
4
|
+
|
5
|
+
module GemInstallBranch
|
6
|
+
def self.install(gem, branch)
|
7
|
+
puts gem + " " + branch
|
8
|
+
command = "git clone --branch #{branch} https://github.com/#{github_repo(gem)}"
|
9
|
+
Dir.mktmpdir do |dir|
|
10
|
+
system("cd #{dir} ; #{command} ; ls ; cd #{gem} ; gem build #{gem}.gemspec")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.github_repo(gem)
|
15
|
+
github_uri(gem).match(/github.com[:\/](.*)/)[1].split('/').take(2).join('/')
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.github_uri(gem)
|
19
|
+
metadata = metadata(gem)
|
20
|
+
metadata['source_code_uri'] || metadata['homepage_uri']
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.metadata(gem)
|
24
|
+
uri = URI("https://rubygems.org/api/v1/gems/#{gem}.json")
|
25
|
+
JSON.parse(Net::HTTP.get_response(uri).body)
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'rubygems/commands/install_command'
|
2
|
+
require 'gem_install_branch'
|
3
|
+
|
4
|
+
class Gem::Commands::InstallBranchCommand < Gem::Commands::InstallCommand
|
5
|
+
def initialize
|
6
|
+
super
|
7
|
+
|
8
|
+
add_option '--master', "Install from gem's GitHub 'master' branch" do |value, options|
|
9
|
+
@github_branch = 'master'
|
10
|
+
end
|
11
|
+
|
12
|
+
add_option '--branch BRANCH', "Install from gem's GitHub BRANCH branch" do |value, options|
|
13
|
+
@github_branch = value
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def execute
|
18
|
+
if @github_branch
|
19
|
+
GemInstallBranch.install(options[:args].first, @github_branch)
|
20
|
+
else
|
21
|
+
super
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
Gem::Commands.send(:remove_const, 'InstallCommand')
|
27
|
+
Gem::Commands::InstallCommand = Gem::Commands::InstallBranchCommand
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'rubygems/commands/install_branch_command'
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require 'open3'
|
3
|
+
|
4
|
+
describe 'gem install' do
|
5
|
+
it "works with --master" do
|
6
|
+
skip
|
7
|
+
output = command("gem install gem-install-branch-test --master")
|
8
|
+
end
|
9
|
+
|
10
|
+
it "works with --branch" do
|
11
|
+
skip
|
12
|
+
output = command("gem install gem-install-branch-test --branch 1-0-stable")
|
13
|
+
end
|
14
|
+
|
15
|
+
it "works as usual" do
|
16
|
+
output = command("gem install gem-install-branch-test")
|
17
|
+
output.must_include "Successfully installed gem-install-branch-test"
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def command(command)
|
23
|
+
env = {"RUBYLIB" => "./lib:#{ENV['RUBYLIB']}"}
|
24
|
+
output, _ = Open3.capture2(env, command)
|
25
|
+
output
|
26
|
+
end
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gem-install-branch
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Wojciech Mach
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-07-12 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.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 5.0.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 5.0.0
|
55
|
+
description: Allows to install gem straight from github branch
|
56
|
+
email:
|
57
|
+
- wojtek@wojtekmach.pl
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- .gitignore
|
63
|
+
- Gemfile
|
64
|
+
- Rakefile
|
65
|
+
- VERSION
|
66
|
+
- gem-install-branch-test.gemspec
|
67
|
+
- gem-install-branch.gemspec
|
68
|
+
- lib/gem_install_branch.rb
|
69
|
+
- lib/gem_install_branch/version.rb
|
70
|
+
- lib/gem_install_branch_test.rb
|
71
|
+
- lib/rubygems/commands/install_branch_command.rb
|
72
|
+
- lib/rubygems_plugin.rb
|
73
|
+
- test/gem_install_branch_test.rb
|
74
|
+
homepage: https://github.com/wojtekmach/gem-install-branch
|
75
|
+
licenses:
|
76
|
+
- MIT
|
77
|
+
metadata: {}
|
78
|
+
post_install_message:
|
79
|
+
rdoc_options: []
|
80
|
+
require_paths:
|
81
|
+
- lib
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - '>='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - '>='
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
requirements: []
|
93
|
+
rubyforge_project:
|
94
|
+
rubygems_version: 2.0.3
|
95
|
+
signing_key:
|
96
|
+
specification_version: 4
|
97
|
+
summary: Allows to install gem straight from github branch
|
98
|
+
test_files:
|
99
|
+
- test/gem_install_branch_test.rb
|