Class: Monolith::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/monolith/install/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#append_gemfileObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/generators/monolith/install/install_generator.rb', line 6

def append_gemfile
  ###### Authorization & Authentication ######

  # Huh!? No omni-auth! Correct ... we just handle logins via email to start. Way
  # less configuration and you need email addresses.
  gem "nopassword", git: "https://github.com/rocketshipio/nopassword.git", branch: "main"

  # Objects for authorizing user actions.
  gem "pundit"

  ###### Views & UI ######

  # Encapsulate views (instead of using partials)
  gem "view_component"

  # Displays UTC times from the database in the users local time, all computed client-side.
  # Super duper useful for keeping times sane
  gem "local_time"

  # Instead of HAML or Erb. What's that? You don't like these shorthand template
  # languages? I don't like chasing down empty Erb tags in a heavily compentized
  # application, so slim wins the day.
  gem "slim-rails", "~> 3.3"

  ###### Content Management ######

  # Content is managed via Sitepress
  gem "sitepress-rails", git: "https://github.com/sitepress/sitepress.git"

  # Lots of markdown content for help, feature, and how-to articles.
  gem "markdown-rails", "~> 1.0"

  ###### Analytics ######

  # First-party analytics keeps privacy sane and Google out.
  gem "ahoy_matey"

  # Useful for running queries against Ahoy.
  gem "groupdate"

  ###### Testing ######

  # Some people hate rspec. No idea why, but I dig it, so its part of monolith.
  gem "rspec-rails", group: [:development, :test]

  # More sane than fixtures
  gem "factory_bot", group: [:development, :test]

  ##### Other gems ######

  # Parses dates
  gem "chronic", "~> 0.10.2"

  # Send all web addresses to the URL defined via CANONICAL_HOST, if present.
  gem "rack-canonical-host", "~> 1.1"
end

#bundle_gemsObject



68
69
70
# File 'lib/generators/monolith/install/install_generator.rb', line 68

def bundle_gems
  bundle_command "install"
end

#copy_filesObject



63
64
65
66
# File 'lib/generators/monolith/install/install_generator.rb', line 63

def copy_files
  template "Brewfile"
  directory "github", ".github"
end

#install_ahoyObject



80
81
82
# File 'lib/generators/monolith/install/install_generator.rb', line 80

def install_ahoy
  generate "ahoy:install"
end

#install_nopasswordObject



76
77
78
# File 'lib/generators/monolith/install/install_generator.rb', line 76

def install_nopassword
  generate "nopassword:install"
end

#install_sitepressObject



72
73
74
# File 'lib/generators/monolith/install/install_generator.rb', line 72

def install_sitepress
  generate "sitepress:install"
end

#post_install_messageObject



84
85
86
87
88
89
90
# File 'lib/generators/monolith/install/install_generator.rb', line 84

def post_install_message
  say_status "next steps", <<~DOCS
  [ ] Run `./bin/rails db:create db:migrate`
  [ ] Launch the server via `./bin/dev`
  [ ] Open `http://localhost:3000` in your browser
  DOCS
end