fluid_cli 0.1.2 → 0.1.3

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: d274a741ad9269d0d48c3ab12241f61b2ded2fcc2cbca333ddb99cb5d0cd106a
4
- data.tar.gz: 3c8d4d513e15143633e3d12b9223a6697d5172a8aa9362d9a82462fa5cf98534
3
+ metadata.gz: c8b44e3feb5bcffe77aaafbb44253f5f5afe24a6bd86cb945b1361b2cfa2f33e
4
+ data.tar.gz: 620a94cabbe665dbe020fde372e469fe4943900460fd37e9e110e4637b8bf231
5
5
  SHA512:
6
- metadata.gz: 02151415ea46eebd33d6acbb23adea014e5f262002a7d6d9664e48f8322f6e3ce988f6acf907037ced608ffc0a83905f66c38980570621563f6533d90981bdc6
7
- data.tar.gz: 5ab472aed0268946d4dab19b7997dd80c5f4c88deb87a7916977f4d642499a398ef5b12a1ca8a7131ab71a578edaff410ba3f0cd06485d6072eafa25fcefd4b7
6
+ metadata.gz: 7e323d65e9a245be0ee966daad0dbba28605c2de8a5014bea908bfc15d6e229f93f164bcd589296a56a35fae7c499cd65df140e469a8e08e60b93ed5bfaebc31
7
+ data.tar.gz: ccaa1ac2a587e5bb4c0ddd30ddcb57d4f7855c3c2160c2ee30072f268476f676af6caf8268cfe35a9f6910ecf16dc768d8c3545f6356321501962d180c51ae72
data/Rakefile ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env ruby --disable-gems
2
+
3
+ Encoding.default_external = Encoding::UTF_8
4
+ Encoding.default_internal = Encoding::UTF_8
5
+
6
+ unshift_path = ->(path) {
7
+ p = File.expand_path("../#{path}", __FILE__)
8
+ $LOAD_PATH.unshift(p) unless $LOAD_PATH.include?(p)
9
+ }
10
+ unshift_path.call('vendor/deps/cli-ui/lib')
11
+ unshift_path.call('vendor/deps/cli-kit/lib')
12
+ unshift_path.call('vendor/deps/debug/lib')
13
+ unshift_path.call('vendor/deps/webrick/lib')
14
+ unshift_path.call('vendor/deps/base64/lib')
15
+ unshift_path.call('lib')
16
+
17
+ require 'fluid_cli'
18
+ require_relative "lib/fluid_cli/version"
19
+
20
+ namespace :package do
21
+ require "fluid_cli/packager"
22
+
23
+ desc("Builds a Homebrew package of the CLI")
24
+ task :homebrew do
25
+ FluidCLI::Packager.new.build_homebrew
26
+ end
27
+ end
@@ -0,0 +1,36 @@
1
+ module FluidCLI
2
+ class Packager
3
+ PACKAGING_DIR = File.join(FluidCLI::ROOT, "packaging")
4
+ BUILDS_DIR = File.join(PACKAGING_DIR, "builds", FluidCLI::VERSION)
5
+
6
+ def initialize
7
+ FileUtils.mkdir_p(BUILDS_DIR)
8
+ end
9
+
10
+ def build_homebrew
11
+ root_dir = File.join(PACKAGING_DIR, "homebrew")
12
+
13
+ build_path = File.join(BUILDS_DIR, "fluid_cli.rb")
14
+ puts "\nBuilding Homebrew package"
15
+
16
+ puts "Generating formula…"
17
+ File.delete(build_path) if File.exist?(build_path)
18
+
19
+ spec_contents = File.read(File.join(root_dir, "fluid_cli.base.rb"))
20
+ spec_contents = spec_contents.gsub("FLUID_CLI_VERSION", FluidCLI::VERSION)
21
+
22
+ puts "Grabbing sha256 checksum from Rubygems.org"
23
+ require "digest/sha2"
24
+ require "open-uri"
25
+ gem_checksum = URI.open("https://rubygems.org/downloads/fluid_cli-#{FluidCLI::VERSION}.gem") do |io|
26
+ Digest::SHA256.new.hexdigest(io.read)
27
+ end
28
+
29
+ puts "Got sha256 checksum for gem: #{gem_checksum}"
30
+ spec_contents = spec_contents.gsub("FLUID_CLI_GEM_CHECKSUM", gem_checksum)
31
+
32
+ puts "Writing generated formula\n To: #{build_path}\n\n"
33
+ File.write(build_path, spec_contents)
34
+ end
35
+ end
36
+ end
@@ -1,3 +1,3 @@
1
1
  module FluidCLI
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -0,0 +1,109 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ # require "fileutils"
5
+
6
+ # formula generated from gem 'fluid_cli'
7
+ class FluidCli < Formula
8
+ # Module to get Ruby binary path from Homebrew Ruby formula
9
+ module RubyBin
10
+ def ruby_bin
11
+ Formula["ruby"].opt_bin
12
+ end
13
+ end
14
+
15
+ # Custom download strategy to fetch gem from RubyGems
16
+ class RubyGemsDownloadStrategy < AbstractDownloadStrategy
17
+ include RubyBin
18
+
19
+ def fetch(_timeout: nil, **_options)
20
+ ohai("Fetching fluid-cli from gem source")
21
+ cache.cd do
22
+ ENV["GEM_SPEC_CACHE"] = "#{cache}/gem_spec_cache"
23
+
24
+ _, err, status = Open3.capture3("gem", "fetch", "fluid_cli", "--version", gem_version)
25
+ unless status.success?
26
+ odie err
27
+ end
28
+ end
29
+ end
30
+
31
+ def cached_location
32
+ Pathname.new("#{cache}/fluid_cli-#{gem_version}.gem")
33
+ end
34
+
35
+ def cache
36
+ @cache ||= HOMEBREW_CACHE
37
+ end
38
+
39
+ def gem_version
40
+ @version ||= @resource&.version if defined?(@resource)
41
+ raise "Unable to determine version; did Homebrew change?" unless @version
42
+ @version
43
+ end
44
+
45
+ def clear_cache
46
+ cached_location.unlink if cached_location.exist?
47
+ end
48
+ end
49
+
50
+ include RubyBin
51
+
52
+ desc "Fluid CLI tool"
53
+ homepage "https://fluid.app"
54
+ url "fluid_cli", using: RubyGemsDownloadStrategy
55
+ version "FLUID_CLI_VERSION"
56
+ sha256 "FLUID_CLI_GEM_CHECKSUM"
57
+ depends_on "ruby"
58
+ depends_on "git"
59
+
60
+ def install
61
+ # set GEM_HOME and GEM_PATH to make sure we package all the dependent gems
62
+ # together without accidently picking up other gems on the gem path since
63
+ # they might not be there if, say, we change to a different rvm gemset
64
+ ENV["GEM_HOME"] = prefix.to_s
65
+ ENV["GEM_PATH"] = prefix.to_s
66
+
67
+ # Use /usr/local/bin at the front of the path instead of Homebrew shims,
68
+ # which mess with Ruby's own compiler config when building native extensions
69
+ if defined?(HOMEBREW_SHIMS_PATH)
70
+ ENV["PATH"] = ENV["PATH"].sub(HOMEBREW_SHIMS_PATH.to_s, "/usr/local/bin")
71
+ end
72
+
73
+ system(
74
+ "gem",
75
+ "install",
76
+ cached_download,
77
+ "--no-document",
78
+ "--no-wrapper",
79
+ "--no-user-install",
80
+ "--install-dir", prefix,
81
+ "--bindir", bin,
82
+ "--",
83
+ "--skip-cli-build"
84
+ )
85
+
86
+ raise "gem install 'fluid_cli' failed with status #{$CHILD_STATUS.exitstatus}" unless $CHILD_STATUS.success?
87
+
88
+ bin.rmtree if bin.exist?
89
+ bin.mkpath
90
+
91
+ brew_gem_prefix = "#{prefix}/gems/fluid_cli-#{version}"
92
+
93
+ ruby_libs = Dir.glob("#{prefix}/gems/*/lib")
94
+ exe = "fluid"
95
+ file = Pathname.new("#{brew_gem_prefix}/exe/#{exe}")
96
+ (bin + "#{file.basename}").open("w") do |f|
97
+ f << <<~RUBY
98
+ #!#{ruby_bin}/ruby -rjson --disable-gems
99
+ ENV['ORIGINAL_ENV']=ENV.to_h.to_json
100
+ ENV['GEM_HOME']="#{prefix}"
101
+ ENV['GEM_PATH']="#{prefix}"
102
+ ENV['RUBY_BINDIR']="#{ruby_bin}/"
103
+ require 'rubygems'
104
+ $:.unshift(#{ruby_libs.map(&:inspect).join(",")})
105
+ load "#{file}"
106
+ RUBY
107
+ end
108
+ end
109
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluid_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fluid
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-11-05 00:00:00.000000000 Z
10
+ date: 2025-11-06 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: bugsnag
@@ -58,6 +58,7 @@ extensions: []
58
58
  extra_rdoc_files: []
59
59
  files:
60
60
  - README.md
61
+ - Rakefile
61
62
  - dev.yml
62
63
  - exe/fluid
63
64
  - lib/fluid_cli.rb
@@ -91,6 +92,7 @@ files:
91
92
  - lib/fluid_cli/identity_auth.rb
92
93
  - lib/fluid_cli/identity_auth/servlet.rb
93
94
  - lib/fluid_cli/options.rb
95
+ - lib/fluid_cli/packager.rb
94
96
  - lib/fluid_cli/theme/dev_server.rb
95
97
  - lib/fluid_cli/theme/dev_server/certificate_manager.rb
96
98
  - lib/fluid_cli/theme/dev_server/errors.rb
@@ -137,6 +139,7 @@ files:
137
139
  - lib/fluid_cli/thread_pool.rb
138
140
  - lib/fluid_cli/thread_pool/job.rb
139
141
  - lib/fluid_cli/version.rb
142
+ - packaging/homebrew/fluid_cli.base.rb
140
143
  - vendor/deps/base64/.document
141
144
  - vendor/deps/base64/.gitignore
142
145
  - vendor/deps/base64/BSDL