executable-hooks 1.4.1.alpha → 1.6.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.
- data/.travis.yml +4 -0
- data/CHANGELOG.md +26 -0
- data/bin/ruby_executable_hooks +9 -1
- data/executable-hooks.gemspec +1 -1
- data/lib/executable-hooks/regenerate_binstubs_command.rb +2 -2
- data/lib/executable-hooks/version.rb +1 -1
- data/lib/executable-hooks/wrapper.rb +8 -2
- data/lib/rubygems_plugin.rb +4 -1
- data/test-tf-truffleruby/truffleruby_comment_test.sh +16 -0
- metadata +12 -14
data/.travis.yml
CHANGED
@@ -25,10 +25,14 @@ notifications:
|
|
25
25
|
matrix:
|
26
26
|
fast_finish: true
|
27
27
|
include:
|
28
|
+
- rvm: 1.8.7
|
29
|
+
env: WITH_RUBYGEMS=1.4.2
|
28
30
|
- rvm: 1.8.7
|
29
31
|
env: WITH_RUBYGEMS=1.6.2
|
30
32
|
- rvm: 2.5
|
31
33
|
env: TEST_SUFFIX=-bundle
|
34
|
+
- rvm: 2.5
|
35
|
+
env: TEST_SUFFIX=-truffleruby
|
32
36
|
- rvm: 1.8.7
|
33
37
|
- rvm: 1.9.2
|
34
38
|
- rvm: 1.9.3
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,31 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.6.1
|
4
|
+
date: 2021-01-26
|
5
|
+
|
6
|
+
- Avoid Ruby 2.7 warning, merge #38
|
7
|
+
|
8
|
+
## 1.6.0
|
9
|
+
date: 2018-10-25
|
10
|
+
|
11
|
+
- Restore support for ruby-1.8.6, fixes #34
|
12
|
+
- Do not force overwrite wrapper, fixes #33
|
13
|
+
|
14
|
+
## 1.5.0
|
15
|
+
date: 2018-06-25
|
16
|
+
|
17
|
+
- Support truffleruby, fixes rvm/rvm#4408
|
18
|
+
|
19
|
+
## 1.4.2
|
20
|
+
date: 2018-02-14
|
21
|
+
|
22
|
+
- Support rubygems 1.4.2, fixes #29
|
23
|
+
|
24
|
+
## 1.4.1
|
25
|
+
date: 2018-02-12
|
26
|
+
|
27
|
+
- Fix bundle install, fixes #28
|
28
|
+
|
3
29
|
## 1.4.0
|
4
30
|
date: 2018-02-08
|
5
31
|
|
data/bin/ruby_executable_hooks
CHANGED
@@ -12,4 +12,12 @@ rescue LoadError
|
|
12
12
|
warn "unable to load executable-hooks/hooks" if ENV.key?('ExecutableHooks_DEBUG')
|
13
13
|
end unless $0.end_with?('/executable-hooks-uninstaller')
|
14
14
|
|
15
|
-
|
15
|
+
content = File.read($0)
|
16
|
+
|
17
|
+
if (index = content.index("\n#!ruby\n")) && index > 0
|
18
|
+
skipped_content = content.slice!(0..index)
|
19
|
+
start_line = skipped_content.count("\n") + 1
|
20
|
+
eval content, binding, $0, start_line
|
21
|
+
else
|
22
|
+
eval content, binding, $0
|
23
|
+
end
|
data/executable-hooks.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.license = 'Apache 2.0'
|
10
10
|
s.authors = ["Michal Papis"]
|
11
11
|
s.email = ["mpapis@gmail.com"]
|
12
|
-
s.homepage = "https://github.com/
|
12
|
+
s.homepage = "https://github.com/rvm/executable-hooks"
|
13
13
|
s.summary = %q{
|
14
14
|
Hook into rubygems executables allowing extra actions to be taken before executable is run.
|
15
15
|
}
|
@@ -91,7 +91,7 @@ class RegenerateBinstubsCommand < Gem::Command
|
|
91
91
|
return false if executable_paths.include?(nil) # not found
|
92
92
|
executable_shebangs =
|
93
93
|
executable_paths.map do |path|
|
94
|
-
[path, File.readlines(path).map
|
94
|
+
[path, File.readlines(path).map{|l|l.chomp}]
|
95
95
|
end
|
96
96
|
return false if executable_shebangs.detect{|path, lines| !(lines[0] =~ /^#!\//) }
|
97
97
|
puts "#{spec.name} #{spec.version}"
|
@@ -128,7 +128,7 @@ class RegenerateBinstubsCommand < Gem::Command
|
|
128
128
|
end
|
129
129
|
|
130
130
|
def existing_gem_path(full_name)
|
131
|
-
expanded_gem_paths.find{|path| File.exists?
|
131
|
+
expanded_gem_paths.find{|path| File.exists?(File.join(path, 'gems', full_name))}
|
132
132
|
end
|
133
133
|
|
134
134
|
def expanded_gem_paths
|
@@ -16,7 +16,7 @@ module ExecutableHooks
|
|
16
16
|
attr_reader :options
|
17
17
|
|
18
18
|
def initialize(options)
|
19
|
-
@options = options ||
|
19
|
+
@options = options || RegenerateBinstubsCommand.default_install_options
|
20
20
|
end
|
21
21
|
|
22
22
|
def install
|
@@ -35,7 +35,7 @@ module ExecutableHooks
|
|
35
35
|
bindir = calculate_bindir(options)
|
36
36
|
destination = calculate_destination(bindir)
|
37
37
|
|
38
|
-
if File.exist?(wrapper_path) && !
|
38
|
+
if File.exist?(wrapper_path) && !same_file(wrapper_path, destination)
|
39
39
|
FileUtils.mkdir_p(bindir) unless File.exist?(bindir)
|
40
40
|
# exception based on Gem::Installer.generate_bin
|
41
41
|
raise Gem::FilePermissionError.new(bindir) unless File.writable?(bindir)
|
@@ -44,6 +44,12 @@ module ExecutableHooks
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
+
def same_file(file1, file2)
|
48
|
+
File.exist?(file1) && File.exist?(file2) &&
|
49
|
+
File.read(file1) == File.read(file2)
|
50
|
+
end
|
51
|
+
private :same_file
|
52
|
+
|
47
53
|
def uninstall
|
48
54
|
destination = calculate_destination(calculate_bindir(options))
|
49
55
|
FileUtils.rm_f(destination) if File.exist?(destination)
|
data/lib/rubygems_plugin.rb
CHANGED
@@ -13,7 +13,10 @@ if
|
|
13
13
|
|
14
14
|
# Set the custom_shebang if user did not set one
|
15
15
|
Gem.pre_install do |gem_installer|
|
16
|
-
|
16
|
+
options = if gem_installer.methods.map{|m|m.to_s}.include?('options')
|
17
|
+
gem_installer.options
|
18
|
+
end
|
19
|
+
ExecutableHooks::Wrapper.new(options).install
|
17
20
|
end
|
18
21
|
|
19
22
|
if Gem::Version.new(Gem::VERSION) < Gem::Version.new('2.0') then
|
@@ -0,0 +1,16 @@
|
|
1
|
+
gem install executable-hooks-$(awk -F'"' '/VERSION/{print $2}' < lib/executable-hooks/version.rb).gem --development
|
2
|
+
# match=/installed/
|
3
|
+
|
4
|
+
gem install haml -v "4.0.7" # match=/installed/
|
5
|
+
haml_bin=$(which haml )
|
6
|
+
head -n 1 $haml_bin # match=/ruby_executable_hooks/
|
7
|
+
|
8
|
+
## simulate truffleruby style binary with shell code mixed in
|
9
|
+
## \043 - is a # ... somehow it breaks tf
|
10
|
+
( head -n 1 $haml_bin; echo -e 'echo $HOME\n\043!ruby'; tail -n +2 $haml_bin ) > $haml_bin.new
|
11
|
+
mv $haml_bin.new $haml_bin
|
12
|
+
chmod +x $haml_bin
|
13
|
+
|
14
|
+
haml _4.0.7_ -v # match=/4.0.7/
|
15
|
+
|
16
|
+
gem uninstall -x haml -v 4.0.7 # match=/Successfully uninstalled/
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: executable-hooks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 13
|
5
|
+
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
8
|
+
- 6
|
9
9
|
- 1
|
10
|
-
|
11
|
-
version: 1.4.1.alpha
|
10
|
+
version: 1.6.1
|
12
11
|
platform: ruby
|
13
12
|
authors:
|
14
13
|
- Michal Papis
|
@@ -16,7 +15,7 @@ autorequire:
|
|
16
15
|
bindir: bin
|
17
16
|
cert_chain: []
|
18
17
|
|
19
|
-
date:
|
18
|
+
date: 2021-01-06 00:00:00 +01:00
|
20
19
|
default_executable:
|
21
20
|
dependencies:
|
22
21
|
- !ruby/object:Gem::Dependency
|
@@ -64,9 +63,10 @@ files:
|
|
64
63
|
- lib/rubygems_executable_plugin.rb
|
65
64
|
- lib/rubygems_plugin.rb
|
66
65
|
- test-tf-bundle/bundle_comment_test.sh
|
66
|
+
- test-tf-truffleruby/truffleruby_comment_test.sh
|
67
67
|
- test-tf/rubygems_comment_test.sh
|
68
68
|
has_rdoc: true
|
69
|
-
homepage: https://github.com/
|
69
|
+
homepage: https://github.com/rvm/executable-hooks
|
70
70
|
licenses:
|
71
71
|
- Apache 2.0
|
72
72
|
post_install_message: |
|
@@ -89,18 +89,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
89
89
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
90
|
none: false
|
91
91
|
requirements:
|
92
|
-
- - "
|
92
|
+
- - ">="
|
93
93
|
- !ruby/object:Gem::Version
|
94
|
-
hash:
|
94
|
+
hash: 3
|
95
95
|
segments:
|
96
|
-
-
|
97
|
-
|
98
|
-
- 1
|
99
|
-
version: 1.3.1
|
96
|
+
- 0
|
97
|
+
version: "0"
|
100
98
|
requirements: []
|
101
99
|
|
102
100
|
rubyforge_project:
|
103
|
-
rubygems_version: 1.
|
101
|
+
rubygems_version: 1.3.7
|
104
102
|
signing_key:
|
105
103
|
specification_version: 3
|
106
104
|
summary: Hook into rubygems executables allowing extra actions to be taken before executable is run.
|