Only output if different from style_url
This commit is contained in:
@@ -15,9 +15,9 @@ class WpTheme < WpItem
|
|||||||
include WpTheme::Output
|
include WpTheme::Output
|
||||||
include WpTheme::Childtheme
|
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)
|
def initialize(*args)
|
||||||
super(*args)
|
super(*args)
|
||||||
@@ -36,7 +36,7 @@ class WpTheme < WpItem
|
|||||||
|
|
||||||
# @return [ String ] The url to the theme stylesheet
|
# @return [ String ] The url to the theme stylesheet
|
||||||
def style_url
|
def style_url
|
||||||
uri.merge('style.css').to_s
|
@uri.merge('style.css').to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class WpTheme < WpItem
|
|||||||
target_uri,
|
target_uri,
|
||||||
{
|
{
|
||||||
name: matches[2],
|
name: matches[2],
|
||||||
additional_url: matches[0],
|
referenced_url: matches[0],
|
||||||
wp_content_dir: matches[1]
|
wp_content_dir: matches[1]
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ class WpTheme
|
|||||||
def additional_output(verbose = false)
|
def additional_output(verbose = false)
|
||||||
theme_desc = verbose ? @theme_description : truncate(@theme_description, 100)
|
theme_desc = verbose ? @theme_description : truncate(@theme_description, 100)
|
||||||
puts " | Style URL: #{style_url}"
|
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 Name: #@theme_name" if @theme_name
|
||||||
puts " | Theme URI: #@theme_uri" if @theme_uri
|
puts " | Theme URI: #@theme_uri" if @theme_uri
|
||||||
puts " | Description: #{theme_desc}"
|
puts " | Description: #{theme_desc}"
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ describe 'WpTheme::Findable' do
|
|||||||
context 'when other style.css is referenced' do
|
context 'when other style.css is referenced' do
|
||||||
it 'returns the WpTheme' do
|
it 'returns the WpTheme' do
|
||||||
@file = 'yootheme.html'
|
@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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ describe WpTheme do
|
|||||||
let(:theme_path) { 'wp-content/themes/theme-name/' }
|
let(:theme_path) { 'wp-content/themes/theme-name/' }
|
||||||
|
|
||||||
describe '#allowed_options' do
|
describe '#allowed_options' do
|
||||||
its(:allowed_options) { is_expected.to include :additional_url }
|
its(:allowed_options) { is_expected.to include :referenced_url }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#forge_uri' do
|
describe '#forge_uri' do
|
||||||
|
|||||||
Reference in New Issue
Block a user