majesticmonolith 0.1.4
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 +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +37 -0
- data/Rakefile +8 -0
- data/app/assets/config/monolith_manifest.js +1 -0
- data/app/assets/stylesheets/monolith/application.css +15 -0
- data/app/controllers/monolith/application_controller.rb +4 -0
- data/app/helpers/monolith/application_helper.rb +4 -0
- data/app/jobs/monolith/application_job.rb +4 -0
- data/app/mailers/monolith/application_mailer.rb +6 -0
- data/app/models/monolith/application_record.rb +5 -0
- data/app/views/layouts/monolith/application.html.erb +15 -0
- data/config/routes.rb +2 -0
- data/exe/monolith +5 -0
- data/lib/generators/monolith/install/USAGE +7 -0
- data/lib/generators/monolith/install/install_generator.rb +122 -0
- data/lib/generators/monolith/install/templates/Brewfile +9 -0
- data/lib/generators/monolith/install/templates/github/workflows/ruby.yml +59 -0
- data/lib/majestic-monolith.rb +2 -0
- data/lib/majesticmonolith.rb +2 -0
- data/lib/monolith/cli/template.rb +9 -0
- data/lib/monolith/cli.rb +21 -0
- data/lib/monolith/engine.rb +5 -0
- data/lib/monolith/version.rb +3 -0
- data/lib/monolith.rb +10 -0
- data/lib/tasks/monolith_tasks.rake +4 -0
- metadata +103 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 17c02a367aa01812a06187e8f0d130cf431cdc4e3d3f2483dd456463c5a79e53
|
4
|
+
data.tar.gz: 209f2cb6fdce365d78e56b27a1ded8bf03302a5bc15baf60bd3a078c9b086fb7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3b3166c0f9917175f310315429c394716aaadd823059a0320f1a3f75b1391ec95a46f624a770fc235982ef59b1411eaa6cfcf123a4ea08685a93a5cb46a5c250
|
7
|
+
data.tar.gz: 014020ae4feedd77bbbe3e391365b983b882865e8bb813911930ee862c947f9e9ddc7009edf3555d0c6a8a8ef3c262b2fd46aadadaeb003ea5260f11eeee9eb6
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2022 Brad Gessler
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# Monolith
|
2
|
+
|
3
|
+
A quick way to spin up a [Majestic Monlith](https://m.signalvnoise.com/the-majesticmonolith/) Rails application. [Rocketship](https://rocketship.io/) uses Monolith when building new SaaS applications.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Install the gem and add to the application's Gemfile by executing:
|
8
|
+
|
9
|
+
$ gem install majesticmonolith
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
Run the CLI utility to create a monolith:
|
14
|
+
|
15
|
+
$ monolith new my-rad-project
|
16
|
+
|
17
|
+
Monolith creates a new Rails project with the dependencies needed to be productive.
|
18
|
+
|
19
|
+
## Existing Rails applications
|
20
|
+
|
21
|
+
The gem may also be installed for existing Rails applications by executing:
|
22
|
+
|
23
|
+
$ bundle add majesticmonolith
|
24
|
+
|
25
|
+
Then run the following to see the available tasks:
|
26
|
+
|
27
|
+
$ rails generate --help
|
28
|
+
|
29
|
+
## Development
|
30
|
+
|
31
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
32
|
+
|
33
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
34
|
+
|
35
|
+
## Contributing
|
36
|
+
|
37
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/rocketship/monolith.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
//= link_directory ../stylesheets/monolith .css
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
data/config/routes.rb
ADDED
data/exe/monolith
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
class Monolith::InstallGenerator < Rails::Generators::Base
|
2
|
+
source_root File.expand_path("templates", __dir__)
|
3
|
+
|
4
|
+
desc "Installs the base gems for Monolith"
|
5
|
+
|
6
|
+
def append_gemfile
|
7
|
+
###### Authorization & Authentication ######
|
8
|
+
|
9
|
+
# Huh!? No omni-auth! Correct ... we just handle logins via email to start. Way
|
10
|
+
# less configuration and you need email addresses.
|
11
|
+
gem "nopassword", git: "https://github.com/rocketshipio/nopassword.git", branch: "main"
|
12
|
+
|
13
|
+
# Objects for authorizing user actions.
|
14
|
+
gem "pundit"
|
15
|
+
|
16
|
+
###### Views & UI ######
|
17
|
+
|
18
|
+
# Encapsulate views (instead of using partials)
|
19
|
+
gem "view_component"
|
20
|
+
|
21
|
+
# Displays UTC times from the database in the users local time, all computed client-side.
|
22
|
+
# Super duper useful for keeping times sane
|
23
|
+
gem "local_time"
|
24
|
+
|
25
|
+
# Instead of HAML or Erb. What's that? You don't like these shorthand template
|
26
|
+
# languages? I don't like chasing down empty Erb tags in a heavily compentized
|
27
|
+
# application, so slim wins the day.
|
28
|
+
gem "slim-rails", "~> 3.3"
|
29
|
+
|
30
|
+
###### Content Management ######
|
31
|
+
|
32
|
+
# Content is managed via Sitepress
|
33
|
+
gem "sitepress-rails", git: "https://github.com/sitepress/sitepress.git"
|
34
|
+
|
35
|
+
# Lots of markdown content for help, feature, and how-to articles.
|
36
|
+
gem "markdown-rails", "~> 1.0"
|
37
|
+
|
38
|
+
###### Analytics ######
|
39
|
+
|
40
|
+
# First-party analytics keeps privacy sane and Google out.
|
41
|
+
gem "ahoy_matey"
|
42
|
+
|
43
|
+
# Useful for running queries against Ahoy.
|
44
|
+
gem "groupdate"
|
45
|
+
|
46
|
+
###### Testing ######
|
47
|
+
|
48
|
+
# Some people hate rspec. No idea why, but I dig it, so its part of monolith.
|
49
|
+
gem "rspec-rails", group: [:development, :test]
|
50
|
+
|
51
|
+
# More sane than fixtures
|
52
|
+
gem "factory_bot", group: [:development, :test]
|
53
|
+
|
54
|
+
##### Other gems ######
|
55
|
+
|
56
|
+
# Parses dates
|
57
|
+
gem "chronic", "~> 0.10.2"
|
58
|
+
|
59
|
+
# Send all web addresses to the URL defined via CANONICAL_HOST, if present.
|
60
|
+
gem "rack-canonical-host", "~> 1.1"
|
61
|
+
end
|
62
|
+
|
63
|
+
def copy_files
|
64
|
+
template "Brewfile"
|
65
|
+
directory "github", ".github"
|
66
|
+
end
|
67
|
+
|
68
|
+
def bundle_gems
|
69
|
+
bundle_command "install"
|
70
|
+
end
|
71
|
+
|
72
|
+
def install_sitepress
|
73
|
+
generate "sitepress:install"
|
74
|
+
end
|
75
|
+
|
76
|
+
def install_nopassword
|
77
|
+
generate "nopassword:install"
|
78
|
+
end
|
79
|
+
|
80
|
+
def install_ahoy
|
81
|
+
generate "ahoy:install"
|
82
|
+
end
|
83
|
+
|
84
|
+
def post_install_message
|
85
|
+
say_status "next steps", <<~DOCS
|
86
|
+
[ ] Run `./bin/rails db:create db:migrate`
|
87
|
+
[ ] Launch the server via `./bin/dev`
|
88
|
+
[ ] Open `http://localhost:3000` in your browser
|
89
|
+
DOCS
|
90
|
+
end
|
91
|
+
|
92
|
+
private
|
93
|
+
# Lifted from https://github.com/bradgessler/rails/blob/bbd298d7b036c550912139b41903f9f37087befe/railties/lib/rails/generators/app_base.rb#L380-L404,
|
94
|
+
# which is not ideal. I tried to inherit `AppBase`, which also didn't work because it wanted an argument, which
|
95
|
+
# this generator does not need. Look into moving this into a module in Rails core and the including that in here
|
96
|
+
# or decomposing the `AppBase` Thor class in a way that would let me inherit it.
|
97
|
+
def bundle_command(command, env = {})
|
98
|
+
say_status :run, "bundle #{command}"
|
99
|
+
|
100
|
+
# We are going to shell out rather than invoking Bundler::CLI.new(command)
|
101
|
+
# because `rails new` loads the Thor gem and on the other hand bundler uses
|
102
|
+
# its own vendored Thor, which could be a different version. Running both
|
103
|
+
# things in the same process is a recipe for a night with paracetamol.
|
104
|
+
#
|
105
|
+
# Thanks to James Tucker for the Gem tricks involved in this call.
|
106
|
+
_bundle_command = Gem.bin_path("bundler", "bundle")
|
107
|
+
|
108
|
+
require "bundler"
|
109
|
+
Bundler.with_original_env do
|
110
|
+
exec_bundle_command(_bundle_command, command, env)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
def exec_bundle_command(bundle_command, command, env)
|
115
|
+
full_command = %Q["#{Gem.ruby}" "#{bundle_command}" #{command}]
|
116
|
+
if options[:quiet]
|
117
|
+
system(env, full_command, out: File::NULL)
|
118
|
+
else
|
119
|
+
system(env, full_command)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
|
6
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
7
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
8
|
+
|
9
|
+
name: Ruby
|
10
|
+
|
11
|
+
on:
|
12
|
+
push:
|
13
|
+
branches: [ main ]
|
14
|
+
pull_request:
|
15
|
+
branches: [ main ]
|
16
|
+
|
17
|
+
jobs:
|
18
|
+
test:
|
19
|
+
runs-on: ubuntu-latest
|
20
|
+
services:
|
21
|
+
postgres:
|
22
|
+
image: postgres
|
23
|
+
env:
|
24
|
+
POSTGRES_USER: postgres
|
25
|
+
POSTGRES_PASSWORD: postgres
|
26
|
+
options: >-
|
27
|
+
--health-cmd pg_isready
|
28
|
+
--health-interval 10s
|
29
|
+
--health-timeout 5s
|
30
|
+
--health-retries 5
|
31
|
+
ports:
|
32
|
+
- 5432:5432
|
33
|
+
strategy:
|
34
|
+
matrix:
|
35
|
+
ruby-version: [ '3.0', '3.1' ]
|
36
|
+
steps:
|
37
|
+
- uses: actions/checkout@v2
|
38
|
+
- name: Set up Ruby
|
39
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
40
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
41
|
+
uses: ruby/setup-ruby@v1
|
42
|
+
with:
|
43
|
+
ruby-version: ${{ matrix.ruby-version }}
|
44
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
45
|
+
- name: Set up Postgres
|
46
|
+
env:
|
47
|
+
PGHOST: localhost
|
48
|
+
PGUSER: postgres
|
49
|
+
PGPASSWORD: postgres
|
50
|
+
RAILS_ENV: test
|
51
|
+
run: |
|
52
|
+
bin/rails db:setup
|
53
|
+
- name: Run tests
|
54
|
+
env:
|
55
|
+
PGHOST: localhost
|
56
|
+
PGUSER: postgres
|
57
|
+
PGPASSWORD: postgres
|
58
|
+
RAILS_ENV: test
|
59
|
+
run: bundle exec rspec
|
data/lib/monolith/cli.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require "thor"
|
2
|
+
require "monolith/version"
|
3
|
+
|
4
|
+
module Monolith
|
5
|
+
class CLI < Thor
|
6
|
+
include Thor::Actions
|
7
|
+
|
8
|
+
DEFAULT_PROJECT_NAME = "server".freeze
|
9
|
+
|
10
|
+
desc "new [PROJECT_NAME]", "create a new Rails monolith"
|
11
|
+
def new(project_name = DEFAULT_PROJECT_NAME)
|
12
|
+
template_path = File.join File.expand_path(__dir__), "cli/template.rb"
|
13
|
+
run "rails new #{project_name} --template #{template_path} --database postgresql --css tailwind"
|
14
|
+
end
|
15
|
+
|
16
|
+
desc "version", "prints version of monolith"
|
17
|
+
def version
|
18
|
+
puts Monolith::VERSION
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/monolith.rb
ADDED
metadata
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: majesticmonolith
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brad Gessler
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-11-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 7.0.0
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 7.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: thor
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.0'
|
41
|
+
description: CLI used to create Rails monoliths by Rocketship for quickly building
|
42
|
+
SaaS applications.
|
43
|
+
email:
|
44
|
+
- bradgessler@gmail.com
|
45
|
+
executables:
|
46
|
+
- monolith
|
47
|
+
extensions: []
|
48
|
+
extra_rdoc_files: []
|
49
|
+
files:
|
50
|
+
- MIT-LICENSE
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- app/assets/config/monolith_manifest.js
|
54
|
+
- app/assets/stylesheets/monolith/application.css
|
55
|
+
- app/controllers/monolith/application_controller.rb
|
56
|
+
- app/helpers/monolith/application_helper.rb
|
57
|
+
- app/jobs/monolith/application_job.rb
|
58
|
+
- app/mailers/monolith/application_mailer.rb
|
59
|
+
- app/models/monolith/application_record.rb
|
60
|
+
- app/views/layouts/monolith/application.html.erb
|
61
|
+
- config/routes.rb
|
62
|
+
- exe/monolith
|
63
|
+
- lib/generators/monolith/install/USAGE
|
64
|
+
- lib/generators/monolith/install/install_generator.rb
|
65
|
+
- lib/generators/monolith/install/templates/Brewfile
|
66
|
+
- lib/generators/monolith/install/templates/github/workflows/ruby.yml
|
67
|
+
- lib/majestic-monolith.rb
|
68
|
+
- lib/majesticmonolith.rb
|
69
|
+
- lib/monolith.rb
|
70
|
+
- lib/monolith/cli.rb
|
71
|
+
- lib/monolith/cli/template.rb
|
72
|
+
- lib/monolith/engine.rb
|
73
|
+
- lib/monolith/version.rb
|
74
|
+
- lib/tasks/monolith_tasks.rake
|
75
|
+
homepage: https://github.com/majesticmonolith/cli
|
76
|
+
licenses:
|
77
|
+
- MIT
|
78
|
+
metadata:
|
79
|
+
allowed_push_host: https://rubygems.org
|
80
|
+
homepage_uri: https://github.com/majesticmonolith/cli
|
81
|
+
source_code_uri: https://github.com/majesticmonolith/cli
|
82
|
+
changelog_uri: https://github.com/majesticmonolith/cli/releases
|
83
|
+
post_install_message:
|
84
|
+
rdoc_options: []
|
85
|
+
require_paths:
|
86
|
+
- lib
|
87
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: 2.6.0
|
92
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
requirements: []
|
98
|
+
rubygems_version: 3.3.7
|
99
|
+
signing_key:
|
100
|
+
specification_version: 4
|
101
|
+
summary: CLI used to create Rails monoliths by Rocketship for quickly building SaaS
|
102
|
+
applications.
|
103
|
+
test_files: []
|