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

Add CLI config overrides #126

Closed
wants to merge 11 commits into from
Closed

Conversation

jpsim
Copy link
Contributor

@jpsim jpsim commented Mar 20, 2014

Adds ability to override all boolean, integer & string liftoffrc config options with CLI arguments. Fixes #124.

--[no-]cp
--[no-]git
--[no-]warnings
--[no-]todo-scripts
--[no-]static-analyzer
--indentation_level N ... alias -t
--project_name [PROJECT_NAME] ... alias -n
--company [COMPANY] ... alias -c
--author [AUTHOR] ... alias -a
--prefix [PREFIX] ... alias -p
--identifier [IDENTIFIER] ... alias -i

* master:
  Remove Travis config for now
  Add basic travis config
  Update liftoffrc(5) for script phase changes
  Add configuration for setting up Run Script phases
  Reluctantly allow the use of tabs for indentation
  Be more specific about not linking Info.plist file
  Centralize deployment target
* master:
  Break configuration attributes into multiple lines
  Add deprecation manager
@jpsim
Copy link
Contributor Author

jpsim commented Mar 26, 2014

Thoughts on this?

My main concern with this approach is all of the duplication. Every ProjectConfiguration accessor is essentially rewritten here.

But all the other ways I can think of to DRY this up either have less flexibility or unnecessarily complicate the code.

@gfontenot
Copy link
Member

Yeah, sorry. Not ignoring, just got busy with some other stuff.

That's my main concern as well. But like you said, I don't think there's any good way around that.

Let me take another look through this tomorrow. (Or maybe tonight, if I get time)

@jpsim
Copy link
Contributor Author

jpsim commented Mar 26, 2014

no worries, I just wanted to get a discussion started

@@ -2,11 +2,12 @@ module Liftoff
class CLI
def initialize(argv)
@argv = argv
@liftoffrc = {}
Copy link
Member

Choose a reason for hiding this comment

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

Lets call this something else since it's not actually coming from the liftoffrc. Maybe flags or options?

@gfontenot
Copy link
Member

We should remove the option to enable/disable the todo scripts since those have been replaced by run_script_phases, and we should add the ability to be able to enable/disable tabs.

I'm wondering if there shouldn't be a different line drawn in the sand for what keys to add here. Basing the availability of the command line flags on the type of the value from the liftoffrc feels weird to me. Maybe we should just cherry-pick keys that make sense? Proposal:

--[no-]cocoapods
--[no-]git
--indentation_level N ... alias -t
--project_name [PROJECT_NAME] ... alias -n
--company [COMPANY] ... alias -c
--author [AUTHOR] ... alias -a
--prefix [PREFIX] ... alias -p
--identifier [IDENTIFIER] ... alias -i

The stuff that we prompt for, git, and CocoaPods makes sense to enable/disable, but everything else feels like low enough overhead to ignore. Thoughts?

ping @thoughtbot/ios


# Boolean Options

opts.on('--[no-]cp', 'Enable/Disable Cocoapods') do |use_cocoapods|
Copy link
Member

Choose a reason for hiding this comment

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

Can we use --[no-]cocoapods and alias it to -c?

Copy link
Member

Choose a reason for hiding this comment

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

Ah, I see. --company is already using -c. Lets not alias --cocoapods then. I'd rather the long flags be explicit. Worst case scenario, this gives me a reason to learn how to write completion functions and then probably cry a lot I bet.

- removed/renamed some CLI options
- moved liftoffrc/cli_options merging from LaunchPad to ConfigurationParser
@@ -10,7 +14,8 @@ def project_configuration
def evaluated_configuration
default_configuration.
merge(user_configuration).
merge(local_configuration)
merge(local_configuration).

Choose a reason for hiding this comment

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

Place the . on the next line, together with the method name.

Copy link
Member

Choose a reason for hiding this comment

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

This is a new addition to our style guide, but it would probably be good to go ahead and make this change now since we're messing around in here.

@@ -1,6 +1,10 @@
module Liftoff
class ConfigurationParser

def initialize(cli_options)
Copy link
Member

Choose a reason for hiding this comment

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

Can we call this argument options consistently? Here as well as in Launchpad?

@gfontenot
Copy link
Member

I think this is good to go after these last 2 nitpicks. Thanks for being tackling this!

- renamed instances of "cli_options" and "cli_config" to just "options"
@jpsim
Copy link
Contributor Author

jpsim commented Mar 27, 2014

Done and done.

@gfontenot
Copy link
Member

Rebased onto master and merged in 080b30d

@gfontenot gfontenot closed this Mar 27, 2014
@jpsim jpsim deleted the jp-cli-config branch March 27, 2014 19:00
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.

Add CLI config parsing
4 participants