mimas-bridgetown 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b50f042aec9ed40b035f7f06c6b8c052cd92005065e421cb813e23c5853f74c7
4
+ data.tar.gz: da54be33b3b1ea5d7eaf6d470344c2686fb18612c60be23dbbd0d1be932bd4fa
5
+ SHA512:
6
+ metadata.gz: fa1c0f65fa6a295f178fc606220c910816cbfb79eb00a0f37dad4526134b477a6f7326ca878623c702bfa53149d0bd6f7f09a0dbdf6802d6c7e71e8582c208bb
7
+ data.tar.gz: 46891f14c006e82dd53ffc2128fa41e7522ec1de0995248a2225d25fc48a37d7d7c8f69699d97a225406297c85b984e8faa5f3539d6b761b95ff5277d11d133e
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gemspec
6
+
7
+ gem "rake"
data/Gemfile.lock ADDED
@@ -0,0 +1,46 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ mimas-bridgetown (0.1.0)
5
+ mimas
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ bcrypt_pbkdf (1.1.2)
11
+ dry-cli (1.4.1)
12
+ ed25519 (1.4.0)
13
+ logger (1.7.0)
14
+ mimas (0.1.0)
15
+ bcrypt_pbkdf (~> 1.0)
16
+ dry-cli (~> 1.4)
17
+ ed25519 (~> 1.2)
18
+ logger (~> 1.7)
19
+ net-scp (~> 4.1)
20
+ net-ssh (~> 7.3)
21
+ net-scp (4.1.0)
22
+ net-ssh (>= 2.6.5, < 8.0.0)
23
+ net-ssh (7.3.3)
24
+ rake (13.4.2)
25
+
26
+ PLATFORMS
27
+ arm64-darwin-23
28
+ ruby
29
+
30
+ DEPENDENCIES
31
+ mimas-bridgetown!
32
+ rake
33
+
34
+ CHECKSUMS
35
+ bcrypt_pbkdf (1.1.2) sha256=c2414c23ce66869b3eb9f643d6a3374d8322dfb5078125c82792304c10b94cf6
36
+ dry-cli (1.4.1) sha256=b8015bb76c708aa8705a36faf694973e75eeeffca39b89c8e172dc6f66a7d874
37
+ ed25519 (1.4.0) sha256=16e97f5198689a154247169f3453ef4cfd3f7a47481fde0ae33206cdfdcac506
38
+ logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
39
+ mimas (0.1.0) sha256=2b7edf531824e6f1cd6938f081692ab8118882e89bf0e9f4a4113eb5852f83f2
40
+ mimas-bridgetown (0.1.0)
41
+ net-scp (4.1.0) sha256=a99b0b92a1e5d360b0de4ffbf2dc0c91531502d3d4f56c28b0139a7c093d1a5d
42
+ net-ssh (7.3.3) sha256=831def58b2c51dcef66ec00d29397d4f210de89c19fe78f95873ca30f386e86a
43
+ rake (13.4.2) sha256=cb825b2bd5f1f8e91ca37bddb4b9aaf345551b4731da62949be002fa89283701
44
+
45
+ BUNDLED WITH
46
+ 4.0.10
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2026-present Ayush Newatia
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # Bridgetown Plugin for Mimas
2
+
3
+ Mimas is a CLI tool to orchestrate server provisioning and zero-downtime deploys for static sites and Ruby apps.
4
+
5
+ This plugin helps setup Mimas for Bridgetown projects.
6
+
7
+ ## Installing
8
+
9
+ Install Mimas and this plugin:
10
+
11
+ ```shell
12
+ $ bundle add mimas-bridgetown
13
+ $ bundle binstub mimas
14
+ ```
15
+
16
+ ## Create Deployment Files
17
+
18
+ Run the `init` command to setup the config files needed by Mimas:
19
+
20
+ ```shell
21
+ $ bin/mimas init
22
+ ```
23
+
24
+ You'll be prompted for details about your domain and server. The plugin provides configurations for static sites as well as hybrid apps that contain a Ruby service as well.
25
+
26
+ A pre-deploy hook to build you Bridgetown site will also be set up.
27
+
28
+ ## Deploying
29
+
30
+ Provision your server if you haven't already:
31
+
32
+ ```shell
33
+ $ bin/mimas provision production
34
+ ```
35
+
36
+ Push your site to your server:
37
+
38
+ ```shell
39
+ # Push a static site only
40
+ $ bin/mimas push production
41
+
42
+ # Push a hybrid app
43
+ $ bin/mimas push static production
44
+ $ bin/mimas push api production
45
+ ```
46
+
47
+ See the [Mimas Readme](https://codeberg.org/ayushn21/mimas) for complete usage and configuration details.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,70 @@
1
+ module Mimas
2
+ module Plugins
3
+ module Bridgetown
4
+ module Commands
5
+ class Init < Mimas::CLI::Commands::BaseCommand
6
+ desc "Create a Mimas config file for Bridgetown"
7
+
8
+ def call
9
+ say "Initialising Mimas. We need some information about your site."
10
+ say ""
11
+
12
+ say "Your site's domain will be the containing folder on the server."
13
+ domain = ask "What is your site's domain name?"
14
+ ip = ask "What is your production server's IP address?"
15
+ site_type = ask "Are you creating a \n 1. Static site \n 2. Static site and Ruby service \n (1 | 2)"
16
+ site_type = site_types[site_type]
17
+
18
+ app_server = Bundler.load.requested_specs.map(&:name).filter { ["falcon", "puma"].include?(it) }.first
19
+ server_confirmation = "n"
20
+ if site_type == :hybrid
21
+ server_confirmation = ask "Are you using the #{app_server} server? (y|n)" if app_server
22
+
23
+ unless server_confirmation.downcase == "y"
24
+ say "Bridgetown and Mimas natively support Falcon and Puma. To use another server, ensure you configure it to bind to a unix socket defined in `ENV['MIMAS_UNIX_SOCKET']`".white.bold
25
+ end
26
+ end
27
+
28
+ Dir.mkdir("deploy") unless Dir.exist? "deploy"
29
+
30
+ destination_dir = File.join(Dir.pwd, Mimas::Config::DEFAULT_DIRECTORY)
31
+
32
+ config_dir = File.join(__dir__, "..", "templates")
33
+ configrb = template("config.rb", dir: config_dir, ip: ip, domain: domain, site_type: site_type, app_server: app_server)
34
+ File.write(File.join(destination_dir, "mimas.rb"), configrb)
35
+
36
+ if site_type == :hybrid
37
+ copy_file(destination_dir, "Caddyfile.static.erb")
38
+ copy_file(destination_dir, "Caddyfile.ruby.erb", rename: "Caddyfile.api.erb")
39
+
40
+ if server_confirmation == "y"
41
+ if app_server == "falcon"
42
+ falconrb = template("falcon.rb", domain: domain)
43
+ File.write(File.join(destination_dir, "falcon.rb"), falconrb)
44
+ elsif app_server == "puma"
45
+ copy_file(destination_dir, "puma.rb")
46
+ end
47
+ end
48
+
49
+ else
50
+ copy_file(destination_dir, "Caddyfile.static.erb", rename: "Caddyfile.erb")
51
+ end
52
+
53
+ Dir.mkdir("tmp") unless Dir.exist?("tmp")
54
+
55
+ say ""
56
+ say "Successfully created files under `deploy/`. Customise your deployment by editing these files."
57
+ say "Please ensure your DNS is correctly configured."
58
+ end
59
+
60
+ def site_types
61
+ {
62
+ "1" => :static,
63
+ "2" => :hybrid
64
+ }
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,57 @@
1
+ <% if site_type == :static -%>
2
+ site do
3
+ domain "<%= domain %>"
4
+ root_dir "output"
5
+ glob "**/*"
6
+ end
7
+ <% elsif site_type == :hybrid -%>
8
+ site :static do
9
+ domain "<%= domain %>"
10
+ root_dir "output"
11
+ glob "**/*"
12
+ end
13
+
14
+ site :api do
15
+ domain "api.<%= domain %>"
16
+ files do
17
+ `git ls-files -z`.split("\x0")
18
+ .reject { it.match(%r!(bin|mimas.rb|Caddyfile)!) }
19
+ end
20
+
21
+ healthcheck_path "/"
22
+
23
+ # Access the console by running `mimas console SERVER_NAME`
24
+ console "bin/bt console"
25
+
26
+ env do
27
+ <<~STRING
28
+ BRIDGETOWN_ENV=production
29
+ STRING
30
+ end
31
+
32
+ # Mimas automatically runs `bundle install` on deploy if no deploy script is defined.
33
+ # Ensure you invoke `bundle install` if you provide your own script here.
34
+ # deploy do
35
+ # <<~STRING
36
+ # STRING
37
+ # end
38
+
39
+ services do
40
+ web do
41
+ <% if app_server == "puma" -%>
42
+ start "bundle exec puma -C deploy/puma.rb"
43
+ <% elsif app_server == "falcon" -%>
44
+ start "bundle exec falcon host deploy/falcon.rb"
45
+ <% else -%>
46
+ # TODO: Add your server's start command
47
+ start "bundle exec #start server"
48
+ <% end -%>
49
+ end
50
+ end
51
+ end
52
+ <% end -%>
53
+
54
+ server :production do
55
+ host "<%= ip %>"
56
+ user "deploy"
57
+ end
@@ -0,0 +1,7 @@
1
+ module Mimas
2
+ module Plugins
3
+ module Bridgetown
4
+ VERSION = "0.1.0"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,21 @@
1
+ module Mimas
2
+ module Plugins
3
+ module Bridgetown
4
+ extend self
5
+
6
+ def commands
7
+ { "init" => Commands::Init }
8
+ end
9
+
10
+ def hooks
11
+ hooks = Mimas::Hooks.new
12
+
13
+ hooks.before_push do
14
+ `bin/bt deploy`
15
+ end
16
+
17
+ hooks
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,5 @@
1
+ require "mimas"
2
+ require_relative "mimas/plugins/bridgetown"
3
+ require_relative "mimas/plugins/bridgetown/commands/init"
4
+
5
+ Mimas::Plugins.register(Mimas::Plugins::Bridgetown)
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/mimas/plugins/bridgetown/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "mimas-bridgetown"
7
+ spec.version = Mimas::Plugins::Bridgetown::VERSION
8
+ spec.author = "Ayush Newatia"
9
+ spec.email = "ayush@hey.com"
10
+ spec.summary = "Simplify Bridgetown deployment using Mimas"
11
+ spec.license = "MIT"
12
+
13
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r!^(test)/!) }
14
+ spec.test_files = spec.files.grep(%r!^test/!)
15
+
16
+ spec.metadata["mimas_plugin"] = "true"
17
+
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.required_ruby_version = ">= 3.4.0"
21
+
22
+ spec.add_dependency "mimas"
23
+ end
data/scripts/release ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+
3
+ # Tag and push a release to Rubygems
4
+
5
+ set -e
6
+
7
+ bundle exec rake release
metadata ADDED
@@ -0,0 +1,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mimas-bridgetown
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Ayush Newatia
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 2026-07-22 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: mimas
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '0'
26
+ email: ayush@hey.com
27
+ executables: []
28
+ extensions: []
29
+ extra_rdoc_files: []
30
+ files:
31
+ - Gemfile
32
+ - Gemfile.lock
33
+ - LICENSE.txt
34
+ - README.md
35
+ - Rakefile
36
+ - lib/mimas-bridgetown.rb
37
+ - lib/mimas/plugins/bridgetown.rb
38
+ - lib/mimas/plugins/bridgetown/commands/init.rb
39
+ - lib/mimas/plugins/bridgetown/templates/config.rb.erb
40
+ - lib/mimas/plugins/bridgetown/version.rb
41
+ - mimas-bridgetown.gemspec
42
+ - scripts/release
43
+ licenses:
44
+ - MIT
45
+ metadata:
46
+ mimas_plugin: 'true'
47
+ rdoc_options: []
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 3.4.0
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ requirements: []
61
+ rubygems_version: 3.6.2
62
+ specification_version: 4
63
+ summary: Simplify Bridgetown deployment using Mimas
64
+ test_files: []