gem-wrappers 1.2.4 → 1.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 32a7eb10c3056fd0982337472e6dc5f685ff77ac
4
- data.tar.gz: 45c271782ad34456456b3413b0f8f4e49df5a7f7
5
- SHA512:
6
- metadata.gz: 0f015589131be12c9c28af5c7674e0b5cc517fb29572c1e419f71eb90d564d0ce3be858d9578bf3d3255cca3470587c5bb05f10a23ea4f4c19cc5865efa376ba
7
- data.tar.gz: c7bc82787556f79588c797f796ce4803691956152ec1afb04d8fc63c3793d6d4cd4dc087a61b592b03282dd16c7ee466b1d31bbb99920a2f8b4fb8c0ab5883c2
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ec806afe0a9a14e1b6dd1ad522a069cff3e18897
4
+ data.tar.gz: d18f6f664c999dc3893e90e228c3b28e4d304eb5
5
+ SHA512:
6
+ metadata.gz: 81136a70889356c2c5d35653205470d558730e5672f70a52a0cd79143337678a9110ad5421d9ea41f54b79a2557ee1d5647eb27c87b81e6f7bef39aae8f283a1
7
+ data.tar.gz: 2c067514b09f648929767c51058b5c8177a96894ea008e8db52c5f7f9479c8e5ca5eb782b35e2ab013e996f43c1bda396730fd71d0d2052d7ef0aabc17e497dc
data/Changelog.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.2.5
4
+ date: 2014-05-27
5
+
6
+ - allow generating formatted binary wrappers, fix #5
7
+
3
8
  ## 1.2.4
4
9
  date: 2014-01-03
5
10
 
@@ -5,8 +5,9 @@ module GemWrappers
5
5
  class Installer
6
6
  attr_reader :environment_file
7
7
 
8
- def initialize(environment_file = nil)
8
+ def initialize(environment_file = nil, executable_format = Gem.default_exec_format)
9
9
  @environment_file = environment_file
10
+ @executable_format = executable_format
10
11
  end
11
12
 
12
13
  def self.wrappers_path
@@ -33,6 +34,20 @@ module GemWrappers
33
34
  raise "Missing environment file for initialize!" unless @environment_file
34
35
  @executable = executable
35
36
  content = ERB.new(template).result(binding)
37
+ install_file(executable, content)
38
+ install_ty_formatted(executable, content)
39
+ end
40
+
41
+ def install_ty_formatted(executable, content)
42
+ formated_executble = @executable_format % executable
43
+ if
44
+ formated_executble != executable
45
+ then
46
+ install_file(formated_executble, content)
47
+ end
48
+ end
49
+
50
+ def install_file(executable, content)
36
51
  file_name = File.join(wrappers_path, File.basename(executable))
37
52
  File.open(file_name, 'w') do |file|
38
53
  file.write(content)
@@ -1,3 +1,3 @@
1
1
  module GemWrappers
2
- VERSION = "1.2.4"
2
+ VERSION = "1.2.5"
3
3
  end
@@ -2,6 +2,22 @@ require 'test_helper'
2
2
  require 'tempfile'
3
3
  require 'gem-wrappers/installer'
4
4
 
5
+ def format_content(script_path)
6
+ <<-EXPECTED
7
+ #!/usr/bin/env bash
8
+
9
+ if
10
+ [[ -s "/path/to/environment" ]]
11
+ then
12
+ source "/path/to/environment"
13
+ exec #{script_path} "$@"
14
+ else
15
+ echo "ERROR: Missing RVM environment file: '/path/to/environment'" >&2
16
+ exit 1
17
+ fi
18
+ EXPECTED
19
+ end
20
+
5
21
  describe GemWrappers::Installer do
6
22
  describe "configuration" do
7
23
  it "uses default file" do
@@ -57,22 +73,23 @@ describe GemWrappers::Installer do
57
73
  subject.ensure
58
74
  subject.install("rake")
59
75
  File.open(full_path, "r") do |file|
60
- file.read.must_equal(<<-EXPECTED)
61
- #!/usr/bin/env bash
76
+ file.read.must_equal(format_content('rake'))
77
+ end
78
+ end
62
79
 
63
- if
64
- [[ -s "/path/to/environment" ]]
65
- then
66
- source "/path/to/environment"
67
- exec rake "$@"
68
- else
69
- echo "ERROR: Missing RVM environment file: '/path/to/environment'" >&2
70
- exit 1
71
- fi
72
- EXPECTED
80
+ it "creates formated wrapper" do
81
+ subject.instance_variable_set(:@wrappers_path, @test_path)
82
+ subject.instance_variable_set(:@executable_format, 'j%s')
83
+ full_path = File.join(subject.wrappers_path, "jrake")
84
+ File.exist?(full_path).must_equal(false)
85
+ subject.ensure
86
+ subject.install("rake")
87
+ File.open(full_path, "r") do |file|
88
+ file.read.must_equal(format_content('rake'))
73
89
  end
