From 26e0066c82e69cb68555a35a208fbd313a2b4c96 Mon Sep 17 00:00:00 2001 From: Christian Mehlmauer Date: Wed, 16 Jul 2014 18:38:39 +0200 Subject: [PATCH] Only output if different from style_url --- lib/common/models/wp_theme.rb | 6 +++--- lib/common/models/wp_theme/findable.rb | 2 +- lib/common/models/wp_theme/output.rb | 2 +- spec/lib/common/models/wp_theme/findable_spec.rb | 2 +- spec/lib/common/models/wp_theme_spec.rb | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/common/models/wp_theme.rb b/lib/common/models/wp_theme.rb index 6f840a09..08563f47 100755 --- a/lib/common/models/wp_theme.rb +++ b/lib/common/models/wp_theme.rb @@ -15,9 +15,9 @@ class WpTheme < WpItem include WpTheme::Output include WpTheme::Childtheme - attr_accessor :additional_url + attr_accessor :referenced_url - def allowed_options; super << :additional_url end + def allowed_options; super << :referenced_url end def initialize(*args) super(*args) @@ -36,7 +36,7 @@ class WpTheme < WpItem # @return [ String ] The url to the theme stylesheet def style_url - uri.merge('style.css').to_s + @uri.merge('style.css').to_s end end diff --git a/lib/common/models/wp_theme/findable.rb b/lib/common/models/wp_theme/findable.rb index 033ac4a0..172fd2cc 100755 --- a/lib/common/models/wp_theme/findable.rb +++ b/lib/common/models/wp_theme/findable.rb @@ -36,7 +36,7 @@ class WpTheme < WpItem target_uri, { name: matches[2], - additional_url: matches[0], + referenced_url: matches[0], wp_content_dir: matches[1] } ) diff --git a/lib/common/models/wp_theme/output.rb b/lib/common/models/wp_theme/output.rb index f806dc7a..6aecc31b 100644 --- a/lib/common/models/wp_theme/output.rb +++ b/lib/common/models/wp_theme/output.rb @@ -7,7 +7,7 @@ class WpTheme def additional_output(verbose = false) theme_desc = verbose ? @theme_description : truncate(@theme_description, 100) puts " | Style URL: #{style_url}" - puts " | Additional URL: #{additional_url}" if additional_url + puts " | Referenced style.css: #{referenced_url}" if referenced_url && referenced_url != style_url puts " | Theme Name: #@theme_name" if @theme_name puts " | Theme URI: #@theme_uri" if @theme_uri puts " | Description: #{theme_desc}" diff --git a/spec/lib/common/models/wp_theme/findable_spec.rb b/spec/lib/common/models/wp_theme/findable_spec.rb index 1554492f..29f412cb 100644 --- a/spec/lib/common/models/wp_theme/findable_spec.rb +++ b/spec/lib/common/models/wp_theme/findable_spec.rb @@ -55,7 +55,7 @@ describe 'WpTheme::Findable' do context 'when other style.css is referenced' do it 'returns the WpTheme' do @file = 'yootheme.html' - @expected = WpTheme.new(uri, name: 'yoo_solar_wp') + @expected = WpTheme.new(uri, name: 'yoo_solar_wp', referenced_url: '/wp-content/themes/yoo_solar_wp/styles/wood/css/style.css') end end diff --git a/spec/lib/common/models/wp_theme_spec.rb b/spec/lib/common/models/wp_theme_spec.rb index 3b99e6d1..804acea8 100644 --- a/spec/lib/common/models/wp_theme_spec.rb +++ b/spec/lib/common/models/wp_theme_spec.rb @@ -29,7 +29,7 @@ describe WpTheme do let(:theme_path) { 'wp-content/themes/theme-name/' } describe '#allowed_options' do - its(:allowed_options) { is_expected.to include :additional_url } + its(:allowed_options) { is_expected.to include :referenced_url } end describe '#forge_uri' do