gem-wrappers 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +11 -0
- data/Gemfile +11 -0
- data/gem-wrappers.gemspec +2 -3
- data/lib/gem-wrappers.rb +13 -4
- data/lib/gem-wrappers/installer.rb +7 -1
- data/lib/gem-wrappers/version.rb +1 -1
- data/lib/rubygems_plugin.rb +5 -0
- data/test/gem-wrappers/command_test.rb +1 -1
- data/test/gem-wrappers/environment_test.rb +1 -1
- data/test/gem-wrappers/installer_test.rb +12 -0
- data/test/gem-wrappers_test.rb +10 -0
- data/test/test_helper.rb +16 -12
- metadata +2 -44
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd77331a83cc2f7bc061d5bec0bfa1b7fa525db4
|
4
|
+
data.tar.gz: c9b5fd6eec8cf8b5eaefe7aadf0eb79c32419093
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f98a163cb25c960acaa7165b6eb462f218c2b72a80c28de45cb778c3fa51069694b23c7c07820e5950bf537c72928af774acee7ea17fc1a357622bfb3278211
|
7
|
+
data.tar.gz: 3b9ecc914ebdb1406e2de70d14a1d933586f88c445e3fc4ad69388f599b0c884d928617896703237cd3eb0de8fc9a7ecb43cae8b6e869f3d644e196d0120ffb7
|
data/.travis.yml
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
+
- jruby
|
4
|
+
- ruby-head
|
5
|
+
- 1.8.7
|
6
|
+
- 1.9.2
|
7
|
+
- 1.9.3
|
3
8
|
- 2.0.0
|
9
|
+
- 2.1.0
|
10
|
+
- rbx
|
4
11
|
notifications:
|
5
12
|
irc:
|
6
13
|
channels:
|
@@ -9,3 +16,7 @@ notifications:
|
|
9
16
|
recipients:
|
10
17
|
- mpapis@gmail.com
|
11
18
|
on_failure: change
|
19
|
+
matrix:
|
20
|
+
allow_failures:
|
21
|
+
- rvm: rbx
|
22
|
+
fast_finish: true
|
data/Gemfile
CHANGED
@@ -3,3 +3,14 @@ source "https://rubygems.org"
|
|
3
3
|
#ruby=2.0.0
|
4
4
|
|
5
5
|
gemspec
|
6
|
+
|
7
|
+
group :development do
|
8
|
+
# statistics only on MRI 2.0 - avoid problems on older rubies
|
9
|
+
gem "redcarpet", :platforms => [:mri_20]
|
10
|
+
gem "simplecov", :platforms => [:mri_20]
|
11
|
+
gem "coveralls", :platforms => [:mri_20]
|
12
|
+
|
13
|
+
# rubinius support
|
14
|
+
gem "rubysl-mutex_m", :platforms => [:rbx]
|
15
|
+
gem "rubysl-singleton", :platforms => [:rbx]
|
16
|
+
end
|
data/gem-wrappers.gemspec
CHANGED
@@ -14,8 +14,7 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.extensions = %w( ext/wrapper_generator/extconf.rb )
|
15
15
|
s.files = `git ls-files`.split("\n")
|
16
16
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
-
|
18
|
-
|
19
|
-
end
|
17
|
+
s.add_development_dependency("rake")
|
18
|
+
s.add_development_dependency("minitest")
|
20
19
|
# s.add_development_dependency("smf-gem")
|
21
20
|
end
|
data/lib/gem-wrappers.rb
CHANGED
@@ -6,17 +6,26 @@ module GemWrappers
|
|
6
6
|
def self.install(executables)
|
7
7
|
environment = GemWrappers::Environment.new
|
8
8
|
environment.ensure
|
9
|
-
|
10
|
-
|
9
|
+
installer = GemWrappers::Installer.new(environment.file_name)
|
10
|
+
installer.ensure
|
11
11
|
|
12
12
|
# gem executables
|
13
13
|
executables.each do |executable|
|
14
|
-
|
14
|
+
installer.install(executable)
|
15
15
|
end
|
16
16
|
|
17
17
|
# ruby executables
|
18
18
|
%w{ruby gem erb irb}.each do |executable|
|
19
|
-
|
19
|
+
installer.install(executable)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.uninstall(executables)
|
24
|
+
installer = GemWrappers::Installer.new
|
25
|
+
|
26
|
+
# gem executables
|
27
|
+
executables.each do |executable|
|
28
|
+
installer.uninstall(executable)
|
20
29
|
end
|
21
30
|
end
|
22
31
|
|
@@ -4,7 +4,7 @@ module GemWrappers
|
|
4
4
|
class Installer
|
5
5
|
attr_reader :environment_file
|
6
6
|
|
7
|
-
def initialize(environment_file)
|
7
|
+
def initialize(environment_file = nil)
|
8
8
|
@environment_file = environment_file
|
9
9
|
end
|
10
10
|
|
@@ -23,7 +23,13 @@ module GemWrappers
|
|
23
23
|
raise Gem::FilePermissionError.new(wrappers_path) unless File.writable?(wrappers_path)
|
24
24
|
end
|
25
25
|
|
26
|
+
def uninstall(executable)
|
27
|
+
file_name = File.join(wrappers_path, executable)
|
28
|
+
File.delete(file_name) if File.exist?(file_name)
|
29
|
+
end
|
30
|
+
|
26
31
|
def install(executable)
|
32
|
+
raise "Missing environment file for initialize!" unless @environment_file
|
27
33
|
content = ERB.new(template).result(binding)
|
28
34
|
file_name = File.join(wrappers_path, executable)
|
29
35
|
File.open(file_name, 'w') do |file|
|
data/lib/gem-wrappers/version.rb
CHANGED
data/lib/rubygems_plugin.rb
CHANGED
@@ -14,5 +14,10 @@ if
|
|
14
14
|
Gem.post_install do |installer|
|
15
15
|
GemWrappers.install(installer.spec.executables)
|
16
16
|
end
|
17
|
+
|
18
|
+
Gem.post_uninstall do |installer|
|
19
|
+
GemWrappers.uninstall(installer.spec.executables)
|
20
|
+
end
|
21
|
+
|
17
22
|
Gem::CommandManager.instance.register_command :wrappers
|
18
23
|
end
|
@@ -63,5 +63,17 @@ EXPECTED
|
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
+
it "removes wrapper" do
|
67
|
+
subject.instance_variable_set(:@wrappers_path, @test_path)
|
68
|
+
full_path = File.join(subject.wrappers_path, "rake")
|
69
|
+
subject.ensure
|
70
|
+
File.open(full_path, "w") do |file|
|
71
|
+
file.puts "empty"
|
72
|
+
end
|
73
|
+
File.exist?(full_path).must_equal(true)
|
74
|
+
subject.uninstall("rake")
|
75
|
+
File.exist?(full_path).must_equal(false)
|
76
|
+
end
|
77
|
+
|
66
78
|
end
|
67
79
|
end
|
data/test/gem-wrappers_test.rb
CHANGED
@@ -40,4 +40,14 @@ describe GemWrappers do
|
|
40
40
|
File.exist?(File.join(@test_path, "wrappers", "other")).must_equal(false)
|
41
41
|
end
|
42
42
|
|
43
|
+
it "does remove wrapper" do
|
44
|
+
Gem.configuration[:wrappers_path] = File.join(@test_path, "wrappers")
|
45
|
+
Gem.configuration[:wrappers_environment_file] = File.join(@test_path, "environment")
|
46
|
+
Gem.configuration[:wrappers_path_take] = 0
|
47
|
+
GemWrappers.install(%w{rake})
|
48
|
+
File.exist?(File.join(@test_path, "wrappers", "rake")).must_equal(true)
|
49
|
+
GemWrappers.uninstall(%w{rake})
|
50
|
+
File.exist?(File.join(@test_path, "wrappers", "rake")).must_equal(false)
|
51
|
+
end
|
52
|
+
|
43
53
|
end
|
data/test/test_helper.rb
CHANGED
@@ -1,17 +1,21 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
if
|
2
|
+
RUBY_VERSION == "2.0.0" # check Gemfile
|
3
|
+
then
|
4
|
+
require "coveralls"
|
5
|
+
require "simplecov"
|
3
6
|
|
4
|
-
SimpleCov.start do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
end
|
7
|
+
SimpleCov.start do
|
8
|
+
formatter SimpleCov::Formatter::MultiFormatter[
|
9
|
+
SimpleCov::Formatter::HTMLFormatter,
|
10
|
+
Coveralls::SimpleCov::Formatter,
|
11
|
+
]
|
12
|
+
command_name "Unit Tests"
|
13
|
+
add_filter "/test/"
|
14
|
+
add_filter "/demo/"
|
15
|
+
end
|
13
16
|
|
14
|
-
Coveralls.noisy = true unless ENV['CI']
|
17
|
+
Coveralls.noisy = true unless ENV['CI']
|
18
|
+
end
|
15
19
|
|
16
20
|
require 'minitest/autorun'
|
17
21
|
require 'minitest/unit'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gem-wrappers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michal Papis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -38,48 +38,6 @@ dependencies:
|
|
38
38
|
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: simplecov
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - '>='
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - '>='
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: coveralls
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - '>='
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: redcarpet
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - '>='
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - '>='
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
41
|
description:
|
84
42
|
email:
|
85
43
|
- mpapis@gmail.com
|