From cea2d7c290523e2e7e0fc037779f2999eadd91a7 Mon Sep 17 00:00:00 2001 From: miya0001 Date: Wed, 1 Feb 2017 04:07:43 +0900 Subject: [PATCH 1/8] fix localization problem --- provision/playbooks/wordpress.yml | 35 +++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/provision/playbooks/wordpress.yml b/provision/playbooks/wordpress.yml index 528c081..0293692 100644 --- a/provision/playbooks/wordpress.yml +++ b/provision/playbooks/wordpress.yml @@ -99,6 +99,12 @@ - name: Move `.gitignore` command: "mv /tmp/.gitignore {{ path }}/.gitignore" + - name: Run `wp core language install` + command: | + wp core language install {{ vccw.lang }} + --path={{ path }} + --activate + # Install Plugins - name: Run `wp plugin install` command: | @@ -107,6 +113,14 @@ --path={{ path }} with_items: "{{ vccw.plugins | default([]) }}" + # Install wp-multibyte-patch + - name: Run `wp plugin install wp-multibyte-patch` + command: | + wp plugin install wp-multibyte-patch + --activate + --path={{ path }} + when: vccw.lang == 'ja' + # Check exsist Theme - name: Run `wp theme is-installed` command: | @@ -156,6 +170,27 @@ --path={{ path }} with_dict: "{{ vccw.options }}" + # Localization + - name: Get the timezone + command: | + wp eval "echo _x( '0', 'default GMT offset or timezone string' );" + --path={{ path }} + register: timezone + - name: Update timezone + command: | + wp option update timezone_string '{{ timezone.stdout }}' + --path={{ path }} + + - name: Get the timezone + command: | + wp eval "echo __( 'M jS Y' );" + --path={{ path }} + register: date_format + - name: Update date format + command: | + wp option update date_format '{{ date_format.stdout }}' + --path={{ path }} + # Setting Permalink - name: Run `wp rewrite structure` command: | From 56f94eb31a16c487b054ab0ad3c714fa37640d6a Mon Sep 17 00:00:00 2001 From: miya0001 Date: Wed, 1 Feb 2017 04:18:38 +0900 Subject: [PATCH 2/8] update tests for localization --- spec/default/wpconfig_spec.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/spec/default/wpconfig_spec.rb b/spec/default/wpconfig_spec.rb index 97c7b15..9e0ae70 100644 --- a/spec/default/wpconfig_spec.rb +++ b/spec/default/wpconfig_spec.rb @@ -56,6 +56,25 @@ end end +# Tests for localization +if $conf['lang'] == "ja" then + describe command("su -l #{$conf['user']} bash -lc 'wp --no-color plugin status wp-multibyte-patch") do + let(:disable_sudo) { true } + its(:exit_status) { should eq 0 } + its(:stdout){ should match /Status: Active/ } + end + describe command("su -l #{$conf['user']} bash -lc 'wp --no-color option get timezone_string") do + let(:disable_sudo) { true } + its(:exit_status) { should eq 0 } + its(:stdout){ should eq "Asia/Tokyo\n" } + end + describe command("su -l #{$conf['user']} bash -lc 'wp --no-color plugin status wp-multibyte-patch") do + let(:disable_sudo) { true } + its(:exit_status) { should eq 0 } + its(:stdout){ should eq "Y年n月j\n" } + end +end + # # Multi site # From accbcec76c70f3cb2732216e7136673578e1962e Mon Sep 17 00:00:00 2001 From: miya0001 Date: Wed, 1 Feb 2017 04:28:17 +0900 Subject: [PATCH 3/8] fix problem on travis #123.2 --- provision/playbooks/wordpress.yml | 2 +- spec/default/wpconfig_spec.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/provision/playbooks/wordpress.yml b/provision/playbooks/wordpress.yml index 0293692..7e40fb3 100644 --- a/provision/playbooks/wordpress.yml +++ b/provision/playbooks/wordpress.yml @@ -181,7 +181,7 @@ wp option update timezone_string '{{ timezone.stdout }}' --path={{ path }} - - name: Get the timezone + - name: Get the date format command: | wp eval "echo __( 'M jS Y' );" --path={{ path }} diff --git a/spec/default/wpconfig_spec.rb b/spec/default/wpconfig_spec.rb index 9e0ae70..cbdb329 100644 --- a/spec/default/wpconfig_spec.rb +++ b/spec/default/wpconfig_spec.rb @@ -58,17 +58,17 @@ # Tests for localization if $conf['lang'] == "ja" then - describe command("su -l #{$conf['user']} bash -lc 'wp --no-color plugin status wp-multibyte-patch") do + describe command("su -l #{$conf['user']} bash -lc 'wp --no-color plugin status wp-multibyte-patch'") do let(:disable_sudo) { true } its(:exit_status) { should eq 0 } its(:stdout){ should match /Status: Active/ } end - describe command("su -l #{$conf['user']} bash -lc 'wp --no-color option get timezone_string") do + describe command("su -l #{$conf['user']} bash -lc 'wp --no-color option get timezone_string'") do let(:disable_sudo) { true } its(:exit_status) { should eq 0 } its(:stdout){ should eq "Asia/Tokyo\n" } end - describe command("su -l #{$conf['user']} bash -lc 'wp --no-color plugin status wp-multibyte-patch") do + describe command("su -l #{$conf['user']} bash -lc 'wp --no-color plugin status wp-multibyte-patch'") do let(:disable_sudo) { true } its(:exit_status) { should eq 0 } its(:stdout){ should eq "Y年n月j\n" } From be9cce8778ac62d23983c68f1dfee91625e52ea7 Mon Sep 17 00:00:00 2001 From: miya0001 Date: Wed, 1 Feb 2017 04:34:23 +0900 Subject: [PATCH 4/8] remove locale param from wp core download --- provision/playbooks/wordpress.yml | 1 - spec/default/wpconfig_spec.rb | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/provision/playbooks/wordpress.yml b/provision/playbooks/wordpress.yml index 7e40fb3..5e1e8b1 100644 --- a/provision/playbooks/wordpress.yml +++ b/provision/playbooks/wordpress.yml @@ -43,7 +43,6 @@ command: | wp core download --path={{ path }} - --locale={{ vccw.lang }} --version={{ vccw.version }} --force diff --git a/spec/default/wpconfig_spec.rb b/spec/default/wpconfig_spec.rb index cbdb329..386b2a9 100644 --- a/spec/default/wpconfig_spec.rb +++ b/spec/default/wpconfig_spec.rb @@ -68,7 +68,7 @@ its(:exit_status) { should eq 0 } its(:stdout){ should eq "Asia/Tokyo\n" } end - describe command("su -l #{$conf['user']} bash -lc 'wp --no-color plugin status wp-multibyte-patch'") do + describe command("su -l #{$conf['user']} bash -lc 'wp --no-color option get date_format'") do let(:disable_sudo) { true } its(:exit_status) { should eq 0 } its(:stdout){ should eq "Y年n月j\n" } From f3426fae2a7db3088bedcd0f0fff8608c8163ce2 Mon Sep 17 00:00:00 2001 From: miya0001 Date: Wed, 1 Feb 2017 04:43:58 +0900 Subject: [PATCH 5/8] some fix --- spec/default/wpconfig_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/default/wpconfig_spec.rb b/spec/default/wpconfig_spec.rb index 386b2a9..6d046bc 100644 --- a/spec/default/wpconfig_spec.rb +++ b/spec/default/wpconfig_spec.rb @@ -71,7 +71,7 @@ describe command("su -l #{$conf['user']} bash -lc 'wp --no-color option get date_format'") do let(:disable_sudo) { true } its(:exit_status) { should eq 0 } - its(:stdout){ should eq "Y年n月j\n" } + its(:stdout){ should eq 'Y\xE5\xB9\xB4n\xE6\x9C\x88j\xE6\x97\xA5' + "\n" } end end From e5899e084693e1623b44c037debd6206a0f1e658 Mon Sep 17 00:00:00 2001 From: miya0001 Date: Wed, 1 Feb 2017 05:02:53 +0900 Subject: [PATCH 6/8] fixed typo --- spec/default/wpconfig_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/default/wpconfig_spec.rb b/spec/default/wpconfig_spec.rb index 6d046bc..3430bbf 100644 --- a/spec/default/wpconfig_spec.rb +++ b/spec/default/wpconfig_spec.rb @@ -71,7 +71,7 @@ describe command("su -l #{$conf['user']} bash -lc 'wp --no-color option get date_format'") do let(:disable_sudo) { true } its(:exit_status) { should eq 0 } - its(:stdout){ should eq 'Y\xE5\xB9\xB4n\xE6\x9C\x88j\xE6\x97\xA5' + "\n" } + its(:stdout){ should eq "Y年n月j日\n" } end end From a0930080814a8175a9ba8caa1e71c67a6e33591a Mon Sep 17 00:00:00 2001 From: miya0001 Date: Wed, 1 Feb 2017 05:13:37 +0900 Subject: [PATCH 7/8] update test --- spec/default/wpconfig_spec.rb | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/spec/default/wpconfig_spec.rb b/spec/default/wpconfig_spec.rb index 3430bbf..53397f5 100644 --- a/spec/default/wpconfig_spec.rb +++ b/spec/default/wpconfig_spec.rb @@ -9,32 +9,27 @@ # describe command("su -l #{$conf['user']} bash -lc 'wp user get #{Shellwords.shellescape($conf['admin_user'])} --format=json' | jq -r .roles") do - let(:disable_sudo) { true } its(:exit_status) { should eq 0 } its(:stdout){ should eq 'administrator' + "\n" } end describe command("su -l #{$conf['user']} bash -lc 'wp user get #{Shellwords.shellescape($conf['admin_user'])} --format=json' | jq -r .user_email") do - let(:disable_sudo) { true } its(:exit_status) { should eq 0 } its(:stdout){ should eq $conf['admin_email'] + "\n" } end describe command("su -l #{$conf['user']} bash -lc 'wp eval \"echo get_locale();\"'") do - let(:disable_sudo) { true } its(:exit_status) { should eq 0 } its(:stdout){ should eq $conf['lang'] } end describe command("su -l #{$conf['user']} bash -lc 'wp eval \"bloginfo('name');\"'") do - let(:disable_sudo) { true } its(:exit_status) { should eq 0 } its(:stdout){ should eq $conf['title'] } end $conf['plugins'].each do |plugin| describe command("su -l #{$conf['user']} bash -lc 'wp --no-color plugin status " + Shellwords.shellescape(plugin)+"'") do - let(:disable_sudo) { true } its(:exit_status) { should eq 0 } its(:stdout){ should match /Status: Active/ } end @@ -42,7 +37,6 @@ if $conf['theme'] != "" then describe command("su -l #{$conf['user']} bash -lc 'wp --no-color theme status " + Shellwords.shellescape($conf['theme'])+"'") do - let(:disable_sudo) { true } its(:exit_status) { should eq 0 } its(:stdout){ should match /Status: Active/ } end @@ -50,7 +44,6 @@ $conf['options'].each do |key, value| describe command("su -l #{$conf['user']} bash -lc 'wp option get " + Shellwords.shellescape(key.to_s)+"'") do - let(:disable_sudo) { true } its(:exit_status) { should eq 0 } its(:stdout){ should eq value.to_s + "\n" } end @@ -59,19 +52,16 @@ # Tests for localization if $conf['lang'] == "ja" then describe command("su -l #{$conf['user']} bash -lc 'wp --no-color plugin status wp-multibyte-patch'") do - let(:disable_sudo) { true } its(:exit_status) { should eq 0 } its(:stdout){ should match /Status: Active/ } end describe command("su -l #{$conf['user']} bash -lc 'wp --no-color option get timezone_string'") do - let(:disable_sudo) { true } its(:exit_status) { should eq 0 } its(:stdout){ should eq "Asia/Tokyo\n" } end describe command("su -l #{$conf['user']} bash -lc 'wp --no-color option get date_format'") do - let(:disable_sudo) { true } its(:exit_status) { should eq 0 } - its(:stdout){ should eq "Y年n月j日\n" } + its(:stdout){ should match /^Y.+n.+j.+\n$/ } end end @@ -80,19 +70,16 @@ # if true == $conf['multisite'] describe command("su -l #{$conf['user']} bash -lc 'wp eval \"echo WP_ALLOW_MULTISITE;\"'") do - let(:disable_sudo) { true } its(:exit_status) { should eq 0 } its(:stdout){ should eq '1' } end describe command("su -l #{$conf['user']} bash -lc 'wp option get permalink_structure'") do - let(:disable_sudo) { true } its(:exit_status) { should eq 0 } its(:stdout){ should eq '/blog/%year%/%monthnum%/%day%/%postname%/' + "\n" } end if defined? $conf['multisite_options'].each $conf['multisite_options'].each do |key, value| describe command("su -l #{$conf['user']} bash -lc 'wp meta get 1 " + Shellwords.shellescape(key.to_s)+"'") do - let(:disable_sudo) { true } its(:exit_status) { should eq 0 } its(:stdout){ should eq value.to_s + "\n" } end @@ -100,7 +87,6 @@ end else describe command("su -l #{$conf['user']} bash -lc 'wp option get permalink_structure'") do - let(:disable_sudo) { true } its(:exit_status) { should eq 0 } its(:stdout){ should eq $conf['rewrite_structure'] + "\n" } end From 7b5860f93ec0dc22fa4d21570b95ea31ada3f9b1 Mon Sep 17 00:00:00 2001 From: miya0001 Date: Wed, 1 Feb 2017 05:30:22 +0900 Subject: [PATCH 8/8] v3.1.0 --- Vagrantfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index 6c8b6e9..634ef55 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -7,7 +7,7 @@ Vagrant.require_version '>= 1.8.6' Vagrant.configure(2) do |config| - vccw_version = '3.0.11'; + vccw_version = '3.1.0'; _conf = YAML.load( File.open(