Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ruby_on_rails/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ The application (and relative GitHub repo) will be named after the `[project-nam
> Have you decided if you need two environments (develop and main) or just one?
> As a rule of thumb: for customers we always use two environments, for internal projects we usually only use one.
> Why the difference? Because we can bare the risk of having a bug in an internal project, but we cannot do that for a customer.
> Decide with your team if you want one or two branches.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could be more explicit with this line that the customer opinion / need is not to be disregarded? I know it's implied from the whole paragraph, but I guess it could be interpreted as such


1. [Initialise the Rails Application](app_initialisation.md)
1. [Push to Git Repository](first_git_push.md)
Expand Down
6 changes: 2 additions & 4 deletions ruby_on_rails/app_initialisation.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,17 @@ rails new [project-name] --database=postgresql --skip-kamal --skip-ci --skip-act
where the `project-name` is exactly the one you chose before.

> ⚠️ You may want to choose a different database than Postgres, but most of the time this will be your choice.\
> If you do not need a DB you may rethink the fact that you may not need Rails at all: Take a look at [Sinatra](http://www.sinatrarb.com/) or [Angular](https://angular.io/)\
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What a shitty suggestion. It is not the fact that you have a database or not that should make consider alternative frameworks.

> You might also need actionmailbox of course, so always double-check the parameters that you are using.

> ⭐️ This setup does not include either js-bundling nor css-bundling by default.\
> It will start with the simplest possible Rails setup and will use sprockets and importmaps.\
> If you need to do fancy stuff, discuss with your team the opportunity of including a js-bundling and css-bundling tool.\
> We want to go ["no build"](https://www.youtube.com/watch?v=iqXjGiQ_D-A) whenever possible.

* Run `bin/setup`

* Run `bundle exec rails db:migrate` to generate an empty `schema.rb` file.
* Run `bin/setup`
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we first need to run db:migrate


* Then check your default Rails setup by running `rails s` and visiting http://localhost:3000.
* Then check your default Rails setup by running `bin/run` and visiting http://[project-name].localhost:3000.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's check bin/run and subdomain and start from the beginning with a good habit

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not add all the commands to the bin/setup?

I think now if you create a new Rails application and run bin/setup, you end up with the app running on localhost.

You should be on Rails now, yay!
* Finally check if http://localhost:3000/up is green.

Expand Down
9 changes: 9 additions & 0 deletions ruby_on_rails/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
RUBY
end

insert_into_file "Gemfile", after: /^group :development, :test do\n/ do
<<~RUBY
gem "dotenv"
RUBY
end

# replace bin/rails db:prepare with bin/rails db:setup in bin/setup
gsub_file "bin/setup", "bin/rails db:prepare", "bin/rails db:setup"

Expand Down Expand Up @@ -37,6 +43,9 @@
RUBOCOP
end

create_file ".env.example", force: true
create_file ".env", force: true

create_file "bin/run", force: true do
<<~RUN
#!/usr/bin/env bash
Expand Down