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

Provide attributes for git config #434

Merged
merged 14 commits into from
Dec 13, 2017
Merged

Provide attributes for git config #434

merged 14 commits into from
Dec 13, 2017

Conversation

faustinoaq
Copy link
Contributor

@faustinoaq faustinoaq commented Dec 4, 2017

Description of the Change

  • Add README enhancements
  • Add attributes for git config (based on crystal tools)

Alternate Designs

No

Benefits

Useful data on default README

Possible Drawbacks

No

shards install
npm install
```

Configure the `config/environments/development.yml` and set the `database_url` with your credentials to your database.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this line still valid?, Should we add amber encrypt reference to this README too? What steps are needed to setup production.yml? What about .encryption_key?

Copy link
Member

Choose a reason for hiding this comment

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

That might live nicely in a Deployment section

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@robacarp I added a link to amber encrypt documentation 👍


```
AMBER_ENV=production
shards build --production --release <%= @name %>
Copy link
Contributor Author

@faustinoaq faustinoaq Dec 4, 2017

Choose a reason for hiding this comment

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

Maybe we can use production automatically if --release flags is used? WDYT?

# config/application.cr
{% if flag :release %}
settings.env = "production"
{% else %}
settings.env = ENV["AMBER_ENV"] if ENV["AMBER_ENV"]?
{% end %}

Copy link
Member

Choose a reason for hiding this comment

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

I'd rather not, that defeats the purpose of the environment variable.

Copy link
Contributor

@veelenga veelenga Dec 4, 2017

Choose a reason for hiding this comment

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

Sorry, what does --release do in shards build command? I haven't seen it as a valid flag:

❯ shards --version                                                                                                                                                                     
Shards 0.7.1 (2017-10-12)
❯ shards build -h                                                                                                                                                                        
shards [options] <command>

Commands:
    build [targets] [options]
    check
    init
    install
    list
    prune
    update

Options:
    --no-color
    --version
    --production
    -v, --verbose
    -q, --quiet
    -h, --help

Builds an executable with --release flag?

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'd rather not, that defeats the purpose of the environment variable.

@robacarp Yeah I know, that's Why I asked,

Sometimes I just think compiling amber projects for production is so repetitive

# Enable production env to read production.enc
AMBER_ENV=production

 # --production does not install DevDependencies
shards insttall --production

# --release enable crystal build optimizations for production
shards build --release <%= @name %>

Maybe we should add something like amber build -e production

We already have amber run -e production but it runs the binary by default, so I think this is more useful during development.

Of course I can do something like AMBER_ENV=production shards build myproject at works (unoptimized). I just thought maybe we can take advantage from shards --production and crystal --release flags.

Builds an executable with --release flag?

@veelenga Yeah, --release builds executable with release flag, seems to be not documented yet

Copy link
Member

Choose a reason for hiding this comment

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

Hm, I believe shards build --release does check dependencies for you, no need to do shards install beforehand.

I'd like to avoid making the way amber uses the underlying crystal commands and libraries too opaque, because it handicaps people when they need to wander outside the bounds of an ordinary Amber application. Perhaps a command like amber build -e production could be more transparent by echoing out what it's doing as it happens?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm, I believe shards build --release does check dependencies for you, no need to do shards install beforehand.

Yeah, you can use shards build --production --release

Perhaps a command like amber build -e production could be more transparent by echoing out what it's doing as it happens?

Yeah I like that 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

...echoing out what it's doing as it happens?

We should do the same with amber run and amber watch using some kind of flag like --verbose

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, seems that amber build is useless, we already have shards build, currently I'm thinking on remove amber run too


def fetch_github_name
default = "[your-github-name]"
return default unless system(WHICH_GIT_COMMAND)
Copy link
Contributor

Choose a reason for hiding this comment

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

system(WHICH_GIT_COMMAND) will be called 3 times (getch_author, fetch_email, fetch_github_name). Better to check whether git exists or not earlier.

Copy link
Contributor Author

@faustinoaq faustinoaq Dec 4, 2017

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@veelenga Done! Thank you for your suggestion! 👍


def fetch_email
return "[your-email-here]" unless system(WHICH_GIT_COMMAND)
`git config --get user.email`.strip
Copy link
Contributor

Choose a reason for hiding this comment

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

User may not also have user.email and user.name configured, so fetch_email and fetch_author will return an empty string (instead of "[your-email-here]").

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, we already used this without major problems for all crystal projects until now, check: https://github.com/crystal-lang/crystal/blob/master/src/compiler/crystal/tools/init.cr

Copy link
Contributor

@veelenga veelenga Dec 5, 2017

Choose a reason for hiding this comment

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

Right, it doesn't have major problems, but it just doesn't work in all cases properly and is easy to fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@veelenga Done! Thank you for your suggestion! 👍

Copy link
Contributor Author

@faustinoaq faustinoaq left a comment

Choose a reason for hiding this comment

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

Pending for more reviews 👍


def fetch_github_name
default = "[your-github-name]"
return default unless system(WHICH_GIT_COMMAND)
Copy link
Contributor Author

@faustinoaq faustinoaq Dec 4, 2017

Choose a reason for hiding this comment

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

@marksiemers
Copy link
Contributor

Can this write the name and email to the generated shards.yml as well?

Copy link
Member

@elorest elorest left a comment

Choose a reason for hiding this comment

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

Looks cool to me.

@elorest elorest merged commit 9cdc372 into master Dec 13, 2017
@faustinoaq faustinoaq deleted the fa/git-readme branch December 13, 2017 07:22
@eliasjpr eliasjpr added this to the 0.5.0 - Features & Bugfixes milestone Dec 22, 2017
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.

6 participants