Code Monkey home page Code Monkey logo

silverstripe-console's People

Contributors

dmc-core avatar robbieaverill avatar robingram avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

silverstripe-console's Issues

Injector lookup returns incorrect module for resolved class

When looking up an injector resolution the module name returned is that of the owner of the input class name, but it should probably be the result class name:

$ ssconsole object:lookup "SilverStripe\Security\BasicAuthMiddleware"
SilverStripe\Security\BasicAuthMiddleware resolves to CWP\Core\Control\CwpBasicAuthMiddleware
Module: silverstripe/framework

Expected: cwp/cwp-core
Actual: silverstripe/framework

Rename object:lookup to injector:lookup

The command object:lookup seems to fit more naturally under injector:lookup instead.

We could introduce this as a command alias initially to preserve backwards compatibility for the 1.x line.

Rename the module to silverleague/ssconsole

It's not a SilverStripe module, so there's no real need to follow the vendor/silverstripe-package convention.

Let's simplify this by making the repository URL, the readme title and the composer package name all silverleague/ssconsole.

Undefined index: SERVER_PROTOCOL

SilverStripe 4.2.x-dev, latest dev-master for ssconsole

PHP Notice:  Undefined index: SERVER_PROTOCOL in /Users/robbieaverill/dev/releases/release-cwp_cwp-recipe-kitchen-sink-2.1.0-rc1/vendor/silverstripe/framework/src/Control/HTTPResponse.php on line 125
PHP Stack trace:
PHP   1. {main}() /Users/robbieaverill/.composer/vendor/silverleague/ssconsole/bin/ssconsole:0
PHP   2. SilverLeague\Console\Framework\Scaffold->__construct() /Users/robbieaverill/.composer/vendor/silverleague/ssconsole/bin/ssconsole:23
PHP   3. SilverLeague\Console\Framework\Scaffold->bootstrap() /Users/robbieaverill/.composer/vendor/silverleague/ssconsole/src/Framework/Scaffold.php:68
PHP   4. SilverLeague\Console\Framework\Bootstrap->initialize() /Users/robbieaverill/.composer/vendor/silverleague/ssconsole/src/Framework/Scaffold.php:161
PHP   5. SilverLeague\Console\Framework\Bootstrap->findSilverStripe() /Users/robbieaverill/.composer/vendor/silverleague/ssconsole/src/Framework/Bootstrap.php:23
PHP   6. SilverStripe\Control\HTTPApplication->handle() /Users/robbieaverill/.composer/vendor/silverleague/ssconsole/src/Framework/Bootstrap.php:60

Notice only, doesn't break functionality, but would be nice not to have it there.

Enhancement: console should be extensible

As a developer I should be able to add my own commands for the console.

They may live in a user directory, e.g. ~/silverstripe-console/src or in a SilverStripe application folder, e.g. /var/www/silverstripe-console/src

Any configuration YAML files should be merged into the main configuration file before commands are loaded.

We could also search through all vendor/ folders for a ssconsole.yml file to be able to pick up multiple modules installed with composer.

The user directory configuration (e.g. ~/ssconsole.yml) should take priority over custom modules, which should be loaded on top of core commands.

I don't imagine any way initially of being able to modify the core ssconsole behaviour, although we could probably use symfony console events to provide some level of abstraction if we need to.

Better error messages when creating a new member

When using member:create we could present better error messages in some cases, for example when a member with the same email address already exists in the database.

Currently:

  [SilverStripe\ORM\ValidationException]                                                        
  Can't overwrite existing member #112 with identical identifier (Email = [email protected]))

Instead, we could $output->writeln('<error>A member with the email <info>' . $email . '</info> already exists!</error>'); or something similar

Enhancement: cache management - flush, inspect, remove individually

  • cache:list: list all cache IDs as well as some information about them
  • cache:dump: Dump the contents of everything in the cache, or by ID
  • cache:flush: Clear the entire cache manifest
  • cache:view: View the contents of specific cache entries by key This can be incorporated as an argument of cache:dump
  • cache:remove Remove specific cache entries by key

I'm not sure that the ConfigManifest will actually let us do these:

  • cache:enable: Enable the global cache (if disabled)
  • cache:disable: Disable the global cache (if enabled)

