gem-wrappers 0.0.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +5 -0
- data/Rakefile +9 -0
- data/gem-wrappers.gemspec +2 -2
- data/lib/gem-wrappers.rb +27 -0
- data/lib/gem-wrappers/command.rb +69 -0
- data/lib/gem-wrappers/environment.rb +55 -0
- data/lib/gem-wrappers/installer.rb +52 -0
- data/lib/gem-wrappers/specification.rb +17 -0
- data/lib/gem-wrappers/version.rb +3 -0
- data/lib/gem/wrappers/specification.rb +19 -0
- data/lib/rubygems_plugin.rb +18 -0
- data/test/gem-wrappers/command_test.rb +33 -0
- data/test/gem-wrappers/environment_test.rb +82 -0
- data/test/gem-wrappers/installer_test.rb +67 -0
- data/test/gem-wrappers/specification_and_version_test.rb +15 -0
- data/test/gem-wrappers_test.rb +42 -0
- data/test/test_helper.rb +17 -0
- metadata +39 -18
- data/lib/gem/wrappers/version.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 761e2571ef7fc92b5714b61cfcf5ac00c5a18b05
|
4
|
+
data.tar.gz: 981ecd6d3091a20ecd5ce0b50629ccd099c568e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 382b5be8ff702859ba69a9ee2da720c31f987ef35bcdd553a686231c7ff14749a34479d1faff251fb1f307c97152bc43c5a306ac3cab9e438a9b0efcdda97164
|
7
|
+
data.tar.gz: 36806d2e568a7f1423914e7eaed9bff66562020cf4b12b341c959aba8f731de799f55648c0184133698e0bee7576ae4936f01a36b2f3721f49e45a3ca0eea277
|
data/Gemfile
ADDED
data/Rakefile
ADDED
data/gem-wrappers.gemspec
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# -*- encoding: utf-8 -*-
|
3
3
|
|
4
|
-
require File.expand_path("../lib/gem
|
4
|
+
require File.expand_path("../lib/gem-wrappers/version.rb", __FILE__)
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "gem-wrappers"
|
8
|
-
s.version =
|
8
|
+
s.version = GemWrappers::VERSION
|
9
9
|
s.authors = ["Michal Papis"]
|
10
10
|
s.email = ["mpapis@gmail.com"]
|
11
11
|
s.homepage = "https://github.com/rvm/gem-wrappers"
|
data/lib/gem-wrappers.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'gem-wrappers/environment'
|
2
|
+
require 'gem-wrappers/installer'
|
3
|
+
|
4
|
+
module GemWrappers
|
5
|
+
|
6
|
+
def self.install(executables)
|
7
|
+
environment = GemWrappers::Environment.new
|
8
|
+
environment.ensure
|
9
|
+
wrappers = GemWrappers::Installer.new(environment.file)
|
10
|
+
wrappers.ensure
|
11
|
+
executables.each do |executable|
|
12
|
+
wrappers.install(executable)
|
13
|
+
end
|
14
|
+
%w{ruby gem}.each do |executable|
|
15
|
+
wrappers.install(executable)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.wrappers_path
|
20
|
+
GemWrappers::Installer.wrappers_path
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.environment_file
|
24
|
+
GemWrappers::Environment.file
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'rubygems/command_manager'
|
2
|
+
require 'rubygems/installer'
|
3
|
+
require 'rubygems/version'
|
4
|
+
require 'gem-wrappers'
|
5
|
+
|
6
|
+
class WrappersCommand < Gem::Command
|
7
|
+
def initialize
|
8
|
+
super 'regenerate_binstubs', 'Re run generation of environment wrappers for gems.'
|
9
|
+
end
|
10
|
+
|
11
|
+
def arguments # :nodoc:
|
12
|
+
"regenerate regenerate environment wrappers for current Gem.home"
|
13
|
+
end
|
14
|
+
|
15
|
+
def usage # :nodoc:
|
16
|
+
"#{program_name} [regenerate]"
|
17
|
+
end
|
18
|
+
|
19
|
+
def defaults_str # :nodoc:
|
20
|
+
""
|
21
|
+
end
|
22
|
+
|
23
|
+
def description # :nodoc:
|
24
|
+
<<-DOC
|
25
|
+
Show (default) or regenerate environment wrappers for current 'GEM_HOME'.
|
26
|
+
DOC
|
27
|
+
end
|
28
|
+
|
29
|
+
def execute
|
30
|
+
subcommand = get_one_optional_argument || ''
|
31
|
+
case subcommand
|
32
|
+
when ''
|
33
|
+
execute_show
|
34
|
+
when 'regenerate'
|
35
|
+
execute_regenerate
|
36
|
+
else
|
37
|
+
execute_unknown subcommand
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def execute_show
|
42
|
+
$stdout.puts description
|
43
|
+
$stdout.puts " Wrappers path: #{GemWrappers.wrappers_path}"
|
44
|
+
$stdout.puts "Environment file: #{GemWrappers.environment_file}"
|
45
|
+
end
|
46
|
+
|
47
|
+
def execute_unknown(subcommand)
|
48
|
+
$stderr.puts "Unknown wrapper subcommand: #{subcommand}"
|
49
|
+
$stdout.puts description
|
50
|
+
false
|
51
|
+
end
|
52
|
+
|
53
|
+
def execute_regenerate
|
54
|
+
gem_dir_specs = installed_gems.select { |spec|
|
55
|
+
File.exists?( File.join( Gem.dir, 'gems', spec.full_name ) )
|
56
|
+
}
|
57
|
+
executables = gem_dir_specs.map(&:executables).reject(&:nil?).inject(&:+).reject(&:nil?)
|
58
|
+
GemWrappers.install(executables)
|
59
|
+
end
|
60
|
+
|
61
|
+
private
|
62
|
+
def installed_gems
|
63
|
+
if Gem::VERSION > '1.8' then
|
64
|
+
Gem::Specification.to_a
|
65
|
+
else
|
66
|
+
Gem.source_index.map{|name,spec| spec}
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'erb'
|
2
|
+
|
3
|
+
module GemWrappers
|
4
|
+
class Environment
|
5
|
+
|
6
|
+
def self.file
|
7
|
+
path = Gem.configuration && Gem.configuration[:wrappers_environment_file]
|
8
|
+
if path.nil? || path == ""
|
9
|
+
path = File.join(Gem.dir, 'environment')
|
10
|
+
end
|
11
|
+
path
|
12
|
+
end
|
13
|
+
|
14
|
+
def file
|
15
|
+
@file ||= self.class.file
|
16
|
+
end
|
17
|
+
|
18
|
+
def path_take
|
19
|
+
return @path_take if @path_take
|
20
|
+
@path_take = Gem.configuration && Gem.configuration[:wrappers_path_take] || 1
|
21
|
+
@path_take += gem_path.size
|
22
|
+
end
|
23
|
+
|
24
|
+
def ensure
|
25
|
+
return if File.exist?(file)
|
26
|
+
FileUtils.mkdir_p(File.dirname(file)) unless File.exist?(File.dirname(file))
|
27
|
+
content = ERB.new(template).result(binding)
|
28
|
+
File.open(file, 'w') do |file|
|
29
|
+
file.write(content)
|
30
|
+
end
|
31
|
+
File.chmod(0644, file)
|
32
|
+
end
|
33
|
+
|
34
|
+
def template
|
35
|
+
@template ||= <<-TEMPLATE
|
36
|
+
export PATH="<%= path.join(":") %>:$PATH"
|
37
|
+
export GEM_PATH="<%= gem_path.join(":") %>"
|
38
|
+
export GEM_HOME="<%= gem_home %>"
|
39
|
+
TEMPLATE
|
40
|
+
end
|
41
|
+
|
42
|
+
def gem_path
|
43
|
+
@gem_path ||= Gem.path
|
44
|
+
end
|
45
|
+
|
46
|
+
def gem_home
|
47
|
+
@gem_home ||= Gem.dir
|
48
|
+
end
|
49
|
+
|
50
|
+
def path(base = ENV['PATH'])
|
51
|
+
@path ||= base.split(":").take(path_take)
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'erb'
|
2
|
+
|
3
|
+
module GemWrappers
|
4
|
+
class Installer
|
5
|
+
attr_reader :environment_file
|
6
|
+
|
7
|
+
def initialize(environment_file)
|
8
|
+
@environment_file = environment_file
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.wrappers_path
|
12
|
+
Gem.configuration && Gem.configuration[:wrappers_path] ||
|
13
|
+
File.join(Gem.dir, 'wrappers')
|
14
|
+
end
|
15
|
+
|
16
|
+
def wrappers_path
|
17
|
+
@wrappers_path ||= self.class.wrappers_path
|
18
|
+
end
|
19
|
+
|
20
|
+
def ensure
|
21
|
+
FileUtils.mkdir_p(wrappers_path) unless File.exist?(wrappers_path)
|
22
|
+
# exception based on Gem::Installer.generate_bin
|
23
|
+
raise Gem::FilePermissionError.new(wrappers_path) unless File.writable?(wrappers_path)
|
24
|
+
end
|
25
|
+
|
26
|
+
def install(executable)
|
27
|
+
content = ERB.new(template).result(binding)
|
28
|
+
file = File.join(wrappers_path, executable)
|
29
|
+
File.open(file, 'w') do |file|
|
30
|
+
file.write(content)
|
31
|
+
end
|
32
|
+
File.chmod(0755, file)
|
33
|
+
end
|
34
|
+
|
35
|
+
def template
|
36
|
+
@template ||= <<-TEMPLATE
|
37
|
+
#!/usr/bin/env bash
|
38
|
+
|
39
|
+
if
|
40
|
+
[[ -s "<%= environment_file %>" ]]
|
41
|
+
then
|
42
|
+
source "<%= environment_file %>"
|
43
|
+
exec <%= executable %> "$@"
|
44
|
+
else
|
45
|
+
echo "ERROR: Missing RVM environment file: '<%= environment_file %>'" >&2
|
46
|
+
exit 1
|
47
|
+
fi
|
48
|
+
TEMPLATE
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module GemWrappers
|
2
|
+
module Specification
|
3
|
+
def self.find
|
4
|
+
@gem_wrappers_spec ||=
|
5
|
+
if Gem::Specification.respond_to?(:find_by_name)
|
6
|
+
Gem::Specification.find_by_name("gem-wrappers")
|
7
|
+
else
|
8
|
+
Gem.source_index.find_name("gem-wrappers").last
|
9
|
+
end
|
10
|
+
rescue Gem::LoadError
|
11
|
+
nil
|
12
|
+
end
|
13
|
+
def self.version
|
14
|
+
find ? find.version.to_s : nil
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Gem
|
2
|
+
module Wrappers
|
3
|
+
module Specification
|
4
|
+
def self.find
|
5
|
+
@executable_hooks_spec ||=
|
6
|
+
if Gem::Specification.respond_to?(:find_by_name)
|
7
|
+
Gem::Specification.find_by_name("gem-wrappers")
|
8
|
+
else
|
9
|
+
Gem.source_index.find_name("gem-wrappers").last
|
10
|
+
end
|
11
|
+
rescue Gem::LoadError
|
12
|
+
nil
|
13
|
+
end
|
14
|
+
def self.version
|
15
|
+
find ? find.version.to_s : nil
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Simulate require_relative - it's required as the plugin can be called in wrong version or from bundler.
|
2
|
+
require File.expand_path('../gem-wrappers/specification.rb', __FILE__)
|
3
|
+
|
4
|
+
called_path, called_version = __FILE__.match(/^(.*\/gem-wrappers-([^\/]+)\/lib).*$/)[1..2]
|
5
|
+
|
6
|
+
# continue only if loaded and called versions all the same, and not shared gems disabled in bundler
|
7
|
+
if
|
8
|
+
( $:.include?(called_path) || GemWrappers::Specification.version == called_version ) and
|
9
|
+
( !defined?(Bundler) || ( defined?(Bundler) && Bundler::SharedHelpers.in_bundle? && !Bundler.settings[:disable_shared_gems]) )
|
10
|
+
|
11
|
+
require 'gem-wrappers'
|
12
|
+
require 'gem-wrappers/command'
|
13
|
+
|
14
|
+
Gem.post_install do |installer|
|
15
|
+
GemWrappers.install(installer.spec.executables)
|
16
|
+
end
|
17
|
+
Gem::CommandManager.instance.register_command :wrappers
|
18
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'tempfile'
|
3
|
+
require 'gem-wrappers/environment'
|
4
|
+
|
5
|
+
describe WrappersCommand do
|
6
|
+
subject do
|
7
|
+
WrappersCommand.new
|
8
|
+
end
|
9
|
+
|
10
|
+
before do
|
11
|
+
$stdout = StringIO.new
|
12
|
+
$stderr = StringIO.new
|
13
|
+
end
|
14
|
+
|
15
|
+
after do
|
16
|
+
$stdout = STDOUT
|
17
|
+
$stderr = STDERR
|
18
|
+
end
|
19
|
+
|
20
|
+
it "has some strings" do
|
21
|
+
subject.arguments.class.must_equal(String)
|
22
|
+
subject.usage.class.must_equal(String)
|
23
|
+
subject.defaults_str.class.must_equal(String)
|
24
|
+
subject.description.class.must_equal(String)
|
25
|
+
subject.program_name.class.must_equal(String)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "shows help on unknown command" do
|
29
|
+
subject.options[:args] = ['wrong']
|
30
|
+
subject.execute
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'tempfile'
|
3
|
+
require 'gem-wrappers/environment'
|
4
|
+
|
5
|
+
describe GemWrappers::Environment do
|
6
|
+
describe "configuration" do
|
7
|
+
it "uses default file" do
|
8
|
+
Gem.configuration[:wrappers_environment_file] = nil
|
9
|
+
GemWrappers::Environment.file.must_equal(File.join(Gem.dir, "environment"))
|
10
|
+
GemWrappers::Environment.new.file.must_equal(GemWrappers::Environment.file)
|
11
|
+
end
|
12
|
+
it "reads configured file" do
|
13
|
+
Gem.configuration[:wrappers_environment_file] = "/path/to/environment"
|
14
|
+
GemWrappers::Environment.file.must_equal("/path/to/environment")
|
15
|
+
GemWrappers::Environment.new.file.must_equal("/path/to/environment")
|
16
|
+
Gem.configuration[:wrappers_environment_file] = nil
|
17
|
+
end
|
18
|
+
it "uses default take" do
|
19
|
+
Gem.configuration[:wrappers_path_take] = nil
|
20
|
+
GemWrappers::Environment.new.path_take.must_equal(Gem.path.size + 1)
|
21
|
+
end
|
22
|
+
it "reads configured take" do
|
23
|
+
Gem.configuration[:wrappers_path_take] = 0
|
24
|
+
GemWrappers::Environment.new.path_take.must_equal(Gem.path.size)
|
25
|
+
Gem.configuration[:wrappers_path_take] = nil
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "instance" do
|
30
|
+
subject do
|
31
|
+
GemWrappers::Environment.new
|
32
|
+
end
|
33
|
+
|
34
|
+
before do
|
35
|
+
@test_file = Tempfile.new('environment-file')
|
36
|
+
end
|
37
|
+
|
38
|
+
after do
|
39
|
+
@test_file.close
|
40
|
+
@test_file.unlink
|
41
|
+
end
|
42
|
+
|
43
|
+
it "calculates path part 1" do
|
44
|
+
subject.instance_variable_set(:@path_take, 1)
|
45
|
+
subject.path("/one/bin:/two/bin:/three/bin:/four/bin").must_equal(["/one/bin"])
|
46
|
+
end
|
47
|
+
|
48
|
+
it "calculates path part 3" do
|
49
|
+
subject.instance_variable_set(:@path_take, 3)
|
50
|
+
subject.path("/one/bin:/two/bin:/three/bin:/four/bin").must_equal(["/one/bin", "/two/bin", "/three/bin"])
|
51
|
+
end
|
52
|
+
|
53
|
+
it "does not overwrite existing file" do
|
54
|
+
subject.instance_variable_set(:@file, @test_file.path)
|
55
|
+
File.open(subject.file, "w") do |file|
|
56
|
+
file.write("something")
|
57
|
+
end
|
58
|
+
subject.ensure
|
59
|
+
File.open(subject.file, "r") do |file|
|
60
|
+
file.read.must_equal("something")
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
it "creates environment file" do
|
65
|
+
subject.instance_variable_set(:@path, ["/one/bin", "/two/bin"])
|
66
|
+
subject.instance_variable_set(:@gem_path, ["/one", "/two"])
|
67
|
+
subject.instance_variable_set(:@gem_home, "/one")
|
68
|
+
subject.instance_variable_set(:@file, @test_file.path)
|
69
|
+
@test_file.close
|
70
|
+
@test_file.unlink
|
71
|
+
subject.ensure
|
72
|
+
File.open(subject.file, "r") do |file|
|
73
|
+
file.read.must_equal(<<-EXPECTED)
|
74
|
+
export PATH="/one/bin:/two/bin:$PATH"
|
75
|
+
export GEM_PATH="/one:/two"
|
76
|
+
export GEM_HOME="/one"
|
77
|
+
EXPECTED
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'tempfile'
|
3
|
+
require 'gem-wrappers/installer'
|
4
|
+
|
5
|
+
describe GemWrappers::Installer do
|
6
|
+
describe "configuration" do
|
7
|
+
it "uses default file" do
|
8
|
+
Gem.configuration[:wrappers_path] = nil
|
9
|
+
GemWrappers::Installer.wrappers_path.must_equal(File.join(Gem.dir, 'wrappers'))
|
10
|
+
GemWrappers::Installer.new(nil).wrappers_path.must_equal(GemWrappers::Installer.wrappers_path)
|
11
|
+
end
|
12
|
+
it "reads configured file" do
|
13
|
+
Gem.configuration[:wrappers_path] = "/path/to/wrappers"
|
14
|
+
GemWrappers::Installer.wrappers_path.must_equal("/path/to/wrappers")
|
15
|
+
GemWrappers::Installer.new(nil).wrappers_path.must_equal("/path/to/wrappers")
|
16
|
+
Gem.configuration[:wrappers_path] = nil
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "instance" do
|
21
|
+
subject do
|
22
|
+
GemWrappers::Installer.new('/path/to/environment')
|
23
|
+
end
|
24
|
+
|
25
|
+
before do
|
26
|
+
file = Tempfile.new('wrappers')
|
27
|
+
@test_path = file.path
|
28
|
+
file.close
|
29
|
+
file.unlink
|
30
|
+
end
|
31
|
+
|
32
|
+
after do
|
33
|
+
FileUtils.rm_rf(@test_path)
|
34
|
+
end
|
35
|
+
|
36
|
+
it "does create target dir" do
|
37
|
+
subject.instance_variable_set(:@wrappers_path, @test_path)
|
38
|
+
File.exist?(subject.wrappers_path).must_equal(false)
|
39
|
+
subject.ensure
|
40
|
+
File.exist?(subject.wrappers_path).must_equal(true)
|
41
|
+
end
|
42
|
+
|
43
|
+
it "creates wrapper" do
|
44
|
+
subject.instance_variable_set(:@wrappers_path, @test_path)
|
45
|
+
full_path = File.join(subject.wrappers_path, "rake")
|
46
|
+
File.exist?(full_path).must_equal(false)
|
47
|
+
subject.ensure
|
48
|
+
subject.install("rake")
|
49
|
+
File.open(full_path, "r") do |file|
|
50
|
+
file.read.must_equal(<<-EXPECTED)
|
51
|
+
#!/usr/bin/env bash
|
52
|
+
|
53
|
+
if
|
54
|
+
[[ -s "/path/to/environment" ]]
|
55
|
+
then
|
56
|
+
source "/path/to/environment"
|
57
|
+
exec rake "$@"
|
58
|
+
else
|
59
|
+
echo "ERROR: Missing RVM environment file: '/path/to/environment'" >&2
|
60
|
+
exit 1
|
61
|
+
fi
|
62
|
+
EXPECTED
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'gem-wrappers/specification'
|
3
|
+
require 'gem-wrappers/version'
|
4
|
+
|
5
|
+
describe GemWrappers::Specification do
|
6
|
+
|
7
|
+
it "finds specification" do
|
8
|
+
GemWrappers::Specification.find.name.must_equal("gem-wrappers")
|
9
|
+
end
|
10
|
+
|
11
|
+
it "gets specification version" do
|
12
|
+
GemWrappers::Specification.version.must_equal(GemWrappers::VERSION)
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'tempfile'
|
3
|
+
require 'gem-wrappers'
|
4
|
+
|
5
|
+
describe GemWrappers do
|
6
|
+
before do
|
7
|
+
file = Tempfile.new('gem_dir')
|
8
|
+
@test_path = file.path
|
9
|
+
file.close
|
10
|
+
file.unlink
|
11
|
+
end
|
12
|
+
|
13
|
+
after do
|
14
|
+
FileUtils.rm_rf(@test_path)
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "configuration" do
|
18
|
+
it "reads configured file" do
|
19
|
+
Gem.configuration[:wrappers_environment_file] = "/path/to/environment"
|
20
|
+
GemWrappers.environment_file.must_equal("/path/to/environment")
|
21
|
+
Gem.configuration[:wrappers_environment_file] = nil
|
22
|
+
end
|
23
|
+
it "reads configured file" do
|
24
|
+
Gem.configuration[:wrappers_path] = "/path/to/wrappers"
|
25
|
+
GemWrappers.wrappers_path.must_equal("/path/to/wrappers")
|
26
|
+
Gem.configuration[:wrappers_path] = nil
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
it "does create environment and wrapper" do
|
31
|
+
Gem.configuration[:wrappers_path] = File.join(@test_path, "wrappers")
|
32
|
+
Gem.configuration[:wrappers_environment_file] = File.join(@test_path, "environment")
|
33
|
+
Gem.configuration[:wrappers_path_take] = 0
|
34
|
+
GemWrappers.install(%w{rake test})
|
35
|
+
File.exist?(File.join(@test_path, "environment")).must_equal(true)
|
36
|
+
File.exist?(File.join(@test_path, "wrappers", "gem")).must_equal(true)
|
37
|
+
File.exist?(File.join(@test_path, "wrappers", "rake")).must_equal(true)
|
38
|
+
File.exist?(File.join(@test_path, "wrappers", "ruby")).must_equal(true)
|
39
|
+
File.exist?(File.join(@test_path, "wrappers", "test")).must_equal(true)
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require "coveralls"
|
2
|
+
require "simplecov"
|
3
|
+
|
4
|
+
SimpleCov.start do
|
5
|
+
formatter SimpleCov::Formatter::MultiFormatter[
|
6
|
+
SimpleCov::Formatter::HTMLFormatter,
|
7
|
+
Coveralls::SimpleCov::Formatter,
|
8
|
+
]
|
9
|
+
command_name "Unit Tests"
|
10
|
+
add_filter "/test/"
|
11
|
+
add_filter "/demo/"
|
12
|
+
end
|
13
|
+
|
14
|
+
Coveralls.noisy = true unless ENV['CI']
|
15
|
+
|
16
|
+
require 'minitest/autorun'
|
17
|
+
require 'minitest/unit'
|
metadata
CHANGED
@@ -1,83 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gem-wrappers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.7.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-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: minitest
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: simplecov
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: coveralls
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: redcarpet
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
description:
|
@@ -87,11 +87,26 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
-
- .gitignore
|
90
|
+
- ".gitignore"
|
91
|
+
- Gemfile
|
91
92
|
- LICENSE
|
92
93
|
- README.md
|
94
|
+
- Rakefile
|
93
95
|
- gem-wrappers.gemspec
|
94
|
-
- lib/gem
|
96
|
+
- lib/gem-wrappers.rb
|
97
|
+
- lib/gem-wrappers/command.rb
|
98
|
+
- lib/gem-wrappers/environment.rb
|
99
|
+
- lib/gem-wrappers/installer.rb
|
100
|
+
- lib/gem-wrappers/specification.rb
|
101
|
+
- lib/gem-wrappers/version.rb
|
102
|
+
- lib/gem/wrappers/specification.rb
|
103
|
+
- lib/rubygems_plugin.rb
|
104
|
+
- test/gem-wrappers/command_test.rb
|
105
|
+
- test/gem-wrappers/environment_test.rb
|
106
|
+
- test/gem-wrappers/installer_test.rb
|
107
|
+
- test/gem-wrappers/specification_and_version_test.rb
|
108
|
+
- test/gem-wrappers_test.rb
|
109
|
+
- test/test_helper.rb
|
95
110
|
homepage: https://github.com/rvm/gem-wrappers
|
96
111
|
licenses:
|
97
112
|
- Apache 2.0
|
@@ -102,18 +117,24 @@ require_paths:
|
|
102
117
|
- lib
|
103
118
|
required_ruby_version: !ruby/object:Gem::Requirement
|
104
119
|
requirements:
|
105
|
-
- -
|
120
|
+
- - ">="
|
106
121
|
- !ruby/object:Gem::Version
|
107
122
|
version: 2.0.0
|
108
123
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
124
|
requirements:
|
110
|
-
- -
|
125
|
+
- - ">="
|
111
126
|
- !ruby/object:Gem::Version
|
112
127
|
version: '0'
|
113
128
|
requirements: []
|
114
129
|
rubyforge_project:
|
115
|
-
rubygems_version: 2.
|
130
|
+
rubygems_version: 2.2.0
|
116
131
|
signing_key:
|
117
132
|
specification_version: 4
|
118
133
|
summary: Create gem wrappers for easy use of gems in cron and other system locations.
|
119
|
-
test_files:
|
134
|
+
test_files:
|
135
|
+
- test/gem-wrappers/command_test.rb
|
136
|
+
- test/gem-wrappers/environment_test.rb
|
137
|
+
- test/gem-wrappers/installer_test.rb
|
138
|
+
- test/gem-wrappers/specification_and_version_test.rb
|
139
|
+
- test/gem-wrappers_test.rb
|
140
|
+
- test/test_helper.rb
|