74
90
  end
75
91
 
92
+
76
93
  it "creates shell script wrapper" do
77
94
  subject.instance_variable_set(:@wrappers_path, @test_path)
78
95
  script_path = File.join(subject.wrappers_path, "example", "test.sh")
@@ -85,19 +102,7 @@ EXPECTED
85
102
  subject.ensure
86
103
  subject.install(script_path)
87
104
  File.open(full_path, "r") do |file|
88
- file.read.must_equal(<<-EXPECTED)
89
- #!/usr/bin/env bash
90
-
91
- if
92
- [[ -s "/path/to/environment" ]]
93
- then
94
- source "/path/to/environment"
95
- exec #{script_path} "$@"
96
- else
97
- echo "ERROR: Missing RVM environment file: '/path/to/environment'" >&2
98
- exit 1
99
- fi
100
- EXPECTED
105
+ file.read.must_equal(format_content(script_path))
101
106
  end
102
107
  end
103
108
 
@@ -113,19 +118,7 @@ EXPECTED
113
118
  subject.ensure
114
119
  subject.install(script_path)
115
120
  File.open(full_path, "r") do |file|
116
- file.read.must_equal(<<-EXPECTED)
117
- #!/usr/bin/env bash
118
-
119
- if
120
- [[ -s "/path/to/environment" ]]
121
- then
122
- source "/path/to/environment"
123
- exec ruby #{script_path} "$@"
124
- else
125
- echo "ERROR: Missing RVM environment file: '/path/to/environment'" >&2
126
- exit 1
127
- fi
128
- EXPECTED
121
+ file.read.must_equal(format_content("ruby #{script_path}"))
129
122
  end
130
123
  File.executable?(full_path).must_equal(true)
131
124
  end
metadata CHANGED
@@ -1,45 +1,51 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: gem-wrappers
3
- version: !ruby/object:Gem::Version
4
- version: 1.2.4
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.2.5
5
5
  platform: ruby
6
- authors:
6
+ authors:
7
7
  - Michal Papis
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
-
12
- date: 2014-01-03 00:00:00 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
11
+ date: 2014-05-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
15
14
  name: rake
15
+ version_requirements: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ requirement: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - '>='
23
+ - !ruby/object:Gem::Version
24
+ version: '0'
16
25
  prerelease: false
17
- requirement: &id001 !ruby/object:Gem::Requirement
18
- requirements:
19
- - &id002
20
- - ">="
21
- - !ruby/object:Gem::Version
22
- version: "0"
23
26
  type: :development
24
- version_requirements: *id001
25
- - !ruby/object:Gem::Dependency
27
+ - !ruby/object:Gem::Dependency
26
28
  name: minitest
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ requirement: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
27
39
  prerelease: false
28
- requirement: &id003 !ruby/object:Gem::Requirement
29
- requirements:
30
- - *id002
31
40
  type: :development
32
- version_requirements: *id003
33
- description:
34
- email:
41
+ description:
42
+ email:
35
43
  - mpapis@gmail.com
36
44
  executables: []
37
-
38
- extensions:
45
+ extensions:
39
46
  - ext/wrapper_generator/extconf.rb
40
47
  extra_rdoc_files: []
41
-
42
- files:
48
+ files:
43
49
  - .gitignore
44
50
  - .travis.yml
45
51
  - Changelog.md
@@ -65,29 +71,30 @@ files:
65
71
  - test/gem-wrappers_test.rb
66
72
  - test/test_helper.rb
67
73
  homepage: https://github.com/rvm/gem-wrappers
68
- licenses:
74
+ licenses:
69
75
  - Apache 2.0
70
76
  metadata: {}
71
-
72
- post_install_message:
77
+ post_install_message:
73
78
  rdoc_options: []
74
-
75
- require_paths:
79
+ require_paths:
76
80
  - lib
77
- required_ruby_version: !ruby/object:Gem::Requirement
78
- requirements:
79
- - *id002
80
- required_rubygems_version: !ruby/object:Gem::Requirement
81
- requirements:
82
- - *id002
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
83
91
  requirements: []
84
-
85
- rubyforge_project:
86
- rubygems_version: 2.0.14
87
- signing_key:
92
+ rubyforge_project:
93
+ rubygems_version: 2.2.2
94
+ signing_key:
88
95
  specification_version: 4
89
96
  summary: Create gem wrappers for easy use of gems in cron and other system locations.
90
- test_files:
97
+ test_files:
91
98
  - test/gem-wrappers/command_test.rb
92
99
  - test/gem-wrappers/environment_test.rb
93
100
  - test/gem-wrappers/fakes.rb