Interactive `rails new`

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Interactive `rails new`

Viktor Fonic
Hi,

Every time I run `rails new`, I need to pull out the command I use (and maybe even the template as well). The command I currently use looks like this:
$ rails new magic --database=postgresql --skip-coffee --skip-turbolinks --skip-test --skip-system-test --webpack=react

On the other hand (and I know I'm comparing apples and oranges here), here's what happens when I run `npm init`:
$ npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See `npm help json` for definitive documentation on these fields
and exactly what they do.

Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
package name: (asd)
version: (1.0.0)
description:
entry point: (index.js)
test command:
git repository:
keywords:
author:
license: (ISC)
About to write to /Users/vfonic/Developer/javascript/asd/package.json:

{
  "name": "asd",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}


Is this OK? (yes)


Bold are prompts, with sensible defaults in the (brackets).

Wouldn't it be great if rails had something similar? Imagine gems attaching directly to the `rails new` and immediately installing and setting up even before you `cd` to your app! If not, at least I'll be able to skip all the flags I want to skip, by going through the interactive `rails new`.

If you prefer the simplicity of `rails new` and would like to keep it, we could add a single "Y/n" prompt before all the others:
Create new app with sensible defaults Y/n:

What do you think?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Interactive `rails new`

Andrew Kaspick
+1 Nice idea.

On Mon, Jun 4, 2018 at 5:37 AM Viktor Fonic <[hidden email]> wrote:
Hi,

Every time I run `rails new`, I need to pull out the command I use (and maybe even the template as well). The command I currently use looks like this:
$ rails new magic --database=postgresql --skip-coffee --skip-turbolinks --skip-test --skip-system-test --webpack=react

On the other hand (and I know I'm comparing apples and oranges here), here's what happens when I run `npm init`:
$ npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See `npm help json` for definitive documentation on these fields
and exactly what they do.

Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
package name: (asd)
version: (1.0.0)
description:
entry point: (index.js)
test command:
git repository:
keywords:
author:
license: (ISC)
About to write to /Users/vfonic/Developer/javascript/asd/package.json:

{
  "name": "asd",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}


Is this OK? (yes)


Bold are prompts, with sensible defaults in the (brackets).

Wouldn't it be great if rails had something similar? Imagine gems attaching directly to the `rails new` and immediately installing and setting up even before you `cd` to your app! If not, at least I'll be able to skip all the flags I want to skip, by going through the interactive `rails new`.

If you prefer the simplicity of `rails new` and would like to keep it, we could add a single "Y/n" prompt before all the others:
Create new app with sensible defaults Y/n:

What do you think?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Interactive `rails new`

Emanuel Hayford
In reply to this post by Viktor Fonic
+1 I like this idea :)

On Monday, June 4, 2018 at 11:37:48 AM UTC+2, Viktor Fonic wrote:
Hi,

Every time I run `rails new`, I need to pull out the command I use (and maybe even the template as well). The command I currently use looks like this:
$ rails new magic --database=postgresql --skip-coffee --skip-turbolinks --skip-test --skip-system-test --webpack=react

On the other hand (and I know I'm comparing apples and oranges here), here's what happens when I run `npm init`:
$ npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See `npm help json` for definitive documentation on these fields
and exactly what they do.

Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
package name: (asd)
version: (1.0.0)
description:
entry point: (index.js)
test command:
git repository:
keywords:
author:
license: (ISC)
About to write to /Users/vfonic/Developer/javascript/asd/package.json:

{
  "name": "asd",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}


Is this OK? (yes)


Bold are prompts, with sensible defaults in the (brackets).

Wouldn't it be great if rails had something similar? Imagine gems attaching directly to the `rails new` and immediately installing and setting up even before you `cd` to your app! If not, at least I'll be able to skip all the flags I want to skip, by going through the interactive `rails new`.

If you prefer the simplicity of `rails new` and would like to keep it, we could add a single "Y/n" prompt before all the others:
Create new app with sensible defaults Y/n:

What do you think?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Interactive `rails new`

Rolandas Barysas
I think it would be against the idea of convention over configuration. You can create an alias if you use those flags all the time.


On Tue, Jul 17, 2018, at 02:32, Emanuel Hayford wrote:
+1 I like this idea :)

On Monday, June 4, 2018 at 11:37:48 AM UTC+2, Viktor Fonic wrote:
Hi,

Every time I run `rails new`, I need to pull out the command I use (and maybe even the template as well). The command I currently use looks like this:
$ rails new magic --database=postgresql --skip-coffee --skip-turbolinks --skip-test --skip-system-test --webpack=react

On the other hand (and I know I'm comparing apples and oranges here), here's what happens when I run `npm init`:
$ npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See `npm help json` for definitive documentation on these fields
and exactly what they do.

Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
package name: (asd)
version: (1.0.0)
description:
entry point: (index.js)
test command:
git repository:
keywords:
author:
license: (ISC)
About to write to /Users/vfonic/Developer/javascript/asd/package.json:

{
  "name": "asd",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}


Is this OK? (yes)


Bold are prompts, with sensible defaults in the (brackets).

Wouldn't it be great if rails had something similar? Imagine gems attaching directly to the `rails new` and immediately installing and setting up even before you `cd` to your app! If not, at least I'll be able to skip all the flags I want to skip, by going through the interactive `rails new`.

If you prefer the simplicity of `rails new` and would like to keep it, we could add a single "Y/n" prompt before all the others:
Create new app with sensible defaults Y/n:

What do you think?


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Interactive `rails new`

Leonardo Prado
+1 for the idea.

But I would put it behind some flag, like `rails new --interactive`. This way we'll still have the default "convention over configuration" and add an option for when you need to add more configuration.


Em ter, 17 de jul de 2018 05:17, Rolandas Barysas <[hidden email]> escreveu:
I think it would be against the idea of convention over configuration. You can create an alias if you use those flags all the time.


On Tue, Jul 17, 2018, at 02:32, Emanuel Hayford wrote:
+1 I like this idea :)

On Monday, June 4, 2018 at 11:37:48 AM UTC+2, Viktor Fonic wrote:
Hi,

Every time I run `rails new`, I need to pull out the command I use (and maybe even the template as well). The command I currently use looks like this:
$ rails new magic --database=postgresql --skip-coffee --skip-turbolinks --skip-test --skip-system-test --webpack=react

On the other hand (and I know I'm comparing apples and oranges here), here's what happens when I run `npm init`:
$ npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See `npm help json` for definitive documentation on these fields
and exactly what they do.

Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
package name: (asd)
version: (1.0.0)
description:
entry point: (index.js)
test command:
git repository:
keywords:
author:
license: (ISC)
About to write to /Users/vfonic/Developer/javascript/asd/package.json:

{
  "name": "asd",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}


Is this OK? (yes)


Bold are prompts, with sensible defaults in the (brackets).

Wouldn't it be great if rails had something similar? Imagine gems attaching directly to the `rails new` and immediately installing and setting up even before you `cd` to your app! If not, at least I'll be able to skip all the flags I want to skip, by going through the interactive `rails new`.

If you prefer the simplicity of `rails new` and would like to keep it, we could add a single "Y/n" prompt before all the others:
Create new app with sensible defaults Y/n:

What do you think?


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Interactive `rails new`

Xavier Noria
The application generator has about 25 options, I believe an interactive mode wouldn't be practical.

I second Rolandas' suggestion: make your own shortcut.

For example, I often want to create a vanilla application to test something quickly, --skip-bundle is the key there.  I have a Bash function for that called "rn" that does this:

    rails new $app_name --skip-bundle "$@" && \
  cd $app_name && \
  bundle install --local

Since a Bash function can change the $PWD, I am even left at the app's root directory.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Interactive `rails new`

Kevin Deisz
You can also just use the .railsrc file from your home directory to specify those args every time.


On Sat, Aug 4, 2018 at 5:24 AM Xavier Noria <[hidden email]> wrote:
The application generator has about 25 options, I believe an interactive mode wouldn't be practical.

I second Rolandas' suggestion: make your own shortcut.

For example, I often want to create a vanilla application to test something quickly, --skip-bundle is the key there.  I have a Bash function for that called "rn" that does this:

    rails new $app_name --skip-bundle "$@" && \
  cd $app_name && \
  bundle install --local

Since a Bash function can change the $PWD, I am even left at the app's root directory.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.


--
Kevin D. Deisz

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Interactive `rails new`

antoinematyja@gmail.com
In reply to this post by Viktor Fonic
+1 for the idea

Every time I create a rails app I forget to disable stuff and end up running `rails new --help` to check every option.

I also agree that a `npm init` style interface wouldn't be practical.
Instead I suggest doing something like vue-cli does. When you run `vue create myapp`, you can pick features step by step. See https://cli.vuejs.org/guide/creating-a-project.html#vue-create

We could imagine a first step where you can toggle turbolinks, sprockets, action mailer, coffee script, webpacker etc...
Then another step to select a database preconfiguration (mysql/postgresql/...) if database wasn't disabled in the first step.
Then another step to select webpack integrations (erb, react, angular, vue...).

It doesn't have to allow to toggle every option of `rails new`, but to provide essentials.

I also think this would be a nice feature for rails beginners and make rails more user friendly.

Le lundi 4 juin 2018 11:37:48 UTC+2, Viktor Fonic a écrit :
Hi,

Every time I run `rails new`, I need to pull out the command I use (and maybe even the template as well). The command I currently use looks like this:
$ rails new magic --database=postgresql --skip-coffee --skip-turbolinks --skip-test --skip-system-test --webpack=react

On the other hand (and I know I'm comparing apples and oranges here), here's what happens when I run `npm init`:
$ npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See `npm help json` for definitive documentation on these fields
and exactly what they do.

Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
package name: (asd)
version: (1.0.0)
description:
entry point: (index.js)
test command:
git repository:
keywords:
author:
license: (ISC)
About to write to /Users/vfonic/Developer/javascript/asd/package.json:

{
  "name": "asd",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}


Is this OK? (yes)


Bold are prompts, with sensible defaults in the (brackets).

Wouldn't it be great if rails had something similar? Imagine gems attaching directly to the `rails new` and immediately installing and setting up even before you `cd` to your app! If not, at least I'll be able to skip all the flags I want to skip, by going through the interactive `rails new`.

If you prefer the simplicity of `rails new` and would like to keep it, we could add a single "Y/n" prompt before all the others:
Create new app with sensible defaults Y/n:

What do you think?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/rubyonrails-core.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-core/d129f5eb-2f7c-41f9-b3cf-92a7c6375291%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Interactive `rails new`

Kevin Gnadinger
In reply to this post by Viktor Fonic
I like the idea and believe it should be pursued. 

However, like most other major frameworks that implement something like this, the cli should be separate from the main rails repo.

On Monday, June 4, 2018 at 4:37:48 AM UTC-5, Viktor Fonic wrote:
Hi,

Every time I run `rails new`, I need to pull out the command I use (and maybe even the template as well). The command I currently use looks like this:
$ rails new magic --database=postgresql --skip-coffee --skip-turbolinks --skip-test --skip-system-test --webpack=react

On the other hand (and I know I'm comparing apples and oranges here), here's what happens when I run `npm init`:
$ npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See `npm help json` for definitive documentation on these fields
and exactly what they do.

Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
package name: (asd)
version: (1.0.0)
description:
entry point: (index.js)
test command:
git repository:
keywords:
author:
license: (ISC)
About to write to /Users/vfonic/Developer/javascript/asd/package.json:

{
  "name": "asd",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}


Is this OK? (yes)


Bold are prompts, with sensible defaults in the (brackets).

Wouldn't it be great if rails had something similar? Imagine gems attaching directly to the `rails new` and immediately installing and setting up even before you `cd` to your app! If not, at least I'll be able to skip all the flags I want to skip, by going through the interactive `rails new`.

If you prefer the simplicity of `rails new` and would like to keep it, we could add a single "Y/n" prompt before all the others:
Create new app with sensible defaults Y/n:

What do you think?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/rubyonrails-core.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-core/47f77f38-7eff-4641-80b1-538016c27c94%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Interactive `rails new`

Robb Shecter-2
+1 as well

I think rails new could do something much more basic that'd really help  both new and experienced users: check its inputs. Fail fast and clearly instead of failing silently. There are at least a couple rails sub-commands that don't check the supplied options. I looked into attacking this issue, but it'd be a good amount of work.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/rubyonrails-core.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-core/4703553b-d4c4-4b16-b498-dd62abdf0573%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Interactive `rails new`

Philip Lambok
In reply to this post by Viktor Fonic
+1 I love the idea. The interactive option can be an alternative to creating a rails app without having to eliminate the current option.

Pada Senin, 04 Juni 2018 16.37.48 UTC+7, Viktor Fonic menulis:
Hi,

Every time I run `rails new`, I need to pull out the command I use (and maybe even the template as well). The command I currently use looks like this:
$ rails new magic --database=postgresql --skip-coffee --skip-turbolinks --skip-test --skip-system-test --webpack=react

On the other hand (and I know I'm comparing apples and oranges here), here's what happens when I run `npm init`:
$ npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See `npm help json` for definitive documentation on these fields
and exactly what they do.

Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
package name: (asd)
version: (1.0.0)
description:
entry point: (index.js)
test command:
git repository:
keywords:
author:
license: (ISC)
About to write to /Users/vfonic/Developer/javascript/asd/package.json:

{
  "name": "asd",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}


Is this OK? (yes)


Bold are prompts, with sensible defaults in the (brackets).

Wouldn't it be great if rails had something similar? Imagine gems attaching directly to the `rails new` and immediately installing and setting up even before you `cd` to your app! If not, at least I'll be able to skip all the flags I want to skip, by going through the interactive `rails new`.

If you prefer the simplicity of `rails new` and would like to keep it, we could add a single "Y/n" prompt before all the others:
Create new app with sensible defaults Y/n:

What do you think?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/rubyonrails-core.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-core/1d5b818b-ce75-4ccd-be88-4ec46b7b923c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.