Skip to content

[RFR] Graceful relative paths in CLI and config file - #364

Merged
valeriangalliat merged 3 commits into
masterfrom
hotfix/cli-theme-relative
Feb 10, 2015
Merged

[RFR] Graceful relative paths in CLI and config file#364
valeriangalliat merged 3 commits into
masterfrom
hotfix/cli-theme-relative

Conversation

@valeriangalliat

Copy link
Copy Markdown
Member

This needs to be merged with --no-ff in both master and develop after review. Then make publish on master.

If no `dest` is passed, docopt would still force it to `sassdoc` and the
rest of the code would think `dest` was set explicitely via CLI, thus
overriding any `dest` from potential configuration file.
@valeriangalliat valeriangalliat changed the title Graceful relative paths in CLI and config file [RFR] Graceful relative paths in CLI and config file Feb 9, 2015
Comment thread src/cli.js

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why did you remove the default value here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

See commit message and Slack discussion; it was overriding any config-defined dest even if not explicitely given via CLI.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.18%) to 93.78% when pulling 15d607b on hotfix/cli-theme-relative into bb6838f on master.

@valeriangalliat valeriangalliat self-assigned this Feb 10, 2015
Comment thread src/environment.js Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I find the keys destName and themeName a bit confusing, since they are actually paths. (relative but still).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

You're right, though themeName can also be the package name (not path)… and it's used only for display.

We could call them destPath and themePath but it would not be relevant for theme in the case of a non-path package name.

I'm thinking the most correct way would be to rename them in displayDest and displayTheme.

But themeName was already present in the interface, I don't think it's documented though, so we can consider it private and might rename it without "breaking".

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Then yeah, either displayDest and displayTheme.
Or maybe a method display() which could be used like env.display('themeName') ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

You mean env.display('theme')? Not possible since the display value for the theme is figured out at the same time as theme, depending if it's a package or a path. Or env.display() would just be a proxy to the env.displayTheme variable.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's keep it the simpler and DRY possible :-)

@pascalduez

Copy link
Copy Markdown
Member

LGTM

Before this, `dest` was always relative to CWD even when set from config
file, and if a config file was defined, `theme` was always relative to
it even when set via CLI.

Now for all CLI-passed environment properties, a "friend" `*Cli` prperty
is set to `true` (`themeCli`, `destCli`), so the environment loader can
determine whether it's relative to CWD or config file.

Also paths are now stored absolute, but are always displayed relative to
the CWD for coherent CLI output. If you set `theme: ../../theme` in
`foo/config.yml`, the displayed theme in CLI output will be `../theme`.

This fixes #362.
@valeriangalliat
valeriangalliat force-pushed the hotfix/cli-theme-relative branch from 15d607b to c47dea1 Compare February 10, 2015 17:51
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.18%) to 93.78% when pulling c47dea1 on hotfix/cli-theme-relative into bb6838f on master.

@valeriangalliat
valeriangalliat merged commit c47dea1 into master Feb 10, 2015
@valeriangalliat
valeriangalliat deleted the hotfix/cli-theme-relative branch February 10, 2015 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants