rucy 0.1.30 → 0.1.32

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
  SHA256:
3
- metadata.gz: e8aa5ea6b09dce36e1eb46e3f5bb27c6316c6bfa9deebae90c35658a156f61da
4
- data.tar.gz: ad210cfad2639931777a1cc5c6e4392f03b84f82268c91c01996e3a3d5783640
3
+ metadata.gz: c89685c7459df42c182e7cf35d81c7e0da7e225a825311514cd83a4f3f796365
4
+ data.tar.gz: 545dc4331565a973c35f2bf31a8dd7c956b81ff249cc9b0805d8904feebaa9c5
5
5
  SHA512:
6
- metadata.gz: 6bd30011857e1f6ea7c0e472fff0dfdf78645e062bd51f4bf4ed03f08b647e036d8a06f58b9dc79953a8ed2458845008ed9240d1d8d63bc09a84aae96469b242
7
- data.tar.gz: 76dd8197bf2d9f7bc8754e5e6071acefb82657af0875bc20280e14f3eb9473526c38493986d4f1c20562ad287607e6331f245eaee286fe7a63d87b43cc5d42c5
6
+ metadata.gz: 247fae5e615284b5940e1cff1b19700340ac6ee45746e4fc79a2af0f639868088bea6dca7bfb2abbe8b6bfea4c6741688d223ff761d2b4a4bd8b1165a939b3ec
7
+ data.tar.gz: 38571c46ef907b0df2a422f7a1c6d74670febec720d3dadb08c623704fceb82688e3788fabd926fb35a1396f2419596f3806912facb0a73f9b44255624d0fd81
@@ -0,0 +1,59 @@
1
+ name: Release Gem
2
+
3
+ on:
4
+ push:
5
+ tags: ['v[0-9]*']
6
+
7
+ jobs:
8
+ release:
9
+ runs-on: macos-latest
10
+
11
+ steps:
12
+ - name: ruby 3.2
13
+ uses: ruby/setup-ruby@v1
14
+ with:
15
+ ruby-version: 3.2
16
+
17
+ - name: checkout
18
+ uses: actions/checkout@v2
19
+
20
+ - name: setup dependencies
21
+ run: "ruby -I.github/workflows -rutils -e 'setup_dependencies'"
22
+
23
+ - name: test
24
+ run: rake test
25
+
26
+ - name: create gem
27
+ id: gem
28
+ run: |
29
+ rake gem
30
+ echo path=$(ruby -e 'print Dir.glob("*.gem").first') >> $GITHUB_OUTPUT
31
+
32
+ - name: create github release
33
+ id: release
34
+ uses: actions/create-release@v1
35
+ env:
36
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37
+ with:
38
+ tag_name: ${{ github.ref }}
39
+ release_name: ${{ github.ref }}
40
+
41
+ - name: upload to github release
42
+ uses: actions/upload-release-asset@v1
43
+ env:
44
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45
+ with:
46
+ upload_url: ${{ steps.release.outputs.upload_url }}
47
+ asset_path: ./${{ steps.gem.outputs.path }}
48
+ asset_name: ${{ steps.gem.outputs.path }}
49
+ asset_content_type: application/zip
50
+
51
+ - name: upload to rubygems
52
+ env:
53
+ GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_AUTH_TOKEN }}
54
+ run: |
55
+ mkdir -p $HOME/.gem
56
+ touch $HOME/.gem/credentials
57
+ chmod 0600 $HOME/.gem/credentials
58
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
59
+ rake upload
@@ -0,0 +1,35 @@
1
+ name: Tag
2
+
3
+ on:
4
+ push:
5
+ branches: [master]
6
+
7
+ jobs:
8
+ tag:
9
+ runs-on: ubuntu-latest
10
+
11
+ steps:
12
+ - name: ruby 3.2
13
+ uses: ruby/setup-ruby@v1
14
+ with:
15
+ ruby-version: 3.2
16
+
17
+ - name: checkout
18
+ uses: actions/checkout@v2
19
+ with:
20
+ fetch-depth: 0
21
+ token: ${{ secrets.PAT }}
22
+
23
+ - name: setup dependencies
24
+ run: "ruby -I.github/workflows -rutils -e 'setup_dependencies only: :xot'"
25
+
26
+ - name: setup user name and email
27
+ run: |
28
+ git config --global user.email "xordog@gmail.com"
29
+ git config --global user.name "xord"
30
+
31
+ - name: tag versions
32
+ run: "ruby -I.github/workflows -rutils -e 'tag_versions'"
33
+
34
+ - name: push tags
35
+ run: git push origin --tags
@@ -0,0 +1,26 @@
1
+ name: Test
2
+
3
+ on:
4
+ push:
5
+ branches: [master]
6
+ pull_request:
7
+ branches: [master]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: macos-latest
12
+
13
+ steps:
14
+ - name: ruby 3.2
15
+ uses: ruby/setup-ruby@v1
16
+ with:
17
+ ruby-version: 3.2
18
+
19
+ - name: checkout
20
+ uses: actions/checkout@v2
21
+
22
+ - name: setup dependencies
23
+ run: "ruby -I.github/workflows -rutils -e 'setup_dependencies'"
24
+
25
+ - name: test
26
+ run: rake test
@@ -0,0 +1,55 @@
1
+ RENAMES = {reflex: 'reflexion'}
2
+
3
+ def sh(cmd)
4
+ puts cmd
5
+ system cmd
6
+ end
7
+
8
+ def setup_dependencies(build: true, only: nil)
9
+ gemspec_path = `git ls-files`.lines(chomp: true).find {|l| l =~ /\.gemspec$/}
10
+ return unless gemspec_path
11
+
12
+ gemspec = File.read gemspec_path
13
+ name = File.basename gemspec_path, '.gemspec'
14
+
15
+ exts = File.readlines('Rakefile')
16
+ .map {|l| l[%r|^\s*require\W+(\w+)/extension\W+$|, 1]}
17
+ .compact
18
+ .reject {|ext| ext == name}
19
+ exts = exts & [only].flatten.map(&:to_s) if only
20
+
21
+ exts.each do |ext|
22
+ gem = RENAMES[ext.to_sym].then {|s| s || ext}
23
+ clone = "git clone --depth 1 https://github.com/xord/#{ext}.git ../#{ext}"
24
+ ver = gemspec[/add_runtime_dependency.*['"]#{gem}['"].*['"]\s*~>\s*([\d\.]+)\s*['"]/, 1]
25
+
26
+ # 'rake subtree:push' pushes all subrepos, so cloning by new tag
27
+ # often fails before tagging each new tag
28
+ sh %( #{clone} --branch v#{ver} || #{clone} )
29
+ sh %( cd ../#{ext} && rake ext )
30
+ end
31
+ end
32
+
33
+ def tag_versions()
34
+ tags = `git tag`.lines chomp: true
35
+ vers = `git log --oneline ./VERSION`
36
+ .lines(chomp: true)
37
+ .map {|line| line.split.first[/^\w+$/]}
38
+ .map {|hash| [`git cat-file -p #{hash}:./VERSION 2>/dev/null`[/[\d\.]+/], hash]}
39
+ .select {|ver, hash| ver && hash}
40
+ .reverse
41
+ .to_h
42
+
43
+ changes = File.read('ChangeLog.md')
44
+ .split(/^\s*##\s*\[\s*v([\d\.]+)\s*\].*$/)
45
+ .slice(1..-1)
46
+ .each_slice(2)
47
+ .to_h
48
+ .transform_values(&:strip!)
49
+
50
+ vers.to_a.reverse.each do |ver, hash|
51
+ tag = "v#{ver}"
52
+ break if tags.include?(tag)
53
+ sh %( git tag -a -m \"#{changes[ver]&.gsub '"', '\\"'}\" #{tag} #{hash} )
54
+ end
55
+ end
data/ChangeLog.md ADDED
@@ -0,0 +1,18 @@
1
+ # rucy ChangeLog
2
+
3
+
4
+ ## [v0.1.32] - 2023-03-01
5
+
6
+ - fix bugs
7
+
8
+
9
+ ## [v0.1.31] - 2023-02-27
10
+
11
+ - add ChangeLog.md file
12
+ - add test.yml, tag.yaml, and release.yml
13
+ - requires ruby 2.7.0 or later
14
+
15
+
16
+ ## [v0.1.30] - 2023-02-09
17
+
18
+ - refactoring
data/Rakefile CHANGED
@@ -7,18 +7,17 @@
7
7
 
8
8
  require 'rucy/rake'
9
9
 
10
- require 'xot/module'
11
- require 'rucy/module'
10
+ require 'xot/extension'
11
+ require 'rucy/extension'
12
12
 
13
13
 
14
- MODULES = [Xot, Rucy]
14
+ EXTENSIONS = [Xot, Rucy]
15
15
  NPARAM_MAX = 8
16
16
  NTIMES = (0..NPARAM_MAX)
17
17
 
18
+ default_tasks :ext
18
19
  build_native_library
19
- build_ruby_extension dlname: :tester
20
+ build_ruby_extension dlname: :tester, liboutput: false
20
21
  test_ruby_extension
21
22
  generate_documents
22
23
  build_ruby_gem
23
-
24
- task :default => :ext
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.30
1
+ 0.1.32
data/ext/rucy/extconf.rb CHANGED
@@ -7,8 +7,8 @@
7
7
 
8
8
  require 'mkmf'
9
9
  require 'xot/extconf'
10
- require 'xot/module'
11
- require 'rucy/module'
10
+ require 'xot/extension'
11
+ require 'rucy/extension'
12
12
 
13
13
 
14
14
  Xot::ExtConf.new Xot, Rucy do
data/include/rucy/ruby.h CHANGED
@@ -4,7 +4,10 @@
4
4
  #define __RUCY_RUBY_H__
5
5
 
6
6
 
7
+ #pragma clang diagnostic push
8
+ #pragma clang diagnostic ignored "-Wundef"
7
9
  #include <ruby.h>
10
+ #pragma clang diagnostic pop
8
11
 
9
12
 
10
13
  #ifdef memcpy
@@ -4,7 +4,7 @@
4
4
  module Rucy
5
5
 
6
6
 
7
- module Module
7
+ module Extension
8
8
 
9
9
  module_function
10
10
 
@@ -13,7 +13,7 @@ module Rucy
13
13
  end
14
14
 
15
15
  def version()
16
- open(root_dir 'VERSION') {|f| f.readline.chomp}
16
+ File.read(root_dir 'VERSION')[/[\d\.]+/]
17
17
  end
18
18
 
19
19
  def root_dir(path = '')
@@ -28,7 +28,7 @@ module Rucy
28
28
  root_dir 'lib'
29
29
  end
30
30
 
31
- end# Module
31
+ end# Extension
32
32
 
33
33
 
34
34
  end# Rucy
data/lib/rucy.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
 
4
- require 'rucy/module'
4
+ require 'rucy/extension'
data/rucy.gemspec CHANGED
@@ -4,7 +4,7 @@
4
4
  File.expand_path('lib', __dir__)
5
5
  .tap {|s| $:.unshift s if !$:.include?(s) && File.directory?(s)}
6
6
 
7
- require 'rucy/module'
7
+ require 'rucy/extension'
8
8
 
9
9
 
10
10
  Gem::Specification.new do |s|
@@ -12,23 +12,26 @@ Gem::Specification.new do |s|
12
12
  patterns.map {|pat| Dir.glob(pat).to_a}.flatten
13
13
  end
14
14
 
15
- mod = Rucy::Module
16
- name = mod.name.downcase
15
+ ext = Rucy::Extension
16
+ name = ext.name.downcase
17
17
  rdocs = glob.call *%w[README .doc/ext/**/*.cpp]
18
18
 
19
19
  s.name = name
20
20
  s.summary = 'A Ruby C++ Extension Helper Library.'
21
21
  s.description = 'This library helps you to develop Ruby Extension by C++.'
22
- s.version = mod.version
22
+ s.version = ext.version
23
23
 
24
24
  s.authors = %w[xordog]
25
25
  s.email = 'xordog@gmail.com'
26
26
  s.homepage = "https://github.com/xord/rucy"
27
27
 
28
28
  s.platform = Gem::Platform::RUBY
29
- s.required_ruby_version = '>= 2.6.0'
29
+ s.required_ruby_version = '>= 2.7.0'
30
30
 
31
- s.add_runtime_dependency 'xot', '~> 0.1.30'
31
+ s.add_runtime_dependency 'xot', '~> 0.1.32'
32
+
33
+ s.add_development_dependency 'rake'
34
+ s.add_development_dependency 'test-unit'
32
35
 
33
36
  s.files = `git ls-files`.split $/
34
37
  s.executables = s.files.grep(%r{^bin/}) {|f| File.basename f}
data/task/doc.rake CHANGED
@@ -16,8 +16,8 @@ end
16
16
  namespace :doc do
17
17
 
18
18
 
19
- mod = MODULE
20
- name = env :NAME, MODULE.name.downcase
19
+ ext = EXTENSIONS.last
20
+ name = env :NAME, ext.name.downcase
21
21
  extdir = env :EXTDIR, 'ext'
22
22
  docdir = env :DOCDIR, 'doc'
23
23
  rdoc = env :RDOC, 'rdoc'# 'yardoc'
data/test/helper.rb CHANGED
@@ -8,6 +8,6 @@
8
8
  require 'test/unit'
9
9
  require 'xot/test'
10
10
  require 'rucy'
11
- require 'rucy/tester'
11
+ require_relative '../ext/rucy/tester'
12
12
 
13
13
  include Xot::Test
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rucy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.30
4
+ version: 0.1.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - xordog
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-08 00:00:00.000000000 Z
11
+ date: 2023-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xot
@@ -16,14 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.1.30
19
+ version: 0.1.32
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: 0.1.30
26
+ version: 0.1.32
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: test-unit
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
27
55
  description: This library helps you to develop Ruby Extension by C++.
28
56
  email: xordog@gmail.com
29
57
  executables:
@@ -44,6 +72,11 @@ files:
44
72
  - ".doc/ext/rucy/struct.cpp"
45
73
  - ".doc/ext/rucy/tester.cpp"
46
74
  - ".doc/ext/rucy/value.cpp"
75
+ - ".github/workflows/release-gem.yml"
76
+ - ".github/workflows/tag.yml"
77
+ - ".github/workflows/test.yml"
78
+ - ".github/workflows/utils.rb"
79
+ - ChangeLog.md
47
80
  - LICENSE
48
81
  - README.md
49
82
  - Rakefile
@@ -71,7 +104,7 @@ files:
71
104
  - include/rucy/symbol.h
72
105
  - include/rucy/value.h.erb
73
106
  - lib/rucy.rb
74
- - lib/rucy/module.rb
107
+ - lib/rucy/extension.rb
75
108
  - lib/rucy/rake.rb
76
109
  - rucy.gemspec
77
110
  - src/class.cpp
@@ -100,14 +133,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
100
133
  requirements:
101
134
  - - ">="
102
135
  - !ruby/object:Gem::Version
103
- version: 2.6.0
136
+ version: 2.7.0
104
137
  required_rubygems_version: !ruby/object:Gem::Requirement
105
138
  requirements:
106
139
  - - ">="
107
140
  - !ruby/object:Gem::Version
108
141
  version: '0'
109
142
  requirements: []
110
- rubygems_version: 3.4.1
143
+ rubygems_version: 3.4.6
111
144
  signing_key:
112
145
  specification_version: 4
113
146
  summary: A Ruby C++ Extension Helper Library.