thermite 0.8.0 → 0.9.0

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
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9902385f6d7c70426db6c25fabe306a29034e7fc
4
- data.tar.gz: 4618e00a6dfb06afef4ab73675b9f45bdf892b7b
3
+ metadata.gz: f5be6d2dadd7ecc7511529c5c02bc2a8b818b2c2
4
+ data.tar.gz: 93507f6f71a4135fb8a26d9188a59bfe7ae9e02f
5
5
  SHA512:
6
- metadata.gz: 68aa59bb0dc5129afc1cd63d56ccf6e10de7ea30199dddda075edcc2d3320563ab6a0dc73ef86862cbd49e02664e07cc90ce3060ffa115f635124a8c0eddb708
7
- data.tar.gz: 0391dce454f1da154121078fb9edf3ffbadecc11294e443a2dbcf09ec2a7a2056e366cf61ec6a54b6ed7e80ed323cd23236b9dfcbc55a0427d211a2270b0c9c2
6
+ metadata.gz: fd95587e1e64983ca41e37bf597ed87564a6f929f5fcd05d5972fd59348bc871995c02e6328c02bd619f7b7914020ea016b5987198e02dedca28598b5917caa0
7
+ data.tar.gz: 6480dbe2896f46ff2126cf650049e239caaf8171999390fa6f1480c57e21fc6e1e96a4f24b6fdbe687f5ba728aed3c7bf5c6ef0a85e9dcbe79368136ff1d6836
@@ -2,11 +2,14 @@ language: ruby
2
2
  os:
3
3
  - linux
4
4
  - osx
5
+ dist: trusty
6
+ sudo: false
5
7
  osx_image: xcode8
6
8
  rvm:
7
9
  - 2.1.10
8
10
  - 2.2.5
9
- - 2.3.1
11
+ - 2.3.3
12
+ - 2.4.0
10
13
  cache: bundler
11
14
  after_success:
12
15
  - bundle exec codeclimate-test-reporter
data/NEWS.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## [0.9.0] - 2017-01-18
6
+
7
+ ### Fixed
8
+
9
+ * The library name is consistent with how Cargo handles hyphens (#19)
10
+ * Raise error if using GitHub Releases & repository not in `Cargo.toml` (#18)
11
+
5
12
  ## [0.8.0] - 2016-12-05
6
13
 
7
14
  ### Added
@@ -95,6 +102,8 @@
95
102
 
96
103
  Initial release.
97
104
 
105
+ [0.9.0]: https://github.com/malept/thermite/compare/v0.8.0...v0.9.0
106
+ [0.8.0]: https://github.com/malept/thermite/compare/v0.7.0...v0.8.0
98
107
  [0.7.0]: https://github.com/malept/thermite/compare/v0.6.0...v0.7.0
99
108
  [0.6.0]: https://github.com/malept/thermite/compare/v0.5.0...v0.6.0
100
109
  [0.5.0]: https://github.com/malept/thermite/compare/v0.4.0...v0.5.0
@@ -99,13 +99,12 @@ module Thermite
99
99
  #
100
100
  # The name of the library compiled by Rust.
101
101
  #
102
+ # Due to the way that Cargo works, all hyphens in library names are replaced with underscores.
103
+ #
102
104
  def library_name
103
105
  @library_name ||= begin
104
- if toml[:lib] && toml[:lib][:name]
105
- toml[:lib][:name]
106
- else
107
- toml[:package][:name]
108
- end
106
+ base = toml[:lib] && toml[:lib][:name] ? toml[:lib] : toml[:package]
107
+ base[:name].tr('-', '_') if base[:name]
109
108
  end
110
109
  end
111
110
 
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  # frozen_string_literal: true
3
3
  #
4
- # Copyright (c) 2016 Mark Lee and contributors
4
+ # Copyright (c) 2016, 2017 Mark Lee and contributors
5
5
  #
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
7
7
  # associated documentation files (the "Software"), to deal in the Software without restriction,
@@ -83,7 +83,13 @@ module Thermite
83
83
  end
84
84
 
85
85
  def github_uri
86
- @github_uri ||= config.toml[:package][:repository]
86
+ @github_uri ||= begin
87
+ unless (repository = config.toml[:package][:repository])
88
+ raise KeyError, 'No repository found in Config.toml'
89
+ end
90
+
91
+ repository
92
+ end
87
93
  end
88
94
 
89
95
  def github_download_uri(tag, version)
@@ -41,6 +41,16 @@ module Thermite
41
41
  assert_equal 'barbaz', config.library_name
42
42
  end
43
43
 
44
+ def test_library_name_from_cargo_lib_has_no_hyphens
45
+ config.stubs(:toml).returns(lib: { name: 'foo-bar' }, package: { name: 'bar-baz' })
46
+ assert_equal 'foo_bar', config.library_name
47
+ end
48
+
49
+ def test_library_name_from_cargo_package_has_no_hyphens
50
+ config.stubs(:toml).returns(lib: {}, package: { name: 'bar-baz' })
51
+ assert_equal 'bar_baz', config.library_name
52
+ end
53
+
44
54
  def test_shared_library
45
55
  config.stubs(:library_name).returns('foobar')
46
56
  config.stubs(:shared_ext).returns('ext')
@@ -1,3 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # frozen_string_literal: true
3
+ #
4
+ # Copyright (c) 2016, 2017 Mark Lee and contributors
5
+ #
6
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
7
+ # associated documentation files (the "Software"), to deal in the Software without restriction,
8
+ # including without limitation the rights to use, copy, modify, merge, publish, distribute,
9
+ # sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all copies or
13
+ # substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
16
+ # NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18
+ # DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
19
+ # OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+
1
21
  require 'tmpdir'
2
22
  require 'test_helper'
3
23
  require 'thermite/github_release_binary'
@@ -51,9 +71,23 @@ module Thermite
51
71
  assert mock_module.download_binary_from_github_release
52
72
  end
53
73
 
54
- def test_download_cargo_version_from_github_release_with_client_error
74
+ def test_download_cargo_version_from_github_release_with_no_repository
55
75
  mock_module(github_releases: true)
56
76
  mock_module.config.stubs(:toml).returns(package: { version: '4.5.6' })
77
+
78
+ assert_raises KeyError do
79
+ mock_module.download_binary_from_github_release
80
+ end
81
+ end
82
+
83
+ def test_download_cargo_version_from_github_release_with_client_error
84
+ mock_module(github_releases: true)
85
+ mock_module.config.stubs(:toml).returns(
86
+ package: {
87
+ repository: 'test/test',
88
+ version: '4.5.6'
89
+ }
90
+ )
57
91
  Net::HTTP.stubs(:get_response).returns(Net::HTTPClientError.new('1.1', 403, 'Forbidden'))
58
92
 
59
93
  assert !mock_module.download_binary_from_github_release
@@ -61,7 +95,12 @@ module Thermite
61
95
 
62
96
  def test_download_cargo_version_from_github_release_with_server_error
63
97
  mock_module(github_releases: true)
64
- mock_module.config.stubs(:toml).returns(package: { version: '4.5.6' })
98
+ mock_module.config.stubs(:toml).returns(
99
+ package: {
100
+ repository: 'test/test',
101
+ version: '4.5.6'
102
+ }
103
+ )
65
104
  server_error = Net::HTTPServerError.new('1.1', 500, 'Internal Server Error')
66
105
  Net::HTTP.stubs(:get_response).returns(server_error)
67
106
 
@@ -3,7 +3,7 @@ require 'English'
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = 'thermite'
6
- s.version = '0.8.0'
6
+ s.version = '0.9.0'
7
7
  s.summary = 'Rake helpers for Rust+Ruby'
8
8
  s.description = 'A Rake-based helper for building and distributing Rust-based Ruby extensions'
9
9
 
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.8.0
4
+ version: 0.9.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: 2016-12-06 00:00:00.000000000 Z
11
+ date: 2017-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake