specific_install 0.3.3 → 0.3.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 34836fbe97d3b0e31d399ed3740fb1066630cda5
4
- data.tar.gz: 0d5fe0f2d82e3146f04c12791af9584624181c6b
2
+ SHA256:
3
+ metadata.gz: 3116c3947928d56b53ddefb21f04e054ee6f7f6d87c9a2f6db5eb0cee6c35b95
4
+ data.tar.gz: 937108da7d150435f786a76ee72e4076af3977b00abe6cb7df57b7818aee54e1
5
5
  SHA512:
6
- metadata.gz: 31488875a64212384f74de1acbb9fb624c56d8688b98b174000c8d9e9c012c65a93811f1ebb0160a72d2fc31dfb4e20b7c6cbf9704be19271f991195b4c3edfb
7
- data.tar.gz: 79744026b113881e2a776f3e3d3dfbb54edc68d048fb59d513b456d9e61866ad02e1f8449f824fc15079c1322f6c16773e688411fb9f54775c78ac440e7b1073
6
+ metadata.gz: b4d2988cd8f060580d3060ab8bc1a09e5ae6d9565b581b1f645007cdbb3315e859bcfce3fc21453fa6132225ede9dbad8c12b2927c86a0549e2fa6e6e0289005
7
+ data.tar.gz: 47c325189d85d00bf40cef6ca203f820f95a3fa1eee31f853d66353894556dc525ec38b928374035f816f152c8c1b7ad66b72b68e6b373c27348baa75597f6a0
data/README.md CHANGED
@@ -16,7 +16,7 @@ Or install it yourself as:
16
16
 
17
17
  ## Usage
18
18
 
19
- A Rubygem plugin that allows you to install an "edge" gem straight from its github repository,
19
+ A Rubygem plugin that allows you to install an "edge" gem straight from its github repository,
20
20
  or install one from an arbitrary url web:
21
21
 
22
22
  ex:
@@ -47,12 +47,18 @@ Or a specific branch in an explicit way
47
47
  $ gem specific_install -l http://github.com/githubsvnclone/rdoc.git -b edge
48
48
  `
49
49
 
50
- Or a specific subdirectory in a repo
50
+ Or a specific subdirectory in a repo
51
51
 
52
52
  `
53
53
  $ gem specific_install https://github.com/orlandohill/waxeye -d src/ruby
54
54
  `
55
55
 
56
+ Or install in the users personal gem directory
57
+
58
+ `
59
+ $ gem specific_install https://github.com/orlandohill/waxeye -u
60
+ `
61
+
56
62
  The following URI types are accepted:
57
63
 
58
64
  - http(s)://github.com/rdp/specific_install.git
@@ -64,7 +70,7 @@ The following URI types are accepted:
64
70
 
65
71
  ### Additional Options
66
72
 
67
- -l --location URL of resource
73
+ -l --location URL of resource
68
74
  Formats of URL/Resource
69
75
  * Full URL to HTTP Repo `https://github.com/rdp/specific_install.git`
70
76
  * Full URL to Git Repo `git@github.com:rdp/specific_install.git`
@@ -79,13 +85,19 @@ The following URI types are accepted:
79
85
 
80
86
  -d --directory DIRECTORY in source
81
87
  This will change the directory in the downloaded source directory
82
- before building the gem.
88
+ before building the gem.
89
+
90
+ -r, --ref COMMIT-ISH to use for Gem creation
91
+ Ref option does a `git reset --hard COMMIT-ISH` before `gem build GEM`
92
+
93
+ -u, --user-install to indicate that the gem should be unpacked into the users personal gem directory.
94
+ This will install the gem in the user folder making it possible to use specific_install without root access.
83
95
 
84
96
  `git_install` is aliased to the behavior of `specific_install`
85
97
  This alias is shorter and is more intention revealing of the gem's behavior.
86
98
  ## Internal Behavior
87
99
 
88
- It runs `git clone`, and `rake install,` install the gem, then deletes the temp directory]
100
+ It runs `git clone`, and `rake install,` install the gem, then deletes the temp directory.
89
101
 
