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

Added Elixir option to ThemeScaffold #27

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
3 participants
@originalwebgurl
Copy link

originalwebgurl commented May 27, 2016

Not sure if this is something you'd want for this module. I was planning to put it in a separate one but thought I'd check in first to see if you'd prefer to have it as part of the existing ThemeScaffold.

Added the option to include elixir as part of the theme scaffolding. During the setup you can choose to include elixir and specify the version if you like.

If you choose to include Elixir as part of the theme scaffolding it will be configured to look for source files in THEME_NAME/resources and generate your assets within your THEME_NAME/assets directory.

It also includes the 'stylistPublish' Elixir extension. An updated version of the snippet documented here: https://asgardcms.com/docs/themes/usage#elixir

New unit tests were added to make sure it's backwards compatible. No elixir files are created when you choose 'no' during setup. Tests were added to validate the elixir files get created as well when you choose 'yes' during setup.

To manually test:

php artisan asgard:theme:scaffold
// 1. 'vendor/themename' [Enter]
// 2. 'frontend' [Enter]
// 3. 'Yes' [Enter]
// 4. '*' [Enter]
// 5. '*' [Enter]
cd Themes/themename
npm install
// add a css or less file to be mixed in
gulp
// see the generated file in Themes/themename/assets
// see the published assets in public/themes/themename

The .php_cs file seems to be out-dated so I ran this (tried to match it up as best as I could)

php-cs-fixer fix . --rules=@PSR1,@PSR2,concat_with_spaces,ordered_imports,no_extra_consecutive_blank_lines,no_useless_return,no_unused_imports,no_whitespace_in_blank_lines --verbose --dry-run

Not sure if you're still following the PSR2 standards since most of the files failed the unix line endings test, so I left them as-is.

sherrif
Added Elixir option to ThemeScaffold
Added the option to include elixir as part of the theme scaffolding. During the setup you can choose to include elixir and specify the version if you like.

If you choose to include Elixir as part of the theme scaffolding it will be configured to look for source files in THEME_NAME/resources and generate your assets within your THEME_NAME/assets directory.

It also includes the 'stylistPublish' Elixir extension. An updated version of the snippet documented here: https://asgardcms.com/docs/themes/usage#elixir

New unit tests were added to make sure it's backwards compatible. No elixir files are created when you choose 'no' during setup. Tests were added to validate the elixir files get created as well when you choose 'yes' during setup.
* @param string $gulp Version of gulp to write to package.json
* @return $this
*/
public function withElixir($elixir="*", $gulp="*")

This comment has been minimized.

@Nitpick-CI

Nitpick-CI May 27, 2016

  • Incorrect spacing between argument $elixir and equals sign; expected 1 but found 0
  • Incorrect spacing between default value and equals sign for argument $elixir; expected 1 but found 0
  • Incorrect spacing between argument $gulp and equals sign; expected 1 but found 0
  • Incorrect spacing between default value and equals sign for argument $gulp; expected 1 but found 0
* @group elixir
* @test
*/
public function it_does_not_create_elixir_files_when_option_is_no()

This comment has been minimized.

@Nitpick-CI

Nitpick-CI May 27, 2016

Method name ThemeScaffoldTest::it_does_not_create_elixir_files_when_option_is_no is not in camel caps format

* @group elixir
* @test
*/
public function it_creates_elixir_files_when_option_is_yes_with_defaults()

This comment has been minimized.

@Nitpick-CI

Nitpick-CI May 27, 2016

Method name ThemeScaffoldTest::it_creates_elixir_files_when_option_is_yes_with_defaults is not in camel caps format

* @group elixir
* @test
*/
public function it_creates_versioned_elixir_files_when_version_set()

This comment has been minimized.

@Nitpick-CI

Nitpick-CI May 27, 2016

Method name ThemeScaffoldTest::it_creates_versioned_elixir_files_when_version_set is not in camel caps format

@nWidart

This comment has been minimized.

Copy link
Member

nWidart commented May 27, 2016

Thanks. But please use the .php_cs file to run php-cs-fixer, which is for PSR2.

Edit: your tests are failing.

@originalwebgurl

This comment has been minimized.

Copy link

originalwebgurl commented May 27, 2016

@nWidart I'll tinker around with this some more tomorrow. Unfortunately when I run php-cs-fixer I see this:

vagrant@homestead:~/Code/AsgardCMS/Platform/Modules/Workshop$ php-cs-fixer fix . --verbose --dry-run
PHP Fatal error:  Uncaught Error: Class 'Symfony\CS\Finder\DefaultFinder' not found in /home/vagrant/Code/AsgardCMS/Platform/Modules/Workshop/.php_cs:3

Is there some other script I need to run beforehand?

@nWidart

This comment has been minimized.

Copy link
Member

nWidart commented May 27, 2016

do you have php-cs-fixer installed globally ? and which version ?

@originalwebgurl

This comment has been minimized.

Copy link

originalwebgurl commented May 27, 2016

Closing since I'm unable to run php-cs-fixer. If I find time to troubleshoot this I'll re-open in the future.

Tried running this (as described here: https://asgardcms.com/docs/getting-started/contributing#style-guide)

cd Modules/Workshop
php-cs-fixer fix . --config-file=".php_cs" --verbose

Error:

  [Symfony\Component\Console\Exception\RuntimeException]
  The "--config-file" option does not exist.

Corrected it to

php-cs-fixer fix . --config=".php_cs" --verbose

Error:

PHP Fatal error:  Uncaught Error: Class 'Symfony\CS\Finder\DefaultFinder' not found in /home/vagrant/Code/AsgardCMS/Platform/Modules/Workshop/.php_cs:3

Tried to run it a few ways and keep getting this error. I have to get back to my project but will try and find time to look into this when I can.

PHP: v7.0.1
PHP CS Fixer: v2.0-DEV (installed globally)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment