beam_up 0.6.0 → 0.7.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 +4 -4
- data/README.md +12 -2
- data/lib/beam_up/cli.rb +11 -29
- data/lib/beam_up/core.rb +40 -0
- data/lib/beam_up/progress.rb +82 -0
- data/lib/beam_up/providers/neocities.rb +5 -0
- data/lib/beam_up/providers/netlify.rb +6 -1
- data/lib/beam_up/providers/s3_compatible.rb +7 -1
- data/lib/beam_up/providers/seal_static.rb +105 -0
- data/lib/beam_up/providers/sftp.rb +7 -1
- data/lib/beam_up/providers/statichost.rb +2 -0
- data/lib/beam_up/providers/transporter.rb +4 -3
- data/lib/beam_up/providers.rb +2 -0
- data/lib/beam_up/result.rb +3 -2
- data/lib/beam_up/version.rb +1 -1
- data/lib/beam_up.rb +16 -0
- metadata +22 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4a72e817350e2432e79027289ca5838cb36c749adce555c34054015ae39ae30d
|
|
4
|
+
data.tar.gz: 6c1716a0ef1fac860312c479da279987771f5ce3ce2d2d9e7cb999aa287d39b2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 982c69b88f7b3bf0132bd8c5926216a656a087d63c2df506434dc411573df08749e6af1f73b717e6c59b7c38943a839df9ecfbac865a1583e2829fc52fa49fc5
|
|
7
|
+
data.tar.gz: 3e509ff7e4f81aacf39b93ee12fe23428c3234489245d95e9bfa5ea18ee6e574fc54617843bf890a43d9b5fb7e7efea98b66b4d9a602d611f3e5df597d5f1fb8
|
data/README.md
CHANGED
|
@@ -13,12 +13,16 @@ gem install beam_up
|
|
|
13
13
|
|
|
14
14
|
## Configuration
|
|
15
15
|
|
|
16
|
-
Create a config file:
|
|
16
|
+
Create a config file interactively:
|
|
17
17
|
```bash
|
|
18
18
|
beam_up init netlify
|
|
19
|
+
# api_token:
|
|
20
|
+
# project_id:
|
|
19
21
|
```
|
|
20
22
|
|
|
21
|
-
Or
|
|
23
|
+
Or specify values programmatically (see [Usage from Ruby](#usage-from-ruby) for details).
|
|
24
|
+
|
|
25
|
+
You can also manually create `.beam_up.yml` (or `config/beam_up.yml`):
|
|
22
26
|
```yaml
|
|
23
27
|
provider: netlify
|
|
24
28
|
# path: ./output # optional
|
|
@@ -51,6 +55,7 @@ beam_up ./output --provider bunny
|
|
|
51
55
|
- hetzner
|
|
52
56
|
- neocities
|
|
53
57
|
- netlify
|
|
58
|
+
- [Seal Static](https://sealstatic.com/)
|
|
54
59
|
- sftp
|
|
55
60
|
- statichost
|
|
56
61
|
|
|
@@ -60,6 +65,10 @@ beam_up ./output --provider bunny
|
|
|
60
65
|
```ruby
|
|
61
66
|
require "beam_up"
|
|
62
67
|
|
|
68
|
+
# Configure a provider interactively
|
|
69
|
+
BeamUp.init! "netlify"
|
|
70
|
+
|
|
71
|
+
# Deploy
|
|
63
72
|
BeamUp.deploy! "./output"
|
|
64
73
|
|
|
65
74
|
# Deploy with provider override
|
|
@@ -75,6 +84,7 @@ Run commands before and after deployment:
|
|
|
75
84
|
|
|
76
85
|
```yaml
|
|
77
86
|
provider: netlify
|
|
87
|
+
|
|
78
88
|
before_actions:
|
|
79
89
|
- npm run build
|
|
80
90
|
after_actions:
|
data/lib/beam_up/cli.rb
CHANGED
|
@@ -39,33 +39,13 @@ module BeamUp
|
|
|
39
39
|
exit(1)
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
config_keys = provider_config_class.config_keys
|
|
44
|
-
config_file = ["config/beam_up.yml", ".beam_up.yml"].find { File.exist?(it) }
|
|
42
|
+
path = BeamUp.init!(provider_name)
|
|
45
43
|
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
puts "Configured #{provider_name} in #{path}"
|
|
45
|
+
rescue ConfigurationError => error
|
|
46
|
+
puts error.message
|
|
48
47
|
|
|
49
|
-
|
|
50
|
-
puts "Provider '#{provider_name}' already configured in #{config_file}"
|
|
51
|
-
|
|
52
|
-
exit(1)
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
provider_section = YAML.dump({provider_name => config_keys.to_h { [it, ""] }}, indent: 2, line_width: 80).sub(/^---\n/, "")
|
|
56
|
-
File.write(config_file, File.read(config_file) + "\n" + provider_section)
|
|
57
|
-
|
|
58
|
-
puts "Updated #{config_file} with #{provider_name} provider"
|
|
59
|
-
else
|
|
60
|
-
configuration = YAML.dump({
|
|
61
|
-
"provider" => provider_name,
|
|
62
|
-
"path" => nil,
|
|
63
|
-
provider_name => config_keys.to_h { |key| [key, ""] }
|
|
64
|
-
}, indent: 2, line_width: 80).gsub(/^path:$/, "# path: ./output # uncomment to set a default folder")
|
|
65
|
-
|
|
66
|
-
File.write(".beam_up.yml", configuration)
|
|
67
|
-
puts "Created .beam_up.yml with #{provider_name} provider"
|
|
68
|
-
end
|
|
48
|
+
exit(1)
|
|
69
49
|
end
|
|
70
50
|
|
|
71
51
|
def deploy_or_help
|
|
@@ -82,12 +62,14 @@ module BeamUp
|
|
|
82
62
|
def deploy
|
|
83
63
|
input = parse_options
|
|
84
64
|
|
|
85
|
-
|
|
65
|
+
BeamUp.with_progress do
|
|
66
|
+
beamed = BeamUp.deploy! input, provider: @provider, config_file: @config_file
|
|
86
67
|
|
|
87
|
-
|
|
88
|
-
|
|
68
|
+
puts beamed.message
|
|
69
|
+
puts "Deploy ID: #{beamed.deploy_id}" if beamed.deploy_id
|
|
89
70
|
|
|
90
|
-
|
|
71
|
+
exit(1) unless beamed.success?
|
|
72
|
+
end
|
|
91
73
|
end
|
|
92
74
|
|
|
93
75
|
def scotty
|
data/lib/beam_up/core.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "yaml"
|
|
4
|
+
require "tty-prompt"
|
|
4
5
|
|
|
5
6
|
module BeamUp
|
|
6
7
|
class Core
|
|
@@ -38,6 +39,45 @@ module BeamUp
|
|
|
38
39
|
result
|
|
39
40
|
end
|
|
40
41
|
|
|
42
|
+
def init!(provider, config_file: nil, values: {})
|
|
43
|
+
raise ConfigurationError, "Unknown provider: #{provider}" unless PROVIDERS.key?(provider)
|
|
44
|
+
|
|
45
|
+
config_file ||= ["config/beam_up.yml", ".beam_up.yml"].find { File.exist?(it) }
|
|
46
|
+
config_file ||= ".beam_up.yml"
|
|
47
|
+
|
|
48
|
+
if File.exist?(config_file)
|
|
49
|
+
data = YAML.safe_load_file(config_file) || {}
|
|
50
|
+
|
|
51
|
+
raise ConfigurationError, "Provider '#{provider}' already configured in #{config_file}" if data.key?(provider)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
config_keys = PROVIDERS[provider]::Config.config_keys
|
|
55
|
+
|
|
56
|
+
if values.empty? && $stdout.tty? && !ENV["TTY_TEST"]
|
|
57
|
+
prompt = TTY::Prompt.new
|
|
58
|
+
|
|
59
|
+
values = config_keys.to_h { |key| [key, prompt.ask("#{key}:") { it.required false }.to_s] }
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
configured_values = config_keys.to_h { [it, values[it].to_s] }
|
|
63
|
+
|
|
64
|
+
if File.exist?(config_file)
|
|
65
|
+
section = YAML.dump({provider => configured_values}, indent: 2, line_width: 80).sub(/^---\n/, "")
|
|
66
|
+
|
|
67
|
+
File.write(config_file, File.read(config_file) + "\n" + section)
|
|
68
|
+
else
|
|
69
|
+
yaml = YAML.dump({
|
|
70
|
+
"provider" => provider,
|
|
71
|
+
"path" => nil,
|
|
72
|
+
provider => configured_values
|
|
73
|
+
}, indent: 2, line_width: 80).gsub(/^path:$/, "# path: ./output # uncomment to set a default folder")
|
|
74
|
+
|
|
75
|
+
File.write(config_file, yaml)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
config_file
|
|
79
|
+
end
|
|
80
|
+
|
|
41
81
|
private
|
|
42
82
|
|
|
43
83
|
def configuration_file(custom_path = nil)
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module BeamUp
|
|
4
|
+
class Progress
|
|
5
|
+
def initialize
|
|
6
|
+
@mutex = Thread::Mutex.new
|
|
7
|
+
@current = 0
|
|
8
|
+
@total = nil
|
|
9
|
+
@type = nil
|
|
10
|
+
@spinner_index = 0
|
|
11
|
+
end
|
|
12
|
+
attr_reader :total, :current, :type
|
|
13
|
+
|
|
14
|
+
def start(type:, total:)
|
|
15
|
+
@mutex.synchronize do
|
|
16
|
+
@type = type
|
|
17
|
+
@total = total
|
|
18
|
+
@current = 0
|
|
19
|
+
@spinner_index = 0
|
|
20
|
+
|
|
21
|
+
render
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def tick(bytes: nil)
|
|
26
|
+
@mutex.synchronize do
|
|
27
|
+
@current += (@type == :bytes) ? bytes.to_i : 1
|
|
28
|
+
|
|
29
|
+
render
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def finish
|
|
34
|
+
@mutex.synchronize do
|
|
35
|
+
return if @total.nil?
|
|
36
|
+
|
|
37
|
+
stop_render
|
|
38
|
+
|
|
39
|
+
@total = nil
|
|
40
|
+
@current = nil
|
|
41
|
+
@type = nil
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
private
|
|
46
|
+
|
|
47
|
+
SPINNERS = %w[⠋ ⠙ ⠹ ⠸ ⠼ ⠴ ⠦ ⠧ ⠇]
|
|
48
|
+
|
|
49
|
+
def render
|
|
50
|
+
return unless tty?
|
|
51
|
+
|
|
52
|
+
spinner = SPINNERS[@spinner_index % SPINNERS.length]
|
|
53
|
+
@spinner_index += 1
|
|
54
|
+
|
|
55
|
+
line = if @type == :bytes
|
|
56
|
+
"#{spinner} #{formatted(@current)} of #{formatted(@total)}"
|
|
57
|
+
else
|
|
58
|
+
"#{spinner} #{@current} of #{@total}"
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
$stdout.write("\r#{line}")
|
|
62
|
+
|
|
63
|
+
$stdout.flush
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def stop_render
|
|
67
|
+
$stdout.write("\r#{" " * 80}\r")
|
|
68
|
+
|
|
69
|
+
$stdout.flush
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def tty? = $stdout.tty?
|
|
73
|
+
|
|
74
|
+
def formatted(bytes)
|
|
75
|
+
return format("%.1fGB", bytes.to_f / 1_073_741_824) if bytes >= 1_073_741_824
|
|
76
|
+
return format("%.1fMB", bytes.to_f / 1_048_576) if bytes >= 1_048_576
|
|
77
|
+
return format("%.1fKB", bytes.to_f / 1024) if bytes >= 1024
|
|
78
|
+
|
|
79
|
+
"#{bytes}B"
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
@@ -28,6 +28,9 @@ module BeamUp
|
|
|
28
28
|
def deploy!(path)
|
|
29
29
|
@path = path
|
|
30
30
|
|
|
31
|
+
files = files_to_deploy
|
|
32
|
+
BeamUp.progress&.start(type: :files, total: files.count)
|
|
33
|
+
|
|
31
34
|
upload_files
|
|
32
35
|
|
|
33
36
|
Result.new(
|
|
@@ -37,6 +40,8 @@ module BeamUp
|
|
|
37
40
|
)
|
|
38
41
|
rescue => error
|
|
39
42
|
Result.new(provider: "Neocities", error: error.message)
|
|
43
|
+
ensure
|
|
44
|
+
BeamUp.progress&.finish
|
|
40
45
|
end
|
|
41
46
|
|
|
42
47
|
private
|
|
@@ -62,7 +62,9 @@ module BeamUp
|
|
|
62
62
|
required_shas = response["required"] || []
|
|
63
63
|
return if required_shas.empty?
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
BeamUp.progress&.start(type: :files, total: required_shas.count)
|
|
66
|
+
|
|
67
|
+
required_shas.each do |sha|
|
|
66
68
|
file_path = file_map_from(files)[sha]
|
|
67
69
|
next if file_path.nil? || file_path.empty?
|
|
68
70
|
|
|
@@ -70,7 +72,10 @@ module BeamUp
|
|
|
70
72
|
escaped_path = CGI.escape(relative_path.delete_prefix("/"))
|
|
71
73
|
|
|
72
74
|
put("/deploys/#{response["id"]}/files/#{escaped_path}", File.read(file_path))
|
|
75
|
+
BeamUp.progress&.tick
|
|
73
76
|
end
|
|
77
|
+
ensure
|
|
78
|
+
BeamUp.progress&.finish
|
|
74
79
|
end
|
|
75
80
|
|
|
76
81
|
def message
|
|
@@ -8,8 +8,12 @@ module BeamUp
|
|
|
8
8
|
def deploy!(path)
|
|
9
9
|
@path = path
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
files = files_to_deploy
|
|
12
|
+
BeamUp.progress&.start(type: :files, total: files.count)
|
|
13
|
+
|
|
14
|
+
files.each do |file|
|
|
12
15
|
upload file.delete_prefix("#{@path}/"), file
|
|
16
|
+
BeamUp.progress&.tick
|
|
13
17
|
end
|
|
14
18
|
|
|
15
19
|
Result.new(
|
|
@@ -19,6 +23,8 @@ module BeamUp
|
|
|
19
23
|
)
|
|
20
24
|
rescue => error
|
|
21
25
|
Result.new(provider: provider_name, error: error.message)
|
|
26
|
+
ensure
|
|
27
|
+
BeamUp.progress&.finish
|
|
22
28
|
end
|
|
23
29
|
|
|
24
30
|
private
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "net/http"
|
|
4
|
+
require "uri"
|
|
5
|
+
require "json"
|
|
6
|
+
require "zip"
|
|
7
|
+
require "tempfile"
|
|
8
|
+
|
|
9
|
+
module BeamUp
|
|
10
|
+
module Providers
|
|
11
|
+
class SealStatic < Base
|
|
12
|
+
BASE_URL = "https://app.sealstatic.com/api"
|
|
13
|
+
|
|
14
|
+
class Config
|
|
15
|
+
def self.config_keys = %w[api_key]
|
|
16
|
+
|
|
17
|
+
attr_accessor :api_key
|
|
18
|
+
|
|
19
|
+
def with(options)
|
|
20
|
+
self.api_key = options[:api_key]
|
|
21
|
+
self
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def validate!
|
|
25
|
+
raise ConfigurationError, "API key must be set" if api_key.nil? || api_key.empty?
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def deploy!(path)
|
|
30
|
+
@path = path
|
|
31
|
+
|
|
32
|
+
zipped_file = create_zip(path)
|
|
33
|
+
BeamUp.progress&.start(type: :bytes, total: zipped_file.size)
|
|
34
|
+
response = upload zipped_file
|
|
35
|
+
|
|
36
|
+
return Result.new(provider: "Seal Static", error: response["error"]) if response["error"]
|
|
37
|
+
|
|
38
|
+
Result.new(
|
|
39
|
+
provider: "Seal Static",
|
|
40
|
+
url: response["url"]
|
|
41
|
+
)
|
|
42
|
+
rescue => error
|
|
43
|
+
Result.new(provider: "Seal Static", error: error.message)
|
|
44
|
+
ensure
|
|
45
|
+
BeamUp.progress&.finish
|
|
46
|
+
zipped_file&.close!
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
private
|
|
50
|
+
|
|
51
|
+
def create_zip(path)
|
|
52
|
+
temporary_file = Tempfile.new(["seal_static", ".zip"], binmode: true)
|
|
53
|
+
|
|
54
|
+
Zip::OutputStream.open(temporary_file) do |zip|
|
|
55
|
+
files_to_deploy.each do |file|
|
|
56
|
+
relative_path = file.delete_prefix("#{path}/")
|
|
57
|
+
|
|
58
|
+
zip.put_next_entry(relative_path)
|
|
59
|
+
zip.write(File.read(file))
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
temporary_file.rewind
|
|
64
|
+
temporary_file
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def upload(zipped_file)
|
|
68
|
+
uri = URI("#{BASE_URL}/uploads")
|
|
69
|
+
|
|
70
|
+
boundary = "----BeamUpBoundary#{SecureRandom.hex(16)}"
|
|
71
|
+
body = multipart_body(boundary, zipped_file)
|
|
72
|
+
|
|
73
|
+
request = Net::HTTP::Post.new(uri)
|
|
74
|
+
request["Authorization"] = "Bearer #{@configuration.api_key}"
|
|
75
|
+
request["Content-Type"] = "multipart/form-data; boundary=#{boundary}"
|
|
76
|
+
request["Accept"] = "application/json"
|
|
77
|
+
request.body = body
|
|
78
|
+
|
|
79
|
+
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(request) }
|
|
80
|
+
|
|
81
|
+
case response.code.to_i
|
|
82
|
+
when 200..299
|
|
83
|
+
response.body.empty? ? {} : JSON.parse(response.body)
|
|
84
|
+
else
|
|
85
|
+
raise DeploymentError, "Seal Static API error: #{response.code} #{response.body}"
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def multipart_body(boundary, zipped_file)
|
|
90
|
+
content = zipped_file.read
|
|
91
|
+
filename = "site.zip"
|
|
92
|
+
|
|
93
|
+
parts = []
|
|
94
|
+
parts << "--#{boundary}\r\n"
|
|
95
|
+
parts << "Content-Disposition: form-data; name=\"file\"; filename=\"#{filename}\"\r\n"
|
|
96
|
+
parts << "Content-Type: application/zip\r\n"
|
|
97
|
+
parts << "\r\n"
|
|
98
|
+
parts << content
|
|
99
|
+
parts << "\r\n"
|
|
100
|
+
parts << "--#{boundary}--\r\n"
|
|
101
|
+
parts.join
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
|
@@ -38,9 +38,13 @@ module BeamUp
|
|
|
38
38
|
}
|
|
39
39
|
options[:keys] = [@configuration.key] if @configuration.key
|
|
40
40
|
|
|
41
|
+
files = files_to_deploy
|
|
42
|
+
BeamUp.progress&.start(type: :files, total: files.count)
|
|
43
|
+
|
|
41
44
|
Net::SFTP.start(@configuration.host, @configuration.username, options) do |sftp|
|
|
42
|
-
|
|
45
|
+
files.each do |file|
|
|
43
46
|
upload sftp, file
|
|
47
|
+
BeamUp.progress&.tick
|
|
44
48
|
end
|
|
45
49
|
end
|
|
46
50
|
|
|
@@ -53,6 +57,8 @@ module BeamUp
|
|
|
53
57
|
raise ConfigurationError, "SFTP requires net-sftp gem. Install with: gem install net-sftp (or add to Gemfile)"
|
|
54
58
|
rescue => error
|
|
55
59
|
Result.new(provider: "SFTP", error: error.message)
|
|
60
|
+
ensure
|
|
61
|
+
BeamUp.progress&.finish
|
|
56
62
|
end
|
|
57
63
|
|
|
58
64
|
private
|
|
@@ -30,6 +30,7 @@ module BeamUp
|
|
|
30
30
|
@path = path
|
|
31
31
|
|
|
32
32
|
zipped_file = create_zip path
|
|
33
|
+
BeamUp.progress&.start(type: :bytes, total: zipped_file.size)
|
|
33
34
|
response = upload zipped_file
|
|
34
35
|
|
|
35
36
|
Result.new(
|
|
@@ -41,6 +42,7 @@ module BeamUp
|
|
|
41
42
|
Result.new(provider: "Statichost", error: error.message)
|
|
42
43
|
ensure
|
|
43
44
|
zipped_file&.close!
|
|
45
|
+
BeamUp.progress&.finish
|
|
44
46
|
end
|
|
45
47
|
|
|
46
48
|
private
|
|
@@ -24,8 +24,7 @@ module BeamUp
|
|
|
24
24
|
@path = path
|
|
25
25
|
files = files_to_deploy
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
puts "Matter stream detected: #{files.length} files"
|
|
27
|
+
BeamUp.progress&.start(type: :files, total: files.length)
|
|
29
28
|
|
|
30
29
|
FileUtils.mkdir_p(@configuration.target_directory)
|
|
31
30
|
|
|
@@ -36,7 +35,7 @@ module BeamUp
|
|
|
36
35
|
FileUtils.mkdir_p(File.dirname(target_path))
|
|
37
36
|
FileUtils.cp(file, target_path)
|
|
38
37
|
|
|
39
|
-
|
|
38
|
+
BeamUp.progress&.tick
|
|
40
39
|
end
|
|
41
40
|
|
|
42
41
|
puts "Transport complete. Files materialized at: #{@configuration.target_directory}"
|
|
@@ -48,6 +47,8 @@ module BeamUp
|
|
|
48
47
|
)
|
|
49
48
|
rescue => error
|
|
50
49
|
Result.new(provider: "Transporter", error: error.message)
|
|
50
|
+
ensure
|
|
51
|
+
BeamUp.progress&.finish
|
|
51
52
|
end
|
|
52
53
|
end
|
|
53
54
|
end
|
data/lib/beam_up/providers.rb
CHANGED
|
@@ -7,6 +7,8 @@ require "beam_up/providers/digital_ocean_spaces"
|
|
|
7
7
|
require "beam_up/providers/hetzner"
|
|
8
8
|
require "beam_up/providers/neocities"
|
|
9
9
|
require "beam_up/providers/netlify"
|
|
10
|
+
require "beam_up/providers/s3_compatible"
|
|
11
|
+
require "beam_up/providers/seal_static"
|
|
10
12
|
require "beam_up/providers/sftp"
|
|
11
13
|
require "beam_up/providers/statichost"
|
|
12
14
|
require "beam_up/providers/transporter"
|
data/lib/beam_up/result.rb
CHANGED
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
module BeamUp
|
|
4
4
|
class Result
|
|
5
|
-
attr_reader :deploy_id, :error, :provider
|
|
5
|
+
attr_reader :deploy_id, :error, :provider, :api_key
|
|
6
6
|
|
|
7
|
-
def initialize(provider:, deploy_id: nil, url: nil, error: nil)
|
|
7
|
+
def initialize(provider:, deploy_id: nil, url: nil, error: nil, api_key: nil)
|
|
8
8
|
@provider = provider
|
|
9
9
|
@deploy_id = deploy_id
|
|
10
10
|
@url = url
|
|
11
11
|
@error = error
|
|
12
|
+
@api_key = api_key
|
|
12
13
|
end
|
|
13
14
|
|
|
14
15
|
def success? = @error.nil?
|
data/lib/beam_up/version.rb
CHANGED
data/lib/beam_up.rb
CHANGED
|
@@ -5,6 +5,7 @@ require "beam_up/errors"
|
|
|
5
5
|
require "beam_up/providers"
|
|
6
6
|
require "beam_up/configuration"
|
|
7
7
|
require "beam_up/result"
|
|
8
|
+
require "beam_up/progress"
|
|
8
9
|
require "beam_up/core"
|
|
9
10
|
require "beam_up/cli"
|
|
10
11
|
|
|
@@ -16,12 +17,25 @@ module BeamUp
|
|
|
16
17
|
"hetzner" => Providers::Hetzner,
|
|
17
18
|
"neocities" => Providers::Neocities,
|
|
18
19
|
"netlify" => Providers::Netlify,
|
|
20
|
+
"seal_static" => Providers::SealStatic,
|
|
19
21
|
"sftp" => Providers::SFTP,
|
|
20
22
|
"statichost" => Providers::Statichost,
|
|
21
23
|
"transporter" => Providers::Transporter
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
class << self
|
|
27
|
+
attr_accessor :progress
|
|
28
|
+
|
|
29
|
+
def with_progress
|
|
30
|
+
self.progress = Progress.new
|
|
31
|
+
|
|
32
|
+
yield
|
|
33
|
+
ensure
|
|
34
|
+
progress&.finish
|
|
35
|
+
|
|
36
|
+
self.progress = nil
|
|
37
|
+
end
|
|
38
|
+
|
|
25
39
|
def configure(&block) = Core.configure(&block)
|
|
26
40
|
|
|
27
41
|
def config_file=(path)
|
|
@@ -31,5 +45,7 @@ module BeamUp
|
|
|
31
45
|
def configuration(config_file: nil) = Core.configuration(config_file: config_file)
|
|
32
46
|
|
|
33
47
|
def deploy!(path = nil, provider: nil, to: nil, config_file: nil) = Core.deploy!(path, provider: (to || provider)&.to_s, config_file: config_file)
|
|
48
|
+
|
|
49
|
+
def init!(provider, config_file: nil, values: {}) = Core.init!(provider, config_file: config_file, values: values)
|
|
34
50
|
end
|
|
35
51
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: beam_up
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rails Designer
|
|
@@ -51,8 +51,22 @@ dependencies:
|
|
|
51
51
|
- - "~>"
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
53
|
version: '3.0'
|
|
54
|
+
- !ruby/object:Gem::Dependency
|
|
55
|
+
name: tty-prompt
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - "~>"
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '0.23'
|
|
61
|
+
type: :runtime
|
|
62
|
+
prerelease: false
|
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - "~>"
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '0.23'
|
|
54
68
|
description: Beam Up is a deployment CLI for static sites that works with popular
|
|
55
|
-
hosting providers like Netlify, AWS S3,
|
|
69
|
+
hosting providers like Netlify, AWS S3, Seal Static, statichost.eu and Hetzner.
|
|
56
70
|
Configure it once, then deploy your site to any provider with a single command.
|
|
57
71
|
Use it from the command line, embed it in your Ruby scripts or integrate it into
|
|
58
72
|
your CI/CD pipeline.
|
|
@@ -69,6 +83,7 @@ files:
|
|
|
69
83
|
- lib/beam_up/configuration.rb
|
|
70
84
|
- lib/beam_up/core.rb
|
|
71
85
|
- lib/beam_up/errors.rb
|
|
86
|
+
- lib/beam_up/progress.rb
|
|
72
87
|
- lib/beam_up/providers.rb
|
|
73
88
|
- lib/beam_up/providers/aws_s3.rb
|
|
74
89
|
- lib/beam_up/providers/base.rb
|
|
@@ -78,6 +93,7 @@ files:
|
|
|
78
93
|
- lib/beam_up/providers/neocities.rb
|
|
79
94
|
- lib/beam_up/providers/netlify.rb
|
|
80
95
|
- lib/beam_up/providers/s3_compatible.rb
|
|
96
|
+
- lib/beam_up/providers/seal_static.rb
|
|
81
97
|
- lib/beam_up/providers/sftp.rb
|
|
82
98
|
- lib/beam_up/providers/statichost.rb
|
|
83
99
|
- lib/beam_up/providers/transporter.rb
|
|
@@ -86,7 +102,9 @@ files:
|
|
|
86
102
|
homepage: https://railsdesigner.com/open-source/beam-up/
|
|
87
103
|
licenses:
|
|
88
104
|
- MIT
|
|
89
|
-
metadata:
|
|
105
|
+
metadata:
|
|
106
|
+
homepage_uri: https://railsdesigner.com/open-source/beam-up/
|
|
107
|
+
source_code_uri: https://github.com/Rails-Designer/beam_up/
|
|
90
108
|
rdoc_options: []
|
|
91
109
|
require_paths:
|
|
92
110
|
- lib
|
|
@@ -101,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
101
119
|
- !ruby/object:Gem::Version
|
|
102
120
|
version: '0'
|
|
103
121
|
requirements: []
|
|
104
|
-
rubygems_version: 4.0.
|
|
122
|
+
rubygems_version: 4.0.14
|
|
105
123
|
specification_version: 4
|
|
106
124
|
summary: A CLI tool that deploys your static sites to multiple hosting providers from
|
|
107
125
|
a single command.
|