Skip to content

Commit

Permalink
Merge pull request #315 from wildlyinaccurate/fix-gallery-generation-…
Browse files Browse the repository at this point in the history
…for-old-path-configs

Fix gallery generation for old path configs
  • Loading branch information
wildlyinaccurate committed Nov 13, 2015
2 parents b2e28be + bcdb24a commit 442eb20
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
6 changes: 5 additions & 1 deletion lib/wraith/gallery.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,15 @@ def matcher(match, filename, dirname, category)
def figure_out_url(group, category)
root = wraith.domains["#{group}"]
return '' if root.nil?
path = wraith.paths["#{category}"]['path']
path = get_path(category)
url = root + path
url
end

def get_path(category)
wraith.paths[category]['path'] || wraith.paths[category]
end

def get_group_from_match(match)
group = match[2]
dash = match[2].rindex('-')
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
18 changes: 9 additions & 9 deletions spec/wraith_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,27 +109,27 @@

images = [
{
:filename => 'test/test_image-1.png',
:thumb => 'thumbnails/test/test_image-1.png'
:filename => 'home/test_image-afrique.png',
:thumb => 'thumbnails/home/test_image-afrique.png'
},
{
:filename => 'test/test_image-2.png',
:thumb => 'thumbnails/test/test_image-2.png'
:filename => 'home/test_image-russian.png',
:thumb => 'thumbnails/home/test_image-russian.png'
}
]

dirs['test'][0][:variants].each_with_index do |image, i|
dirs['home'][0][:variants].each_with_index do |image, i|
expect(image[:filename]).to eq images[i][:filename]
expect(image[:thumb]).to eq images[i][:thumb]
end

diff = {
:filename => 'test/test_image-diff.png',
:thumb => 'thumbnails/test/test_image-diff.png'
:filename => 'home/test_image-diff.png',
:thumb => 'thumbnails/home/test_image-diff.png'
}

expect(dirs['test'][0][:diff][:filename]).to eq 'test/test_image-diff.png'
expect(dirs['test'][0][:diff][:thumb]).to eq 'thumbnails/test/test_image-diff.png'
expect(dirs['home'][0][:diff][:filename]).to eq 'home/test_image-diff.png'
expect(dirs['home'][0][:diff][:thumb]).to eq 'thumbnails/home/test_image-diff.png'
end
end

Expand Down

0 comments on commit 442eb20

Please sign in to comment.