Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
212 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2.1.5 | ||
2.1.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,38 @@ | ||
require 'fileutils' | ||
|
||
# rubocop:disable Metrics/BlockLength | ||
namespace :picture_set do | ||
COMBINED_SUFFIX = '_combined.jpg'.freeze | ||
|
||
desc 'Combine all images into one' | ||
task :combine_images, [:path] => [:environment] do |_task, args| | ||
path = args[:path] | ||
path = Rails.root.join('public', 'picture_sets') if path.blank? | ||
puts "Using directory #{path}." | ||
Dir.chdir(path) do | ||
picture_sets = Dir.glob('*').select { |f| File.directory? f } | ||
picture_sets.each do |date| | ||
puts "Processing #{date}..." | ||
combine_images(date, path) | ||
end | ||
end | ||
desc 'Re-create collage images' | ||
task :recreate_collage_images, [:path] => [:environment] do |_task, args| | ||
PictureSet::PICTURE_PATH = args[:path] if args[:path].present? | ||
PictureSet.all.each { |ps| ps.combine_images(overwrite: true) } | ||
end | ||
|
||
desc 'Remove combined images. Necessary before running combine_images task again.' | ||
task :clean_combine_images, [:path] => [:environment] do |_task, args| | ||
path = args[:path] | ||
path = Rails.root.join('public', 'picture_sets') if path.blank? | ||
puts "Using directory #{path}." | ||
Dir.chdir(path) do | ||
picture_sets = Dir.glob('*').select { |f| File.directory? f } | ||
picture_sets.each do |date| | ||
Dir.chdir(File.join(path, date)) do | ||
FileUtils.rm("#{date}#{COMBINED_SUFFIX}", force: true) | ||
end | ||
end | ||
desc 'Re-create single polaroid images' | ||
task :recreate_polaroid_images, [:path] => [:environment] do |_task, args| | ||
PictureSet::PICTURE_PATH = args[:path] if args[:path].present? | ||
PictureSet.all.each do |ps| | ||
angle = Random.rand(355..365) | ||
(1..4).each { |num| ps.convert_to_polaroid(num, angle) } | ||
end | ||
end | ||
|
||
desc 'Copies all images into one directory (without the single polaroids)' | ||
task :copy, %i[path output] => [:environment] do |_task, args| | ||
path = args[:path] | ||
path = Rails.root.join('public', 'picture_sets') if path.blank? | ||
puts "Using directory #{path}." | ||
Dir.chdir(path) do | ||
picture_sets = Dir.glob('*').select { |f| File.directory?(f) && f != 'all' } | ||
picture_sets.each do |date| | ||
begin | ||
Syscall.execute("cp #{File.join(path, date, '*.jpg')} #{args[:output]}") | ||
Syscall.execute("cp #{File.join(path, date, '*.gif')} #{args[:output]}") | ||
rescue StandardError => e | ||
puts e | ||
end | ||
end | ||
end | ||
desc 'Re-create animated gifs' | ||
task :recreate_animations, [:path] => [:environment] do |_task, args| | ||
PictureSet::PICTURE_PATH = args[:path] if args[:path].present? | ||
PictureSet.all.each { |ps| ps.create_animation(overwrite: true) } | ||
end | ||
|
||
def combine_images(date, path) | ||
dir = File.join(path, date) | ||
return if File.exist?(File.join(dir, "#{date}#{COMBINED_SUFFIX}")) | ||
begin | ||
Syscall.execute("time montage -geometry '25%x25%+25+25<' -background '#{OPTS.background_color}' " \ | ||
"-title '#{OPTS.image_caption}' -font '#{OPTS.font}' -fill '#{OPTS.font_color}' " \ | ||
"-pointsize #{OPTS.combined_image_fontsize} -gravity 'Center' #{date}_*.jpg #{date}#{COMBINED_SUFFIX}", | ||
dir: dir) | ||
rescue StandardError => e | ||
puts "Can not process #{dir}: #{e}" | ||
desc 'Exports all images into a single directory (without the single polaroids)' | ||
task :export, %i[output path] => [:environment] do |_task, args| | ||
PictureSet::PICTURE_PATH = args[:path] if args[:path].present? | ||
puts "copying from #{PictureSet::PICTURE_PATH} to #{args[:output]}." | ||
PictureSet.all.each do |ps| | ||
Dir.chdir(ps.dir) do | ||
FileUtils.cp(ps.animation, args[:output]) | ||
FileUtils.cp(ps.pictures.map { |p| p[:full] }, args[:output]) | ||
end | ||
end | ||
end | ||
|
||
end | ||
# rubocop:enable Metrics/BlockLength |
Empty file.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
require 'rails_helper' | ||
|
||
feature 'Photobox send picture set by email', js: true do | ||
|
||
context 'navigating from index page' do | ||
before do | ||
visit '/' | ||
find(:css, 'img.gallery-img', match: :first).click | ||
click_link('Send per email') | ||
end | ||
|
||
it 'shows the email send form' do | ||
expect(page).to have_text('Get your picture send to you immediately') | ||
end | ||
|
||
it 'can go back to picture set' do | ||
click_link('Back') | ||
expect(page).to have_css('.fullscreen img') | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.