-
Notifications
You must be signed in to change notification settings - Fork 22k
bin/setup script to bootstrap applications.
#15189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
👍 |
|
Generated README seems like it'd be a good place to document it. |
|
Yes. I usually put on the README in my applications |
|
I thought about the README. However I noticed that we don't document any conventions there at all. For example |
|
Not sure. @fxn is the best person to talk about documentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before even this, we should install bundler.
|
How are we dealing with error output? Will calling system show STDOUT stuff? |
|
Otherwise I think this is a good start. We can merge it in. |
|
@dhh |
|
Why does the script use pathname instead of a string? |
|
Re: documenting this convention. The generated README is a meta-README https://github.com/senny/rails/blob/bin/setup/railties/lib/rails/generators/rails/app/templates/README.rdoc. READMEs depend so much on the project that I find hard that we can write anything specific and more helpful than that, although if anyone feels inspired and wants to give it a shot please feel free. That was also why I was skeptical about |
|
@fxn I see the script as a starting point. Many operations will involve paths and |
|
Well, in my scripting I never use pathnames, string interpolation works for me and it is simple. No big deal though, not worth discussing it. |
|
@dhh uncommented the sections you proposed and added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we wanna include this? at least the apps I worked with 10% of them needed to copy a database.yml.sample , wondering if adding this will make starters life harder?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's commented out as a suggestion. We have some projects where this is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I’d kill this. We have the secrets.yml now. So everyone is supposed to checkin database.yml.
On May 22, 2014, at 5:45 PM, Yves Senn notifications@github.com wrote:
In railties/lib/rails/generators/rails/app/templates/bin/setup:
+# path to your application root.
+APP_ROOT = Pathname.new File.expand_path('../../', FILE)
+
+Dir.chdir APP_ROOT do
This script is a starting point to setup your application.
Add necessary setup steps to this file:
- puts "== Installing dependencies =="
- system "gem install bundler --conservative"
- system "bundle install"
puts "\n== Copying sample files =="
unless File.exists?("config/database.yml")
system "cp config/database.yml.sample config/database.yml"
end
It's commented out as a suggestion. We have some projects where this is needed.
—
Reply to this email directly or view it on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copying sample files is not directly related to database.yml. I could change the file name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could change this to copy a sample of secrets.yml instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’d like to see a realistic example before we include it.
On May 22, 2014, at 6:00 PM, Lucas Mazza notifications@github.com wrote:
In railties/lib/rails/generators/rails/app/templates/bin/setup:
+# path to your application root.
+APP_ROOT = Pathname.new File.expand_path('../../', FILE)
+
+Dir.chdir APP_ROOT do
This script is a starting point to setup your application.
Add necessary setup steps to this file:
- puts "== Installing dependencies =="
- system "gem install bundler --conservative"
- system "bundle install"
puts "\n== Copying sample files =="
unless File.exists?("config/database.yml")
system "cp config/database.yml.sample config/database.yml"
end
We could change this to copy a sample of secrets.yml instead.
—
Reply to this email directly or view it on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
secrets.yml can be checked too. We use sample files a lot but I'd remove it since I believe it is specific of some projects.
|
Regarding docs: The Getting Started guide has a table that explains the project layout. The description about Also implicitly, if the guide had |
|
Oh, and if it did something meaningful in newly generated apps and mentioned as is in the getting started guide, then I believe the generated |
|
/cc @zzak @chancancode should I add this to the release notes? |
|
@senny I think so |
|
@senny it's still sitting on a branch, and we haven't started writing about railties yet, so it's up to you :) If you don't, I'll make sure I add it when we do the initial pass on railties. |
bin/setup script to bootstrap applications. [WIP]bin/setup script to bootstrap applications.
|
Updated according to suggestions. Going to merge this so other can contribute as well. |
`bin/setup` script to bootstrap applications.
|
👍 |
|
The way bin/setup is now written, it creates a fresh start - at least for the database. If you pull new changes to a project you're already working on - you'll have your database droped, recreated and migrated all over again. You'll lose all development data. Wouldn't it be convenient to have the bin/setup just migrate your database if it already exists? I'm currently using the following code snippet although i guess there should be a better way to check if the database exists: system <<-SHELL
bin/rake db:migrate:status > /dev/null
if [ "$?" = "0" ]; then
echo "\n== Migrating database =="
bin/rake db:migrate
else
echo "\n== Preparing database =="
bin/rake db:setup
fi
SHELL |
|
Some guys expected to run this once after P.S. there is a google group where you can discuss such ideas or propositions |
|
If you already have the database setup, then you already have the app On Wed, Jul 15, 2015 at 2:09 AM, DamirSvrtan notifications@github.com
|
|
Thank you David - I was looking for an explanation on this part - wether it should be used for a clean state setup or a continuos setup. We have devs that only do frontend/javascript work on our applications and know very little about Rails - that's why I was looking at |
|
@DamirSvrtan maybe a custom |
|
I think that's a great idea, Xavier. That's how bin/setup started out for On Wed, Jul 15, 2015 at 2:49 PM, Xavier Noria notifications@github.com
|
* Adds a new file bin/setup which is intended to act as a bootstrapper: rails/rails#15189 I'm not sure the default ('starting point') script is helpful here
* Adds a new file bin/setup which is intended to act as a bootstrapper: rails/rails#15189 I'm not sure the default ('starting point') script is helpful here
* Adds a new file bin/setup which is intended to act as a bootstrapper: rails/rails#15189 I'm not sure the default ('starting point') script is helpful here
squash! Generated template changes in Rails 4.2 * Adds assets.digest = true to develop * Adds a new file bin/setup which is intended to act as a bootstrapper: rails/rails#15189 * Adds a new initializer that allows us to tell ActiveSupport to preserve timezones when using Ruby 2.4
* Adds assets.digest = true to develop * Adds a new file bin/setup which is intended to act as a bootstrapper: rails/rails#15189 * Adds a new initializer that allows us to tell ActiveSupport to preserve timezones when using Ruby 2.4
* Adds assets.digest = true to develop * Adds a new file bin/setup which is intended to act as a bootstrapper: rails/rails#15189 * Adds a new initializer that allows us to tell ActiveSupport to preserve timezones when using Ruby 2.4
* Adds assets.digest = true to develop * Adds a new file bin/setup which is intended to act as a bootstrapper: rails/rails#15189 * Adds a new initializer that allows us to tell ActiveSupport to preserve timezones when using Ruby 2.4
This is a first draft to collect feedback.
About
While this script does not perform much work out of the box, the idea is to have a starting point to add your own setup code. Having an automated way to bootstrap your application saves not only time but also serves as verifiable documentation. By default the script does:
bundle installbin/rake db:setupTo encourage users to modify it, I included some suggestions what you might want to do.
Example
This Gist shows the output of the script for a newly generated application. Database setup fails because there is no schema present.
Work