solidus_foudra 0.1.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6f2704edbaf930feef8685b15230447fc9d363db7f6c8e5299133fe113f92551
4
- data.tar.gz: 643c18b9fe0b3473d80638998832334fe8c29fde61f759073af88909017eec5e
3
+ metadata.gz: bc5515f0fd80bf71c843cb429d8b249a38453da5d7a747e7e9536b6068167ce8
4
+ data.tar.gz: b1f47b0d4783f1baad94d19460ac98c6ce68f149db9b84db8de7875003650f28
5
5
  SHA512:
6
- metadata.gz: 2d721dffa038fb58660cfc61da2e25cc1f17f9c312ebcb68f3fc789dcf5be91c9416f2633847113e8fc0bd3463504f686c0f904adb7253b699e0dc110c2982fe
7
- data.tar.gz: 0b07959ea4cd4c4d09ab1a511704775a50f64bd69c21863512cdc443b917fad04d60b6aabed2a2aaacbc7dbeee729ee8d0a531f604d638646a73e1ba33cc4e1c
6
+ metadata.gz: 109fb124ed66d7f46e668ff4eeec85e5368467d907c99241d480f35621165593c9e9e2ad3b84a5c9f22e0372152c466adb2ec62a3e4d8ddfcdc28fcb7af47605
7
+ data.tar.gz: f88e070c5ae17fc84f383ad8f6b7729661bd231a27da1a1d795843d9b5058df918a61fc5233751c0c73f351d9ce40243ad864babe94a44f7ba4b9cf5dae91bc5
data/bin/release ADDED
@@ -0,0 +1,127 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # Copyright (c) 2026, Kalopa Robotics Limited.
5
+ # Licensed under the Apache License, Version 2.0; see LICENSE for details.
6
+ #
7
+ # Release the gem at the version in the gemspec (which reads it from
8
+ # lib/<name>/version.rb):
9
+ #
10
+ # 1. build pkg/<name>-<version>.gem
11
+ # 2. create the annotated tag v<version> on HEAD and push it to origin
12
+ # 3. push the gem to rubygems.org
13
+ # 4. create the GitHub release v<version>, with the .gem attached
14
+ #
15
+ # Bump the version and commit it first: the script refuses to run with a
16
+ # dirty working tree, off the main branch, or out of step with origin.
17
+ # Each step is skipped if it has already been done, so a release that
18
+ # failed part-way through can be finished by running the script again.
19
+ #
20
+ # Usage: bin/release [-n|--dry-run]
21
+
22
+ require "open3"
23
+ require "optparse"
24
+ require "rubygems"
25
+
26
+ Dir.chdir(File.expand_path("..", __dir__))
27
+
28
+ dry_run = false
29
+ OptionParser.new do |o|
30
+ o.banner = "Usage: bin/release [-n|--dry-run]"
31
+ o.on("-n", "--dry-run", "Show what would be done, change nothing") { dry_run = true }
32
+ end.parse!
33
+
34
+ def die(msg)
35
+ warn "release: #{msg}"
36
+ exit 1
37
+ end
38
+
39
+ # Run a command, echoing it; abort if it fails. Skipped in a dry run.
40
+ def run(*cmd, dry_run:)
41
+ puts "+ #{cmd.join(' ')}"
42
+ return if dry_run
43
+
44
+ system(*cmd) || die("failed: #{cmd.join(' ')}")
45
+ end
46
+
47
+ # Run a read-only command and return [stdout, success?].
48
+ def query(*cmd)
49
+ out, status = Open3.capture2(*cmd, err: File::NULL)
50
+ [out.strip, status.success?]
51
+ end
52
+
53
+ def version_from_file(name)
54
+ path = Dir["lib/**/version.rb"].find { |f| f.include?(name) } || Dir["lib/**/version.rb"].first
55
+ return unless path
56
+
57
+ File.read(path)[/VERSION\s*=\s*["']([^"']+)["']/, 1]
58
+ end
59
+
60
+ # --- What are we releasing? ---------------------------------------------------
61
+
62
+ gemspec_path = Dir["*.gemspec"].first || die("no .gemspec in #{Dir.pwd}")
63
+ spec = Gem::Specification.load(gemspec_path) || die("could not load #{gemspec_path}")
64
+ name = spec.name
65
+ version = spec.version&.to_s || version_from_file(name) || die("no version found")
66
+ tag = "v#{version}"
67
+ gem_file = "pkg/#{name}-#{version}.gem"
68
+
69
+ puts "Releasing #{name} #{version}#{' (dry run)' if dry_run}"
70
+
71
+ # --- Pre-flight checks --------------------------------------------------------
72
+
73
+ die("working tree is not clean; commit or stash first") unless query("git", "status", "--porcelain").first.empty?
74
+
75
+ branch = query("git", "rev-parse", "--abbrev-ref", "HEAD").first
76
+ default_branch = query("git", "symbolic-ref", "--short", "refs/remotes/origin/HEAD").first.sub(%r{\Aorigin/}, "")
77
+ default_branch = "main" if default_branch.empty?
78
+ die("on branch #{branch}, not #{default_branch}") unless branch == default_branch
79
+
80
+ query("git", "fetch", "--quiet", "origin", default_branch)
81
+ head = query("git", "rev-parse", "HEAD").first
82
+ upstream = query("git", "rev-parse", "origin/#{default_branch}").first
83
+ die("HEAD is not origin/#{default_branch}; push or pull first") unless head == upstream
84
+
85
+ die("gh is not logged in; run 'gh auth login'") unless query("gh", "auth", "status").last
86
+
87
+ tag_commit, tag_exists = query("git", "rev-parse", "--verify", "--quiet", "#{tag}^{commit}")
88
+ die("tag #{tag} already exists on another commit (#{tag_commit[0, 7]})") if tag_exists && tag_commit != head
89
+
90
+ # --- 1. Build -----------------------------------------------------------------
91
+
92
+ Dir.mkdir("pkg") unless dry_run || Dir.exist?("pkg")
93
+ run("gem", "build", gemspec_path, "--output", gem_file, dry_run:)
94
+
95
+ # --- 2. Tag -------------------------------------------------------------------
96
+
97
+ if tag_exists
98
+ puts "- tag #{tag} already exists on HEAD"
99
+ else
100
+ run("git", "tag", "-a", tag, "-m", "Release #{version}", dry_run:)
101
+ end
102
+
103
+ if query("git", "ls-remote", "--exit-code", "--tags", "origin", "refs/tags/#{tag}").last
104
+ puts "- tag #{tag} already on origin"
105
+ else
106
+ run("git", "push", "origin", tag, dry_run:)
107
+ end
108
+
109
+ # --- 3. rubygems.org ----------------------------------------------------------
110
+
111
+ published = query("gem", "list", "--remote", "--exact", "--all", name).first
112
+ if published[/\(([^)]*)\)/, 1].to_s.split(/,\s*/).include?(version)
113
+ puts "- #{name} #{version} already on rubygems.org"
114
+ else
115
+ run("gem", "push", gem_file, dry_run:)
116
+ end
117
+
118
+ # --- 4. GitHub release --------------------------------------------------------
119
+
120
+ if query("gh", "release", "view", tag).last
121
+ puts "- GitHub release #{tag} already exists"
122
+ else
123
+ run("gh", "release", "create", tag, gem_file,
124
+ "--title", tag, "--generate-notes", "--verify-tag", dry_run:)
125
+ end
126
+
127
+ puts "Released #{name} #{version}." unless dry_run
@@ -4,5 +4,5 @@
4
4
  # Licensed under the Apache License, Version 2.0; see LICENSE for details.
