majestic-monolith 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +12 -2
  4. data/Rakefile +5 -5
  5. data/app/assets/config/monolith_manifest.js +1 -0
  6. data/app/assets/stylesheets/monolith/application.css +15 -0
  7. data/app/controllers/monolith/application_controller.rb +4 -0
  8. data/app/helpers/monolith/application_helper.rb +4 -0
  9. data/app/jobs/monolith/application_job.rb +4 -0
  10. data/app/mailers/monolith/application_mailer.rb +6 -0
  11. data/app/models/monolith/application_record.rb +5 -0
  12. data/app/views/layouts/monolith/application.html.erb +15 -0
  13. data/config/routes.rb +2 -0
  14. data/exe/monolith +2 -2
  15. data/lib/generators/monolith/install/USAGE +7 -0
  16. data/lib/generators/monolith/install/install_generator.rb +126 -0
  17. data/lib/generators/monolith/install/templates/Brewfile +9 -0
  18. data/lib/generators/monolith/install/templates/github/workflows/ruby.yml +59 -0
  19. data/lib/monolith/cli/template.rb +9 -0
  20. data/lib/monolith/cli.rb +15 -0
  21. data/lib/monolith/engine.rb +5 -0
  22. data/lib/monolith/version.rb +3 -0
  23. data/lib/monolith.rb +10 -0
  24. data/lib/tasks/monolith_tasks.rake +4 -0
  25. metadata +43 -19
  26. data/.rspec +0 -3
  27. data/Gemfile +0 -10
  28. data/Gemfile.lock +0 -36
  29. data/lib/majestic/monolith/cli.rb +0 -16
  30. data/lib/majestic/monolith/templates/alpha/template/Procfile.dev +0 -3
  31. data/lib/majestic/monolith/templates/alpha/template.rb +0 -66
  32. data/lib/majestic/monolith/templates/alpha.rb +0 -39
  33. data/lib/majestic/monolith/version.rb +0 -7
  34. data/lib/majestic/monolith.rb +0 -19
  35. data/majestic-monolith.gemspec +0 -38
  36. data/sig/majestic/monolith.rbs +0 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2c986edc3ac824e56dc936d7fb0dcb642b50d2799331f030e894b4552658237a
4
- data.tar.gz: 7ed2d703fd3cc3d3c7b3394283823a0b41d30588dfff8cb53df46fdeedd63668
3
+ metadata.gz: 1d75c3bba7534f3e424058c4909bd64f27b4fdb172c6c40f9e5c2b988e99ca2d
4
+ data.tar.gz: f8c7c1628027ed44c3dd96485f01e9e9d5a8594cf14203663d3a24f3ccd710c8
5
5
  SHA512:
6
- metadata.gz: 17c82bfe517c7aeefc1d50dd879f1cc41c35d200e594ea2e4246bfd46f620913c7486a5c890c78f95c2f5c4886b5f4f4b695b68831ea6126e60e7e4d6e8214f0
7
- data.tar.gz: a52ce5bb214d2ef5c86ec28c754634777662cd4a9aa29bd24e31c3ed5e1752d72efef96a0a58e7db967d7be0e49c62e9b6b66365558c2fbd538cb74a4b96098e
6
+ metadata.gz: 933a4cdd8a14f12b6218107049d1978568f2115323ac96a7dcded3f8de492f562f11c68b9b48e91ad1238db9a5bf4ee492b7f4efe11322a1b4d5c9281c677653
7
+ data.tar.gz: a467c9324b5ae586c8a15ed7565765b9c084dae95a66d5c875472b4c7eec711b218b21fa5b51e439bd8784845c68168372ac2064cd2a88951424cab23e09eb77
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 CHANGED
@@ -1,6 +1,6 @@
1
- # Majestic Monolith
1
+ # Monolith
2
2
 
