specific_install 0.3.2 → 0.3.6

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: 1fe8a6271c3d89e452478cfc076268bf6fe91ee5
4
- data.tar.gz: f1a63b315b574fda3606954aa97d36f91fd36cde
2
+ SHA256:
3
+ metadata.gz: 7512355e136131a4c1413629e4a30ff7be2a5326dcb4fa213b627448ee53f1a1
4
+ data.tar.gz: 587deaf278b3408bea5e3deb07b45ccafef2d8e21652857853816db225182574
5
5
  SHA512:
6
- metadata.gz: 9270ba07a8f3a8ed058926746ebf29534e2712a4f355a8fcfa46f9df65e3dc6af2e99e8ebb2df312961ee59c001a59815e6e6d586babb98d54b4c02bc0bcb6c9
7
- data.tar.gz: bf50d8fee05d38a639dcfa6d5b58da2df6f95e4dbb9afc429ebe3a722b703a03ab32292b83cc42570b31d19a83de69f712930546bcfa26b58ec5883cf1a03c60
6
+ metadata.gz: d2b36f503ae729bdc11a657b98dc925c1b345a5f88113648134e51e5c4be9d6c30d39012ad095afab98233a318ffe79086f6a8e3d3de989d04cff10491333ab5
7
+ data.tar.gz: 78579052188479a5ae52f18817e22917f907daa8bd05d121fa204e5020752cf197e48f5e91a6b5aeaeb859425440d68e32a8ec24a8db55066d02362e2934343d
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ Gemfile.lock
1
2
  .config
2
3
  InstalledFiles
3
4
  pkg
data/ChangeLog CHANGED
@@ -1,2 +1,4 @@
1
+ 0.3.3
2
+ Added an option '-r' to specify commit-ish
1
3
  0.2.12
2
4
  automatically clone submodules if any are there
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
 
@@ -1,9 +1,5 @@
1
1
  require 'rubygems/command_manager'
2
2
  require 'rubygems/dependency_installer'
3
- require 'tempfile'
4
- require 'backports'
5
- require 'fileutils'
6
- require 'open-uri'
7
3
 
8
4
  class Gem::Commands::SpecificInstallCommand < Gem::Command
9
5
  attr_accessor :output
@@ -20,13 +16,21 @@ class Gem::Commands::SpecificInstallCommand < Gem::Command
20
16
  options[:location] = location
21
17
  end
22
18
 
23
- add_option('-b', '--branch LOCATION', arguments) do |branch, options|
19
+ add_option('-b', '--branch BRANCH', arguments) do |branch, options|
24
20
  options[:branch] = branch
25
21
  end
26
22
 
27
23
  add_option('-d', '--directory DIRECTORY', arguments) do |directory, options|
28
24
  options[:directory] = directory
29
25
  end
26
+
27
+ add_option('-r', '--ref COMMIT-ISH', arguments) do |ref, options|
28
+ options[:ref] = ref
29
+ end
30
+
31
+ add_option('-u', '--user-install', arguments) do |userinstall, options|
32
+ options[:userinstall] = userinstall
33
+ end
30
34
  end
31
35
 
32
36
  def arguments
@@ -42,9 +46,11 @@ class Gem::Commands::SpecificInstallCommand < Gem::Command
42
46
  def execute
43
47
  @loc ||= set_location
44
48
  @branch ||= set_branch if set_branch
49
+ @ref ||= set_ref
45
50
  if @loc.nil?
46
51
  raise ArgumentError, "No location received. Use like `gem specific_install -l http://example.com/rdp/specific_install`"
47
52
  end
53
+ require 'tempfile' if not defined?(Tempfile)
48
54
  Dir.mktmpdir do |dir|
49
55
  if subdir = options[:directory]
50
56
  abort("Subdir '#{subdir}' is not a valid directory") unless valid_subdir?(subdir)
@@ -57,8 +63,15 @@ class Gem::Commands::SpecificInstallCommand < Gem::Command
57
63
  end
58
64
  end
59
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
+
60
73
  def break_unless_git_present
61
- unless system("which git") || system("where git")
74
+ unless system("type -a git")
62
75
  abort("Please install git before using a git based link for specific_install")
63
76
  end
64
77
  end
@@ -101,7 +114,7 @@ class Gem::Commands::SpecificInstallCommand < Gem::Command
101
114
  @loc = [@loc, '.git'].join unless @loc[/\.git$/]
102
115
 
103
116
  redirect_for_specs = ENV.fetch( "SPECIFIC_INSTALL_SPEC" ) { "" }
104
- system("git clone #{@loc} #{@top_dir} #{redirect_for_specs}")
117
+ git "clone", @loc, @top_dir, redirect_for_specs
105
118
  install_from_git(@src_dir)
106
119
  end
107
120
 
@@ -113,7 +126,7 @@ class Gem::Commands::SpecificInstallCommand < Gem::Command
113
126
  output.puts 'git installing from ' + @loc
114
127
 
115
128
  redirect_for_specs = ENV.fetch( "SPECIFIC_INSTALL_SPEC" ) { "" }
116
- system("git clone #{@loc} #{@top_dir} #{redirect_for_specs}")
129
+ git "clone", @loc, @top_dir, redirect_for_specs
117
130
  install_from_git(@src_dir)
118
131
  end
119
132
 
@@ -121,11 +134,12 @@ class Gem::Commands::SpecificInstallCommand < Gem::Command
121
134
  output.puts "Installing from git@github.com:#{@loc}.git"
122
135
 
123
136
  redirect_for_specs = ENV.fetch( "SPECIFIC_INSTALL_SPEC" ) { "" }
124
- 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
125
138
  install_from_git(@src_dir)
126
139
  end
127
140
 
128
141
  def download( full_url, output_name )
142
+ require 'open-uri' if not defined?(OpenURI)
129
143
  File.open(output_name, "wb") do |output_file|
130
144
  uri = URI.parse(full_url)
131
145
  output_file.write(uri.read)
@@ -135,7 +149,8 @@ class Gem::Commands::SpecificInstallCommand < Gem::Command
135
149
  def install_from_git(dir)
136
150
  Dir.chdir @top_dir do
137
151
  change_to_branch(@branch) if @branch
138
- system("git submodule update --init --recursive") # issue 25
152
+ reset_to_commit(@ref) if @ref
153
+ git "submodule", "update", "--init", "--recursive" # Issue 25
139
154
  end
140
155
 
141
156
  Dir.chdir dir do
@@ -165,6 +180,10 @@ class Gem::Commands::SpecificInstallCommand < Gem::Command
165
180
  options[:branch] || options[:args][1]
166
181
  end
167
182
 
183
+ def set_ref
184
+ options[:ref] || options[:args][2]
185
+ end
186
+
168
187
  def success_message
169
188
  output.puts 'Successfully installed'
170
189
  end
@@ -172,7 +191,9 @@ class Gem::Commands::SpecificInstallCommand < Gem::Command
172
191
  def install_gemspec
173
192
  gem = find_or_build_gem
174
193
  if gem
175
- inst = Gem::DependencyInstaller.new
194
+ install_options = {}
195
+ install_options[:user_install] = options[:userinstall].nil? ? nil : true
196
+ inst = Gem::DependencyInstaller.new install_options
176
197
  inst.install gem
177
198
  else
178
199
  nil
@@ -211,8 +232,12 @@ class Gem::Commands::SpecificInstallCommand < Gem::Command
211
232
  end
212
233
 
213
234
  def change_to_branch(branch)
214
- system("git checkout #{branch}")
215
- system("git branch")
235
+ git "checkout", branch
236
+ end
237
+
238
+ def reset_to_commit(ref)
239
+ git "reset", "--hard", ref
240
+ git "show", "-q"
216
241
  end
217
242
 
218
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.2"
2
+ VERSION = "0.3.6"
3
3
  end
@@ -19,9 +19,7 @@ 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
- s.add_dependency 'backports'
25
23
  s.add_development_dependency 'rspec'
26
24
  s.add_development_dependency 'sane'
27
25
  s.add_development_dependency "bundler", "~> 1.3"
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.2
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roger Pack
@@ -9,22 +9,8 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-03-20 00:00:00.000000000 Z
12
+ date: 2021-11-07 00:00:00.000000000 Z
13
13
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: backports
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - ">="
19
- - !ruby/object:Gem::Version
20
- version: '0'
21
- type: :runtime
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- version: '0'
28
14
  - !ruby/object:Gem::Dependency
29
15
  name: rspec
30
16
  requirement: !ruby/object:Gem::Requirement
@@ -121,7 +107,6 @@ files:
121
107
  - ".gitignore"
122
108
  - ChangeLog
123
109
  - Gemfile
124
- - Gemfile.lock
125
110
  - LICENSE.txt
126
111
  - README.md
127
112
  - Rakefile
@@ -151,8 +136,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
136
  - !ruby/object:Gem::Version
152
137
  version: '0'
153
138
  requirements: []
154
- rubyforge_project: "[none]"
155
- rubygems_version: 2.2.2
139
+ rubyforge_project:
140
+ rubygems_version: 2.7.6
156
141
  signing_key:
157
142
  specification_version: 4
158
143
  summary: rubygems plugin that allows you you to install a gem from from its github
data/Gemfile.lock DELETED
@@ -1,44 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- specific_install (0.3.2)
5
- backports
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- backports (3.6.8)
11
- diff-lcs (1.2.4)
12
- multi_json (1.8.0)
13
- os (0.9.6)
14
- rake (10.1.0)
15
- rspec (2.14.1)
16
- rspec-core (~> 2.14.0)
17
- rspec-expectations (~> 2.14.0)
18
- rspec-mocks (~> 2.14.0)
19
- rspec-core (2.14.5)
20
- rspec-expectations (2.14.3)
21
- diff-lcs (>= 1.1.3, < 2.0)
22
- rspec-mocks (2.14.3)
23
- sane (0.25.6)
24
- os
25
- simplecov (0.7.1)
26
- multi_json (~> 1.0)
27
- simplecov-html (~> 0.7.1)
28
- simplecov-html (0.7.1)
29
- simplecov-vim (0.0.1)
30
-
31
- PLATFORMS
32
- ruby
33
-
34
- DEPENDENCIES
35
- bundler (~> 1.3)
36
- rake
37
- rspec
38
- sane
39
- simplecov
40
- simplecov-vim
41
- specific_install!
42
-
43
- BUNDLED WITH
44
- 1.10.6