thermite 0.3.0 → 0.4.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: f7e1fdf35d72e4e54a4fb1f473bc907cac1369b3
4
- data.tar.gz: 587855f223d66731edfcc00ef37c9cf9ef1619a1
3
+ metadata.gz: 1fdbea9d416375c6831c8dc80d9966cb6cf20eea
4
+ data.tar.gz: a2029b606d18db0b23dc9a3c34f894af351d3d75
5
5
  SHA512:
6
- metadata.gz: 7360723b5236c7142c5875ef9c695c67eea913bcaa3e532d035fbcdbca634e47ecc5e56807a6c608847c521c9866e94e5fbc4bb4bdccd75174d2974ecd5d0059
7
- data.tar.gz: f8189cb6cbee4bd8e7cf523a5327d74a824f7444fdd1c968170617326d7fbc8f0f121249b85712840f21edfa73bb30248d738522e713101b175328f5f356bdd3
6
+ metadata.gz: e3a6cd74b197901582b2e04ef4a99eabea6b9a636712fcaee488c402f7f6e46a6f89043af8ab9d54e2c75b112686750d347af2688a606079848df2d31dee5b06
7
+ data.tar.gz: ec981b8bc75da63d8deedf273d2c4df8bc18c69dc027ef681eb478ee75c8982185168976ef97c97f3fdb72279be4a93ea9c0f2457c8ec5f780e56db2fe3933e8
data/.travis.yml CHANGED
@@ -4,3 +4,10 @@ rvm:
4
4
  - 2.2.5
5
5
  - 2.3.1
6
6
  cache: bundler
7
+ after_success: ci/after_success.py
8
+ env:
9
+ global:
10
+ # TRAVIS_TOKEN
11
+ - secure: Ia4faKtCVBGN6z5jFrnBsCJX/Hg3Hs+pGll+lczDE+UFM0Io7LT/upQdre5JUftM0IiynwCw/XS4dz6h/ZZWS28pSFm12NvHHmO22NAaX/xQjKvBhWz8OblnNjybPNSdt0bBa4XnssW7SiPSH5moO3PEnRfbaVrAppHWw+VL0449RnFwu33J9663Gvsf48cE9f3ZeX/NUowqe9Gr3Y1edKsE5btK2vgW+VrwCCbf3PIF60SveClcivB823IrjHsBN76n8C6/Hx6zngZXYN8GfBN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qtNl4Ly/8/kRn0DjyPVauQ1o=
data/NEWS.md CHANGED
@@ -2,6 +2,23 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## [0.4.0] - 2016-07-12
6
+
7
+ ### Added
8
+
9
+ * Write debug output to file, if the `THERMITE_DEBUG_FILENAME` environment variable is set
10
+
11
+ ### Changed
12
+
13
+ * Relaxed rake version requirement
14
+ * Ruby version (major + minor) is considered when generating tarball names
15
+
16
+ ### Fixed
17
+
18
+ * The library path in the generated tarballs is relative
19
+
20
+ ## [0.3.0] - 2016-07-03
21
+
5
22
  ### Added
6
23
 
7
24
  * `github_release_type`, to add `'cargo'` releases via `Cargo.toml` (default) in addition to the
@@ -32,5 +49,7 @@
32
49
 
33
50
  Initial release.
34
51
 
52
+ [0.4.0]: https://github.com/malept/thermite/compare/v0.3.0...v0.4.0
53
+ [0.3.0]: https://github.com/malept/thermite/compare/v0.2.0...v0.3.0
35
54
  [0.2.0]: https://github.com/malept/thermite/compare/v0.1.0...v0.2.0
36
55
  [0.1.0]: https://github.com/malept/thermite/releases/tag/v0.1.0
data/README.md CHANGED
@@ -67,6 +67,11 @@ repository contains an example of using Thermite with [ruru](https://github.com/
67
67
  to provide a `String.blank?` speedup extension. While the example uses ruru, this gem should be
68
68
  usable with any method of integrating Rust and Ruby that you choose.
69
69
 
70
+ ### Troubleshooting
71
+
72
+ Debug statements can be written to a file specified by the `THERMITE_DEBUG_FILENAME` environment
73
+ variable.
74
+
70
75
  ## FAQ
71
76
 
72
77
  ### Why is it named Thermite?
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env python
2
+
3
+ from __future__ import print_function
4
+
5
+ import httplib
6
+ import json
7
+ import os
8
+
9
+ JSON = 'application/json'
10
+
11
+ def trigger_appveyor_build():
12
+ payload = {
13
+ 'accountName': 'malept',
14
+ 'projectSlug': 'rusty-blank',
15
+ 'branch': 'master',
16
+ }
17
+
18
+ headers = {
19
+ 'Accept': JSON,
20
+ 'Authorization': 'Bearer {}'.format(os.environ['APPVEYOR_TOKEN']),
21
+ 'Content-Type': JSON,
22
+ }
23
+
24
+ http = httplib.HTTPSConnection('ci.appveyor.com')
25
+ http.request('POST', '/api/builds', json.dumps(payload), headers)
26
+ print(http.getresponse().read())
27
+
28
+ def trigger_travis_build():
29
+ msg = "Triggered by {}@{} ({})".format(os.environ['TRAVIS_REPO_SLUG'],
30
+ os.environ['TRAVIS_BRANCH'],
31
+ os.environ['TRAVIS_COMMIT'])
32
+ payload = {
33
+ "request": {
34
+ "branch": "master",
35
+ "message": msg,
36
+ }
37
+ }
38
+
39
+ headers = {
40
+ 'Accept': JSON,
41
+ 'Authorization': 'token {}'.format(os.environ['TRAVIS_TOKEN']),
42
+ 'Content-Type': JSON,
43
+ 'Travis-Api-Version': '3',
44
+ }
45
+
46
+ http = httplib.HTTPSConnection('api.travis-ci.org')
47
+ http.request('POST', '/repo/malept%2Frusty_blank/requests', json.dumps(payload), headers)
48
+ print(http.getresponse().read())
49
+
50
+ if __name__ == '__main__':
51
+ if os.environ['TRAVIS_RUBY_VERSION'].startswith('2.3.'):
52
+ trigger_appveyor_build()
53
+ trigger_travis_build()
@@ -36,6 +36,13 @@ module Thermite
36
36
  @options = options
37
37
  end
38
38
 
39
+ #
40
+ # Location to emit debug output, if not `nil`. Defaults to `nil`.
41
+ #
42
+ def debug_filename
43
+ @debug_filename ||= ENV['THERMITE_DEBUG_FILENAME']
44
+ end
45
+
39
46
  #
40
47
  # The file extension of the compiled shared Rust library.
41
48
  #
@@ -52,10 +59,13 @@ module Thermite
52
59
  end
53
60
 
54
61
  #
55
- # Alias for `RbConfig::CONFIG['target_os']`.
62
+ # The major and minor version of the Ruby interpreter that's currently running.
56
63
  #
57
- def target_os
58
- @target_os ||= RbConfig::CONFIG['target_os']
64
+ def ruby_version
65
+ @ruby_version ||= begin
66
+ version_info = RbConfig::CONFIG['ruby_version'].split('.')
67
+ "ruby#{version_info[0]}#{version_info[1]}"
68
+ end
59
69
  end
60
70
 
61
71
  #
@@ -65,6 +75,13 @@ module Thermite
65
75
  @target_arch ||= RbConfig::CONFIG['target_cpu']
66
76
  end
67
77
 
78
+ #
79
+ # Alias for `RbConfig::CONFIG['target_os']`.
80
+ #
81
+ def target_os
82
+ @target_os ||= RbConfig::CONFIG['target_os']
83
+ end
84
+
68
85
  #
69
86
  # The name of the library compiled by Rust.
70
87
  #
@@ -94,7 +111,7 @@ module Thermite
94
111
  # package `version`.
95
112
  #
96
113
  def tarball_filename(version)
97
- "#{library_name}-#{version}-#{target_os}-#{target_arch}.tar.gz"
114
+ "#{library_name}-#{version}-#{ruby_version}-#{target_os}-#{target_arch}.tar.gz"
98
115
  end
99
116
 
100
117
  #
@@ -58,7 +58,9 @@ module Thermite
58
58
  def download_cargo_version_from_github_release
59
59
  version = config.toml[:package][:version]
60
60
  tag = options.fetch(:git_tag_format, 'v%s') % version
61
- if (tgz = download_binary_from_github_release(github_download_uri(tag, version), version))
61
+ uri = github_download_uri(tag, version)
62
+ if (tgz = download_binary_from_github_release(uri, version))
63
+ debug "Unpacking GitHub release from Cargo version: #{File.basename(uri)}"
62
64
  unpack_tarball(tgz)
63
65
  true
64
66
  end
@@ -73,6 +75,7 @@ module Thermite
73
75
  each_github_release(github_uri) do |version, download_uri|
74
76
  tgz = download_binary_from_github_release(download_uri, version)
75
77
  next unless tgz
78
+ debug "Unpacking GitHub release: #{File.basename(download_uri)}"
76
79
  unpack_tarball(tgz)
77
80
  installed_binary = true
78
81
  break
@@ -123,6 +126,7 @@ module Thermite
123
126
  tar.each do |entry|
124
127
  path = entry.header.name
125
128
  next if path.end_with?('/')
129
+ debug "Unpacking file: #{path}"
126
130
  File.open(path, 'wb') do |f|
127
131
  f.write(entry.read)
128
132
  end
@@ -32,7 +32,10 @@ module Thermite
32
32
  def build_package
33
33
  filename = config.tarball_filename(config.toml[:package][:version])
34
34
  tgz = Zlib::GzipWriter.new(File.open(filename, 'wb'))
35
- Archive::Tar::Minitar.pack(config.ruby_extension_path, tgz)
35
+ relative_library_path = config.ruby_extension_path.sub("#{config.ruby_toplevel_dir}/", '')
36
+ Dir.chdir(config.ruby_toplevel_dir) do
37
+ Archive::Tar::Minitar.pack(relative_library_path, tgz)
38
+ end
36
39
  end
37
40
  end
38
41
  end
@@ -24,6 +24,7 @@ require 'thermite/cargo'
24
24
  require 'thermite/config'
25
25
  require 'thermite/github_release_binary'
26
26
  require 'thermite/package'
27
+ require 'thermite/util'
27
28
 
28
29
  #
29
30
  # Helpers for Rust-based Ruby extensions.
@@ -41,6 +42,7 @@ module Thermite
41
42
  include Thermite::Cargo
42
43
  include Thermite::GithubReleaseBinary
43
44
  include Thermite::Package
45
+ include Thermite::Util
44
46
 
45
47
  #
46
48
  # The configuration used for the Rake tasks.
@@ -0,0 +1,34 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # frozen_string_literal: true
3
+ #
4
+ # Copyright (c) 2016 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
+
21
+ module Thermite
22
+ #
23
+ # Utility methods
24
+ #
25
+ module Util
26
+ def debug(msg)
27
+ # Should probably replace with a Logger
28
+ if config.debug_filename
29
+ @debug ||= File.open(config.debug_filename, 'w')
30
+ @debug.write("#{msg}\n")
31
+ end
32
+ end
33
+ end
34
+ end
data/thermite.gemspec CHANGED
@@ -3,7 +3,7 @@ require 'English'
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = 'thermite'
6
- s.version = '0.3.0'
6
+ s.version = '0.4.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
 
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
17
17
 
18
18
  # Mostly due to tomlrb
19
19
  s.required_ruby_version = '>= 2.0.0'
20
- s.add_runtime_dependency 'rake', '~> 11'
20
+ s.add_runtime_dependency 'rake', '>= 10'
21
21
  s.add_runtime_dependency 'minitar', '~> 0.5'
22
22
  s.add_runtime_dependency 'tomlrb', '~> 1.2'
23
23
  s.add_development_dependency 'rdoc', '~> 4.2'
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thermite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.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-07-04 00:00:00.000000000 Z
11
+ date: 2016-07-12 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
- version: '11'
19
+ version: '10'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '11'
26
+ version: '10'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: minitar
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -97,11 +97,13 @@ files:
97
97
  - NEWS.md
98
98
  - README.md
99
99
  - Rakefile
100
+ - ci/after_success.py
100
101
  - lib/thermite/cargo.rb
101
102
  - lib/thermite/config.rb
102
103
  - lib/thermite/github_release_binary.rb
103
104
  - lib/thermite/package.rb
104
105
  - lib/thermite/tasks.rb
106
+ - lib/thermite/util.rb
105
107
  - thermite.gemspec
106
108
  homepage: https://github.com/malept/thermite
107
109
  licenses: