wp_wrapper 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 84593928500719e7492d7872902ed82016bd59dd
4
- data.tar.gz: ec08aebed77d677a320cb64b9005a47723883968
3
+ metadata.gz: e47e1d50966b606904762e455abe7f5e79e6d5f3
4
+ data.tar.gz: 8fc42273c93030fda4968248843a70445ab179f6
5
5
  SHA512:
6
- metadata.gz: bfc21471d832c2c500894e759ed99d8418199e586c58ce7c3b386a106b369a4c81f662fedf26417ba4d014565ce96e251411efc02bd7906ff94ba7453581883d
7
- data.tar.gz: fa650d62900e6d038d3aa015f5a0454698da384e97326dd6762da62242b09687842c40972227f1ac3ae2ef47bb309548e4e458a19877ef17199daca1d64820f0
6
+ metadata.gz: 15767b3c4d4d9abe3d261c5ce9982a4f31080e52d62b546825f2807337f46ffc53f659f3d95f49a672ad37f1a581b00493abf35fb85af39c69a947350bc00115
7
+ data.tar.gz: 6e17db691d2f90b599b1629b1aa4d69cd96d0fe61a73fdb93ba0826c675dd75f5a1df817fd36185f6fec7c877f5944d4470a5891bbb15d9dcb22db55bdc7069f
@@ -6,7 +6,7 @@ module WpWrapper
6
6
  def configure_w3_total_cache(caching_mechanism = :memcached, options = {})
7
7
  configure_general_settings(caching_mechanism, options)
8
8
  configure_page_cache
9
- configure_minification
9
+ configure_minification(options.fetch(:minify, {}))
10
10
  configure_browser_cache
11
11
  activate_configuration
12
12
  end
@@ -17,36 +17,35 @@ module WpWrapper
17
17
 
18
18
  url = "admin.php?page=w3tc_general"
19
19
  form_identifier = {:id => 'w3tc_form'}
20
- button_identifier = {:name => 'w3tc_save_options'}
20
+ button_identifier = {:name => 'w3tc_default_save_and_flush'}
21
21
 
22
22
  varnish_server = options.fetch(:varnish_server, "localhost")
23
23
 
24
24
  cache_sections.each do |cache_section|
25
25
  section_options = {
26
- "#{cache_section}cache.enabled" => {:checked => true, :type => :checkbox},
27
- "#{cache_section}cache.engine" => {:value => caching_mechanism, :type => :select}
26
+ "#{cache_section}cache__enabled" => {:checked => true, :type => :checkbox},
27
+ "#{cache_section}cache__engine" => {:value => caching_mechanism, :type => :select}
28
28
  }
29
29
 
30
30
  caching_options.merge!(section_options)
31
31
  end
32
32
 
33
33
  minify_options = {
34
- "minify.enabled" => {:checked => true, :type => :checkbox},
35
- "minify.engine" => {:value => caching_mechanism, :type => :select},
36
- #"minify.auto" => {:checked => true, :type => :radiobutton}
34
+ "minify__enabled" => {:checked => true, :type => :checkbox},
35
+ "minify__engine" => {:value => caching_mechanism, :type => :select},
37
36
  }
38
37
 
39
38
  caching_options.merge!(minify_options)
40
39
 
41
40
  browser_cache_options = {
42
- "browsercache.enabled" => {:checked => true, :type => :checkbox},
41
+ "browsercache__enabled" => {:checked => true, :type => :checkbox},
43
42
  }
44
43
 
45
44
  caching_options.merge!(browser_cache_options)
46
45
 
47
46
  varnish_options = {
48
- "varnish.enabled" => {:checked => true, :type => :checkbox},
49
- "varnish.servers" => {:value => varnish_server, :type => :input}
47
+ "varnish__enabled" => {:checked => true, :type => :checkbox},
48
+ "varnish__servers" => {:value => varnish_server, :type => :input}
50
49
  }
51
50
 
52
51
  caching_options.merge!(varnish_options)
@@ -57,25 +56,34 @@ module WpWrapper
57
56
  def configure_page_cache
58
57
  url = "admin.php?page=w3tc_pgcache"
59
58
  form_identifier = {:action => /admin\.php\?page=w3tc_pgcache/i, :index => 1}
60
- button_identifier = {:name => 'w3tc_save_options'}
59
+ button_identifier = {:name => 'w3tc_default_save_and_flush'}
61
60
 
