genki-specific_install 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +7 -0
- data/ChangeLog +2 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +104 -0
- data/Rakefile +9 -0
- data/lib/rubygems/commands/specific_install_command.rb +246 -0
- data/lib/rubygems_plugin.rb +2 -0
- data/lib/specific_install.rb +4 -0
- data/lib/specific_install/version.rb +3 -0
- data/spec/spec_helper.rb +12 -0
- data/spec/specific_install_spec.rb +221 -0
- data/specific_install.gemspec +30 -0
- metadata +147 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ab1c46be3631544d1104863279f5a1475f966a6d
|
4
|
+
data.tar.gz: dcf3646e74c1421365901eab1f9e1b3e62221851
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: afc7ce00b20a45d4783adab5bdd5a4999784aeafddd23064ab9649bfa0dc3ff68e9a02cc0094b47939035965f697c8053e8c4c1680a1ac0f0958962433b41731
|
7
|
+
data.tar.gz: fa279f00d038fec09581b9cffbe23b66eff6a576e7a36ee8b7778c74cd5198077b2eb55323a309d49e2f4b6aabc4ed06410d0b14f81512d0ab511ce96355f78c
|
data/.gitignore
ADDED
data/ChangeLog
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2010-2013 Roger Pack
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
# Gem::SpecificInstall
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
Add this line to your application's Gemfile:
|
6
|
+
|
7
|
+
gem 'specific_install'
|
8
|
+
|
9
|
+
And then execute:
|
10
|
+
|
11
|
+
$ bundle
|
12
|
+
|
13
|
+
Or install it yourself as:
|
14
|
+
|
15
|
+
$ gem install specific_install
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
A Rubygem plugin that allows you to install an "edge" gem straight from its github repository,
|
20
|
+
or install one from an arbitrary url web:
|
21
|
+
|
22
|
+
ex:
|
23
|
+
|
24
|
+
`
|
25
|
+
$ gem specific_install https://github.com/githubsvnclone/rdoc.git
|
26
|
+
`
|
27
|
+
|
28
|
+
Or more explicitly:
|
29
|
+
|
30
|
+
`
|
31
|
+
$ gem specific_install -l http://github.com/githubsvnclone/rdoc.git
|
32
|
+
`
|
33
|
+
|
34
|
+
Or very tersely:
|
35
|
+
|
36
|
+
`gem specific_install githubsvnclone/rdoc`
|
37
|
+
|
38
|
+
Or a specific branch
|
39
|
+
|
40
|
+
`
|
41
|
+
$ gem specific_install http://github.com/githubsvnclone/rdoc.git edge
|
42
|
+
`
|
43
|
+
|
44
|
+
Or a specific branch in an explicit way
|
45
|
+
|
46
|
+
`
|
47
|
+
$ gem specific_install -l http://github.com/githubsvnclone/rdoc.git -b edge
|
48
|
+
`
|
49
|
+
|
50
|
+
Or a specific subdirectory in a repo
|
51
|
+
|
52
|
+
`
|
53
|
+
$ gem specific_install https://github.com/orlandohill/waxeye -d src/ruby
|
54
|
+
`
|
55
|
+
|
56
|
+
The following URI types are accepted:
|
57
|
+
|
58
|
+
- http(s)://github.com/rdp/specific_install.git
|
59
|
+
- http(s)://github.com/rdp/specific_install-current.gem
|
60
|
+
- http://github.com/rdp/specific_install.git
|
61
|
+
- git@github.com:rdp/specific_install.git
|
62
|
+
- rdp/specific_install
|
63
|
+
|
64
|
+
|
65
|
+
### Additional Options
|
66
|
+
|
67
|
+
-l --location URL of resource
|
68
|
+
Formats of URL/Resource
|
69
|
+
* Full URL to HTTP Repo `https://github.com/rdp/specific_install.git`
|
70
|
+
* Full URL to Git Repo `git@github.com:rdp/specific_install.git`
|
71
|
+
* URL of Pre-Built Gem `http://example.com/specific_install.gem`
|
72
|
+
* Github Repo shortcode `rdp/specific_install`
|
73
|
+
|
74
|
+
-b --branch BRANCH to use for Gem creation
|
75
|
+
Branch option does a `git checkout BRANCH` before `gem build GEM`
|
76
|
+
Example:
|
77
|
+
`git specific_install -l rdp/specific_install -b pre-release`
|
78
|
+
Note: This feature is new and may not fail gracefully.
|
79
|
+
|
80
|
+
-d --directory DIRECTORY in source
|
81
|
+
This will change the directory in the downloaded source directory
|
82
|
+
before building the gem.
|
83
|
+
|
84
|
+
`git_install` is aliased to the behavior of `specific_install`
|
85
|
+
This alias is shorter and is more intention revealing of the gem's behavior.
|
86
|
+
## Internal Behavior
|
87
|
+
|
88
|
+
It runs `git clone`, and `rake install,` install the gem, then deletes the temp directory]
|
89
|
+
|
90
|
+
## Compatibility
|
91
|
+
|
92
|
+
v0.2.10 is known to work against Rubygems v2.2.2 and has a compatibility issue with Rubygems v1.8.25 (possible other older Rubygems).
|
93
|
+
Work-arounds: Upgrade Rubygems via `rvm rubygems current` or install older version of `specific_install`.
|
94
|
+
## Contributing
|
95
|
+
|
96
|
+
1. Fork it
|
97
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
98
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
99
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
100
|
+
5. Create new Pull Request
|
101
|
+
|
102
|
+
Enjoy!
|
103
|
+
|
104
|
+
Copyright 2010-2014 Roger Pack - `http://github.com/rdp/specific_install`
|
data/Rakefile
ADDED
@@ -0,0 +1,246 @@
|
|
1
|
+
require 'rubygems/command_manager'
|
2
|
+
require 'rubygems/dependency_installer'
|
3
|
+
require 'tempfile'
|
4
|
+
require 'fileutils'
|
5
|
+
require 'open-uri'
|
6
|
+
|
7
|
+
class Gem::Commands::SpecificInstallCommand < Gem::Command
|
8
|
+
attr_accessor :output
|
9
|
+
|
10
|
+
def description
|
11
|
+
"Allows you to install an 'edge' gem straight from its github repository or from a web site"
|
12
|
+
end
|
13
|
+
|
14
|
+
def initialize(output=STDOUT)
|
15
|
+
super 'specific_install', description
|
16
|
+
@output = output
|
17
|
+
|
18
|
+
add_option('-l', '--location LOCATION', arguments) do |location, options|
|
19
|
+
options[:location] = location
|
20
|
+
end
|
21
|
+
|
22
|
+
add_option('-b', '--branch LOCATION', arguments) do |branch, options|
|
23
|
+
options[:branch] = branch
|
24
|
+
end
|
25
|
+
|
26
|
+
add_option('-d', '--directory DIRECTORY', arguments) do |directory, options|
|
27
|
+
options[:directory] = directory
|
28
|
+
end
|
29
|
+
|
30
|
+
add_option('-r', '--ref COMMIT-ISH', arguments) do |ref, options|
|
31
|
+
options[:ref] = ref
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def arguments
|
36
|
+
"LOCATION like http://github.com/rdp/ruby_tutorials_core or git://github.com/rdp/ruby_tutorials_core.git or http://host/gem_name.gem\n" +
|
37
|
+
"BRANCH (optional) like beta, or new-feature\n" +
|
38
|
+
"DIRECTORY (optional) This will change the directory in the downloaded source directory before building the gem."
|
39
|
+
end
|
40
|
+
|
41
|
+
def usage
|
42
|
+
"#{program_name} [LOCATION] [BRANCH] (or command line options for the same)"
|
43
|
+
end
|
44
|
+
|
45
|
+
def execute
|
46
|
+
@loc ||= set_location
|
47
|
+
@branch ||= set_branch if set_branch
|
48
|
+
@ref ||= set_ref
|
49
|
+
if @loc.nil?
|
50
|
+
raise ArgumentError, "No location received. Use like `gem specific_install -l http://example.com/rdp/specific_install`"
|
51
|
+
end
|
52
|
+
Dir.mktmpdir do |dir|
|
53
|
+
if subdir = options[:directory]
|
54
|
+
abort("Subdir '#{subdir}' is not a valid directory") unless valid_subdir?(subdir)
|
55
|
+
@top_dir = dir
|
56
|
+
@src_dir = File.join(dir, subdir)
|
57
|
+
else
|
58
|
+
@top_dir = @src_dir = dir
|
59
|
+
end
|
60
|
+
determine_source_and_install
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def break_unless_git_present
|
65
|
+
unless system("which git") || system("where git")
|
66
|
+
abort("Please install git before using a git based link for specific_install")
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def determine_source_and_install
|
71
|
+
case @loc
|
72
|
+
when /^https?(.*)\.gem$/
|
73
|
+
install_gem
|
74
|
+
when /\.git$/
|
75
|
+
break_unless_git_present
|
76
|
+
install_git
|
77
|
+
when /^https?(.*)$/
|
78
|
+
break_unless_git_present
|
79
|
+
install_http_repo
|
80
|
+
when %r(.*/.*)
|
81
|
+
break_unless_git_present
|
82
|
+
install_shorthand
|
83
|
+
else
|
84
|
+
warn 'Error: must end with .git to be a git repository' +
|
85
|
+
'or be in shorthand form: rdp/specific_install'
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def install_gem
|
90
|
+
Dir.chdir @top_dir do
|
91
|
+
output.puts "downloading #{@loc}"
|
92
|
+
download(@loc, gem_name)
|
93
|
+
|
94
|
+
if install_gemspec
|
95
|
+
success_message
|
96
|
+
else
|
97
|
+
output.puts "Failed"
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def install_http_repo
|
103
|
+
output.puts 'http installing from ' + @loc
|
104
|
+
|
105
|
+
@loc = [@loc, '.git'].join unless @loc[/\.git$/]
|
106
|
+
|
107
|
+
redirect_for_specs = ENV.fetch( "SPECIFIC_INSTALL_SPEC" ) { "" }
|
108
|
+
system("git clone #{@loc} #{@top_dir} #{redirect_for_specs}")
|
109
|
+
install_from_git(@src_dir)
|
110
|
+
end
|
111
|
+
|
112
|
+
def gem_name
|
113
|
+
@gem_name ||= @loc.split("/").last
|
114
|
+
end
|
115
|
+
|
116
|
+
def install_git
|
117
|
+
output.puts 'git installing from ' + @loc
|
118
|
+
|
119
|
+
redirect_for_specs = ENV.fetch( "SPECIFIC_INSTALL_SPEC" ) { "" }
|
120
|
+
system("git clone #{@loc} #{@top_dir} #{redirect_for_specs}")
|
121
|
+
install_from_git(@src_dir)
|
122
|
+
end
|
123
|
+
|
124
|
+
def install_shorthand
|
125
|
+
output.puts "Installing from git@github.com:#{@loc}.git"
|
126
|
+
|
127
|
+
redirect_for_specs = ENV.fetch( "SPECIFIC_INSTALL_SPEC" ) { "" }
|
128
|
+
system("git clone git@github.com:#{@loc}.git #{@top_dir} #{redirect_for_specs}")
|
129
|
+
install_from_git(@src_dir)
|
130
|
+
end
|
131
|
+
|
132
|
+
def download( full_url, output_name )
|
133
|
+
File.open(output_name, "wb") do |output_file|
|
134
|
+
uri = URI.parse(full_url)
|
135
|
+
output_file.write(uri.read)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
def install_from_git(dir)
|
140
|
+
Dir.chdir @top_dir do
|
141
|
+
change_to_branch(@branch) if @branch
|
142
|
+
reset_to_commit(@ref) if @ref
|
143
|
+
system("git submodule update --init --recursive") # issue 25
|
144
|
+
end
|
145
|
+
|
146
|
+
Dir.chdir dir do
|
147
|
+
# reliable method
|
148
|
+
if install_gemspec
|
149
|
+
success_message
|
150
|
+
exit 0
|
151
|
+
end
|
152
|
+
|
153
|
+
# legacy methods
|
154
|
+
['', 'rake gemspec', 'rake gem', 'rake build', 'rake package'].each do |command|
|
155
|
+
puts "attempting #{command}..."
|
156
|
+
system command
|
157
|
+
if install_gemspec
|
158
|
+
success_message
|
159
|
+
exit 0
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
def set_location
|
166
|
+
options[:location] || options[:args][0]
|
167
|
+
end
|
168
|
+
|
169
|
+
def set_branch
|
170
|
+
options[:branch] || options[:args][1]
|
171
|
+
end
|
172
|
+
|
173
|
+
def set_ref
|
174
|
+
options[:ref] || options[:args][2]
|
175
|
+
end
|
176
|
+
|
177
|
+
def success_message
|
178
|
+
output.puts 'Successfully installed'
|
179
|
+
end
|
180
|
+
|
181
|
+
def install_gemspec
|
182
|
+
gem = find_or_build_gem
|
183
|
+
if gem
|
184
|
+
inst = Gem::DependencyInstaller.new
|
185
|
+
inst.install gem
|
186
|
+
else
|
187
|
+
nil
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
def find_or_build_gem
|
192
|
+
if gemspec_exists?
|
193
|
+
gemspec = Gem::Specification.load(gemspec_file)
|
194
|
+
Gem::Package.build gemspec
|
195
|
+
elsif gemfile
|
196
|
+
gemfile
|
197
|
+
else
|
198
|
+
nil
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
def gemspec_file(name = "*.gemspec")
|
203
|
+
Dir[name][0]
|
204
|
+
end
|
205
|
+
|
206
|
+
def gemspec_exists?(name = "*.gemspec")
|
207
|
+
if gemspec_file(name)
|
208
|
+
File.exists?(gemspec_file(name))
|
209
|
+
else
|
210
|
+
false
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
def gemfile(name = '**/*.gem')
|
215
|
+
if Dir[name].empty?
|
216
|
+
false
|
217
|
+
else
|
218
|
+
Dir[name][0]
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
def change_to_branch(branch)
|
223
|
+
system("git checkout #{branch}")
|
224
|
+
system("git branch")
|
225
|
+
end
|
226
|
+
|
227
|
+
def reset_to_commit(ref)
|
228
|
+
system("git reset --hard #{ref}")
|
229
|
+
system("git show -q")
|
230
|
+
end
|
231
|
+
|
232
|
+
DOTDOT_REGEX = /(?:#{File::PATH_SEPARATOR}|\A)\.\.(?:#{File::PATH_SEPARATOR}|\z)/.freeze
|
233
|
+
ABS_REGEX = /\A#{File::PATH_SEPARATOR}/.freeze
|
234
|
+
|
235
|
+
def valid_subdir?(subdir)
|
236
|
+
!subdir.empty? &&
|
237
|
+
subdir !~ DOTDOT_REGEX &&
|
238
|
+
subdir !~ ABS_REGEX
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
class Gem::Commands::GitInstallCommand < Gem::Commands::SpecificInstallCommand
|
243
|
+
end
|
244
|
+
|
245
|
+
Gem::CommandManager.instance.register_command :specific_install
|
246
|
+
Gem::CommandManager.instance.register_command :git_install
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'rspec/mocks'
|
3
|
+
|
4
|
+
if RUBY_VERSION > '1.9.0'
|
5
|
+
require 'simplecov'
|
6
|
+
require 'simplecov-vim/formatter'
|
7
|
+
SimpleCov.start do
|
8
|
+
formatter SimpleCov::Formatter::VimFormatter
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
require File.dirname(__FILE__) + "/../lib/rubygems_plugin"
|
@@ -0,0 +1,221 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require './spec_helper'
|
3
|
+
require 'stringio'
|
4
|
+
require 'open3'
|
5
|
+
|
6
|
+
describe Gem::Commands::SpecificInstallCommand do
|
7
|
+
before do
|
8
|
+
module Kernel
|
9
|
+
alias_method :real_system, :system
|
10
|
+
|
11
|
+
def system(cmd)
|
12
|
+
'system "#{cmd}"'
|
13
|
+
end
|
14
|
+
|
15
|
+
def puts(cmd)
|
16
|
+
cmd
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
after do
|
22
|
+
module Kernel
|
23
|
+
alias_method :system, :real_system
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
subject { Gem::Commands::SpecificInstallCommand.new(StringIO.new) }
|
28
|
+
describe "#gem_name" do
|
29
|
+
it "sets gem_name from location" do
|
30
|
+
subject.instance_variable_set(:@loc, "stuff/foo/bar")
|
31
|
+
expect(subject.gem_name).to eq("bar")
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context "disable #install_from_git" do
|
36
|
+
before do
|
37
|
+
class Gem::Commands::SpecificInstallCommand
|
38
|
+
def install_from_git(dir)
|
39
|
+
dir
|
40
|
+
end
|
41
|
+
end
|
42
|
+
subject.instance_variable_set(:@top_dir, "foo")
|
43
|
+
end
|
44
|
+
describe "#install_git" do
|
45
|
+
before do
|
46
|
+
subject.instance_variable_set(:@loc, "bar")
|
47
|
+
end
|
48
|
+
it "sends correct command to system" do
|
49
|
+
subject.should_receive(:system).with(/git clone bar foo/)
|
50
|
+
subject.install_git
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe "#download" do
|
55
|
+
it "downloads a gem" do
|
56
|
+
Dir.mktmpdir do |tmpdir|
|
57
|
+
url = "https://rubygems.org/downloads/specific_install-0.2.7.gem"
|
58
|
+
output_name = "specific_install.gem"
|
59
|
+
subject.download(url, output_name)
|
60
|
+
expect(File.exists?(output_name)).to be_true
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe "#install_shorthand" do
|
66
|
+
it "formats the shorthand into a git repo" do
|
67
|
+
subject.instance_variable_set(:@loc, "bar/zoz")
|
68
|
+
subject.should_receive(:system).with(%r{git clone git@github.com:bar/zoz.git foo})
|
69
|
+
subject.install_shorthand
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
describe "#success_message" do
|
75
|
+
it "returns correct message" do
|
76
|
+
subject.output.should_receive(:puts).with('Successfully installed')
|
77
|
+
subject.success_message
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
describe "#install_gemspec" do
|
82
|
+
context "when no gemspec or gem" do
|
83
|
+
xit "returns false" do
|
84
|
+
expect( subject.install_gemspec ).to eq(false)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
describe "#gemspec_exists?" do
|
90
|
+
it "response true to when exists" do
|
91
|
+
expect( subject.gemspec_exists? ).to be_true
|
92
|
+
end
|
93
|
+
|
94
|
+
it "responds false when not present" do
|
95
|
+
expect( subject.gemspec_exists?("*.gemNOTPRESENT") ).to be_false
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
describe "#gemfile" do
|
100
|
+
it "response false when not existing" do
|
101
|
+
expect( subject.gemfile("*.gemNOTPRESENT") ).to be_false
|
102
|
+
end
|
103
|
+
it "response true to when exists" do
|
104
|
+
expect( subject.gemfile("**/*.gem") ).to be_true
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
describe "#determine_source_and_install" do
|
109
|
+
it "executes http gem requests" do
|
110
|
+
subject.instance_variable_set(:@loc, "http://example.com/rad.gem")
|
111
|
+
subject.should_receive(:install_gem)
|
112
|
+
subject.determine_source_and_install
|
113
|
+
end
|
114
|
+
it "executes https gem requests" do
|
115
|
+
subject.instance_variable_set(:@loc, "https://example.com/rad.gem")
|
116
|
+
subject.should_receive(:install_gem)
|
117
|
+
subject.determine_source_and_install
|
118
|
+
end
|
119
|
+
it "executes https git install requests" do
|
120
|
+
subject.instance_variable_set(:@loc, "https://example.com/rad.git")
|
121
|
+
subject.should_receive(:install_git)
|
122
|
+
subject.determine_source_and_install
|
123
|
+
end
|
124
|
+
it "executes git url git install requests" do
|
125
|
+
subject.instance_variable_set(:@loc, "git@github.com:example/rad.git")
|
126
|
+
subject.should_receive(:install_git)
|
127
|
+
subject.determine_source_and_install
|
128
|
+
end
|
129
|
+
it "executes shorthand github install requests" do
|
130
|
+
subject.instance_variable_set(:@loc, "example/rad")
|
131
|
+
subject.should_receive(:install_shorthand)
|
132
|
+
subject.determine_source_and_install
|
133
|
+
end
|
134
|
+
it "executes shorthand github install requests" do
|
135
|
+
subject.instance_variable_set(:@loc, "example")
|
136
|
+
subject.should_receive(:warn)
|
137
|
+
subject.determine_source_and_install
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
describe "#set_location" do
|
142
|
+
it "sets from options[location]" do
|
143
|
+
subject.options[:location] = "example"
|
144
|
+
expect( subject.set_location ).to eq("example")
|
145
|
+
end
|
146
|
+
it "sets from options[args]" do
|
147
|
+
subject.options[:location] = nil
|
148
|
+
subject.options[:args] = ["args"]
|
149
|
+
expect( subject.set_location ).to eq("args")
|
150
|
+
end
|
151
|
+
it "sets neither and results in nil" do
|
152
|
+
subject.options[:location] = nil
|
153
|
+
subject.options[:args] = []
|
154
|
+
expect( subject.set_location ).to be_nil
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
describe "#execute" do
|
159
|
+
it "raises error when no location received" do
|
160
|
+
subject.options[:location] = nil
|
161
|
+
subject.options[:args] = []
|
162
|
+
expect{ subject.execute }.to raise_error(ArgumentError)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
end
|
167
|
+
|
168
|
+
|
169
|
+
describe "Integration Tests" do
|
170
|
+
|
171
|
+
$STDOUT = StringIO.new
|
172
|
+
let(:output) { StringIO.new }
|
173
|
+
subject { Gem::Commands::SpecificInstallCommand.new(output) }
|
174
|
+
before(:all) do
|
175
|
+
# ENV.store( "SPECIFIC_INSTALL_SPEC", '2&> /dev/null' )
|
176
|
+
end
|
177
|
+
before(:each) do
|
178
|
+
`gem uninstall specific_install --executables 2&> /dev/null`
|
179
|
+
`rake install 2&> /dev/null`
|
180
|
+
end
|
181
|
+
|
182
|
+
after(:all) do
|
183
|
+
`gem uninstall specific_install --executables 2&> /dev/null`
|
184
|
+
`gem install specific_install`
|
185
|
+
ENV.delete( "SPECIFIC_INSTALL_SPEC" )
|
186
|
+
end
|
187
|
+
|
188
|
+
context "working URIs" do
|
189
|
+
it "installs from https" do
|
190
|
+
url = "https://github.com/rdp/specific_install.git"
|
191
|
+
subject.instance_variable_set(:@loc, url)
|
192
|
+
subject.options[:args] = []
|
193
|
+
stdout, status = Open3.capture2 "gem specific_install #{url}"
|
194
|
+
expect(stdout).to match(/Successfully installed/)
|
195
|
+
end
|
196
|
+
it "installs from http" do
|
197
|
+
url = "http://github.com/rdp/specific_install.git"
|
198
|
+
subject.instance_variable_set(:@loc, url)
|
199
|
+
subject.options[:args] = []
|
200
|
+
stdout, status = Open3.capture2 "gem specific_install #{url}"
|
201
|
+
expect(stdout).to match(/Successfully installed/)
|
202
|
+
end
|
203
|
+
it "installs from shorthand" do
|
204
|
+
url = "rdp/specific_install"
|
205
|
+
subject.instance_variable_set(:@loc, url)
|
206
|
+
subject.options[:args] = []
|
207
|
+
stdout, status = Open3.capture2 "gem specific_install #{url}"
|
208
|
+
expect(stdout).to match(/Successfully installed/)
|
209
|
+
end
|
210
|
+
it "installs from git" do
|
211
|
+
url = "git@github.com:zph/buff.git"
|
212
|
+
stdout, status = Open3.capture2 "gem specific_install #{url}"
|
213
|
+
expect(stdout).to match(/Successfully installed/)
|
214
|
+
end
|
215
|
+
it "installs from packaged gem" do
|
216
|
+
url = "https://rubygems.org/downloads/specific_install-0.2.7.gem"
|
217
|
+
stdout, status = Open3.capture2 "gem specific_install #{url}"
|
218
|
+
expect(stdout).to match(/Successfully installed/)
|
219
|
+
end
|
220
|
+
end
|
221
|
+
end if ENV['SPECIFIC_INSTALL_INTEGRATION_SPECS']
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
$:.unshift File.expand_path('../lib', __FILE__)
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
4
|
+
require "#{lib}/specific_install/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
|
8
|
+
s.name = "specific_install"
|
9
|
+
s.version = SpecificInstall::VERSION
|
10
|
+
s.description = %q{rubygems plugin that allows you you to install a gem from from its github repository (like 'edge'), or from an arbitrary URL}
|
11
|
+
s.summary = "rubygems plugin that allows you you to install a gem from from its github repository (like 'edge'), or from an arbitrary URL"
|
12
|
+
s.authors = ["Roger Pack", "Zander Hill"]
|
13
|
+
s.email = ["rogerdpack@gmail.com", "zander@civet.ws" ]
|
14
|
+
s.homepage = "https://github.com/rdp/specific_install"
|
15
|
+
s.license = "MIT"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split($/)
|
18
|
+
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
s.platform = Gem::Platform::RUBY
|
22
|
+
s.rubyforge_project = '[none]'
|
23
|
+
|
24
|
+
s.add_development_dependency 'rspec'
|
25
|
+
s.add_development_dependency 'sane'
|
26
|
+
s.add_development_dependency "bundler", "~> 1.3"
|
27
|
+
s.add_development_dependency "rake"
|
28
|
+
s.add_development_dependency "simplecov"
|
29
|
+
s.add_development_dependency "simplecov-vim"
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,147 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: genki-specific_install
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Roger Pack
|
8
|
+
- Zander Hill
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2017-01-22 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: sane
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: bundler
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '1.3'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '1.3'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rake
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: simplecov
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: simplecov-vim
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
description: rubygems plugin that allows you you to install a gem from from its github
|
99
|
+
repository (like 'edge'), or from an arbitrary URL
|
100
|
+
email:
|
101
|
+
- rogerdpack@gmail.com
|
102
|
+
- zander@civet.ws
|
103
|
+
executables: []
|
104
|
+
extensions: []
|
105
|
+
extra_rdoc_files: []
|
106
|
+
files:
|
107
|
+
- ".gitignore"
|
108
|
+
- ChangeLog
|
109
|
+
- Gemfile
|
110
|
+
- LICENSE.txt
|
111
|
+
- README.md
|
112
|
+
- Rakefile
|
113
|
+
- lib/rubygems/commands/specific_install_command.rb
|
114
|
+
- lib/rubygems_plugin.rb
|
115
|
+
- lib/specific_install.rb
|
116
|
+
- lib/specific_install/version.rb
|
117
|
+
- spec/spec_helper.rb
|
118
|
+
- spec/specific_install_spec.rb
|
119
|
+
- specific_install.gemspec
|
120
|
+
homepage: https://github.com/rdp/specific_install
|
121
|
+
licenses:
|
122
|
+
- MIT
|
123
|
+
metadata: {}
|
124
|
+
post_install_message:
|
125
|
+
rdoc_options: []
|
126
|
+
require_paths:
|
127
|
+
- lib
|
128
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
requirements: []
|
139
|
+
rubyforge_project: "[none]"
|
140
|
+
rubygems_version: 2.6.8
|
141
|
+
signing_key:
|
142
|
+
specification_version: 4
|
143
|
+
summary: rubygems plugin that allows you you to install a gem from from its github
|
144
|
+
repository (like 'edge'), or from an arbitrary URL
|
145
|
+
test_files:
|
146
|
+
- spec/spec_helper.rb
|
147
|
+
- spec/specific_install_spec.rb
|