specific_install_pixie 0.3.9

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 75d59e543ad54d9a82845bf0fe681d428704c8bbb0543b1949d7c836c2327584
4
+ data.tar.gz: 36320b53cb0f1629ef7b9c178f7fe993b36d28f2a4b234763cd2426658d89103
5
+ SHA512:
6
+ metadata.gz: 30fea7ca9f1265da4a35c37312366017fe567d93a8e1e9baa649514222e4d8d6281bf24472a0a308e4a47b49bbbc4e31006b34eed1f1dbe6c03ddb1cf99194c5
7
+ data.tar.gz: aad222c9f941d1dbbbcbff330bf0db0823be53a27f565964c3c0309e6516703bd8086dbab8dfe1697d0146b6c7f7c87a7e3a3a3e998360109757d8be0d5c4adc
@@ -0,0 +1,21 @@
1
+ name: CI
2
+ on:
3
+ push:
4
+ branches: [master]
5
+ pull_request:
6
+ workflow_dispatch:
7
+ jobs:
8
+ test:
9
+ name: Test on Ruby ${{ matrix.ruby }}
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ fail-fast: false
13
+ matrix:
14
+ ruby: ['2.7', '3.0', '3.1', '3.2']
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - uses: ruby/setup-ruby@v1
18
+ with:
19
+ ruby-version: ${{ matrix.ruby }}
20
+ bundler-cache: true
21
+ - run: bundle exec rspec
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ Gemfile.lock
2
+ .config
3
+ InstalledFiles
4
+ pkg
5
+ *.gem
6
+ .bundle
7
+ coverage/
8
+ coverage.vim
data/ChangeLog ADDED
@@ -0,0 +1,6 @@
1
+ 0.3.8
2
+ Ruby 3.2 compat
3
+ 0.3.3
4
+ Added an option '-r' to specify commit-ish
5
+ 0.2.12
6
+ automatically clone submodules if any are there
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in specific_install_pixie.gemspec
4
+ gemspec
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,130 @@
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 web url:
21
+
22
+ examples:
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
+ `
37
+ $ gem specific_install githubsvnclone/rdoc
38
+ `
39
+
40
+ Or a specific branch
41
+
42
+ `
43
+ $ gem specific_install http://github.com/githubsvnclone/rdoc.git edge
44
+ `
45
+
46
+ Or a specific branch in an explicit way
47
+
48
+ `
49
+ $ gem specific_install -l http://github.com/githubsvnclone/rdoc.git -b edge
50
+ `
51
+
52
+ Or a specific subdirectory in a repo
53
+
54
+ `
55
+ $ gem specific_install https://github.com/orlandohill/waxeye -d src/ruby
56
+ `
57
+
58
+ Or install in the users personal gem directory
59
+
60
+ `
61
+ $ gem specific_install https://github.com/orlandohill/waxeye -u
62
+ `
63
+
64
+ Or install in the install directory
65
+
66
+ `
67
+ $ gem specific_install https://github.com/cxr0715/cocoapods-TSPodfileTimeWatch.git -i /Users/bkdevops/TSPodfileTimeWatch_dir
68
+ `
69
+
70
+ PS: you should **export RUBYLIB=/Users/bkdevops/TSPodfileTimeWatch_dir/cocoapods-TSPodfileTimeWatch-0.0.6/lib:other_plug_path** to use -i install plug
71
+
72
+ The following URI types are accepted:
73
+
74
+ - http(s)://github.com/rdp/specific_install.git
75
+ - http(s)://github.com/rdp/specific_install-current.gem
76
+ - http://github.com/rdp/specific_install.git
77
+ - http://somewhere_else.com/rdp/specific_install.git
78
+ - git@github.com:rdp/specific_install.git
79
+ - rdp/specific_install # implies github
80
+
81
+ ### Additional Options
82
+
83
+ -l --location URL of resource
84
+ Formats of URL/Resource
85
+ * Full URL to HTTP Repo `https://github.com/rdp/specific_install.git`
86
+ * Full URL to Git Repo `git@github.com:rdp/specific_install.git`
87
+ * URL of Pre-Built Gem `http://example.com/specific_install.gem`
88
+ * Github Repo shortcode `rdp/specific_install`
89
+
90
+ -b --branch BRANCH to use for Gem creation
91
+ Branch option does a `git checkout BRANCH` before `gem build GEM`
92
+ Example:
93
+ `git specific_install -l rdp/specific_install -b pre-release`
94
+ Note: This feature is new and may not fail gracefully.
95
+
96
+ -d --directory DIRECTORY in source
97
+ This will change the directory in the downloaded source directory
98
+ before building the gem.
99
+
100
+ -r, --ref COMMIT-ISH to use for Gem creation
101
+ Ref option does a `git reset --hard COMMIT-ISH` before `gem build GEM`
102
+
103
+ -u, --user-install to indicate that the gem should be unpacked into the users personal gem directory.
104
+ This will install the gem in the user folder making it possible to use specific_install without root access.
105
+
106
+ `git_install` is aliased to the behavior of `specific_install`
107
+ This alias is shorter and is more intention revealing of the gem's behavior.
108
+
109
+ -t, --tag to indicate git tag to be checked out.
110
+ This will use/install a specific git tag.
111
+
112
+ ## Internal Behavior
113
+
114
+ It runs `git clone`, and `rake install,` install the gem, then deletes the temp directory.
115
+
116
+ ## Compatibility
117
+
118
+ 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).
119
+ Work-arounds: Upgrade Rubygems via `rvm rubygems current` or install older version of `specific_install`.
120
+ ## Contributing
121
+
122
+ 1. Fork it
123
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
124
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
125
+ 4. Push to the branch (`git push origin my-new-feature`)
126
+ 5. Create new Pull Request
127
+
128
+ Enjoy!
129
+
130
+ Copyright 2010-2014 Roger Pack - `http://github.com/rdp/specific_install`
data/Rakefile ADDED
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+ require "bundler/gem_tasks"
3
+
4
+ # how to:
5
+ # edit lib/specific_install/version.rb
6
+ # rake release, seems to work!
7
+
8
+ desc "Uninstall specific_install and release, then reinstall"
9
+ task :rubygems do
10
+ sh "gem uninstall specific_install --executables"
11
+ Rake::Task["release"].invoke
12
+ sh "gem install specific_install"
13
+ end
@@ -0,0 +1,282 @@
1
+ require 'rubygems/command_manager'
2
+ require 'rubygems/dependency_installer'
3
+
4
+ class Gem::Commands::SpecificInstallPixieCommand < Gem::Command
5
+ attr_accessor :output
6
+
7
+ def description
8
+ "Allows you to install an 'edge' gem straight from its github repository or from a web site"
9
+ end
10
+
11
+ def initialize(output=STDOUT)
12
+ super 'specific_install', description
13
+ @output = output
14
+
15
+ add_option('-l', '--location LOCATION', arguments) do |location, options|
16
+ options[:location] = location
17
+ end
18
+
19
+ add_option('-b', '--branch BRANCH', arguments) do |branch, options|
20
+ options[:branch] = branch
21
+ end
22
+
23
+ add_option('-d', '--directory DIRECTORY', arguments) do |directory, options|
24
+ options[:directory] = directory
25
+ end
26
+
27
+ add_option('-r', '--ref COMMIT-ISH', arguments) do |ref, options|
28
+ options[:ref] = ref
29
+ end
30
+
31
+ add_option('-t', '--tag TAG', arguments) do |tag, options|
32
+ options[:tag] = tag
33
+ end
34
+
35
+ add_option('-u', '--user-install', arguments) do |userinstall, options|
36
+ options[:userinstall] = userinstall
37
+ end
38
+
39
+ add_option('-i', '--install-dir INSTALL_DIR', arguments) do |installdir, options|
40
+ options[:installdir] = installdir
41
+ end
42
+ end
43
+
44
+ def arguments
45
+ "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" +
46
+ "BRANCH (optional) like beta, or new-feature\n" +
47
+ "DIRECTORY (optional) This will change the directory in the downloaded source directory before building the gem."
48
+ end
49
+
50
+ def usage
51
+ "#{program_name} [LOCATION] [BRANCH] (or command line options for the same)"
52
+ end
53
+
54
+ def execute
55
+ @loc ||= set_location
56
+ @branch ||= set_branch if set_branch
57
+ @ref ||= set_ref
58
+ @tag ||= set_tag
59
+ @installdir ||= set_installdir
60
+ if @loc.nil?
61
+ raise ArgumentError, "No location received. Use like `gem specific_install -l http://example.com/rdp/specific_install`"
62
+ end
63
+ require 'tempfile' if not defined?(Tempfile)
64
+ Dir.mktmpdir do |dir|
65
+ if subdir = options[:directory]
66
+ abort("Subdir '#{subdir}' is not a valid directory") unless valid_subdir?(subdir)
67
+ @top_dir = dir
68
+ @src_dir = File.join(dir, subdir)
69
+ else
70
+ @top_dir = @src_dir = dir
71
+ end
72
+ determine_source_and_install
73
+ end
74
+ end
75
+
76
+ private
77
+
78
+ def git(*commands)
79
+ system "git #{commands.join(' ').chomp(' ')}"
80
+ raise "'$ git #{commands.join(' ').chomp(' ')}' exited with an error" if $?.exitstatus != 0
81
+ end
82
+
83
+ def break_unless_git_present
84
+ unless system("git --version") || system("sh -c 'command -V git'")
85
+ abort("Please install git before using a git based link for specific_install")
86
+ end
87
+ end
88
+
89
+ def determine_source_and_install
90
+ case @loc
91
+ when /^https?(.*)\.gem$/
92
+ install_gem
93
+ when /\.git$/
94
+ break_unless_git_present
95
+ install_git
96
+ when /^https?(.*)$/
97
+ break_unless_git_present
98
+ install_http_repo
99
+ when %r(.*/.*)
100
+ break_unless_git_present
101
+ install_shorthand
102
+ else
103
+ warn 'Error: must end with .git to be a git repository' +
104
+ 'or be in shorthand form: rdp/specific_install'
105
+ end
106
+ end
107
+
108
+ def install_gem
109
+ Dir.chdir @top_dir do
110
+ output.puts "downloading #{@loc}"
111
+ download(@loc, gem_name)
112
+
113
+ if install_gemspec
114
+ success_message
115
+ else
116
+ output.puts "Failed"
117
+ end
118
+ end
119
+ end
120
+
121
+ def install_http_repo
122
+ output.puts 'http installing from ' + @loc
123
+
124
+ @loc = [@loc, '.git'].join unless @loc[/\.git$/]
125
+
126
+ redirect_for_specs = ENV.fetch( "SPECIFIC_INSTALL_SPEC" ) { "" }
127
+ git "clone", @loc, @top_dir, redirect_for_specs
128
+ install_from_git(@src_dir)
129
+ end
130
+
131
+ def gem_name
132
+ @gem_name ||= @loc.split("/").last
133
+ end
134
+
135
+ def install_git
136
+ output.puts 'git installing from ' + @loc
137
+
138
+ redirect_for_specs = ENV.fetch( "SPECIFIC_INSTALL_SPEC" ) { "" }
139
+ git "clone", @loc, @top_dir, redirect_for_specs
140
+ install_from_git(@src_dir)
141
+ end
142
+
143
+ def install_shorthand
144
+ output.puts "Installing from git@github.com:#{@loc}.git"
145
+
146
+ redirect_for_specs = ENV.fetch( "SPECIFIC_INSTALL_SPEC" ) { "" }
147
+ git "clone", "git@github.com:#{@loc}.git", @top_dir, redirect_for_specs
148
+ install_from_git(@src_dir)
149
+ end
150
+
151
+ def download( full_url, output_name )
152
+ require 'open-uri' if not defined?(OpenURI)
153
+ File.open(output_name, "wb") do |output_file|
154
+ uri = URI.parse(full_url)
155
+ output_file.write(uri.read)
156
+ end
157
+ end
158
+
159
+ def install_from_git(dir)
160
+ Dir.chdir @top_dir do
161
+ change_to_branch(@branch) if @branch
162
+ reset_to_commit(@ref) if @ref
163
+ change_to_tag(@tag) if @tag
164
+ git "submodule", "update", "--init", "--recursive" # Issue 25
165
+ end
166
+
167
+ Dir.chdir dir do
168
+ # reliable method
169
+ if install_gemspec
170
+ success_message
171
+ exit 0
172
+ end
173
+
174
+ # legacy methods
175
+ ['', 'rake gemspec', 'rake gem', 'rake build', 'rake package'].each do |command|
176
+ puts "attempting #{command}..."
177
+ system command
178
+ if install_gemspec
179
+ success_message
180
+ exit 0
181
+ end
182
+ end
183
+ end
184
+ end
185
+
186
+ def set_location
187
+ options[:location] || options[:args][0]
188
+ end
189
+
190
+ def set_branch
191
+ options[:branch] || options[:args][1]
192
+ end
193
+
194
+ def set_ref
195
+ options[:ref] || options[:args][2]
196
+ end
197
+
198
+ def set_tag
199
+ options[:tag]
200
+ end
201
+
202
+ def set_installdir
203
+ options[:installdir]
204
+ end
205
+
206
+ def success_message
207
+ output.puts 'Successfully installed'
208
+ end
209
+
210
+ def install_gemspec
211
+ gem = find_or_build_gem
212
+ if gem
213
+ install_options = {}
214
+ install_options[:user_install] = options[:userinstall].nil? ? nil : true
215
+ install_options[:install_dir] = options[:installdir] if options[:installdir]
216
+ install_options[:force] = true
217
+ inst = Gem::DependencyInstaller.new install_options
218
+ inst.install gem
219
+ else
220
+ nil
221
+ end
222
+ end
223
+
224
+ def find_or_build_gem
225
+ if gemspec_exists?
226
+ gemspec = Gem::Specification.load(gemspec_file)
227
+ Gem::Package.build gemspec
228
+ elsif gemfile
229
+ gemfile
230
+ else
231
+ nil
232
+ end
233
+ end
234
+
235
+ def gemspec_file(name = "*.gemspec")
236
+ Dir[name][0]
237
+ end
238
+
239
+ def gemspec_exists?(name = "*.gemspec")
240
+ if gemspec_file(name)
241
+ File.exist?(gemspec_file(name))
242
+ else
243
+ false
244
+ end
245
+ end
246
+
247
+ def gemfile(name = '**/*.gem')
248
+ if Dir[name].empty?
249
+ false
250
+ else
251
+ Dir[name][0]
252
+ end
253
+ end
254
+
255
+ def change_to_branch(branch)
256
+ git "checkout", branch
257
+ end
258
+
259
+ def reset_to_commit(ref)
260
+ git "reset", "--hard", ref
261
+ git "show", "-q"
262
+ end
263
+
264
+ def change_to_tag(tag)
265
+ git "checkout", tag
266
+ end
267
+
268
+ DOTDOT_REGEX = /(?:#{File::PATH_SEPARATOR}|\A)\.\.(?:#{File::PATH_SEPARATOR}|\z)/.freeze
269
+ ABS_REGEX = /\A#{File::PATH_SEPARATOR}/.freeze
270
+
271
+ def valid_subdir?(subdir)
272
+ !subdir.empty? &&
273
+ subdir !~ DOTDOT_REGEX &&
274
+ subdir !~ ABS_REGEX
275
+ end
276
+ end
277
+
278
+ class Gem::Commands::GitInstallPixieCommand < Gem::Commands::SpecificInstallPixieCommand
279
+ end
280
+
281
+ Gem::CommandManager.instance.register_command :specific_install_pixie
282
+ Gem::CommandManager.instance.register_command :git_install_pixie
@@ -0,0 +1,7 @@
1
+ begin
2
+ require "specific_install/version"
3
+ require "rubygems/commands/specific_install_pixie_command"
4
+ rescue LoadError
5
+ # This happens with `bundle exec gem build <gemspec>` commands.
6
+ # But in that context we don't care.
7
+ end
@@ -0,0 +1,3 @@
1
+ module SpecificInstallPixie
2
+ VERSION = "0.3.9"
3
+ end
@@ -0,0 +1,4 @@
1
+ module SpecificInstallPixie
2
+ autoload :SpecificInstallPixieCommand, 'specific_install/specific_install_pixie_command'
3
+ autoload :Version, 'specific_install/version'
4
+ end
@@ -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,227 @@
1
+ require 'rubygems'
2
+ require_relative './spec_helper'
3
+ require 'stringio'
4
+ require 'open3'
5
+ require 'tmpdir'
6
+
7
+ describe Gem::Commands::SpecificInstallPixieCommand do
8
+ before do
9
+ module Kernel
10
+ alias_method :real_system, :system
11
+
12
+ def system(cmd)
13
+ 'system "#{cmd}"'
14
+ end
15
+
16
+ def puts(cmd)
17
+ cmd
18
+ end
19
+ end
20
+
21
+ end
22
+ after do
23
+ module Kernel
24
+ alias_method :system, :real_system
25
+ end
26
+ end
27
+
28
+ subject { Gem::Commands::SpecificInstallPixieCommand.new(StringIO.new) }
29
+ describe "#gem_name" do
30
+ it "sets gem_name from location" do
31
+ subject.instance_variable_set(:@loc, "stuff/foo/bar")
32
+ expect(subject.send(:gem_name)).to eq("bar")
33
+ end
34
+ end
35
+
36
+ context "disable #install_from_git" do
37
+ before do
38
+ class Gem::Commands::SpecificInstallPixieCommand
39
+ def install_from_git(dir)
40
+ dir
41
+ end
42
+ end
43
+ subject.instance_variable_set(:@top_dir, "foo")
44
+ end
45
+ describe "#install_git" do
46
+ before do
47
+ subject.instance_variable_set(:@loc, "bar")
48
+ end
49
+ it "sends correct command to system" do
50
+ subject.should_receive(:system).with(/git clone bar foo/)
51
+ subject.send(:install_git)
52
+ end
53
+ end
54
+
55
+ describe "#download" do
56
+ it "downloads a gem" do
57
+ Dir.mktmpdir do |tmpdir|
58
+ url = "https://rubygems.org/downloads/specific_install-0.2.7.gem"
59
+ output_name = "specific_install.gem"
60
+ subject.send(:download, url, output_name)
61
+ expect(File.exist?(output_name)).to be true
62
+ end
63
+ end
64
+ end
65
+
66
+ describe "#install_shorthand" do
67
+ it "formats the shorthand into a git repo" do
68
+ subject.instance_variable_set(:@loc, "bar/zoz")
69
+ subject.should_receive(:system).with(%r{git clone git@github.com:bar/zoz.git foo})
70
+ subject.send(:install_shorthand)
71
+ end
72
+ end
73
+ end
74
+
75
+ describe "#success_message" do
76
+ it "returns correct message" do
77
+ subject.output.should_receive(:puts).with('Successfully installed')
78
+ subject.send(:success_message)
79
+ end
80
+ end
81
+
82
+ describe "#install_gemspec" do
83
+ context "when no gemspec or gem" do
84
+ xit "returns false" do
85
+ expect( subject.send(:install_gemspec) ).to eq(false)
86
+ end
87
+ end
88
+ end
89
+
90
+ describe "#gemspec_exists?" do
91
+ it "response true to when exists" do
92
+ expect( subject.send(:gemspec_exists?) ).to be true
93
+ end
94
+
95
+ it "responds false when not present" do
96
+ expect( subject.send(:gemspec_exists?, "*.gemNOTPRESENT") ).to be false
97
+ end
98
+ end
99
+
100
+ describe "#gemfile" do
101
+ it "response false when not existing" do
102
+ expect( subject.send(:gemfile, "*.gemNOTPRESENT") ).to be false
103
+ end
104
+ it "response true to when exists" do
105
+ Dir.mktmpdir do |dir|
106
+ Dir.chdir(dir) do
107
+ Pathname("foo.gem").write('foo')
108
+ expect(subject.send(:gemfile, "**/*.gem")).to be_truthy
109
+ end
110
+ end
111
+ end
112
+ end
113
+
114
+ describe "#determine_source_and_install" do
115
+ it "executes http gem requests" do
116
+ subject.instance_variable_set(:@loc, "http://example.com/rad.gem")
117
+ subject.should_receive(:install_gem)
118
+ subject.send(:determine_source_and_install)
119
+ end
120
+ it "executes https gem requests" do
121
+ subject.instance_variable_set(:@loc, "https://example.com/rad.gem")
122
+ subject.should_receive(:install_gem)
123
+ subject.send(:determine_source_and_install)
124
+ end
125
+ it "executes https git install requests" do
126
+ subject.instance_variable_set(:@loc, "https://example.com/rad.git")
127
+ subject.should_receive(:install_git)
128
+ subject.send(:determine_source_and_install)
129
+ end
130
+ it "executes git url git install requests" do
131
+ subject.instance_variable_set(:@loc, "git@github.com:example/rad.git")
132
+ subject.should_receive(:install_git)
133
+ subject.send(:determine_source_and_install)
134
+ end
135
+ it "executes shorthand github install requests" do
136
+ subject.instance_variable_set(:@loc, "example/rad")
137
+ subject.should_receive(:install_shorthand)
138
+ subject.send(:determine_source_and_install)
139
+ end
140
+ it "executes shorthand github install requests" do
141
+ subject.instance_variable_set(:@loc, "example")
142
+ subject.should_receive(:warn)
143
+ subject.send(:determine_source_and_install)
144
+ end
145
+ end
146
+
147
+ describe "#set_location" do
148
+ it "sets from options[location]" do
149
+ subject.options[:location] = "example"
150
+ expect( subject.send(:set_location) ).to eq("example")
151
+ end
152
+ it "sets from options[args]" do
153
+ subject.options[:location] = nil
154
+ subject.options[:args] = ["args"]
155
+ expect( subject.send(:set_location) ).to eq("args")
156
+ end
157
+ it "sets neither and results in nil" do
158
+ subject.options[:location] = nil
159
+ subject.options[:args] = []
160
+ expect( subject.send(:set_location) ).to be_nil
161
+ end
162
+ end
163
+
164
+ describe "#execute" do
165
+ it "raises error when no location received" do
166
+ subject.options[:location] = nil
167
+ subject.options[:args] = []
168
+ expect{ subject.execute }.to raise_error(ArgumentError)
169
+ end
170
+ end
171
+
172
+ end
173
+
174
+
175
+ describe "Integration Tests" do
176
+
177
+ $STDOUT = StringIO.new
178
+ let(:output) { StringIO.new }
179
+ subject { Gem::Commands::SpecificInstallPixieCommand.new(output) }
180
+ before(:all) do
181
+ # ENV.store( "SPECIFIC_INSTALL_SPEC", '2&> /dev/null' )
182
+ end
183
+ before(:each) do
184
+ `gem uninstall specific_install --executables 2&> /dev/null`
185
+ `rake install 2&> /dev/null`
186
+ end
187
+
188
+ after(:all) do
189
+ `gem uninstall specific_install --executables 2&> /dev/null`
190
+ `gem install specific_install`
191
+ ENV.delete( "SPECIFIC_INSTALL_SPEC" )
192
+ end
193
+
194
+ context "working URIs" do
195
+ it "installs from https" do
196
+ url = "https://github.com/rdp/specific_install.git"
197
+ subject.instance_variable_set(:@loc, url)
198
+ subject.options[:args] = []
199
+ stdout, status = Open3.capture2 "gem specific_install #{url}"
200
+ expect(stdout).to match(/Successfully installed/)
201
+ end
202
+ it "installs from http" do
203
+ url = "http://github.com/rdp/specific_install.git"
204
+ subject.instance_variable_set(:@loc, url)
205
+ subject.options[:args] = []
206
+ stdout, status = Open3.capture2 "gem specific_install #{url}"
207
+ expect(stdout).to match(/Successfully installed/)
208
+ end
209
+ it "installs from shorthand" do
210
+ url = "rdp/specific_install"
211
+ subject.instance_variable_set(:@loc, url)
212
+ subject.options[:args] = []
213
+ stdout, status = Open3.capture2 "gem specific_install #{url}"
214
+ expect(stdout).to match(/Successfully installed/)
215
+ end
216
+ it "installs from git" do
217
+ url = "git@github.com:zph/buff.git"
218
+ stdout, status = Open3.capture2 "gem specific_install #{url}"
219
+ expect(stdout).to match(/Successfully installed/)
220
+ end
221
+ it "installs from packaged gem" do
222
+ url = "https://rubygems.org/downloads/specific_install-0.2.7.gem"
223
+ stdout, status = Open3.capture2 "gem specific_install #{url}"
224
+ expect(stdout).to match(/Successfully installed/)
225
+ end
226
+ end
227
+ end if ENV['SPECIFIC_INSTALL_INTEGRATION_SPECS']
@@ -0,0 +1,29 @@
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_pixie"
9
+ s.version = SpecificInstallPixie::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
+
23
+ s.add_development_dependency 'rspec'
24
+ s.add_development_dependency 'sane'
25
+ s.add_development_dependency "bundler"
26
+ s.add_development_dependency "rake"
27
+ s.add_development_dependency "simplecov"
28
+ s.add_development_dependency "simplecov-vim"
29
+ end
metadata ADDED
@@ -0,0 +1,147 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: specific_install_pixie
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.9
5
+ platform: ruby
6
+ authors:
7
+ - Roger Pack
8
+ - Zander Hill
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2024-12-27 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: '0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
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
+ - ".github/workflows/ci.yml"
108
+ - ".gitignore"
109
+ - ChangeLog
110
+ - Gemfile
111
+ - LICENSE.txt
112
+ - README.md
113
+ - Rakefile
114
+ - lib/rubygems/commands/specific_install_pixie_command.rb
115
+ - lib/rubygems_plugin.rb
116
+ - lib/specific_install/version.rb
117
+ - lib/specific_install_pixie.rb
118
+ - spec/spec_helper.rb
119
+ - spec/specific_install_pixie_spec.rb
120
+ - specific_install_pixie.gemspec
121
+ homepage: https://github.com/rdp/specific_install
122
+ licenses:
123
+ - MIT
124
+ metadata: {}
125
+ post_install_message:
126
+ rdoc_options: []
127
+ require_paths:
128
+ - lib
129
+ required_ruby_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ required_rubygems_version: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ requirements: []
140
+ rubygems_version: 3.2.3
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_pixie_spec.rb