90
102
  ## Compatibility
91
103
 
data/Rakefile CHANGED
@@ -1,6 +1,10 @@
1
1
  require 'rubygems'
2
2
  require "bundler/gem_tasks"
3
3
 
4
+ # how to:
5
+ # edit lib/specific_install/version.rb
6
+ # rake release, seems to work!
7
+
4
8
  desc "Uninstall specific_install and release, then reinstall"
5
9
  task :rubygems do
6
10
  sh "gem uninstall specific_install --executables"
@@ -1,8 +1,5 @@
1
1
  require 'rubygems/command_manager'
2
2
  require 'rubygems/dependency_installer'
3
- require 'tempfile'
4
- require 'fileutils'
5
- require 'open-uri'
6
3
 
7
4
  class Gem::Commands::SpecificInstallCommand < Gem::Command
8
5
  attr_accessor :output
@@ -19,7 +16,7 @@ class Gem::Commands::SpecificInstallCommand < Gem::Command
19
16
  options[:location] = location
20
17
  end
21
18
 
22
- add_option('-b', '--branch LOCATION', arguments) do |branch, options|
19
+ add_option('-b', '--branch BRANCH', arguments) do |branch, options|
23
20
  options[:branch] = branch
24
21
  end
25
22
 
@@ -30,6 +27,10 @@ class Gem::Commands::SpecificInstallCommand < Gem::Command
30
27
  add_option('-r', '--ref COMMIT-ISH', arguments) do |ref, options|
31
28
  options[:ref] = ref
32
29
  end
30
+
31
+ add_option('-u', '--user-install', arguments) do |userinstall, options|
32
+ options[:userinstall] = userinstall
33
+ end
33
34
  end
34
35
 
35
36
  def arguments
@@ -49,6 +50,7 @@ class Gem::Commands::SpecificInstallCommand < Gem::Command
49
50
  if @loc.nil?
50
51
  raise ArgumentError, "No location received. Use like `gem specific_install -l http://example.com/rdp/specific_install`"
51
52
  end
53
+ require 'tempfile' if not defined?(Tempfile)
52
54
  Dir.mktmpdir do |dir|
53
55
  if subdir = options[:directory]
54
56
  abort("Subdir '#{subdir}' is not a valid directory") unless valid_subdir?(subdir)
@@ -61,8 +63,15 @@ class Gem::Commands::SpecificInstallCommand < Gem::Command
61
63
  end
62
64
  end
63
65
 
66
+ private
67
+
68
+ def git(*commands)
69
+ system "git #{commands.join(' ').chomp(' ')}"
70
+ raise "'$ git #{commands.join(' ').chomp(' ')}' exited with an error" if $?.exitstatus != 0
71
+ end
72
+
64
73
  def break_unless_git_present
65
- unless system("which git") || system("where git")
74
+ unless system("git --version") || system("sh -c 'command -V git'")
66
75
  abort("Please install git before using a git based link for specific_install")
67
76
  end
68
77
  end
@@ -105,7 +114,7 @@ class Gem::Commands::SpecificInstallCommand < Gem::Command
105
114
  @loc = [@loc, '.git'].join unless @loc[/\.git$/]
106
115
 
107
116
  redirect_for_specs = ENV.fetch( "SPECIFIC_INSTALL_SPEC" ) { "" }
108
- system("git clone #{@loc} #{@top_dir} #{redirect_for_specs}")
117
+ git "clone", @loc, @top_dir, redirect_for_specs
109
118
  install_from_git(@src_dir)
110
119
  end
111
120
 
@@ -117,7 +126,7 @@ class Gem::Commands::SpecificInstallCommand < Gem::Command
117
126
  output.puts 'git installing from ' + @loc
118
127
 
119
128
  redirect_for_specs = ENV.fetch( "SPECIFIC_INSTALL_SPEC" ) { "" }