3
- A quick way to spin up a [Majestic Monlith](https://m.signalvnoise.com/the-majestic-monolith/) Rails application. Rocketship uses Monolith when building new SaaS applications.
3
+ A quick way to spin up a [Majestic Monlith](https://m.signalvnoise.com/the-majestic-monolith/) Rails application. [Rocketship](https://rocketship.io/) uses Monolith when building new SaaS applications.
4
4
 
5
5
  ## Installation
6
6
 
@@ -16,6 +16,16 @@ Run the CLI utility to create a monolith:
16
16
 
17
17
  Monolith creates a new Rails project with the dependencies needed to be productive.
18
18
 
19
+ ## Existing Rails applications
20
+
21
+ The gem may also be installed for existing Rails applications by executing:
22
+
23
+ $ bundle add majestic-monolith
24
+
25
+ Then run the following to see the available tasks:
26
+
27
+ $ rails generate --help
28
+
19
29
  ## Development
20
30
 
21
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.
data/Rakefile CHANGED
@@ -1,8 +1,8 @@
1
- # frozen_string_literal: true
1
+ require "bundler/setup"
2
2
 
3
- require "bundler/gem_tasks"
4
- require "rspec/core/rake_task"
3
+ APP_RAKEFILE = File.expand_path("spec/dummy/Rakefile", __dir__)
4
+ load "rails/tasks/engine.rake"
5
5
 
6
- RSpec::Core::RakeTask.new(:spec)
6
+ load "rails/tasks/statistics.rake"
7
7
 
8
- task default: :spec
8
+ require "bundler/gem_tasks"
@@ -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
+ */
@@ -0,0 +1,4 @@
1
+ module Monolith
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Monolith
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Monolith
2
+ class ApplicationJob < ActiveJob::Base
3
+ end
4
+ end
@@ -0,0 +1,6 @@
1
+ module Monolith
2
+ class ApplicationMailer < ActionMailer::Base
3
+ default from: "from@example.com"
4
+ layout "mailer"
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module Monolith
2
+ class ApplicationRecord < ActiveRecord::Base
3
+ self.abstract_class = true
4
+ end
5
+ end
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Monolith</title>
5
+ <%= csrf_meta_tags %>
6
+ <%= csp_meta_tag %>
7
+
8
+ <%= stylesheet_link_tag "monolith/application", media: "all" %>
9
+ </head>
10
+ <body>
11
+
12
+ <%= yield %>
13
+
14
+ </body>
15
+ </html>
data/config/routes.rb ADDED
@@ -0,0 +1,2 @@
1
+ Monolith::Engine.routes.draw do
2
+ end
data/exe/monolith CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require_relative "../lib/majestic/monolith.rb"
3
+ require_relative "../lib/monolith/cli.rb"
4
4
 
5
- Majestic::Monolith::CLI.start ARGV
5
+ Monolith::CLI.start ARGV
@@ -0,0 +1,7 @@
1
+ Description:
2
+ Installs the base gems needed for Monolith
3
+
4
+ Example:
5
+ bin/rails generate monolith:install
6
+
7
+ This will install several base gems and run their respective install commands
@@ -0,0 +1,126 @@
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
+ # I use to not like Tailwind, but now I love using it with view_components.
22
+ gem "tailwindcss-rails"
23
+
24
+ # Displays UTC times from the database in the users local time, all computed client-side.
25
+ # Super duper useful for keeping times sane
26
+ gem "local_time"
27
+
28
+ # Instead of HAML or Erb. What's that? You don't like these shorthand template
29
+ # languages? I don't like chasing down empty Erb tags in a heavily compentized
30
+ # application, so slim wins the day.
31
+ gem "slim-rails", "~> 3.3"
32
+
33
+ ###### Content Management ######
34
+
35
+ # Content is managed via Sitepress
36
+ gem "sitepress-rails", git: "https://github.com/sitepress/sitepress.git"
37
+
38
+ # Lots of markdown content for help, feature, and how-to articles.
39
+ gem "markdown-rails", "~> 1.0"
40
+
41
+ ###### Analytics ######
42
+
43
+ # First-party analytics keeps privacy sane and Google out.
44
+ gem "ahoy_matey"
45
+
46
+ # Useful for running queries against Ahoy.
47
+ gem "groupdate"
48
+
49
+ ###### Testing ######
50
+
51
+ # Some people hate rspec. No idea why, but I dig it, so its part of monolith.
52
+ gem "rspec-rails", group: [:development, :test]
53
+
54
+ # More sane than fixtures
55
+ gem "factory_bot", group: [:development, :test]
56
+
57
+ ##### Other gems ######
58
+
59
+ # Parses dates
60
+ gem "chronic", "~> 0.10.2"
61
+
62
+ # Send all web addresses to the URL defined via CANONICAL_HOST, if present.
63
+ gem "rack-canonical-host", "~> 1.1"
64
+ end
65
+
66
+ def copy_files
67
+ template "Brewfile"
68
+ directory "github", ".github"
69
+ end
70
+
71
+ def bundle_gems
72
+ bundle_command "install"
73
+ end
74
+
75
+ def install_sitepress
76
+ generate "sitepress:install"
77
+ end
78
+
79
+ def install_nopassword
80
+ generate "nopassword:install"
81
+ end
82
+
83
+ def install_ahoy
84
+ generate "ahoy:install"
85
+ end
86
+
87
+ def post_install_message
88
+ say_status "next steps", <<~DOCS
89
+ [ ] Run `rails db:migrate`
90
+ [ ] Run `bundle install`
91
+ [ ] Launch the server via `dev`
92
+ [ ] Go to `http://localhost:3000`
93
+ DOCS
94
+ end
95
+
96
+ private
97
+ # Lifted from https://github.com/bradgessler/rails/blob/bbd298d7b036c550912139b41903f9f37087befe/railties/lib/rails/generators/app_base.rb#L380-L404,
98
+ # which is not ideal. I tried to inherit `AppBase`, which also didn't work because it wanted an argument, which
99
+ # this generator does not need. Look into moving this into a module in Rails core and the including that in here
100
+ # or decomposing the `AppBase` Thor class in a way that would let me inherit it.
101
+ def bundle_command(command, env = {})
102
+ say_status :run, "bundle #{command}"
103
+
104
+ # We are going to shell out rather than invoking Bundler::CLI.new(command)
105
+ # because `rails new` loads the Thor gem and on the other hand bundler uses
106
+ # its own vendored Thor, which could be a different version. Running both
107
+ # things in the same process is a recipe for a night with paracetamol.
108
+ #
109
+ # Thanks to James Tucker for the Gem tricks involved in this call.
110
+ _bundle_command = Gem.bin_path("bundler", "bundle")
111
+
112
+ require "bundler"
113
+ Bundler.with_original_env do
114
+ exec_bundle_command(_bundle_command, command, env)
115
+ end
116
+ end
117
+
118
+ def exec_bundle_command(bundle_command, command, env)
119
+ full_command = %Q["#{Gem.ruby}" "#{bundle_command}" #{command}]
120
+ if options[:quiet]
121
+ system(env, full_command, out: File::NULL)
122
+ else
123
+ system(env, full_command)
124
+ end
125
+ end
126
+ end
@@ -0,0 +1,9 @@
1
+ # Process payments
2
+ tap "stripe/stripe-cli"
3
+ brew "stripe"
4
+
5
+ # For image processing
6
+ brew "imagemagick"
7
+
8
+ # Database dependency
9
+ brew "postgresql"
@@ -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
@@ -0,0 +1,9 @@
1
+ if path = ENV["MONOLITH_GEM_PATH"]
2
+ gem "monolith", path: path
3
+ else
4
+ gem "monolith"
5
+ end
6
+
7
+ after_bundle do
8
+ generate "monolith:install"
9
+ end
@@ -0,0 +1,15 @@
1
+ require "thor"
2
+
3
+ module Monolith
4
+ class CLI < Thor
5
+ include Thor::Actions
6
+
7
+ DEFAULT_PROJECT_NAME = "server".freeze
8
+
9
+ desc 'new [PROJECT_NAME]', 'create a new Rails monolith'
10
+ def new(project_name = DEFAULT_PROJECT_NAME)
11
+ template_path = File.join File.expand_path(__dir__), "cli/template.rb"
12
+ run "rails new #{project_name} --template #{template_path} --database postgresql --css tailwind"
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,5 @@
1
+ module Monolith
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace Monolith
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module Monolith
2
+ VERSION = "0.1.1"
3
+ end
data/lib/monolith.rb ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "monolith/version"
4
+ require "monolith/engine"
5
+
6
+ module Monolith
7
+ class Error < StandardError; end
8
+
9
+ autoload :CLI, "monolith/cli"
10
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :monolith do
3
+ # # Task goes here
4
+ # end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: majestic-monolith
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brad Gessler
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-25 00:00:00.000000000 Z
11
+ date: 2022-06-06 00:00:00.000000000 Z
12
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: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 7.0.0
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: thor
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -27,33 +41,43 @@ dependencies:
27
41
  description: CLI used to create Rails monoliths by Rocketship for quickly building
28
42
  SaaS applications.
29
43
  email:
30
- - brad@rocketship.com
44
+ - bradgessler@gmail.com
31
45
  executables:
32
46
  - monolith
33
47
  extensions: []
34
48
  extra_rdoc_files: []
35
49
  files:
36
- - ".rspec"
37
- - Gemfile
38
- - Gemfile.lock
50
+ - MIT-LICENSE
39
51
  - README.md
40
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
41
62
  - exe/monolith
42
- - lib/majestic/monolith.rb
43
- - lib/majestic/monolith/cli.rb
44
- - lib/majestic/monolith/templates/alpha.rb
45
- - lib/majestic/monolith/templates/alpha/template.rb
46
- - lib/majestic/monolith/templates/alpha/template/Procfile.dev
47
- - lib/majestic/monolith/version.rb
48
- - majestic-monolith.gemspec
49
- - sig/majestic/monolith.rbs
50
- homepage: https://github.com/rocketshipio/monolith
51
- licenses: []
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/monolith.rb
68
+ - lib/monolith/cli.rb
69
+ - lib/monolith/cli/template.rb
70
+ - lib/monolith/engine.rb
71
+ - lib/monolith/version.rb
72
+ - lib/tasks/monolith_tasks.rake
73
+ homepage: https://github.com/rocketship/monolith
74
+ licenses:
75
+ - MIT
52
76
  metadata:
53
77
  allowed_push_host: https://rubygems.org
54
- homepage_uri: https://github.com/rocketshipio/monolith
55
- source_code_uri: https://github.com/rocketshipio/monolith
56
- changelog_uri: https://github.com/rocketshipio/monolith
78
+ homepage_uri: https://github.com/rocketship/monolith
79
+ source_code_uri: https://github.com/rocketship/monolith
80
+ changelog_uri: https://github.com/rocketship/monolith
57
81
  post_install_message:
58
82
  rdoc_options: []
59
83
  require_paths:
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/Gemfile DELETED
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
-
5
- # Specify your gem's dependencies in majestic-monolith.gemspec
6
- gemspec
7
-
8
- gem "rake", "~> 13.0"
9
-
10
- gem "rspec", "~> 3.0"
data/Gemfile.lock DELETED
@@ -1,36 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- majestic-monolith (0.1.0)
5
- thor (~> 1.0)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- diff-lcs (1.5.0)
11
- rake (13.0.6)
12
- rspec (3.11.0)
13
- rspec-core (~> 3.11.0)
14
- rspec-expectations (~> 3.11.0)
15
- rspec-mocks (~> 3.11.0)
16
- rspec-core (3.11.0)
17
- rspec-support (~> 3.11.0)
18
- rspec-expectations (3.11.0)
19
- diff-lcs (>= 1.2.0, < 2.0)
20
- rspec-support (~> 3.11.0)
21
- rspec-mocks (3.11.1)
22
- diff-lcs (>= 1.2.0, < 2.0)
23
- rspec-support (~> 3.11.0)
24
- rspec-support (3.11.0)
25
- thor (1.2.1)
26
-
27
- PLATFORMS
28
- x86_64-darwin-20
29
-
30
- DEPENDENCIES
31
- majestic-monolith!
32
- rake (~> 13.0)
33
- rspec (~> 3.0)
34
-
35
- BUNDLED WITH
36
- 2.3.13
@@ -1,16 +0,0 @@
1
- require "thor"
2
-
3
- module Majestic
4
- module Monolith
5
- class CLI < Thor
6
- include Thor::Actions
7
-
8
- desc 'new [PROJECT_NAME]', 'create a new Rails monolith'
9
- def new(project_name = Templates::Alpha::DEFAULT_PROJECT_NAME)
10
- project = Templates::Alpha.new(name: project_name)
11
- run project.rails_new_command
12
- directory project.template_dir.expand_path, project.rails_path.expand_path
13
- end
14
- end
15
- end
16
- end
@@ -1,3 +0,0 @@
1
- web: bin/rails server -p $PORT
2
- css: bin/rails tailwindcss:watch
3
- stripe: stripe listen --forward-to localhost:5000/webhooks/stripe --latest
@@ -1,66 +0,0 @@
1
- ###### Authorization & Authentication ######
2
-
3
- # Huh!? No omni-auth! Correct ... we just handle logins via email to start. Way
4
- # less configuration and you need email addresses.
5
- gem "nopassword", github: "rocketshipio/nopassword", branch: "main"
6
-
7
- # Objects for authorizing user actions.
8
- gem "pundit"
9
-
10
- ###### Views & UI ######
11
-
12
- # Encapsulate views (instead of using partials)
13
- gem "view_component"
14
-
15
- # I use to not like Tailwind, but now I love using it with view_components.
16
- gem "tailwindcss-rails"
17
-
18
- # Displays UTC times from the database in the users local time, all computed client-side.
19
- # Super duper useful for keeping times sane
20
- gem "local_time"
21
-
22
- # Instead of HAML or Erb. What's that? You don't like these shorthand template
23
- # languages? I don't like chasing down empty Erb tags in a heavily compentized
24
- # application, so slim wins the day.
25
- gem "slim-rails", "~> 3.3"
26
-
27
- ###### Content Management ######
28
-
29
- # Content is managed via Sitepress
30
- gem "sitepress-rails", github: "sitepress/sitepress"
31
-
32
- # Lots of markdown content for help, feature, and how-to articles.
33
- gem "markdown-rails", "~> 1.0"
34
-
35
- ###### Analytics ######
36
-
37
- # First-party analytics keeps privacy sane and Google out.
38
- gem "ahoy_matey"
39
-
40
- # Useful for running queries against Ahoy.
41
- gem "groupdate"
42
-
43
- # Send all web addresses to one URL.
44
- gem "rack-canonical-host", "~> 1.1"
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
- # Get paid yo.
57
- gem "stripe"
58
-
59
- # Parses dates
60
- gem "chronic", "~> 0.10.2"
61
-
62
- after_bundle do
63
- rails_command "db:create"
64
- rails_command "generate ahoy:install"
65
- rails_command "db:migrate"
66
- end
@@ -1,39 +0,0 @@
1
- module Majestic
2
- module Monolith
3
- module Templates
4
- class Alpha
5
- # I've found its best to name Rails applications "server", which keeps the product
6
- # name out of the code, and put the project inside of a path with the product name.
7
- # For example, `~/Projects/acme/server`. This makes it easier to put client code in
8
- # the same directly, like `~/Projects/acme/ios-app`.
9
- DEFAULT_PROJECT_NAME = "server".freeze
10
-
11
- attr_reader :name
12
-
13
- def initialize(name:)
14
- @name = name
15
- end
16
-
17
- def template_path
18
- root.join("template.rb")
19
- end
20
-
21
- def template_dir
22
- root.join("template")
23
- end
24
-
25
- def root
26
- Monolith.root.join "monolith/templates", File.basename(__FILE__, ".rb")
27
- end
28
-
29
- def rails_new_command
30
- "rails new #{rails_path} --template #{template_path} --database postgresql --css tailwind"
31
- end
32
-
33
- def rails_path
34
- Pathname.new(name)
35
- end
36
- end
37
- end
38
- end
39
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Majestic
4
- module Monolith
5
- VERSION = "0.1.0"
6
- end
7
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "monolith/version"
4
- require "pathname"
5
-
6
- module Majestic
7
- module Monolith
8
- class Error < StandardError; end
9
-
10
- autoload :CLI, "majestic/monolith/cli"
11
- module Templates
12
- autoload :Alpha, "majestic/monolith/templates/alpha"
13
- end
14
-
15
- def self.root
16
- Pathname.new(__dir__)
17
- end
18
- end
19
- end
@@ -1,38 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "lib/majestic/monolith/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "majestic-monolith"
7
- spec.version = Majestic::Monolith::VERSION
8
- spec.authors = ["Brad Gessler"]
9
- spec.email = ["brad@rocketship.com"]
10
-
11
- spec.summary = "CLI used to create Rails monoliths by Rocketship for quickly building SaaS applications."
12
- spec.description = spec.summary
13
- spec.homepage = "https://github.com/rocketshipio/monolith"
14
- spec.required_ruby_version = ">= 2.6.0"
15
-
16
- spec.metadata["allowed_push_host"] = "https://rubygems.org"
17
-
18
- spec.metadata["homepage_uri"] = spec.homepage
19
- spec.metadata["source_code_uri"] = spec.homepage
20
- spec.metadata["changelog_uri"] = spec.homepage
21
-
22
- # Specify which files should be added to the gem when it is released.
23
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
24
- spec.files = Dir.chdir(__dir__) do
25
- `git ls-files -z`.split("\x0").reject do |f|
26
- (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
27
- end
28
- end
29
- spec.bindir = "exe"
30
- spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
31
- spec.require_paths = ["lib"]
32
-
33
- # Uncomment to register a new dependency of your gem
34
- spec.add_dependency "thor", "~> 1.0"
35
-
36
- # For more information and examples about making a new gem, check out our
37
- # guide at: https://bundler.io/guides/creating_gem.html
38
- end
@@ -1,6 +0,0 @@
1
- module Majestic
2
- module Monolith
3
- VERSION: String
4
- # See the writing guide of rbs: https://github.com/ruby/rbs#guides
5
- end
6
- end