executable-hooks 1.4.0.alpha0 → 1.4.0.rc1
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 +23 -20
- data/executable-hooks.gemspec +2 -3
- data/ext/wrapper_installer/extconf.rb +2 -1
- data/lib/executable-hooks/regenerate_binstubs_command.rb +23 -5
- data/lib/executable-hooks/specification.rb +1 -1
- data/lib/executable-hooks/uninstaller.rb +6 -2
- data/lib/executable-hooks/version.rb +1 -1
- data/lib/executable-hooks/wrapper.rb +8 -3
- data/lib/rubygems_plugin.rb +1 -1
- data/test-tf/rubygems_comment_test.sh +15 -0
- metadata +36 -11
- checksums.yaml +0 -7
data/.travis.yml
CHANGED
@@ -1,25 +1,19 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
-
|
4
|
-
- 1.9.2
|
5
|
-
- 1.9.3
|
6
|
-
- 2.0.0
|
7
|
-
- jruby-18mode
|
8
|
-
- jruby-19mode
|
3
|
+
- jruby
|
9
4
|
- jruby-head
|
10
|
-
-
|
11
|
-
- rbx-18mode
|
12
|
-
- rbx-19mode
|
5
|
+
- rbx-3
|
13
6
|
before_install:
|
7
|
+
- 'rvm @global do gem uninstall -a -x rubygems-bundler executable-hooks || true'
|
8
|
+
- 'rm -f $(rvm @global do gem env home)/bin/jruby_executable_hooks'
|
14
9
|
- 'rm -rf $rvm_path/gems/*/{bin,gems}/rubygems-bundler-* $rvm_path/gems/*/{bin,gems}/executable-hooks-* $rvm_path/gems/*/bin/ruby_*_{wrapper,hooks}'
|
15
10
|
- hash -r
|
16
|
-
- '
|
17
|
-
-
|
18
|
-
- '
|
19
|
-
install: gem install tf -v '>=0.4.1'
|
11
|
+
- 'if [[ -n "${WITH_RUBYGEMS:-}" ]] ; then gem update --system "${WITH_RUBYGEMS}" ; fi'
|
12
|
+
- gem build executable-hooks.gemspec
|
13
|
+
- gem install executable-hooks-$(awk -F'"' '/VERSION/{print $2}' < lib/executable-hooks/version.rb).gem --development
|
20
14
|
before_script:
|
21
15
|
- unset BUNDLE_GEMFILE
|
22
|
-
script: tf --text test
|
16
|
+
script: tf --text test-tf/*
|
23
17
|
notifications:
|
24
18
|
irc:
|
25
19
|
channels:
|
@@ -29,10 +23,19 @@ notifications:
|
|
29
23
|
- mpapis@gmail.com
|
30
24
|
on_failure: change
|
31
25
|
matrix:
|
32
|
-
|
33
|
-
|
34
|
-
- rvm:
|
35
|
-
|
36
|
-
- rvm:
|
37
|
-
- rvm:
|
26
|
+
fast_finish: true
|
27
|
+
include:
|
28
|
+
- rvm: 1.8.7
|
29
|
+
env: WITH_RUBYGEMS=1.6.2
|
30
|
+
- rvm: 1.8.7
|
31
|
+
- rvm: 1.9.2
|
32
|
+
- rvm: 1.9.3
|
33
|
+
- rvm: 2.0.0
|
34
|
+
- rvm: 2.1
|
35
|
+
- rvm: 2.2
|
36
|
+
- rvm: 2.3
|
37
|
+
- rvm: 2.4
|
38
|
+
- rvm: 2.5
|
38
39
|
- rvm: ruby-head
|
40
|
+
allow_failures:
|
41
|
+
- rvm: rbx-3
|
data/executable-hooks.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
|
|
15
15
|
}
|
16
16
|
s.post_install_message = <<-MESSAGE
|
17
17
|
# In case of problems run the following command to update binstubs:
|
18
|
-
gem regenerate_binstubs
|
18
|
+
gem regenerate_binstubs
|
19
19
|
MESSAGE
|
20
20
|
|
21
21
|
|
@@ -24,6 +24,5 @@ gem regenerate_binstubs
|
|
24
24
|
s.extensions = %w( ext/wrapper_installer/extconf.rb )
|
25
25
|
s.executables = %w( executable-hooks-uninstaller )
|
26
26
|
|
27
|
-
s.add_development_dependency "tf"
|
28
|
-
#s.add_development_dependency "smf-gem"
|
27
|
+
s.add_development_dependency "tf", "~>0.4"
|
29
28
|
end
|
@@ -15,7 +15,8 @@ $: << File.expand_path("../../../lib", __FILE__)
|
|
15
15
|
require 'executable-hooks/wrapper'
|
16
16
|
require 'executable-hooks/regenerate_binstubs_command'
|
17
17
|
# call the actions
|
18
|
-
|
18
|
+
options = RegenerateBinstubsCommand.default_install_options
|
19
|
+
ExecutableHooks::Wrapper.new(options).install_from(File.expand_path("../../..", __FILE__))
|
19
20
|
RegenerateBinstubsCommand.new.execute_no_wrapper
|
20
21
|
# unload the path, what was required stays ... but there is that much we can do
|
21
22
|
$:.pop
|
@@ -4,6 +4,23 @@ require 'rubygems/version'
|
|
4
4
|
require 'executable-hooks/wrapper'
|
5
5
|
|
6
6
|
class RegenerateBinstubsCommand < Gem::Command
|
7
|
+
def self.default_install_options
|
8
|
+
require 'rubygems/commands/install_command'
|
9
|
+
Gem::Command.extra_args = Gem.configuration[:gem]
|
10
|
+
config_args = Gem.configuration[:install]
|
11
|
+
config_args =
|
12
|
+
case config_args
|
13
|
+
when String
|
14
|
+
config_args.split ' '
|
15
|
+
else
|
16
|
+
Array(config_args)
|
17
|
+
end
|
18
|
+
Gem::Command.add_specific_extra_args 'install', config_args
|
19
|
+
ic = Gem::Commands::InstallCommand.new
|
20
|
+
ic.handle_options ["install"]
|
21
|
+
ic.options
|
22
|
+
end
|
23
|
+
|
7
24
|
def initialize
|
8
25
|
super 'regenerate_binstubs', 'Re run generation of executable wrappers for gems.'
|
9
26
|
|
@@ -45,17 +62,17 @@ class RegenerateBinstubsCommand < Gem::Command
|
|
45
62
|
# https://github.com/rubygems/rubygems/issues/326
|
46
63
|
puts "try also: gem pristine --binstubs"
|
47
64
|
end
|
48
|
-
ExecutableHooks::Wrapper.
|
65
|
+
ExecutableHooks::Wrapper.new(options).install
|
49
66
|
execute_no_wrapper
|
50
67
|
end
|
51
68
|
|
52
|
-
def execute_no_wrapper
|
69
|
+
def execute_no_wrapper(wrapper_name = ExecutableHooks::Wrapper.expanded_wrapper_name)
|
53
70
|
require 'executable-hooks/installer'
|
54
71
|
name = get_one_optional_argument || ''
|
55
72
|
specs = installed_gems.select{|spec| spec.name =~ /^#{name}/i }
|
56
73
|
specs.each do |spec|
|
57
74
|
unless spec.executables.empty?
|
58
|
-
try_to_fix_binstubs(spec) or
|
75
|
+
try_to_fix_binstubs(spec, wrapper_name) or
|
59
76
|
try_to_install_binstubs(spec) or
|
60
77
|
$stderr.puts "##{spec.name} #{spec.version} not found in GEM_PATH"
|
61
78
|
end
|
@@ -64,7 +81,7 @@ class RegenerateBinstubsCommand < Gem::Command
|
|
64
81
|
|
65
82
|
private
|
66
83
|
|
67
|
-
def try_to_fix_binstubs(spec)
|
84
|
+
def try_to_fix_binstubs(spec, wrapper_name)
|
68
85
|
executable_paths =
|
69
86
|
spec.executables.map do |executable|
|
70
87
|
path = expanded_bin_paths.detect{|bin_path| File.exist?(File.join(bin_path, executable)) }
|
@@ -79,7 +96,7 @@ class RegenerateBinstubsCommand < Gem::Command
|
|
79
96
|
puts "#{spec.name} #{spec.version}"
|
80
97
|
executable_mode = 0111
|
81
98
|
executable_shebangs.map do |path, lines|
|
82
|
-
lines[0] = "#!#{ExecutableHooksInstaller.env_path} #{
|
99
|
+
lines[0] = "#!#{ExecutableHooksInstaller.env_path} #{wrapper_name}"
|
83
100
|
File.open(path, "w") do |file|
|
84
101
|
file.puts(lines)
|
85
102
|
end
|
@@ -92,6 +109,7 @@ class RegenerateBinstubsCommand < Gem::Command
|
|
92
109
|
@expanded_bin_paths ||= begin
|
93
110
|
paths = expanded_gem_paths.map{|path| File.join(path, "bin") }
|
94
111
|
paths << RbConfig::CONFIG["bindir"]
|
112
|
+
# TODO: bindir from options?
|
95
113
|
paths
|
96
114
|
end
|
97
115
|
end
|
@@ -3,7 +3,7 @@ module ExecutableHooks
|
|
3
3
|
def self.find
|
4
4
|
@executable_hooks_spec ||=
|
5
5
|
if Gem::Specification.respond_to?(:find_by_name)
|
6
|
-
Gem::Specification.find_by_name("executable-hooks")
|
6
|
+
Gem::Specification.find_by_name("executable-hooks", ">=0", ">=0.alpha")
|
7
7
|
else
|
8
8
|
Gem.source_index.find_name("executable-hooks").last
|
9
9
|
end
|
@@ -1,10 +1,14 @@
|
|
1
1
|
require 'executable-hooks/wrapper'
|
2
2
|
require 'executable-hooks/regenerate_binstubs_command'
|
3
|
+
require 'rubygems/uninstaller'
|
3
4
|
|
4
5
|
module ExecutableHooks
|
5
6
|
def self.uninstall
|
6
7
|
Gem.configuration[:custom_shebang] = "$env #{Gem.default_exec_format % "ruby"}"
|
7
|
-
RegenerateBinstubsCommand.
|
8
|
-
|
8
|
+
options = RegenerateBinstubsCommand.default_install_options
|
9
|
+
RegenerateBinstubsCommand.new.execute_no_wrapper("ruby")
|
10
|
+
ExecutableHooks::Wrapper.new(options).uninstall
|
11
|
+
options.merge!(:executables => true, :all => true, :ignore => true)
|
12
|
+
Gem::Uninstaller.new("executable-hooks", options).uninstall
|
9
13
|
end
|
10
14
|
end
|
@@ -13,8 +13,10 @@ module ExecutableHooks
|
|
13
13
|
Gem.default_exec_format % self.wrapper_name
|
14
14
|
end
|
15
15
|
|
16
|
-
|
16
|
+
attr_reader :options
|
17
17
|
|
18
|
+
def initialize(options)
|
19
|
+
@options = options
|
18
20
|
end
|
19
21
|
|
20
22
|
def install
|
@@ -29,7 +31,9 @@ module ExecutableHooks
|
|
29
31
|
end
|
30
32
|
|
31
33
|
def install_from(full_gem_path)
|
32
|
-
wrapper_path = File.expand_path( "bin/#{wrapper_name}", full_gem_path )
|
34
|
+
wrapper_path = File.expand_path( "bin/#{self.class.wrapper_name}", full_gem_path )
|
35
|
+
bindir = calculate_bindir(options)
|
36
|
+
destination = calculate_destination(bindir)
|
33
37
|
|
34
38
|
if File.exist?(wrapper_path) && !File.exist?(destination)
|
35
39
|
FileUtils.mkdir_p(bindir) unless File.exist?(bindir)
|
@@ -41,6 +45,7 @@ module ExecutableHooks
|
|
41
45
|
end
|
42
46
|
|
43
47
|
def uninstall
|
48
|
+
destination = calculate_destination(calculate_bindir(options))
|
44
49
|
FileUtils.rm_f(destination) if File.exist?(destination)
|
45
50
|
end
|
46
51
|
|
@@ -50,7 +55,7 @@ module ExecutableHooks
|
|
50
55
|
end
|
51
56
|
|
52
57
|
def calculate_destination(bindir)
|
53
|
-
File.expand_path(
|
58
|
+
File.expand_path(self.class.expanded_wrapper_name, bindir)
|
54
59
|
end
|
55
60
|
|
56
61
|
|
data/lib/rubygems_plugin.rb
CHANGED
@@ -13,7 +13,7 @@ if
|
|
13
13
|
|
14
14
|
# Set the custom_shebang if user did not set one
|
15
15
|
Gem.pre_install do |gem_installer|
|
16
|
-
ExecutableHooks::Wrapper.
|
16
|
+
ExecutableHooks::Wrapper.new(gem_installer.options).install
|
17
17
|
end
|
18
18
|
|
19
19
|
if Gem::Version.new(Gem::VERSION) < Gem::Version.new('2.0') then
|
@@ -0,0 +1,15 @@
|
|
1
|
+
gem install executable-hooks-$(awk -F'"' '/VERSION/{print $2}' < lib/executable-hooks/version.rb).gem --development
|
2
|
+
# match=/installed/
|
3
|
+
wrapper_name=$(ruby -I ./lib/ -r executable-hooks/wrapper -e "puts ExecutableHooks::Wrapper.expanded_wrapper_name")
|
4
|
+
|
5
|
+
gem install haml -v "<5" # match=/installed/
|
6
|
+
head -n 1 $(which haml ) # match=/ruby_executable_hooks/
|
7
|
+
which ${wrapper_name} # status=0
|
8
|
+
|
9
|
+
gem list # match=/haml/
|
10
|
+
executable-hooks-uninstaller # match=/haml/
|
11
|
+
|
12
|
+
head -n 1 $(which haml) # match!=/ruby_executable_hooks/
|
13
|
+
which ${wrapper_name} # status=1
|
14
|
+
|
15
|
+
gem uninstall -x haml # match=/Successfully uninstalled/
|
metadata
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: executable-hooks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: -3026611996
|
5
|
+
prerelease: 6
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 4
|
9
|
+
- 0
|
10
|
+
- rc
|
11
|
+
- 1
|
12
|
+
version: 1.4.0.rc1
|
5
13
|
platform: ruby
|
6
14
|
authors:
|
7
15
|
- Michal Papis
|
@@ -9,17 +17,22 @@ autorequire:
|
|
9
17
|
bindir: bin
|
10
18
|
cert_chain: []
|
11
19
|
|
12
|
-
date: 2018-01-
|
20
|
+
date: 2018-01-28 00:00:00 +01:00
|
21
|
+
default_executable:
|
13
22
|
dependencies:
|
14
23
|
- !ruby/object:Gem::Dependency
|
15
24
|
name: tf
|
16
25
|
prerelease: false
|
17
26
|
requirement: &id001 !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
18
28
|
requirements:
|
19
|
-
-
|
20
|
-
- ">="
|
29
|
+
- - ~>
|
21
30
|
- !ruby/object:Gem::Version
|
22
|
-
|
31
|
+
hash: 3
|
32
|
+
segments:
|
33
|
+
- 0
|
34
|
+
- 4
|
35
|
+
version: "0.4"
|
23
36
|
type: :development
|
24
37
|
version_requirements: *id001
|
25
38
|
description:
|
@@ -51,33 +64,45 @@ files:
|
|
51
64
|
- lib/executable-hooks/wrapper.rb
|
52
65
|
- lib/rubygems_executable_plugin.rb
|
53
66
|
- lib/rubygems_plugin.rb
|
67
|
+
- test-tf/rubygems_comment_test.sh
|
68
|
+
has_rdoc: true
|
54
69
|
homepage: https://github.com/mpapis/executable-hooks
|
55
70
|
licenses:
|
56
71
|
- Apache 2.0
|
57
|
-
metadata: {}
|
58
|
-
|
59
72
|
post_install_message: |
|
60
73
|
# In case of problems run the following command to update binstubs:
|
61
|
-
|
74
|
+
gem regenerate_binstubs
|
62
75
|
|
63
76
|
rdoc_options: []
|
64
77
|
|
65
78
|
require_paths:
|
66
79
|
- lib
|
67
80
|
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
68
82
|
requirements:
|
69
|
-
-
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
hash: 3
|
86
|
+
segments:
|
87
|
+
- 0
|
88
|
+
version: "0"
|
70
89
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
71
91
|
requirements:
|
72
92
|
- - ">"
|
73
93
|
- !ruby/object:Gem::Version
|
94
|
+
hash: 25
|
95
|
+
segments:
|
96
|
+
- 1
|
97
|
+
- 3
|
98
|
+
- 1
|
74
99
|
version: 1.3.1
|
75
100
|
requirements: []
|
76
101
|
|
77
102
|
rubyforge_project:
|
78
|
-
rubygems_version:
|
103
|
+
rubygems_version: 1.6.2
|
79
104
|
signing_key:
|
80
|
-
specification_version:
|
105
|
+
specification_version: 3
|
81
106
|
summary: Hook into rubygems executables allowing extra actions to be taken before executable is run.
|
82
107
|
test_files: []
|
83
108
|
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: a3043d0088ce1f3b75f8d6b586c9a63a1bdc9d91
|
4
|
-
data.tar.gz: 37aad6f0e9cf450aba70d6ccd31742b11e919365
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: b61715a1115ac1499bbf060d026085f87d796472b736c6fb9bfeeea84a7fd32119d653a01ec94aa5b4ce02d876d4dce43e7b4b1084763b570e292e0f8aca433c
|
7
|
-
data.tar.gz: 82cd911d40f9b4a6abc76ef6df4740f40b628c2143e2e7e3b39cb1c423d4c87c77b698eafc30fc89d19592c0ce6035e52bccacf33b5c43cfc0f641bb475f8a93
|