fly.io-rails 0.1.19 → 0.2.0

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: 4cc23fa369a363a787843d3550716ee786faabbbc0f04d44d6d648fc8199242b
4
- data.tar.gz: c0def1765381df4dd6940049913c0cff4b27fda258efab192848b9a5ad229f59
3
+ metadata.gz: 2ee5de53102f8bdadd0cf90cbac03e07b5dae4c6e9f811b03753fec0ae413020
4
+ data.tar.gz: 05e528e61d28845236fc914274be307c73731fff71d4ba5ca2f21fa5e3833b26
5
5
  SHA512:
6
- metadata.gz: c482ea6f86f0b9184a97def4f78f2ea694192261aae93f0105eda54a859578e1d696a47c4ad6fb9d6fbbaf956c58a3a8431492654639f4aab5f8f7db263629bc
7
- data.tar.gz: 9c2b5c82abbc06cea0f12e505184d6389de4a40f675d2cd8dca65d5957c3c70b5239de7b9cca4459f885818d5becc973aa9621c4945434407181aaecf9261ba6
6
+ metadata.gz: bbb6b3a3f730fb1ac2f0924da06d48b69664e9c5225aac114a807cbdd28ed998dde239eeeef475ed4eee7e8ddbe29c2b96a166030cbb9d1d11f610a5c9735913
7
+ data.tar.gz: 73095dafb055db3c9c4373a0f72f50c81a610b1baa820b1a550e6a0e4c8184b6640c1130e7cfb896fcba2a2bc59eb88becc3193c09365e2f38b39626b6793774
data/Rakefile CHANGED
@@ -1,163 +1,3 @@
1
- # coding: utf-8
2
- #
3
- # Rake tasks to manage native gem packages with flyctl binary executables from github
4
- #
5
- # TL;DR: run "rake package"
6
- #
7
- # The native platform gems (defined by Fly_io::PLATFORMS)
8
- # will each contain two files in addition to what the vanilla ruby gem contains:
9
- #
10
- # exe/
11
- # ├── flyctl # generic ruby script to find and run the binary
12
- # └── <Gem::Platform architecture name>/
13
- # └── flyctl # the flyctl binary executable
14
- #
15
- # The ruby script `exe/flyctl` is installed into the user's path, and it simply locates the
16
- # binary and executes it. Note that this script is required because rubygems requires that
17
- # executables declared in a gemspec must be Ruby scripts.
18
- #
19
- # As a concrete example, an x86_64-linux system will see these files on disk after installing
20
- # fly.io-rails-1.x.x-x86_64-linux.gem:
21
- #
22
- # exe/
23
- # ├── flyctl
24
- # └── x86_64-linux/
25
- # └── flyctl
26
- #
27
- # So the full set of gem files created will be:
28
- #
29
- # - pkg/fly.io-rails-1.0.0.gem
30
- # - pkg/fly.io-rails-1.0.0-arm64-darwin.gem
31
- # - pkg/fly.io-rails-1.0.0-x64-mingw32.gem
32
- # - pkg/fly.io-rails-1.0.0-x86_64-darwin.gem
33
- # - pkg/fly.io-rails-1.0.0-x86_64-linux.gem
34
- #
35
- # Note that in addition to the native gems, a vanilla "ruby" gem will also be created without
36
- # either the `exe/flyctl` script or a binary executable present.
37
- #
38
- #
39
- # New rake tasks created:
40
- #
41
- # - rake gem:ruby # Build the ruby gem
42
- # - rake gem:arm64-darwin # Build the arm64-darwin gem
43
- # - rake gem:x64-mingw32 # Build the x64-mingw32 gem
44
- # - rake gem:x86_64-darwin # Build the x86_64-darwin gem
45
- # - rake gem:x86_64-linux # Build the x86_64-linux gem
46
- # - rake download # Download all flyctl binaries
47
- #
48
- # Modified rake tasks:
49
- #
50
- # - rake gem # Build all the gem files
51
- # - rake package # Build all the gem files (same as `gem`)
52
- # - rake repackage # Force a rebuild of all the gem files
53
- #
54
- # Note also that the binary executables will be lazily downloaded when needed, but you can
55
- # explicitly download them with the `rake download` command.
56
- #
57
- require "bundler/setup"
58
1
  require "bundler/gem_tasks"
