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

Feature/additional enhancements #7

Merged
merged 17 commits into from Mar 9, 2017

Conversation

thijsbouwes
Copy link
Contributor

Added skeletor package:add so developers can easily add new packages.
Changed the class naming (packages) to the complete slug, so there will be no conflicts.

public function searchPackage(string $package)
{
$data = file_get_contents($this->buildSearchUrl($package));
$data = json_decode($data, true);
Copy link
Contributor

Choose a reason for hiding this comment

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

should we check $data is valid? something like json_last_error() === JSON_ERROR_NONE ? array_map(...) : []

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice catch, implement this and for the getVersionsPackage as well

/**
* @param array $options
*/
public function setConfig(array $options)
Copy link
Contributor

Choose a reason for hiding this comment

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

should we rename this method, we are saving/storing the config, setConfig implies you would be doing something like $this->config = $options

@@ -1,11 +1,11 @@
config:
name: Skeletor CLI
name: 'Skeletor CLI'
Copy link
Contributor

Choose a reason for hiding this comment

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

No need for quotes since there is no special characters in the string

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, i already couldn't remember changing this. But what happens, if you add a package and the storeConfig method runs. It exactly puts quotes around the string.

$this->makePackageClass($packageInfo);
}

protected function setupCommand()
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems that this method is very similar to the one implemented in the other commands, should we maybe create an abstract SkeletorCommand and put in the there shared methods and make the actual commands extend from it instead of the Symfony Command

*/
protected function buildPackageInfo(array $packageInfo)
{
$packageName = preg_replace('/\//', ' ', $packageInfo['slug']);
Copy link
Contributor

Choose a reason for hiding this comment

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

We can group these two regular expressions, something like preg_replace('//|-/', ' ', $packageInfo['slug']);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice, still learning regex 😃


//Replace stub dummy data
foreach ($packageInfo as $key => $info)
{
Copy link
Contributor

Choose a reason for hiding this comment

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

following our standard, { on the same line as foreach

public function specifyPackage($packages)
{
$packageQuestion = $this->cli->radio('Choose your packages:', $packages);
return $packageQuestion->prompt();
Copy link
Contributor

Choose a reason for hiding this comment

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

blank line before a return

$this->setName("Behat Behat");
}

public function configure(Framework $activeFramework)
Copy link
Contributor

Choose a reason for hiding this comment

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

empty method, should we delete it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True, what is the best practice. Because we define configure on our packageinterface it must be defined in the child. But like you said, its probably not always going to be used.

Should i remove it from the interface?

Copy link
Contributor

Choose a reason for hiding this comment

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

It case the best practise would be to have to interfaces, PackageInterface and ConfigurablePackageInterface that extends from PackageInterface. So you can pick the one you need for each case.

Copy link
Owner

@kielabokkie kielabokkie left a comment

Choose a reason for hiding this comment

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

Just have some general comments as Tito already caught the rest :)

@@ -1,11 +1,11 @@
config:
name: Skeletor CLI
name: 'Skeletor CLI'
version: 1.0.0
Copy link
Owner

Choose a reason for hiding this comment

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

I wonder if there is a nice way to get the version number from the git tag automatically?

@@ -42,7 +42,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$this->setupCommand();

//Start process in the background
$process = new Process('php skeletor package:show --no-ansi');
$process = new Process('skeletor package:show --no-ansi');
Copy link
Owner

Choose a reason for hiding this comment

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

Is it right that this is being changed back? This was a bugfix you did last time to sort the issue with the packagist API, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is a separate/new bug. So on composer global, the packages aren't fetched because it cant find the command. When removing the php it works, because it can find the command again.

@kielabokkie kielabokkie merged commit decffdd into master Mar 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants