diff --git a/.distignore b/.distignore index ed9d540..41fb34c 100644 --- a/.distignore +++ b/.distignore @@ -1,3 +1,4 @@ +.* /tests /vendor /node_modules @@ -11,4 +12,5 @@ phpcs.xml phpunit.xml readme.md readme.txt.md -.* +Vagrantfile +Homestead.yaml diff --git a/.gitignore b/.gitignore index 1aee7f7..5dc668a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ /dist /node_modules /vendor +/.vagrant /composer.lock /package-lock.json .DS_Store diff --git a/Homestead.yaml b/Homestead.yaml new file mode 100644 index 0000000..06111ed --- /dev/null +++ b/Homestead.yaml @@ -0,0 +1,21 @@ +provider: virtualbox +name: widgetcontext +hostname: widgetcontext + +folders: + - map: vendor/wordpress/wordpress + to: /home/vagrant/code + + - map: ./ + to: /home/vagrant/code/wp-content/plugins/widget-context + +variables: + - key: WP_CLI_CONFIG_PATH + value: /home/vagrant/code/wp-content/plugins/widget-context/wp-cli.yaml + +sites: + - map: widgetcontext.local + to: /home/vagrant/code + +databases: + - homestead diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..7e98a5d --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,23 @@ +require 'yaml' + +confDir = File.expand_path("vendor/laravel/homestead", File.dirname(__FILE__)) +homesteadYamlPath = File.expand_path("Homestead.yaml", File.dirname(__FILE__)) + +require File.expand_path(confDir + '/scripts/homestead.rb') + +Vagrant.require_version '>= 1.9.0' + +Vagrant.configure("2") do |config| + settings = YAML::load(File.read(homesteadYamlPath)) + + Homestead.configure(config, settings) + + # Download and setup our WP site; wp-cli provided out of the box. + config.vm.provision "shell", + inline: "wp config create", + privileged: false + + if defined? VagrantPlugins::HostsUpdater + config.hostsupdater.aliases = settings['sites'].map { |site| site['map'] } + end +end diff --git a/composer.json b/composer.json index 9e880b4..9117ffc 100644 --- a/composer.json +++ b/composer.json @@ -14,10 +14,25 @@ "issues": "https://github.com/kasparsd/widget-context-wporg/issues", "source": "https://github.com/kasparsd/widget-context-wporg" }, + "repositories": [ + { + "type": "package", + "package": { + "name": "wordpress/wordpress", + "version": "5.0", + "dist": { + "url": "https://wordpress.org/wordpress-5.0.zip", + "type": "zip" + } + } + } + ], "require-dev": { "wp-coding-standards/wpcs": "^1.2.0", "phpunit/phpunit": "^5", - "php-coveralls/php-coveralls": "^2.1.0" + "php-coveralls/php-coveralls": "^2.1.0", + "laravel/homestead": "^7.19", + "wordpress/wordpress": "^5.0" }, "autoload": { "classmap": [ diff --git a/wp-cli.yaml b/wp-cli.yaml new file mode 100644 index 0000000..79a2dc3 --- /dev/null +++ b/wp-cli.yaml @@ -0,0 +1,6 @@ +path: /home/vagrant/code + +config create: + dbname: homestead + dbuser: homestead + dbpass: secret