fly.io-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 +4 -4
- data/lib/fly.io-rails/actions.rb +2 -2
- data/lib/fly.io-rails/deploy.rb +41 -0
- data/lib/fly.io-rails/dsl.rb +22 -16
- data/lib/fly.io-rails/version.rb +1 -1
- data/lib/generators/fly/config_generator.rb +19 -0
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3e2cb915aae5b7e8d4d2cd96fc2461e814817793b67933ac50997f4f98fdfd0
|
4
|
+
data.tar.gz: b8671505b05fa89a22b0340054d7c691a0a836cc4206b416b69f77cbc76a241e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: debc5c5ec2c92168e7a0ab10ea3a2dd5a574ddce0687cf505dcd393dbed3a014462d001ed35e05c8664c3eab3f61d3b4f0110f75a89aa817d5830ce93bd5886e
|
7
|
+
data.tar.gz: c3ef5f38213186776cfe5aa67f3fe0d1c32f7254de36794277efddfe5bc03a4d52817bb5ed9c424e40095581ab0864548d002adcbb734ebfdd52e0450ff62565
|
data/lib/fly.io-rails/actions.rb
CHANGED
@@ -16,13 +16,13 @@ module Fly
|
|
16
16
|
include Fly::Scanner
|
17
17
|
attr_accessor :options
|
18
18
|
|
19
|
-
def initialize(app, options={})
|
19
|
+
def initialize(app=nil, options={})
|
20
20
|
# placate thor
|
21
21
|
@options = {}
|
22
22
|
@destination_stack = [Dir.pwd]
|
23
23
|
|
24
24
|
# extract options
|
25
|
-
self.app = app
|
25
|
+
app ? self.app = app : app = self.app
|
26
26
|
regions = options[:region]&.flatten || []
|
27
27
|
@avahi = options[:avahi]
|
28
28
|
@litefs = options[:litefs]
|
@@ -0,0 +1,41 @@
|
|
1
|
+
$:.unshift File.expand_path('lib')
|
2
|
+
require 'fly.io-rails/actions'
|
3
|
+
|
4
|
+
require 'bundler'
|
5
|
+
require 'pp'
|
6
|
+
|
7
|
+
def check_git
|
8
|
+
return if Dir.exist? '/srv/fly.io-rails/lib'
|
9
|
+
|
10
|
+
spec = Bundler::Definition.build('Gemfile', nil, []).dependencies.
|
11
|
+
find {|spec| spec.name == 'fly.io-rails'}
|
12
|
+
|
13
|
+
if spec.git
|
14
|
+
if `which git`.empty? and File.exist? '/etc/debian_version'
|
15
|
+
system 'apt-get update'
|
16
|
+
system 'apt-get install -y git'
|
17
|
+
end
|
18
|
+
|
19
|
+
system `git clone --depth 1 #{spec.git} /srv/fly.io-rails`
|
20
|
+
exit 1 unless Dir.exist? '/srv/fly.io-rails/lib'
|
21
|
+
exec "ruby -r /srv/fly.io-rails/deploy -e #{caller_locations(1,1)[0].label}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def dump_config
|
26
|
+
action = Fly::Actions.new
|
27
|
+
|
28
|
+
config = {}
|
29
|
+
action.instance_variables.sort.each do |name|
|
30
|
+
config[name] = action.instance_variable_get(name)
|
31
|
+
end
|
32
|
+
|
33
|
+
File.open('/srv/config', 'w') {|file| PP.pp(config, file)}
|
34
|
+
end
|
35
|
+
|
36
|
+
def build_gems
|
37
|
+
check_git
|
38
|
+
dump_config
|
39
|
+
|
40
|
+
system 'rake -f lib/tasks/fly.rake fly:build_gems'
|
41
|
+
end
|
data/lib/fly.io-rails/dsl.rb
CHANGED
@@ -1,10 +1,26 @@
|
|
1
1
|
module Fly
|
2
2
|
module DSL
|
3
3
|
class Base
|
4
|
+
@@blocks = {}
|
5
|
+
|
4
6
|
def initialize
|
5
7
|
@value = {}
|
6
8
|
end
|
7
9
|
|
10
|
+
def self.block name, kind
|
11
|
+
@@blocks[name] = kind
|
12
|
+
|
13
|
+
define_method name do |&block|
|
14
|
+
@config[name] ||= kind.new
|
15
|
+
@config[name].instance_eval(&block) if block
|
16
|
+
@config[name]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.blocks
|
21
|
+
@@blocks
|
22
|
+
end
|
23
|
+
|
8
24
|
def self.option name, default=nil
|
9
25
|
@options ||= {}
|
10
26
|
@options[name] = default
|
@@ -47,33 +63,23 @@ module Fly
|
|
47
63
|
option :size, 3
|
48
64
|
end
|
49
65
|
|
66
|
+
class Deploy < Base
|
67
|
+
option :swap_mb, 0
|
68
|
+
end
|
69
|
+
|
50
70
|
#############################################################
|
51
71
|
|
52
|
-
class Config
|
53
|
-
@@blocks = {}
|
72
|
+
class Config < Base
|
54
73
|
|
55
74
|
def initialize
|
56
75
|
@config = {}
|
57
76
|
end
|
58
77
|
|
59
|
-
def self.block name, kind
|
60
|
-
@@blocks[name] = kind
|
61
|
-
|
62
|
-
define_method name do |&block|
|
63
|
-
@config[name] ||= kind.new
|
64
|
-
@config[name].instance_eval(&block) if block
|
65
|
-
@config[name]
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
def self.blocks
|
70
|
-
@@blocks
|
71
|
-
end
|
72
|
-
|
73
78
|
block :machine, Machine
|
74
79
|
block :postgres, Postgres
|
75
80
|
block :redis, Redis
|
76
81
|
block :sqlite3, Sqlite3
|
82
|
+
block :deploy, Deploy
|
77
83
|
end
|
78
84
|
end
|
79
85
|
end
|
data/lib/fly.io-rails/version.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'fly.io-rails/actions'
|
2
|
+
|
3
|
+
module Fly::Generators
|
4
|
+
class ConfigGenerator < Rails::Generators::Base
|
5
|
+
include FlyIoRails::Utils
|
6
|
+
|
7
|
+
# despite its name, this is a debug tool that will dump the config
|
8
|
+
def generate_config
|
9
|
+
action = Fly::Actions.new(@app, options)
|
10
|
+
|
11
|
+
config = {}
|
12
|
+
action.instance_variables.sort.each do |name|
|
13
|
+
config[name] = action.instance_variable_get(name)
|
14
|
+
end
|
15
|
+
|
16
|
+
pp config
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
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.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Ruby
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-11-
|
11
|
+
date: 2022-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fly-ruby
|
@@ -52,7 +52,7 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
description:
|
55
|
+
description:
|
56
56
|
email: rubys@intertwingly.net
|
57
57
|
executables: []
|
58
58
|
extensions: []
|
@@ -63,6 +63,7 @@ files:
|
|
63
63
|
- Rakefile
|
64
64
|
- lib/fly.io-rails.rb
|
65
65
|
- lib/fly.io-rails/actions.rb
|
66
|
+
- lib/fly.io-rails/deploy.rb
|
66
67
|
- lib/fly.io-rails/dsl.rb
|
67
68
|
- lib/fly.io-rails/generators.rb
|
68
69
|
- lib/fly.io-rails/hcl.rb
|
@@ -72,6 +73,7 @@ files:
|
|
72
73
|
- lib/fly.io-rails/utils.rb
|
73
74
|
- lib/fly.io-rails/version.rb
|
74
75
|
- lib/generators/fly/app_generator.rb
|
76
|
+
- lib/generators/fly/config_generator.rb
|
75
77
|
- lib/generators/fly/terraform_generator.rb
|
76
78
|
- lib/generators/templates/Dockerfile.erb
|
77
79
|
- lib/generators/templates/Procfile.fly.erb
|
@@ -91,7 +93,7 @@ licenses:
|
|
91
93
|
- Apache-2.0
|
92
94
|
metadata:
|
93
95
|
homepage_uri: https://github.com/rubys/fly.io-rails
|
94
|
-
post_install_message:
|
96
|
+
post_install_message:
|
95
97
|
rdoc_options: []
|
96
98
|
require_paths:
|
97
99
|
- lib
|
@@ -106,8 +108,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
108
|
- !ruby/object:Gem::Version
|
107
109
|
version: '0'
|
108
110
|
requirements: []
|
109
|
-
rubygems_version: 3.3.
|
110
|
-
signing_key:
|
111
|
+
rubygems_version: 3.3.5
|
112
|
+
signing_key:
|
111
113
|
specification_version: 4
|
112
114
|
summary: Rails support for Fly-io
|
113
115
|
test_files: []
|