120
- system("git clone #{@loc} #{@top_dir} #{redirect_for_specs}")
129
+ git "clone", @loc, @top_dir, redirect_for_specs
121
130
  install_from_git(@src_dir)
122
131
  end
123
132
 
@@ -125,11 +134,12 @@ class Gem::Commands::SpecificInstallCommand < Gem::Command
125
134
  output.puts "Installing from git@github.com:#{@loc}.git"
126
135
 
127
136
  redirect_for_specs = ENV.fetch( "SPECIFIC_INSTALL_SPEC" ) { "" }
128
- system("git clone git@github.com:#{@loc}.git #{@top_dir} #{redirect_for_specs}")
137
+ git "clone", "git@github.com:#{@loc}.git", @top_dir, redirect_for_specs
129
138
  install_from_git(@src_dir)
130
139
  end
131
140
 
132
141
  def download( full_url, output_name )
142
+ require 'open-uri' if not defined?(OpenURI)
133
143
  File.open(output_name, "wb") do |output_file|
134
144
  uri = URI.parse(full_url)
135
145
  output_file.write(uri.read)
@@ -140,7 +150,7 @@ class Gem::Commands::SpecificInstallCommand < Gem::Command
140
150
  Dir.chdir @top_dir do
141
151
  change_to_branch(@branch) if @branch
142
152
  reset_to_commit(@ref) if @ref
143
- system("git submodule update --init --recursive") # issue 25
153
+ git "submodule", "update", "--init", "--recursive" # Issue 25
144
154
  end
145
155
 
146
156
  Dir.chdir dir do
@@ -181,7 +191,9 @@ class Gem::Commands::SpecificInstallCommand < Gem::Command
181
191
  def install_gemspec
182
192
  gem = find_or_build_gem
183
193
  if gem
184
- inst = Gem::DependencyInstaller.new
194
+ install_options = {}
195
+ install_options[:user_install] = options[:userinstall].nil? ? nil : true
196
+ inst = Gem::DependencyInstaller.new install_options
185
197
  inst.install gem
186
198
  else
187
199
  nil
@@ -220,13 +232,12 @@ class Gem::Commands::SpecificInstallCommand < Gem::Command
220
232
  end
221
233
 
222
234
  def change_to_branch(branch)
223
- system("git checkout #{branch}")
224
- system("git branch")
235
+ git "checkout", branch
225
236
  end
226
237
 
227
238
  def reset_to_commit(ref)
228
- system("git reset --hard #{ref}")
229
- system("git show -q")
239
+ git "reset", "--hard", ref
240
+ git "show", "-q"
230
241
  end
231
242
 
232
243
  DOTDOT_REGEX = /(?:#{File::PATH_SEPARATOR}|\A)\.\.(?:#{File::PATH_SEPARATOR}|\z)/.freeze
@@ -1,2 +1,7 @@
1
- require "specific_install/version"
2
- require "rubygems/commands/specific_install_command"
1
+ begin
2
+ require "specific_install/version"
3
+ require "rubygems/commands/specific_install_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
@@ -1,3 +1,3 @@
1
1
  module SpecificInstall
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.7"
3
3
  end
@@ -19,7 +19,6 @@ Gem::Specification.new do |s|
19
19
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
20
20
  s.require_paths = ["lib"]
21
21
  s.platform = Gem::Platform::RUBY
22
- s.rubyforge_project = '[none]'
23
22
 
24
23
  s.add_development_dependency 'rspec'
25
24
  s.add_development_dependency 'sane'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: specific_install
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roger Pack
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-01-23 00:00:00.000000000 Z
12
+ date: 2021-11-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -136,8 +136,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
136
  - !ruby/object:Gem::Version
137
137
  version: '0'
138
138
  requirements: []
139
- rubyforge_project: "[none]"
140
- rubygems_version: 2.5.2
139
+ rubyforge_project:
140
+ rubygems_version: 2.7.6
141
141
  signing_key:
142
142
  specification_version: 4
143
143
  summary: rubygems plugin that allows you you to install a gem from from its github