ffi-libfuse 0.3.3 → 0.3.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 688ea85b8e5ee83a4baae3055c14026e65e929c2e22a8d9a2d0e983584e8bd7b
4
- data.tar.gz: 552a053bea357d44ccf6fa2fcc12d311116d66320e113d7de7acb929a8ac539e
3
+ metadata.gz: d59c87631dfe38e9dc49b36f829acdd704165162deff3bad6479f3394f348657
4
+ data.tar.gz: 01ab562dd537f1f11f7e3c454e49c5df3ef1ce5cfd6cb8b1aa6b5e6a7f89a4c0
5
5
  SHA512:
6
- metadata.gz: ca1a1f2b2b9573c523583f0ee9d8fa05fecbbaf4ba36fbe73b4db5090626b8fc984091880677b4654caacda25d6e073b0a679b57539f6faecfd4c62f5bc45257
7
- data.tar.gz: f8cb9a7d82ac0be86249066b9b69d2cfe03be3e6eb028881b16e715766b2a0f9dbba46ba2478310be75677e2b8c188f0b26235bbfa491dc42d9dff0ca904840e
6
+ metadata.gz: ae437c153a84155c86a9e2d71d4dd1c6234879fae7553676efacd311e26cae3cf653dd4439b2ec4ab584cd01698636915fc6c9cefd14a2f045c2b19e4077e60b
7
+ data.tar.gz: af5fab46502ff889710facc930ee59d7bb27e129da3c70f0d5089c1fa85e29bbfe3ec91b01f75db907da5f8be220755edec6b4b3976421ce0454cc43830387da
data/CHANGELOG.md CHANGED
@@ -1,47 +1,21 @@
1
1
  # Changelog
2
2
 