59
- require "rubygems/package_task"
60
- require 'net/http'
61
- require 'json'
62
- require 'stringio'
63
- require 'zip'
64
- require_relative 'lib/fly.io-rails/platforms'
65
2
 
66
- task default: :package
67
-
68
- FLY_IO_RAILS_GEMSPEC = Bundler.load_gemspec("fly.io-rails.gemspec")
69
-
70
- gem_path = Gem::PackageTask.new(FLY_IO_RAILS_GEMSPEC).define
71
- desc "Build the ruby gem"
72
- task "gem:ruby" => [gem_path]
73
-
74
- def fetch(uri, limit = 10)
75
- raise ArgumentError, 'HTTP redirect too deep' unless limit > 0
76
- response = Net::HTTP.get_response(URI(uri))
77
-
78
- case response
79
- when Net::HTTPSuccess
80
- response.body
81
- when Net::HTTPRedirection
82
- fetch(response['location'], limit - 1)
83
- else
84
- STDERR.puts 'HTTP Error: ' + response.message.to_s
85
- exit 1
86
- end
87
- end
88
-
89
- exepaths = []
90
- uri = 'https://api.github.com/repos/superfly/flyctl/releases/latest'
91
- release = JSON.parse(fetch(uri))
92
-
93
- release['assets'].each do |asset|
94
- platform = Fly_io::PLATFORMS[asset['name'][/^flyctl_.*?_(.*?)\./, 1]]
95
- next unless platform
96
-
97
- FLY_IO_RAILS_GEMSPEC.dup.tap do |gemspec|
98
- exedir = File.join(gemspec.bindir, platform) # "exe/x86_64-linux"
99
- exepath = File.join(exedir, "flyctl") # "exe/x86_64-linux/flyctl"
100
-
101
- if asset['name'] =~ /Windows/i
102
- exepath += '.exe'
103
- dll = File.join(exedir, 'wintun.dll')
104
- gemspec.files << dll
105
- file dll => exepath
106
- end
107
-
108
- exepaths << exepath
109
- gemspec.files << exepath
110
-
111
- # modify a copy of the gemspec to include the native executable
112
- gemspec.platform = platform
113
-
114
- # create a package task
115
- gem_path = Gem::PackageTask.new(gemspec).define
116
- desc "Build the #{platform} gem"
117
- task "gem:#{platform}" => [gem_path]
118
-
119
- directory exedir
120
- file exepath => [exedir] do
121
- release_url = asset['browser_download_url']
122
- warn "Downloading #{release_url} ..."
123
-
124
- case File.extname(asset['name'])
125
- when '.gz'
126
- Zlib::GzipReader.wrap(StringIO.new(fetch(release_url))) do |gz|
127
- Gem::Package::TarReader.new(gz) do |tar|
128
- tar.each do |entry|
129
- exepath = File.join(exedir, entry.full_name)
130
- File.open(exepath, "wb") do |local|
131
- local.write(entry.read)
132
- end
133
- FileUtils.chmod(0755, exepath, verbose: true)
134
- end
135
- end
136
- end
137
- when '.zip'
138
- Zip::File.open_buffer(fetch(release_url)) do |zip_file|
139
- zip_file.each do |entry|
140
- exepath = File.join(exedir, entry.name)
141
- STDERR.puts exepath
142
- File.open(exepath, "wb") do |local|
143
- local.write(zip_file.read(entry.name))
144
- end
145
- end
146
- end
147
- end
148
- end
149
- end
150
- end
151
-
152
- desc "Download all flyctl binaries"
153
- task download: exepaths
154
-
155
- task package: :download
156
-
157
- CLOBBER.add(exepaths.map { |path| File.dirname(path) })
158
-
159
- namespace :gem do
160
- task :push do
161
- sh 'for i in pkg/*.gem; do gem push $i; done'
162
- end
163
- end
3
+ # Run `rake release` to release a new version of the gem.
@@ -19,6 +19,10 @@ module Fly
19
19
  @anycable = gemfile.include? 'anycable'