ssconsole refuses to run with "SilverStripe installation could not be found"

ssconsole (version 0.1.0 and 0.2.0 equally; installed locally or globally) fails as shown in the transcript below (transcript was made with local installation). As shown, there is definitely a SilverStripe installation, because sake dev/build just ran successfully.

…
 * UserDefinedForm_EmailRecipient
 * UserDefinedForm_EmailRecipientCondition
 * SubmittedForm
 * SubmittedFormField
 * SubmittedFileField

 Database build completed!

╭─[email protected] ~/Project/docroot  ‹develop› 
╰─➤  vendor/bin/ssconsole dev:build --flush
A SilverStripe installation could not be found. Please run ssconsole from your SilverStripe root.
╭─[email protected] ~/Project/docroot  ‹develop› 
╰─➤  

The host system is FreeBSD 10.3-RELEASE-p4 amd64 running PHP 5.6.32 and mariadb Ver 15.1 Distrib 10.1.30-MariaDB.

Local project symfony/console 4.x error when using 3.x globally

If you're running this globally with Composer it's currently using symfony/console 3.x. SilverStripe 4.x uses symfony/console 4.x if you have Behat installed. For some reason parts of this API are autoloaded before the global console library, so you end up with this error when running ssconsole:

ERROR [Emergency]: Uncaught Error: Call to undefined method Symfony\Component\Console\Helper\QuestionHelper::getInputStream()
IN GET /
Line 911 in /Users/robbieaverill/.composer/vendor/symfony/console/Application.php

Source
======
  902:             $inputStream = null;
  903: 
  904:             if ($input instanceof StreamableInputInterface) {
  905:                 $inputStream = $input->getStream();
  906:             }
  907: 
  908:             // This check ensures that calling QuestionHelper::setInputStream() works
  909:             // To be removed in 4.0 (in the same time as QuestionHelper::setInputStream)
  910:             if (!$inputStream && $this->getHelperSet()->has('question')) {
* 911:                 $inputStream = $this->getHelperSet()->get('question')->getInputStream(false);
  912:             }
  913: 
  914:             if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) {
  915:                 $input->setInteractive(false);
  916:             }
  917:         }

Trace
=====
Symfony\Component\Console\Application->configureIO(, Symfony\Component\Console\Output\ConsoleOutput)
Application.php:145

Symfony\Component\Console\Application->run()
Scaffold.php:82

SilverLeague\Console\Framework\Scaffold->run()
ssconsole:24

We should probably update to console 4.x. There may still be conflicts with other libraries (like silverstripe/cow) which require symfony/console 3.x, but they can deal with that.

Enhancement: system check command

A system:check command could perform a series of automated checks on your environment. This wouldn't necessarily replace things like the silverstripe/environmentcheck module, but more basic checks that would be required for SilverStripe to operate (NB: it's possible that the command itself may not run if that were the case):

  • PHP version support
  • php-intl installed
  • dotenv is available
  • Permissions across various folders (read everywhere, local write on assets)
  • Database is reachable

cc @silverleague/console for feedback

Add code coverage

To allow us to measure the coverage change over time as this module nears dev complete.

Enhancement: module creator

As a developer, if I want to quickly create a module I should:

  • Enter the module name, e.g. "mymodule"
  • Ask for the desired vendor/package namespace
  • Have it create a shell composer.json including PSR-4 autoloading
  • Have the console prompt me to choose any Objects to extend, and create empty Extensions classes and YAML configuration for each. This should repeat until no more are required.
  • Have the console prompt me for any custom DataObjects to create, and whether they need an accompanying template
  • Initialise a readme
  • Create simple configuration unit tests to ensure that the extensions have been applied to the desired class

Combine all console options in to a single solution

Multiple people have written their own implementation of a SilverStripe console.

I would much rather see a single implementation, than the current option of choosing a single one that almost does what is wanted.

@micmania and @axyr have their own implementations. It would be good to get the three options together and look at the pros and cons and take the best of each instead of keeping on trucking the way the current console implementations are all going their separate path of priority

Update to symfony/console:^5.0

Some of other packages uses symfony/console:^5.0.
Would love to see if this package can be installed along with other packages which uses symfony/console:^5.0.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.