Skip to content
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

fixed the readme in the generated app on how to build a release build #639

Merged

Conversation

baseballlover723
Copy link
Contributor

Description of the Change

Fixed the readme that gets generated in an app. It previously suggested using shards build --production as part of building a release build, but that doesn't actually make a release build. The correct command is shards build --release.

Alternate Designs

None

Benefits

People won't get confused trying to build a release build

Possible Drawbacks

None

Copy link
Member

@robacarp robacarp left a comment

Choose a reason for hiding this comment

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

Thank you @baseballlover723

@@ -28,7 +28,7 @@ To build and run a **production** release:
```
npm run release
amber db create migrate
shards build --production
shards build --release
Copy link
Contributor

Choose a reason for hiding this comment

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

--production flag is needed because development_dependencies shouldn't be installed on production releases

Copy link
Contributor

@faustinoaq faustinoaq Feb 9, 2018

Choose a reason for hiding this comment

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

@baseballlover723 BTW, I think --release flag would be very optional because compiled binaries without --release flag work very well, also compiling with --release is very expensive in some devices/enviroments

See: amberframework/heroku-buildpack-amber#4 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

correct me if I'm wrong, but it looks to me that build completely ignores the production flag (other then passing it on to crystal, which also ignores it). I would also argue that its better to have shards build --release and then the user can decide if --release is too expensive and drop that themselves. Also In my mind, if your giving instructions on how to build a production release, that includes full optimizations.

Copy link
Contributor

@faustinoaq faustinoaq Feb 9, 2018

Choose a reason for hiding this comment

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

then the user can decide if --release is too expensive and drop that themselves.

Yeah, we can keep --release and add some note about release expensiveness

correct me if I'm wrong, but it looks to me that build completely ignores the production flag (other then passing it on to crystal, which also ignores it)

@baseballlover723 No, shards doesn't ignore it, --production flag is used here : https://github.com/crystal-lang/shards/blob/10ed3ea745da980db7a895907d7a8a4ce7775404/src/cli.cr#L32 and introduced here: https://github.com/crystal-lang/shards/blob/c365c5b83680d07df86f0372917b5496965bd355/CHANGELOG.md#v040

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@faustinoaq but to me it doesn't look like Shards.production? is actually used in the actual build command itself. https://github.com/crystal-lang/shards/blob/10ed3ea745da980db7a895907d7a8a4ce7775404/src/commands/build.cr

Copy link
Contributor

@faustinoaq faustinoaq Feb 9, 2018

Choose a reason for hiding this comment

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

@baseballlover723 I tested it and --production flag works as expected:

  1. WIth --production flag: (development_dependency granite_spec isn't installed)
$ shards build --production
Fetching https://github.com/amberframework/amber.git
Fetching https://github.com/luislavena/radix.git
Fetching https://github.com/jeromegn/kilt.git
Fetching https://github.com/jeromegn/slang.git
Fetching https://github.com/stefanwille/crystal-redis.git
Fetching https://github.com/amberframework/cli.git
Fetching https://github.com/mosop/optarg.git
Fetching https://github.com/mosop/callback.git
Fetching https://github.com/mosop/string_inflection.git
Fetching https://github.com/amberframework/teeplate.git
Fetching https://github.com/juanedi/micrate.git
Fetching https://github.com/crystal-lang/crystal-db.git
Fetching https://github.com/jwaldrip/shell-table.cr.git
Fetching https://github.com/askn/spinner.git
Fetching https://github.com/will/crystal-pg.git
Fetching https://github.com/crystal-lang/crystal-mysql.git
Fetching https://github.com/crystal-lang/crystal-sqlite3.git
Fetching https://github.com/amberframework/granite-orm.git
Fetching https://github.com/amberframework/quartz-mailer.git
Fetching https://github.com/amberframework/smtp.cr.git
Fetching https://github.com/amberframework/jasper-helpers.git
Installing amber (0.6.4)
Installing radix (0.3.8)
Installing kilt (0.4.0)
Installing slang (1.7.1 at master)
Installing redis (1.9.0)
Installing cli (0.7.0)
Installing optarg (0.5.8)
Installing callback (0.6.3)
Installing string_inflection (0.2.1)
Installing teeplate (0.5.0)
Installing micrate (0.3.0)
Installing db (0.5.0)
Installing shell-table (0.9.2)
Installing spinner (0.1.1)
Installing pg (0.14.1)
Installing mysql (0.4.0)
Installing sqlite3 (0.9.0)
Installing granite_orm (0.8.4)
Installing quartz_mailer (0.4.0)
Installing smtp (0.3.0)
Installing jasper_helpers (0.1.8)
Building: forum
  1. Without --production flag (development_dependency granite_spec is installed)
$shards build             
Fetching https://github.com/amberframework/amber.git
Fetching https://github.com/luislavena/radix.git
Fetching https://github.com/jeromegn/kilt.git
Fetching https://github.com/jeromegn/slang.git
Fetching https://github.com/stefanwille/crystal-redis.git
Fetching https://github.com/amberframework/cli.git
Fetching https://github.com/mosop/optarg.git
Fetching https://github.com/mosop/callback.git
Fetching https://github.com/mosop/string_inflection.git
Fetching https://github.com/amberframework/teeplate.git
Fetching https://github.com/juanedi/micrate.git
Fetching https://github.com/crystal-lang/crystal-db.git
Fetching https://github.com/jwaldrip/shell-table.cr.git
Fetching https://github.com/askn/spinner.git
Fetching https://github.com/will/crystal-pg.git
Fetching https://github.com/crystal-lang/crystal-mysql.git
Fetching https://github.com/crystal-lang/crystal-sqlite3.git
Fetching https://github.com/amberframework/granite-orm.git
Fetching https://github.com/amberframework/quartz-mailer.git
Fetching https://github.com/amberframework/smtp.cr.git
Fetching https://github.com/amberframework/jasper-helpers.git
Fetching https://github.com/amberframework/garnet-spec.git
Fetching https://github.com/ysbaddaden/selenium-webdriver-crystal.git
Installing amber (0.6.4)
Installing radix (0.3.8)
Installing kilt (0.4.0)
Installing slang (1.7.1 at master)
Installing redis (1.9.0)
Installing cli (0.7.0)
Installing optarg (0.5.8)
Installing callback (0.6.3)
Installing string_inflection (0.2.1)
Installing teeplate (0.5.0)
Installing micrate (0.3.0)
Installing db (0.5.0)
Installing shell-table (0.9.2)
Installing spinner (0.1.1)
Installing pg (0.14.1)
Installing mysql (0.4.0)
Installing sqlite3 (0.9.0)
Installing granite_orm (0.8.4)
Installing quartz_mailer (0.4.0)
Installing smtp (0.3.0)
Installing jasper_helpers (0.1.8)
Installing garnet_spec (0.1.1)
Installing selenium (0.3.0)
Building: forum

Tested with this shard.yml

$ cat shard.yml 
name: forum
version: 0.1.0

authors:
  - Faustino Aguilar <[email protected]>

crystal: 0.24.1

license: UNLICENSED

targets:
  forum:
    main: src/forum.cr

dependencies:
  amber:
    github: amberframework/amber
    version: 0.6.4

  granite_orm:
    github: amberframework/granite-orm
    version: ~> 0.8.0

  quartz_mailer:
    github: amberframework/quartz-mailer
    version: ~> 0.4.0

  jasper_helpers:
    github: amberframework/jasper-helpers
    version: ~> 0.1.6

  sqlite3:
    github: crystal-lang/crystal-sqlite3
    version: ~> 0.9.0

development_dependencies:
  garnet_spec:
    github: amberframework/garnet-spec
    version: ~> 0.1.1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see now, I missed that build calls install (which uses the --production flag) if the shards haven't been installed yet. I'll update the pr to include the --production flag as well and add the note about --release possibly being expensive.

@faustinoaq faustinoaq merged commit 4960690 into amberframework:master Feb 11, 2018
@baseballlover723 baseballlover723 deleted the fix-readme-in-generated-app branch February 12, 2018 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants