images_gallery 1.0.0.rc

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +3 -0
  3. data/LICENSE +674 -0
  4. data/README.md +84 -0
  5. data/Rakefile +53 -0
  6. data/bin/images_gallery +6 -0
  7. data/config.ru +8 -0
  8. data/lib/images_gallery/cli.rb +27 -0
  9. data/lib/images_gallery/collection.rb +15 -0
  10. data/lib/images_gallery/errors.rb +6 -0
  11. data/lib/images_gallery/generator.rb +66 -0
  12. data/lib/images_gallery/image.rb +19 -0
  13. data/lib/images_gallery/source.rb +104 -0
  14. data/lib/images_gallery/templates/_navigation.html.erb +5 -0
  15. data/lib/images_gallery/templates/_thumbnails.html.erb +13 -0
  16. data/lib/images_gallery/templates/layout.html.erb +61 -0
  17. data/lib/images_gallery/test_application.rb +14 -0
  18. data/lib/images_gallery/version.rb +3 -0
  19. data/lib/images_gallery/view.rb +55 -0
  20. data/lib/images_gallery/views/index.rb +26 -0
  21. data/lib/images_gallery/views/make.rb +28 -0
  22. data/lib/images_gallery/views/model.rb +29 -0
  23. data/lib/images_gallery.rb +10 -0
  24. data/spec/features/index_page_spec.rb +36 -0
  25. data/spec/features/makes_pages/canon_page_spec.rb +30 -0
  26. data/spec/features/makes_pages/leica_page_spec.rb +25 -0
  27. data/spec/features/models_pages/canon_eos_20d_page_spec.rb +14 -0
  28. data/spec/features/models_pages/lux_d_3_page_spec.rb +14 -0
  29. data/spec/fixtures/output-template.html +22 -0
  30. data/spec/fixtures/works.xml +596 -0
  31. data/spec/fixtures/works_large.xml +52780 -0
  32. data/spec/lib/images_gallery/cli_spec.rb +64 -0
  33. data/spec/lib/images_gallery/collection_spec.rb +14 -0
  34. data/spec/lib/images_gallery/generator_spec.rb +11 -0
  35. data/spec/lib/images_gallery/image_spec.rb +11 -0
  36. data/spec/lib/images_gallery/source_spec.rb +43 -0
  37. data/spec/lib/images_gallery/view_spec.rb +13 -0
  38. data/spec/lib/images_gallery/views/index_spec.rb +16 -0
  39. data/spec/lib/images_gallery/views/make_spec.rb +16 -0
  40. data/spec/lib/images_gallery/views/model_spec.rb +16 -0
  41. data/spec/spec_helper.rb +32 -0
  42. data/spec/support/capybara.rb +12 -0
  43. data/spec/support/helpers.rb +18 -0
  44. data/spec/support/spec_for_collection_interface.rb +7 -0
  45. data/spec/support/spec_for_generator_interface.rb +29 -0
  46. data/spec/support/spec_for_image_interface.rb +18 -0
  47. data/spec/support/spec_for_images_gallery.rb +28 -0
  48. data/spec/support/spec_for_make_page.rb +9 -0
  49. data/spec/support/spec_for_model_page.rb +13 -0
  50. data/spec/support/spec_for_parser_interface.rb +6 -0
  51. data/spec/support/spec_for_view_inerface.rb +19 -0
  52. data/spec/tmp/canon/canon_eos_20d.html +76 -0
  53. data/spec/tmp/canon/canon_eos_400d_digital.html +76 -0
  54. data/spec/tmp/canon.html +93 -0
  55. data/spec/tmp/fuji_photo_film_co_ltd/slp1000se.html +76 -0
  56. data/spec/tmp/fuji_photo_film_co_ltd.html +81 -0
  57. data/spec/tmp/fujifilm/finepix_s6500fd.html +76 -0
  58. data/spec/tmp/fujifilm.html +81 -0
  59. data/spec/tmp/index.html +181 -0
  60. data/spec/tmp/leica/d_lux_3.html +96 -0
  61. data/spec/tmp/leica.html +121 -0
  62. data/spec/tmp/nikon_corporation/nikon_d80.html +76 -0
  63. data/spec/tmp/nikon_corporation.html +81 -0
  64. data/spec/tmp/panasonic/dmc_fz30.html +81 -0
  65. data/spec/tmp/panasonic.html +91 -0
  66. data/spec/tmp/unknown_make/unknown_model.html +81 -0
  67. data/spec/tmp/unknown_make.html +91 -0
  68. metadata +283 -0
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'The index page', type: :feature do
4
+
5
+ let!(:generator) { ImagesGallery::Generator.new }
6
+ let!(:images) do
7
+ generator.run('spec/fixtures/works.xml', 'spec/tmp/')
8
+ generator.instance_variable_get('@source').send(:images)
9
+ end
10
+
11
+ before(:each) do
12
+ visit '/'
13
+ end
14
+
15
+ it_behaves_like('an images gallery', 10, header_selector, navigation_selector, title_selector)
16
+
17
+ it 'displays a list of all the camera makes' do
18
+ images.makes.each do |make|
19
+ expect(page).to have_content "#{make}"
20
+ end
21
+ end
22
+
23
+ describe 'navigation' do
24
+
25
+ it 'is composed by as many links as there are camera makes' do
26
+ expect(page).to have_selector "#{navigation_selector} a", count: images.makes.count
27
+ end
28
+
29
+ it 'contains a link to each camera make page' do
30
+ images.makes.each do |make|
31
+ make_page = "#{make.to_filename}.html"
32
+ expect(page).to have_selector "#{navigation_selector} a[href=\"#{make_page}\"]"
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'The Canon make page', type: :feature do
4
+
5
+ let!(:generator) { ImagesGallery::Generator.new }
6
+
7
+ before(:each) do
8
+ generator.run('spec/fixtures/works.xml', 'spec/tmp/')
9
+ visit '/canon.html'
10
+ end
11
+
12
+ it_behaves_like('an images gallery', 2, header_selector, navigation_selector, title_selector)
13
+ it_behaves_like('a make page', navigation_selector)
14
+
15
+ describe 'navigation' do
16
+
17
+ it 'contains a link to the two Canon camera models' do
18
+ expect(page).to have_selector "#{navigation_selector} a", text: 'Canon EOS 20D'
19
+ expect(page).to have_selector "#{navigation_selector} a", text: 'Canon EOS 400D DIGITAL'
20
+ end
21
+
22
+ it 'contains a link to the Canon EOS 20D camera model page' do
23
+ expect(page).to have_selector "#{navigation_selector} a[href='canon/canon_eos_20d.html']"
24
+ end
25
+
26
+ it 'contains a link to the Canon EOS 400D DIGITAL camera model page' do
27
+ expect(page).to have_selector "#{navigation_selector} a[href='canon/canon_eos_400d_digital.html']"
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'The Leica make page', type: :feature do
4
+
5
+ let!(:generator) { ImagesGallery::Generator.new }
6
+
7
+ before(:each) do
8
+ generator.run('spec/fixtures/works.xml', 'spec/tmp/')
9
+ visit '/leica.html'
10
+ end
11
+
12
+ it_behaves_like('an images gallery', 5, header_selector, navigation_selector, title_selector)
13
+ it_behaves_like('a make page', navigation_selector)
14
+
15
+ describe 'navigation' do
16
+
17
+ it 'contains a link to the only Leica camera model' do
18
+ expect(page).to have_selector "#{navigation_selector} a", text: 'D-LUX 3'
19
+ end
20
+
21
+ it 'contains a link to the D-LUX3 camera model page' do
22
+ expect(page).to have_selector "#{navigation_selector} a[href='leica/d_lux_3.html']"
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'The Canon EOS 20D model page', type: :feature do
4
+
5
+ let!(:generator) { ImagesGallery::Generator.new }
6
+
7
+ before(:each) do
8
+ generator.run('spec/fixtures/works.xml', 'spec/tmp/')
9
+ visit '/canon/canon_eos_20d.html'
10
+ end
11
+
12
+ it_behaves_like('an images gallery', 1, header_selector, navigation_selector, title_selector)
13
+ it_behaves_like('a model page', 'canon', navigation_selector)
14
+ end
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'The LUX-D 3 model page', type: :feature do
4
+
5
+ let!(:generator) { ImagesGallery::Generator.new }
6
+
7
+ before(:each) do
8
+ generator.run('spec/fixtures/works.xml', 'spec/tmp/')
9
+ visit '/leica/d_lux_3.html'
10
+ end
11
+
12
+ it_behaves_like('an images gallery', 5, header_selector, navigation_selector, title_selector)
13
+ it_behaves_like('a model page', 'leica', navigation_selector)
14
+ end
@@ -0,0 +1,22 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>{{ TITLE GOES HERE }}</title>
5
+ <style type="text/css">
6
+ nav {
7
+ margin: 10px;
8
+ }
9
+ </style>
10
+ </head>
11
+ <body>
12
+ <header>
13
+ <h1>{{ TITLE GOES HERE }}</h1>
14
+
15
+ <nav>
16
+ {{ NAVIGATION GOES HERE }}
17
+ </nav>
18
+ </header>
19
+
20
+ {{ THUMBNAIL IMAGES GO HERE }}
21
+ </body>
22
+ </html>