20
20
  @rmagick = gemfile.include? 'rmagick'
21
21
  @bootstrap = gemfile.include? 'bootstrap'
22
+ @puppeteer = gemfile.include? 'puppeteer'
23
+
24
+ package_json = IO.read('package.json') rescue ''
25
+ @puppeteer ||= package_json.include? 'puppeteer'
22
26
 
23
27
  @cable = ! Dir['app/channels/*.rb'].empty?
24
28
 
@@ -1,3 +1,3 @@
1
1
  module Fly_io
2
- VERSION = '0.1.19'
2
+ VERSION = '0.2.0'
3
3
  end
@@ -51,7 +51,13 @@ RUN mkdir -p tmp/pids
51
51
  RUN curl https://get.volta.sh | bash
52
52
  ENV VOLTA_HOME /root/.volta
53
53
  ENV PATH $VOLTA_HOME/bin:/usr/local/bin:$PATH
54
- RUN volta install node@${NODE_VERSION} yarn@${YARN_VERSION}
54
+ RUN volta install node@${NODE_VERSION} yarn@${YARN_VERSION} && \
55
+ gem update --system --no-document && \
56
+ gem install -N bundler -v ${BUNDLER_VERSION}
57
+
58
+ <% else -%>
59
+ RUN gem update --system --no-document && \
60
+ gem install -N bundler -v ${BUNDLER_VERSION}
55
61
 
56
62
  <% end -%>
57
63
  #######################################################################
@@ -82,9 +88,6 @@ RUN --mount=type=cache,id=dev-apt-cache,sharing=locked,target=/var/cache/apt \
82
88
 
83
89
  FROM build_deps as gems
84
90
 
85
- RUN gem update --system --no-document && \
86
- gem install -N bundler -v ${BUNDLER_VERSION}
87
-
88
91
  COPY Gemfile* ./
89
92
  RUN bundle install && rm -rf vendor/bundle/ruby/*/cache
90
93
 
@@ -95,6 +98,10 @@ RUN bundle install && rm -rf vendor/bundle/ruby/*/cache
95
98
 
96
99
  FROM build_deps as node_modules
97
100
 
101
+ <% if @puppeteer -%>
102
+ ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
103
+
104
+ <% end -%>
98
105
  COPY package*json ./
99
106
  <% if @yarn -%>
100
107
  COPY yarn.* ./
@@ -132,6 +139,12 @@ RUN apt-get install -y dirmngr gnupg apt-transport-https ca-certificates curl &&
132
139
  gpg --dearmor > /etc/apt/trusted.gpg.d/phusion.gpg && \
133
140
  sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger bullseye main > /etc/apt/sources.list.d/passenger.list'
134
141
 
142
+ <% end -%>
143
+ <% if @puppeteer -%>
144
+ # add google chrome repository
145
+ RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
146
+ && echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list
147
+
135
148
  <% end -%>
136
149
  <%
137
150
  @deploy_packages = %w(file vim curl gzip)
@@ -139,6 +152,7 @@ RUN apt-get install -y dirmngr gnupg apt-transport-https ca-certificates curl &&
139
152
  @deploy_packages << 'postgresql-client' if @postgresql
140
153
  @deploy_packages << 'libsqlite3-0' if @sqlite3
141
154
  @deploy_packages << 'default-mysql-client' if @mysql
155
+ @deploy_packages << 'google-chrome-stable' if @puppeteer
142
156
  @deploy_packages << 'imagemagick' if @rmagick
143
157
  @deploy_packages << 'nodejs' if not @node and @bootstrap
144
158
  @deploy_packages << 'fuse' if @litefs
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fly.io-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.19
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Ruby
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-25 00:00:00.000000000 Z
11
+ date: 2022-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fly-ruby