5
5
 
6
6
  module SolidusFoudra
7
- VERSION = "0.1.0"
7
+ VERSION = "0.2.0"
8
8
  end
@@ -22,6 +22,9 @@ Gem::Specification.new do |spec|
22
22
  spec.license = "Apache-2.0"
23
23
 
24
24
  spec.metadata["homepage_uri"] = spec.homepage
25
+ spec.metadata["source_code_uri"] = "https://github.com/kalopa/solidus_foudra"
26
+ spec.metadata["changelog_uri"] = "https://github.com/kalopa/solidus_foudra/releases"
27
+ spec.metadata["bug_tracker_uri"] = "https://github.com/kalopa/solidus_foudra/issues"
25
28
  spec.metadata["rubygems_mfa_required"] = "true"
26
29
  spec.metadata["allowed_push_host"] = "https://rubygems.org"
27
30
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_foudra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kalopa Robotics Limited
@@ -87,6 +87,7 @@ files:
87
87
  - bin/rails-engine
88
88
  - bin/rails-sandbox
89
89
  - bin/rake
90
+ - bin/release
90
91
  - bin/sandbox
91
92
  - bin/setup
92
93
  - config/locales/en.yml
@@ -105,6 +106,9 @@ licenses:
105
106
  - Apache-2.0
106
107
  metadata:
107
108
  homepage_uri: https://foudra.com/developers
109
+ source_code_uri: https://github.com/kalopa/solidus_foudra
110
+ changelog_uri: https://github.com/kalopa/solidus_foudra/releases
111
+ bug_tracker_uri: https://github.com/kalopa/solidus_foudra/issues
108
112
  rubygems_mfa_required: 'true'
109
113
  allowed_push_host: https://rubygems.org
110
114
  rdoc_options: []