durable_streams-rails 0.2.2 → 0.2.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: eb1d7090c279daba2ebd2d5556eeaf2df8f56d7f01a2e5c09d236ea03f4142cd
4
- data.tar.gz: 06ff468c7882ce7d06d0d62f77960350476d5a33c2c3e552c914aa1974724541
3
+ metadata.gz: c92e0876c45c1275005ac561769b4653d63fb344518fa5158b10d79558fd4538
4
+ data.tar.gz: '09935cbb04fb7e94081d10d5313488c7eccb7113fd7a327d892b33fc7d8c3d5a'
5
5
  SHA512:
6
- metadata.gz: 11f0a0dd900fd4526b4566d2794c5bed38f345ed9b7001a8444a72be4b6c3bab53cdd18b10c480b4018f6466829586ceebd3973e309fd60a1adc0be14ac9bc7d
7
- data.tar.gz: a3a6b953074677a5ddccb88769071b92f03f20c5ebf8010fc541c2d4b1e3ff9a9389a16eee170cc50a855d0e7ae95f9bb3f975770bab91fa983bf0c9878d4da8
6
+ metadata.gz: 91afdd838a384a32e001ce175fa3f5e0415953c1e60f28a9afaab9ebdd36aaa05a237fb0d735bf7be42cff3ac0c16746011bdd10e90c15a50234fa4b51a6a3a5
7
+ data.tar.gz: 68c5ba947c3821328d349034d106c18ab2004d1b44619396e2265337442510c82f7c439682d397769638554114cb5f61eb5914249af017fc822b1b76994c9882
@@ -1,3 +1,3 @@
1
1
  module DurableStreams
2
- RAILS_VERSION = "0.2.2"
2
+ RAILS_VERSION = "0.2.3"
3
3
  end
@@ -1,6 +1,9 @@
1
1
  namespace :durable_streams do
2
2
  desc "Download the Durable Streams server binary for the current platform"
3
3
  task :download do
4
+ require "net/http"
5
+ require "json"
6
+
4
7
  version = ENV.fetch("DURABLE_STREAMS_VERSION", "latest")
5
8
  install_dir = Rails.root.join("bin", "dist")
6
9
  bin_path = install_dir.join("durable-streams-server")
@@ -25,18 +28,27 @@ namespace :durable_streams do
25
28
  end
26
29
  }
27
30
 
28
- FileUtils.mkdir_p(install_dir)
29
-
30
31
  if version == "latest"
31
- url = "https://github.com/durable-streams/durable-streams/releases/latest/download/durable-streams-server_#{os}_#{arch}.tar.gz"
32
- else
33
- url = "https://github.com/durable-streams/durable-streams/releases/download/caddy-v#{version}/durable-streams-server_#{version}_#{os}_#{arch}.tar.gz"
32
+ version = resolve_latest_version
34
33
  end
35
34
 
35
+ FileUtils.mkdir_p(install_dir)
36
+
37
+ url = "https://github.com/durable-streams/durable-streams/releases/download/v#{version}/durable-streams-server_#{version}_#{os}_#{arch}.tar.gz"
38
+
36
39
  puts "Downloading durable-streams-server #{version} (#{os}/#{arch})..."
37
- system("curl", "-sL", url, "-o", "-", out: IO.popen(["tar", "xz", "-C", install_dir.to_s], "w").fileno) ||
38
- abort("Download failed")
40
+ system("curl", "-sfL", url, "-o", "-", out: IO.popen(["tar", "xz", "-C", install_dir.to_s], "w").fileno) ||
41
+ abort("Download failed — check https://github.com/durable-streams/durable-streams/releases")
39
42
  FileUtils.chmod(0755, bin_path)
40
43
  puts "Installed to #{bin_path}"
41
44
  end
42
45
  end
46
+
47
+ def resolve_latest_version
48
+ uri = URI("https://api.github.com/repos/durable-streams/durable-streams/releases/latest")
49
+ response = Net::HTTP.get(uri)
50
+ tag = JSON.parse(response).fetch("tag_name")
51
+ tag.delete_prefix("v")
52
+ rescue => e
53
+ abort "Failed to resolve latest version: #{e.message}"
54
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: durable_streams-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - tokimonki