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

Amphtml generator update #6

Open
wants to merge 37 commits into
base: master
Choose a base branch
from
Open

Amphtml generator update #6

wants to merge 37 commits into from

Conversation

marcelovani
Copy link

@marcelovani marcelovani commented Dec 5, 2018

On this pull request I did the following:

  • Added a Vagrantfile to spin a VM with all the dependencies to generate the PHP validator
  • Fixed the autoloader include to make it work from different folders
  • Copied the WP Plugin generator scripts into bin folder
  • Copied the Lullabot AMP generator scripts into bin folder and made minor tweaks
  • Resolved issue #249

See Lullabot#231

config.vm.provider "virtualbox" do |vb|
vb.memory = "1024"
end
end
Copy link
Author

Choose a reason for hiding this comment

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

This Vagrant file is used to download all dependencies inside a VM. We could have an alternative docker file.

require_once ($autoload);
break;
}
}
Copy link
Author

Choose a reason for hiding this comment

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

Allow the script to work from different folders

cp dist/validator-generated.php $PROJECT_PATH/src/Spec/

echo "Generated files"
ls $PROJECT_PATH/src/Spec/*.php
Copy link
Author

Choose a reason for hiding this comment

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

Adapted version of https://github.com/Automattic/amp-wp/blob/develop/bin/amphtml-update.sh
This script generates both the WP and Lullabot versions of validation rules

GeneratePHP(out_dir)

if __name__ == '__main__':
Main()
Copy link
Author

Choose a reason for hiding this comment

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

@@ -15,7 +15,7 @@
"querypath/QueryPath": ">=3.0.4",
"sebastian/diff": "^1.2 || ^2 || ^3",
"marc1706/fast-image-size": "1.*",
"masterminds/html5": "^2.2.0",
"masterminds/html5": "~2.0",
Copy link
Author

@marcelovani marcelovani Dec 5, 2018

Choose a reason for hiding this comment

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

See comments here Lullabot#249

{
// We embed a scanner so that $this->startTag() knows the current line number
$this->scanner = new Scanner($inputstream);
$this->scanner = new Scanner($data);
Copy link
Author

@marcelovani marcelovani Dec 5, 2018

Choose a reason for hiding this comment

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

See comments here Lullabot#249

{
// User options override default options in $this->options
$final_options = array_merge($this->options, $options);
$amp_tree_builder = new AMPDOMTreeBuilder($inputstream, $final_options);
$amp_tree_builder = new AMPDOMTreeBuilder($data, $final_options);
Copy link
Author

Choose a reason for hiding this comment

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

See comments here Lullabot#249

},
"bin": [
"bin/amp-console"
]
Copy link
Author

Choose a reason for hiding this comment

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

Put the executable inside vendor/bin

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.

2 participants