3
- ## [0.3.3](https://github.com/lwoggardner/ffi-libfuse/compare/v0.0.1...v0.3.3) (2023-01-07)
4
-
5
-
6
- ### ⚠ BREAKING CHANGES
7
-
8
- * Support downstream RFuse/RFuseFS
9
-
10
- ### Features
11
-
12
- * FFI::Libfuse::Filesystem - base filesystems ([5b19005](https://github.com/lwoggardner/ffi-libfuse/commit/5b19005c4b1ff2237b85c4854f481ea6e3625c62))
13
-
14
-
15
- ### Code Refactoring
16
-
17
- * Support downstream RFuse/RFuseFS ([e6b3fb5](https://github.com/lwoggardner/ffi-libfuse/commit/e6b3fb552b8881dbf28f014617b7412f2542aaa3))
3
+ ## [0.3.4](https://github.com/lwoggardner/ffi-libfuse/compare/v0.3.3...v0.3.4) (2023-01-08)
18
4
 
19
5
 
20
6
  ### Miscellaneous Chores
21
7
 
22
- * **github:** release 0.3.3 ([b54a56f](https://github.com/lwoggardner/ffi-libfuse/commit/b54a56f3f93f15c7684aa2cb2c2dd38c9d033e7f))
23
-
24
- ## [0.3.2](https://github.com/lwoggardner/ffi-libfuse/compare/v0.3.0...v0.3.2) (2023-01-07)
8
+ * **github:** allow downstream gems to use gem_version etc ([73f3b92](https://github.com/lwoggardner/ffi-libfuse/commit/73f3b92f5e8a1f86a9f6053b71470d7c113e6d19))
25
9
 
10
+ ## [0.3.3](https://github.com/lwoggardner/ffi-libfuse/compare/v0.1.0...v0.3.3) (2023-01-07)
26
11
 
27
12
  ### Miscellaneous Chores
28
13
 
29
- * fix release-please action ([fd55030](https://github.com/lwoggardner/ffi-libfuse/commit/fd550301248ebd9616da457ef8c2d88a7e55f819))
30
-
31
- ## [0.3.0](https://github.com/lwoggardner/ffi-libfuse/compare/v0.2.1...v0.3.0) (2023-01-07)
32
-
33
-
34
- ### Miscellaneous Chores
35
-
36
- * fix release-please action ([57d43e9](https://github.com/lwoggardner/ffi-libfuse/commit/57d43e9cac552b1b36469092a6278058893cadc4))
37
-
38
- ## [0.2.1](https://github.com/lwoggardner/ffi-libfuse/compare/v0.1.0...v0.2.1) (2023-01-07)
39
-
40
- ### Miscellaneous Chores
41
-
42
- * release 0.2.1 ([bb0ef37](https://github.com/lwoggardner/ffi-libfuse/commit/bb0ef37c05a41c6b51a14e5cae292b2d7b75ef1c))
14
+ * **github:** release 0.3.3 ([b54a56f](https://github.com/lwoggardner/ffi-libfuse/commit/b54a56f3f93f15c7684aa2cb2c2dd38c9d033e7f))
15
+
16
+ Using github actions
43
17
 
44
- ## [0.1.0](https://github.com/lwoggardner/ffi-libfuse/compare/v0.0.1...v0.1.0) (2023-01-07)
18
+ ## 0.1.0 (2023-01-07)
45
19
 
46
20
  ### ⚠ BREAKING CHANGES
47
21
 
@@ -0,0 +1,98 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FFI
4
+ # Ruby FFI Binding for [libfuse](https://github.com/libfuse/libfuse)
5
+ module Libfuse
6
+ # @!visibility private
7
+ class GemHelper
8
+ SEMVER_TAG_REGEX = /^v\d+\.\d+\.\d+/.freeze
9
+
10
+ # branches the format is refs/heads/<branch_name>,
11
+ # tags it is refs/tags/<tag_name>.
12
+ # for pull requests it is refs/pull/<pr_number>/merge,
13
+ GIT_REF_TYPES = { 'heads' => :branch, 'tags' => :tag, 'pull' => :pull }.freeze
14
+
15
+ class << self
16
+ # set when install'd.
17
+ attr_accessor :instance
18
+
19
+ def install_tasks(main_branch:, version:)
20
+ require 'bundler/gem_tasks'
21
+ include Rake::DSL if defined? Rake::DSL
22
+ new(main_branch: main_branch, version: version).install
23
+ end
24
+
25
+ def git_ref(env: ENV)
26
+ ref = env.fetch('GIT_REF') do
27
+ # get branch ref, or detached head ref to tag
28
+ `git symbolic-ref HEAD 2>/dev/null || git name-rev HEAD | awk '{ gsub(/[\\^~@].*$/,"",$2); printf("refs/%s\\n",$2)}'`.strip # rubocop:disable Layout/LineLength
29
+ rescue StandardError
30
+ nil
31
+ end
32
+
33
+ return [ref, nil] unless ref&.start_with?('refs/')
34
+
35
+ _refs, ref_type, ref_name = ref.split('/', 3)
36
+ [ref_name, GIT_REF_TYPES[ref_type]]
37
+ end
38
+
39
+ def gem_version(main_branch:, version:, env: ENV)
40
+ ref_name, ref_type = git_ref(env: env)
41
+
42
+ version =
43
+ case ref_type
44
+ when :branch
45
+ ref_name == main_branch ? [version] : [version, ref_name]
46
+ when :tag
47
+ SEMVER_TAG_REGEX.match?(ref_name) ? [ref_name[1..]] : [version, ref_name]
48
+ when :pull
49
+ pr_number, merge, _rest = ref_name.split('/')
50
+ # GITHUB_BASE_REF The name of the base ref or target branch of the pull request in a workflow run
51
+ base_ref = env.fetch('GIT_BASE_REF', 'undefined')
52
+ [version, base_ref, "#{merge}#{pr_number}"]
53
+ else
54
+ [version, 'pre', ref_name]
55
+ end.select { |p| p && !p.empty? }.join('.').tr('//_-', '')
56
+
57
+ [version, ref_name, ref_type]
58
+ end
59
+ end
60
+
61
+ attr_reader :version, :main_branch, :git_ref_name, :git_ref_type, :gem_version, :gem_version_tag
62
+
63
+ def initialize(version:, main_branch:)
64
+ @version = version
65
+ @main_branch = main_branch
66
+ @gem_version, @git_ref_name, @git_ref_type =
67
+ self.class.gem_version(main_branch: main_branch, version: version)
68
+ @gem_version_tag = "v#{@gem_version}"
69
+ end
70
+
71
+ def install
72
+ task 'release:guard_clean' => %i[release_guard_tag]
73
+
74
+ desc 'Version info'
75
+ task :version do
76
+ v, gv = [version, gem_version].map { |ver| Gem::Version.new(ver) }
77
+ msg = "VERSION='#{v}' GEM_VERSION='#{gv}'"
78
+ raise "Mismatched versions - #{msg}" unless gv.release == v
79
+
80
+ puts msg
81
+ end
82
+
83
+ task release_guard_tag: [:version] do
84
+ # If we're on a tag then tag must be tag for this version
85
+ if git_ref_type == :tag && git_ref_name != gem_version_tag
86
+ raise "Checkout is tag '#{git_ref_name}' but does not match the gem version '#{gem_version}'"
87
+ end
88
+
89
+ # BASH expression - test tag does not exist OR exists and points at HEAD
90
+ cmd = '[ -z "$(git tag -l ${V_TAG})" ] || git tag --points-at HEAD | grep "^${V_TAG}$" > /dev/null'
91
+ unless system({ 'V_TAG' => gem_version_tag }, cmd)
92
+ raise "Tag #{gem_version_tag} exists but does not point at HEAD"
93
+ end
94
+ end
95
+ end
96
+ end
97
+ end
98
+ end
@@ -1,54 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative 'version'
4
+ require_relative 'gem_helper'
4
5
 
5
6
  module FFI
6
7
  # Ruby FFI Binding for [libfuse](https://github.com/libfuse/libfuse)
7
8
  module Libfuse
9
+ # @visibility private
10
+ MAIN_BRANCH = 'main'
8
11
  # @!visibility private
9
-
10
- SEMVER_TAG_REGEX = /^v\d+\.\d+\.\d+/.freeze
11
-
12
- # branches the format is refs/heads/<branch_name>,
13
- # tags it is refs/tags/<tag_name>.
14
- # for pull requests it is refs/pull/<pr_number>/merge,
15
- GIT_REF_TYPES = { 'heads' => :branch, 'tags' => :tag, 'pull' => :pull }.freeze
16
-
17
- def self.git_ref(env: ENV)
18
- ref = env.fetch('GIT_REF') do
19
- # get branch ref, or detached head ref to tag
20
- `git symbolic-ref HEAD 2>/dev/null || git name-rev HEAD | awk '{ gsub(/[\\^~@].*$/,"",$2); printf("refs/%s\\n",$2)}'`.strip # rubocop:disable Layout/LineLength
21
- rescue StandardError
22
- nil
23
- end
24
-
25
- return [ref, nil] unless ref&.start_with?('refs/')
26
-
27
- _refs, ref_type, ref_name = ref.split('/', 3)
28
- [ref_name, GIT_REF_TYPES[ref_type]]
29
- end
30
-
31
- def self.gem_version(main_branch: 'main', version: VERSION, env: ENV)
32
- ref_name, ref_type = git_ref(env: env)
33
-
34
- version =
35
- case ref_type
36
- when :branch
37
- ref_name == main_branch ? [version] : [version, ref_name]
38
- when :tag
39
- SEMVER_TAG_REGEX.match?(ref_name) ? [ref_name[1..]] : [version, ref_name]
40
- when :pull
41
- pr_number, merge, _rest = ref_name.split('/')
42
- # GITHUB_BASE_REF The name of the base ref or target branch of the pull request in a workflow run
43
- base_ref = env.fetch('GIT_BASE_REF', 'undefined')
44
- [version, base_ref, "#{merge}#{pr_number}"]
45
- else
46
- [version, 'pre', ref_name]
47
- end.select { |p| p && !p.empty? }.join('.').tr('//_-', '')
48
-
49
- [version, ref_name, ref_type]
50
- end
51
-
52
- GEM_VERSION, GIT_REF_NAME, GIT_REF_TYPE = gem_version
12
+ GEM_VERSION, = GemHelper.gem_version(main_branch: MAIN_BRANCH, version: VERSION)
53
13
  end
54
14
  end
@@ -3,6 +3,6 @@
3
3
  module FFI
4
4
  # Ruby FFI Binding for [libfuse](https://github.com/libfuse/libfuse)
5
5
  module Libfuse
6
- VERSION = '0.3.3'
6
+ VERSION = '0.3.4'
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffi-libfuse
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grant Gardner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-07 00:00:00.000000000 Z
11
+ date: 2023-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -178,6 +178,7 @@ files:
178
178
  - lib/ffi/libfuse/fuse_opt.rb
179
179
  - lib/ffi/libfuse/fuse_poll_handle.rb
180
180
  - lib/ffi/libfuse/fuse_version.rb
181
+ - lib/ffi/libfuse/gem_helper.rb
181
182
  - lib/ffi/libfuse/gem_version.rb
182
183
  - lib/ffi/libfuse/job_pool.rb
183
184
  - lib/ffi/libfuse/main.rb