62
61
  options = {
63
- "pgcache.cache.feed" => {:checked => true, :type => :checkbox},
62
+ "pgcache__cache__feed" => {:checked => true, :type => :checkbox},
64
63
  }
65
64
 
66
65
  return set_options_and_submit(url, form_identifier, options, button_identifier)
67
66
  end
68
67
 
69
- def configure_minification
68
+ def configure_minification(options = {})
70
69
  url = "admin.php?page=w3tc_minify"
71
70
  form_identifier = {:action => /admin\.php\?page=w3tc_minify/i, :index => 1}
72
- button_identifier = {:name => 'w3tc_save_options'}
71
+ button_identifier = {:name => 'w3tc_default_save_and_flush'}
72
+
73
+ minify_html = options.fetch(:html, :enable).to_sym.eql?(:enable)
74
+ minify_inline_css = options.fetch(:inline_css, :enable).to_sym.eql?(:enable)
75
+ minify_inline_js = options.fetch(:inline_js, :enable).to_sym.eql?(:enable)
76
+
77
+ minify_js = options.fetch(:js, :disable).to_sym.eql?(:enable)
78
+ minify_css = options.fetch(:css, :disable).to_sym.eql?(:enable)
73
79
 
74
80
  options = {
75
- "minify.html.enable" => {:checked => true, :type => :checkbox},
76
- "minify.html.inline.css" => {:checked => true, :type => :checkbox},
77
- "minify.html.inline.js" => {:checked => true, :type => :checkbox},
78
- "minify.auto.disable_filename_length_test" => {:checked => true, :type => :checkbox},
81
+ "minify__html__enable" => {:checked => minify_html, :type => :checkbox},
82
+ "minify__html__inline__css" => {:checked => minify_inline_css, :type => :checkbox},
83
+ "minify__html__inline__js" => {:checked => minify_inline_js, :type => :checkbox},
84
+
85
+ "minify__js__enable" => {:checked => minify_js, :type => :checkbox},
86
+ "minify__css__enable" => {:checked => minify_css, :type => :checkbox},
79
87
  }
80
88
 
81
89
  return set_options_and_submit(url, form_identifier, options, button_identifier)
@@ -86,7 +94,7 @@ module WpWrapper
86
94
 
87
95
  url = "admin.php?page=w3tc_browsercache"
88
96
  form_identifier = {:action => /admin\.php\?page=w3tc_browsercache/i, :index => 1}
89
- button_identifier = {:name => 'w3tc_save_options'}
97
+ button_identifier = {:name => 'w3tc_default_save_and_flush'}
90
98
 
91
99
  sections = [
92
100
  :cssjs, :html, :other
@@ -94,9 +102,9 @@ module WpWrapper
94
102
 
95
103
  sections.each do |section|
96
104
  section_options = {
97
- "browsercache.#{section}.expires" => {:checked => true, :type => :checkbox},
98
- "browsercache.#{section}.cache.control" => {:checked => true, :type => :checkbox},
99
- "browsercache.#{section}.etag" => {:checked => true, :type => :checkbox},
105
+ "browsercache__#{section}__expires" => {:checked => true, :type => :checkbox},
106
+ "browsercache__#{section}__cache__control" => {:checked => true, :type => :checkbox},
107
+ "browsercache__#{section}__etag" => {:checked => true, :type => :checkbox},
100
108
  }
101
109
 
102
110
  options.merge!(section_options)
data/lib/wp_wrapper.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module WpWrapper
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
 
4
4
  require File.join(File.dirname(__FILE__), 'wp_wrapper/railtie') if defined?(Rails)
5
5
 
data/wp_wrapper.gemspec CHANGED
@@ -3,7 +3,7 @@ Gem::Specification.new do |s|
3
3
  s.required_rubygems_version = Gem::Requirement.new(">= 1.3.5") if s.respond_to? :required_rubygems_version=
4
4
 
5
5
  s.name = 'wp_wrapper'
6
- s.version = '0.0.2'
6
+ s.version = '0.0.3'
7
7
 
8
8
  s.homepage = "http://github.com/Agiley/wp_wrapper"
9
9
  s.email = "sebastian@agiley.se"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wp_wrapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Johnsson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-10 00:00:00.000000000 Z
11
+ date: 2016-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri