diff --git a/.distignore b/.distignore new file mode 100644 index 0000000..fc9d814 --- /dev/null +++ b/.distignore @@ -0,0 +1,3 @@ +.* +/examples/ +/node_modules/ diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..63ceaa7 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,20 @@ +# EditorConfig is awesome: https://EditorConfig.org +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +indent_style = tab + +[*.{json,yml,yaml,js}] +indent_style = space +indent_size = 2 + +[Vagrantfile] +indent_style = space +indent_size = 2 + +[*.md] +trim_trailing_whitespace = false diff --git a/.gitignore b/.gitignore index 997fa3b..c38f0f8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ /vendor /.vagrant -/composer.lock \ No newline at end of file +/node_modules +/composer.lock +Gemfile.lock diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..565377a --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,2 @@ +Layout/AlignParameters: + EnforcedStyle: with_fixed_indentation diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..b15cab8 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,15 @@ +language: ruby + +install: + - bundle install + +script: + - bash -c 'shopt -s globstar; shellcheck **/*.sh' + - rubocop + +notifications: + email: false + +branches: + only: + - master diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..e076bda --- /dev/null +++ b/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'rubocop' diff --git a/Vagrantfile b/Vagrantfile index 7c580a7..3b3e59e 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,22 +1,20 @@ -projectPath = ENV["PWD"] -localPath = File.dirname(__FILE__) +project_path = ENV['PWD'] +local_path = File.dirname(__FILE__) Vagrant.configure(2) do |config| - - config.vm.box = "ubuntu/xenial64" - config.vm.network "private_network", type: "dhcp" - config.vm.synced_folder projectPath, "/vagrant" + config.vm.box = 'ubuntu/xenial64' + config.vm.network 'private_network', type: 'dhcp' + config.vm.synced_folder project_path, '/vagrant' # Rename ubuntu-xenial-16.04-cloudimg-console.log to console.log - config.vm.provider "virtualbox" do |vb| - vb.customize ["modifyvm", :id, "--uartmode1", "file", "console.log"] + config.vm.provider 'virtualbox' do |vb| + vb.customize ['modifyvm', :id, '--uartmode1', 'file', 'console.log'] end - config.vm.provision :shell, - path: File.join(localPath, 'scripts/vagrant/provision.sh') - - config.vm.provision :shell, - path: File.join(localPath, 'scripts/vagrant/up.sh'), - run: "always" + config.vm.provision 'shell', + path: File.join(local_path, 'scripts/vagrant/provision.sh') + config.vm.provision 'shell', + path: File.join(local_path, 'scripts/vagrant/up.sh'), + run: 'always' end diff --git a/examples/wordpress/.gitignore b/examples/wordpress/.gitignore new file mode 100644 index 0000000..ed6f070 --- /dev/null +++ b/examples/wordpress/.gitignore @@ -0,0 +1,3 @@ +/vendor/ +/.vagrant/ +/composer.lock diff --git a/examples/wordpress/Vagrantfile b/examples/wordpress/Vagrantfile new file mode 100644 index 0000000..d33d9dd --- /dev/null +++ b/examples/wordpress/Vagrantfile @@ -0,0 +1,9 @@ +# Configure the hostname. +Vagrant.configure(2) do |config| + config.vm.hostname = 'wpsh-local' +end + +load File.join( + File.dirname(__FILE__), + 'vendor/wpsh/local/Vagrantfile' +) diff --git a/examples/wordpress/composer.json b/examples/wordpress/composer.json new file mode 100644 index 0000000..b331d45 --- /dev/null +++ b/examples/wordpress/composer.json @@ -0,0 +1,6 @@ +{ + "require": {}, + "require-dev": { + "wpsh/local": "*" + } +} diff --git a/examples/wordpress/docker-compose.yaml b/examples/wordpress/docker-compose.yaml new file mode 100644 index 0000000..52f7672 --- /dev/null +++ b/examples/wordpress/docker-compose.yaml @@ -0,0 +1,44 @@ +version: '3' + +services: + + mysql: + image: mysql:5 + volumes: + - db_data:/var/lib/mysql + restart: always + environment: + MYSQL_DATABASE: wordpress + MYSQL_USER: wordpress + MYSQL_PASSWORD: password + MYSQL_ROOT_PASSWORD: password + + wordpress: + image: wordpress:latest + links: + - mysql:mysql + depends_on: + - mysql + ports: + - "80:80" + - "443:443" + volumes: + - wp_data:/var/www/html + - "./plugin:/var/www/html/wp-content/plugins/plugin:ro" # Without "ro" flags it can't access the directory. + restart: always + environment: + WORDPRESS_DEBUG: 1 + WORDPRESS_DB_USER: wordpress + WORDPRESS_DB_PASSWORD: password + + wpcli: + image: wordpress:cli + depends_on: + - mysql + - wordpress + volumes: + - wp_data:/var/www/html + +volumes: + db_data: {} + wp_data: {} diff --git a/examples/wordpress/plugin/plugin.php b/examples/wordpress/plugin/plugin.php new file mode 100644 index 0000000..b3cb782 --- /dev/null +++ b/examples/wordpress/plugin/plugin.php @@ -0,0 +1,11 @@ + + +