gem-wrappers 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/wrapper_generator/extconf.rb +1 -0
- data/gem-wrappers.gemspec +0 -1
- data/lib/gem-wrappers.rb +2 -2
- data/lib/gem-wrappers/environment.rb +7 -7
- data/lib/gem-wrappers/installer.rb +3 -3
- data/lib/gem-wrappers/version.rb +1 -1
- data/test/gem-wrappers/environment_test.rb +9 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4b7a3de7a69888ea3ab65dbed724ca6ef070f27
|
4
|
+
data.tar.gz: 688894fb36fe28be24030fd006f62e658e43bd25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae428b831abdf7f0a45646bc619a0946137d870b76fd1f9b606f3b0e7cfcacc582264c5c61896e63359b990c900a14043710f754f72cd5d487c39195d9b62b09
|
7
|
+
data.tar.gz: 08f978347b9c1d34c38f91ce6d1e30320d4a480ffa39bf17a3c16fb269bb8f979e552eb72c669aa7a7738ce859adb649347bd37d7e59738bc7dd7bac73f0f2db
|
data/gem-wrappers.gemspec
CHANGED
@@ -14,7 +14,6 @@ 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
|
-
s.required_ruby_version = ">= 2.0.0"
|
18
17
|
%w{rake minitest simplecov coveralls redcarpet}.each do |name|
|
19
18
|
s.add_development_dependency(name)
|
20
19
|
end
|
data/lib/gem-wrappers.rb
CHANGED
@@ -6,7 +6,7 @@ module GemWrappers
|
|
6
6
|
def self.install(executables)
|
7
7
|
environment = GemWrappers::Environment.new
|
8
8
|
environment.ensure
|
9
|
-
wrappers = GemWrappers::Installer.new(environment.
|
9
|
+
wrappers = GemWrappers::Installer.new(environment.file_name)
|
10
10
|
wrappers.ensure
|
11
11
|
|
12
12
|
# gem executables
|
@@ -25,7 +25,7 @@ module GemWrappers
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def self.environment_file
|
28
|
-
GemWrappers::Environment.
|
28
|
+
GemWrappers::Environment.file_name
|
29
29
|
end
|
30
30
|
|
31
31
|
end
|
@@ -3,7 +3,7 @@ require 'erb'
|
|
3
3
|
module GemWrappers
|
4
4
|
class Environment
|
5
5
|
|
6
|
-
def self.
|
6
|
+
def self.file_name
|
7
7
|
path = Gem.configuration && Gem.configuration[:wrappers_environment_file]
|
8
8
|
if path.nil? || path == ""
|
9
9
|
path = File.join(Gem.dir, 'environment')
|
@@ -11,8 +11,8 @@ module GemWrappers
|
|
11
11
|
path
|
12
12
|
end
|
13
13
|
|
14
|
-
def
|
15
|
-
@
|
14
|
+
def file_name
|
15
|
+
@file_name ||= self.class.file_name
|
16
16
|
end
|
17
17
|
|
18
18
|
def path_take
|
@@ -22,13 +22,13 @@ module GemWrappers
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def ensure
|
25
|
-
return if File.exist?(
|
26
|
-
FileUtils.mkdir_p(File.dirname(
|
25
|
+
return if File.exist?(file_name)
|
26
|
+
FileUtils.mkdir_p(File.dirname(file_name)) unless File.exist?(File.dirname(file_name))
|
27
27
|
content = ERB.new(template).result(binding)
|
28
|
-
File.open(
|
28
|
+
File.open(file_name, 'w') do |file|
|
29
29
|
file.write(content)
|
30
30
|
end
|
31
|
-
File.chmod(0644,
|
31
|
+
File.chmod(0644, file_name)
|
32
32
|
end
|
33
33
|
|
34
34
|
def template
|
@@ -25,11 +25,11 @@ module GemWrappers
|
|
25
25
|
|
26
26
|
def install(executable)
|
27
27
|
content = ERB.new(template).result(binding)
|
28
|
-
|
29
|
-
File.open(
|
28
|
+
file_name = File.join(wrappers_path, executable)
|
29
|
+
File.open(file_name, 'w') do |file|
|
30
30
|
file.write(content)
|
31
31
|
end
|
32
|
-
File.chmod(0755,
|
32
|
+
File.chmod(0755, file_name)
|
33
33
|
end
|
34
34
|
|
35
35
|
def template
|
data/lib/gem-wrappers/version.rb
CHANGED
@@ -6,13 +6,13 @@ describe GemWrappers::Environment do
|
|
6
6
|
describe "configuration" do
|
7
7
|
it "uses default file" do
|
8
8
|
Gem.configuration[:wrappers_environment_file] = nil
|
9
|
-
GemWrappers::Environment.
|
10
|
-
GemWrappers::Environment.new.
|
9
|
+
GemWrappers::Environment.file_name.must_equal(File.join(Gem.dir, "environment"))
|
10
|
+
GemWrappers::Environment.new.file_name.must_equal(GemWrappers::Environment.file_name)
|
11
11
|
end
|
12
12
|
it "reads configured file" do
|
13
13
|
Gem.configuration[:wrappers_environment_file] = "/path/to/environment"
|
14
|
-
GemWrappers::Environment.
|
15
|
-
GemWrappers::Environment.new.
|
14
|
+
GemWrappers::Environment.file_name.must_equal("/path/to/environment")
|
15
|
+
GemWrappers::Environment.new.file_name.must_equal("/path/to/environment")
|
16
16
|
Gem.configuration[:wrappers_environment_file] = nil
|
17
17
|
end
|
18
18
|
it "uses default take" do
|
@@ -51,12 +51,12 @@ describe GemWrappers::Environment do
|
|
51
51
|
end
|
52
52
|
|
53
53
|
it "does not overwrite existing file" do
|
54
|
-
subject.instance_variable_set(:@
|
55
|
-
File.open(subject.
|
54
|
+
subject.instance_variable_set(:@file_name, @test_file.path)
|
55
|
+
File.open(subject.file_name, "w") do |file|
|
56
56
|
file.write("something")
|
57
57
|
end
|
58
58
|
subject.ensure
|
59
|
-
File.open(subject.
|
59
|
+
File.open(subject.file_name, "r") do |file|
|
60
60
|
file.read.must_equal("something")
|
61
61
|
end
|
62
62
|
end
|
@@ -65,11 +65,11 @@ describe GemWrappers::Environment do
|
|
65
65
|
subject.instance_variable_set(:@path, ["/one/bin", "/two/bin"])
|
66
66
|
subject.instance_variable_set(:@gem_path, ["/one", "/two"])
|
67
67
|
subject.instance_variable_set(:@gem_home, "/one")
|
68
|
-
subject.instance_variable_set(:@
|
68
|
+
subject.instance_variable_set(:@file_name, @test_file.path)
|
69
69
|
@test_file.close
|
70
70
|
@test_file.unlink
|
71
71
|
subject.ensure
|
72
|
-
File.open(subject.
|
72
|
+
File.open(subject.file_name, "r") do |file|
|
73
73
|
file.read.must_equal(<<-EXPECTED)
|
74
74
|
export PATH="/one/bin:/two/bin:$PATH"
|
75
75
|
export GEM_PATH="/one:/two"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gem-wrappers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michal Papis
|
@@ -121,7 +121,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
121
121
|
requirements:
|
122
122
|
- - '>='
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: '0'
|
125
125
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
126
126
|
requirements:
|
127
127
|
- - '>='
|