majestic-monolith 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2c986edc3ac824e56dc936d7fb0dcb642b50d2799331f030e894b4552658237a
4
+ data.tar.gz: 7ed2d703fd3cc3d3c7b3394283823a0b41d30588dfff8cb53df46fdeedd63668
5
+ SHA512:
6
+ metadata.gz: 17c82bfe517c7aeefc1d50dd879f1cc41c35d200e594ea2e4246bfd46f620913c7486a5c890c78f95c2f5c4886b5f4f4b695b68831ea6126e60e7e4d6e8214f0
7
+ data.tar.gz: a52ce5bb214d2ef5c86ec28c754634777662cd4a9aa29bd24e31c3ed5e1752d72efef96a0a58e7db967d7be0e49c62e9b6b66365558c2fbd538cb74a4b96098e
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/Gemfile ADDED
@@ -0,0 +1,10 @@
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 ADDED
@@ -0,0 +1,36 @@
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
data/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # Majestic Monolith
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.
4
+
5
+ ## Installation
6
+
7
+ Install the gem and add to the application's Gemfile by executing:
8
+
9
+ $ gem install majestic-monolith
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
+ ## Development
20
+
21
+ 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.
22
+
23
+ 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).
24
+
25
+ ## Contributing
26
+
27
+ Bug reports and pull requests are welcome on GitHub at https://github.com/rocketship/monolith.
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
data/exe/monolith ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative "../lib/majestic/monolith.rb"
4
+
5
+ Majestic::Monolith::CLI.start ARGV
@@ -0,0 +1,16 @@
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
@@ -0,0 +1,3 @@
1
+ web: bin/rails server -p $PORT
2
+ css: bin/rails tailwindcss:watch
3
+ stripe: stripe listen --forward-to localhost:5000/webhooks/stripe --latest
@@ -0,0 +1,66 @@
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
@@ -0,0 +1,39 @@
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
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Majestic
4
+ module Monolith
5
+ VERSION = "0.1.0"
6
+ end
7
+ end
@@ -0,0 +1,19 @@
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
@@ -0,0 +1,38 @@
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
@@ -0,0 +1,6 @@
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
metadata ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: majestic-monolith
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Brad Gessler
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-05-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ description: CLI used to create Rails monoliths by Rocketship for quickly building
28
+ SaaS applications.
29
+ email:
30
+ - brad@rocketship.com
31
+ executables:
32
+ - monolith
33
+ extensions: []
34
+ extra_rdoc_files: []
35
+ files:
36
+ - ".rspec"
37
+ - Gemfile
38
+ - Gemfile.lock
39
+ - README.md
40
+ - Rakefile
41
+ - 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: []
52
+ metadata:
53
+ 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
57
+ post_install_message:
58
+ rdoc_options: []
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: 2.6.0
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ requirements: []
72
+ rubygems_version: 3.2.3
73
+ signing_key:
74
+ specification_version: 4
75
+ summary: CLI used to create Rails monoliths by Rocketship for quickly building SaaS
76
+ applications.
77
+ test_files: []