thermite 0.11.1 → 0.12.0
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.
- checksums.yaml +4 -4
- data/.rubocop.yml +7 -0
- data/NEWS.md +15 -0
- data/lib/thermite/cargo.rb +1 -3
- data/lib/thermite/config.rb +13 -4
- data/lib/thermite/tasks.rb +6 -6
- data/test/lib/thermite/cargo_test.rb +1 -1
- data/test/lib/thermite/config_test.rb +14 -0
- data/thermite.gemspec +1 -1
- 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: 45077a1b81efe633a758315d0b521b208d6467d7
|
4
|
+
data.tar.gz: f13423bc8bc0e57df51329dffed5e9dade52760b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1f52ff2ece0053428f4dc5ea9e7fe72c7608c634a58bd211a9b9669b8d32384d60cd09702aac57d0bba919a8ea2ef465c86459a8321a932f4949cc7bd17895a
|
7
|
+
data.tar.gz: 5d77f221ae5889c33e4bd72c980e1300343f805be6c760a3c65fe334c2da15a73a403847a5f58c2cbc1d6a3a1dc0cd39e5f169ec5a3d88714e917a764316b86b
|
data/.rubocop.yml
CHANGED
data/NEWS.md
CHANGED
@@ -2,6 +2,20 @@
|
|
2
2
|
|
3
3
|
## Unreleased
|
4
4
|
|
5
|
+
## [0.12.0] - 2017-04-05
|
6
|
+
|
7
|
+
### Added
|
8
|
+
|
9
|
+
* Support for CARGO_TARGET_DIR environment variable (#33)
|
10
|
+
|
11
|
+
### Fixed
|
12
|
+
|
13
|
+
* Cargo executable and arguments with paths using spaces are supported properly
|
14
|
+
|
15
|
+
### Changed
|
16
|
+
|
17
|
+
* CARGO_TARGET is now CARGO_PROFILE, for less confusion (#35)
|
18
|
+
|
5
19
|
## [0.11.1] - 2017-02-04
|
6
20
|
|
7
21
|
### Fixed
|
@@ -126,6 +140,7 @@
|
|
126
140
|
|
127
141
|
Initial release.
|
128
142
|
|
143
|
+
[0.12.0]: https://github.com/malept/thermite/compare/v0.11.1...v0.12.0
|
129
144
|
[0.11.1]: https://github.com/malept/thermite/compare/v0.11.0...v0.11.1
|
130
145
|
[0.11.0]: https://github.com/malept/thermite/compare/v0.10.0...v0.11.0
|
131
146
|
[0.10.0]: https://github.com/malept/thermite/compare/v0.9.0...v0.10.0
|
data/lib/thermite/cargo.rb
CHANGED
@@ -19,7 +19,6 @@
|
|
19
19
|
# OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
20
20
|
|
21
21
|
require 'mkmf'
|
22
|
-
require 'shellwords'
|
23
22
|
|
24
23
|
module Thermite
|
25
24
|
#
|
@@ -38,8 +37,7 @@ module Thermite
|
|
38
37
|
#
|
39
38
|
def run_cargo(*args)
|
40
39
|
Dir.chdir(config.rust_toplevel_dir) do
|
41
|
-
|
42
|
-
sh "#{cargo} #{shell_args}"
|
40
|
+
sh cargo, *args
|
43
41
|
end
|
44
42
|
end
|
45
43
|
|
data/lib/thermite/config.rb
CHANGED
@@ -30,7 +30,7 @@ module Thermite
|
|
30
30
|
#
|
31
31
|
# Creates a new configuration object.
|
32
32
|
#
|
33
|
-
# `options` is the same as the
|
33
|
+
# `options` is the same as the {Thermite::Tasks#initialize} parameter.
|
34
34
|
#
|
35
35
|
def initialize(options = {})
|
36
36
|
@options = options
|
@@ -135,7 +135,7 @@ module Thermite
|
|
135
135
|
end
|
136
136
|
|
137
137
|
#
|
138
|
-
# Generate a path relative to
|
138
|
+
# Generate a path relative to {#ruby_toplevel_dir}, given the `path_components` that are passed
|
139
139
|
# to `File.join`.
|
140
140
|
#
|
141
141
|
def ruby_path(*path_components)
|
@@ -161,13 +161,22 @@ module Thermite
|
|
161
161
|
end
|
162
162
|
|
163
163
|
#
|
164
|
-
# Generate a path relative to
|
164
|
+
# Generate a path relative to {#rust_toplevel_dir}, given the `path_components` that are
|
165
165
|
# passed to `File.join`.
|
166
166
|
#
|
167
167
|
def rust_path(*path_components)
|
168
168
|
File.join(rust_toplevel_dir, *path_components)
|
169
169
|
end
|
170
170
|
|
171
|
+
#
|
172
|
+
# Generate a path relative to the `CARGO_TARGET_DIR` environment variable, or
|
173
|
+
# {#rust_toplevel_dir} if that is not set.
|
174
|
+
#
|
175
|
+
def cargo_target_path(target, *path_components)
|
176
|
+
target_base = ENV.fetch('CARGO_TARGET_DIR', rust_toplevel_dir)
|
177
|
+
File.join(target_base, target, *path_components)
|
178
|
+
end
|
179
|
+
|
171
180
|
#
|
172
181
|
# If run in a multi-crate environment, the Cargo workspace member that contains the
|
173
182
|
# Ruby extension.
|
@@ -178,7 +187,7 @@ module Thermite
|
|
178
187
|
|
179
188
|
#
|
180
189
|
# The absolute path to the `Cargo.toml` file. The path depends on the existence of the
|
181
|
-
#
|
190
|
+
# {#cargo_workspace_member} configuration option.
|
182
191
|
#
|
183
192
|
def cargo_toml_path
|
184
193
|
@cargo_toml_path ||= begin
|
data/lib/thermite/tasks.rb
CHANGED
@@ -47,7 +47,7 @@ module Thermite
|
|
47
47
|
include Thermite::Util
|
48
48
|
|
49
49
|
#
|
50
|
-
# The configuration used for the Rake tasks.
|
50
|
+
# The configuration used for the Rake tasks. See: {Thermite::Config}
|
51
51
|
#
|
52
52
|
attr_reader :config
|
53
53
|
|
@@ -96,7 +96,7 @@ module Thermite
|
|
96
96
|
attr_reader :options
|
97
97
|
|
98
98
|
#
|
99
|
-
# Define the Thermite tasks with the given configuration parameters (see
|
99
|
+
# Define the Thermite tasks with the given configuration parameters (see {#options}).
|
100
100
|
#
|
101
101
|
# Example:
|
102
102
|
#
|
@@ -117,13 +117,13 @@ module Thermite
|
|
117
117
|
private
|
118
118
|
|
119
119
|
def define_build_task
|
120
|
-
desc 'Build or download the Rust shared library:
|
120
|
+
desc 'Build or download the Rust shared library: CARGO_PROFILE controls Cargo profile'
|
121
121
|
task 'thermite:build' do
|
122
122
|
# if cargo found, build. Otherwise, grab binary (when github_releases is enabled).
|
123
123
|
if cargo
|
124
|
-
|
125
|
-
run_cargo_rustc(
|
126
|
-
FileUtils.cp(config.
|
124
|
+
profile = ENV.fetch('CARGO_PROFILE', 'release')
|
125
|
+
run_cargo_rustc(profile)
|
126
|
+
FileUtils.cp(config.cargo_target_path(profile, config.shared_library),
|
127
127
|
config.ruby_path('lib'))
|
128
128
|
elsif !download_binary_from_custom_uri && !download_binary_from_github_release
|
129
129
|
inform_user_about_cargo
|
@@ -12,7 +12,7 @@ module Thermite
|
|
12
12
|
|
13
13
|
def test_run_cargo_if_exists
|
14
14
|
mock_module.stubs(:find_executable).returns('/opt/cargo-test/bin/cargo')
|
15
|
-
mock_module.expects(:sh).with('/opt/cargo-test/bin/cargo foo bar').once
|
15
|
+
mock_module.expects(:sh).with('/opt/cargo-test/bin/cargo', 'foo', 'bar').once
|
16
16
|
mock_module.run_cargo_if_exists('foo', 'bar')
|
17
17
|
end
|
18
18
|
|
@@ -109,6 +109,20 @@ module Thermite
|
|
109
109
|
assert_equal '/tmp/foobar/baz/quux', config.rust_path('baz', 'quux')
|
110
110
|
end
|
111
111
|
|
112
|
+
def test_cargo_target_path_with_env_var
|
113
|
+
FileUtils.stubs(:pwd).returns('/tmp/foobar')
|
114
|
+
ENV['CARGO_TARGET_DIR'] = 'foo'
|
115
|
+
assert_equal File.join('foo', 'debug', 'bar'), config.cargo_target_path('debug', 'bar')
|
116
|
+
ENV['CARGO_TARGET_DIR'] = nil
|
117
|
+
end
|
118
|
+
|
119
|
+
def test_cargo_target_path_without_env_var
|
120
|
+
FileUtils.stubs(:pwd).returns('/tmp/foobar')
|
121
|
+
ENV['CARGO_TARGET_DIR'] = nil
|
122
|
+
assert_equal File.join('/tmp/foobar', 'debug', 'bar'),
|
123
|
+
config.cargo_target_path('debug', 'bar')
|
124
|
+
end
|
125
|
+
|
112
126
|
def test_cargo_toml_path_with_workspace_member
|
113
127
|
FileUtils.stubs(:pwd).returns('/tmp/foobar')
|
114
128
|
config(cargo_workspace_member: 'baz')
|
data/thermite.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thermite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Lee
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|