kuva 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (160) hide show
  1. checksums.yaml +7 -0
  2. data/.coveralls.yml +1 -0
  3. data/.env.example +4 -0
  4. data/.gitignore +13 -0
  5. data/.rspec +1 -0
  6. data/.ruby-gemset +1 -0
  7. data/.ruby-version +1 -0
  8. data/.travis.yml +12 -0
  9. data/Gemfile +26 -0
  10. data/Gemfile.lock +187 -0
  11. data/MIT-LICENSE +20 -0
  12. data/README.md +129 -0
  13. data/Rakefile +14 -0
  14. data/app/assets/images/kuva/.keep +0 -0
  15. data/app/assets/javascripts/kuva/application.js +13 -0
  16. data/app/assets/javascripts/kuva/jquery-2.1.0.min.js +4 -0
  17. data/app/assets/javascripts/kuva/jquery.justified_gallery.min.js +7 -0
  18. data/app/assets/javascripts/kuva/kuva.js.coffee +2 -0
  19. data/app/assets/stylesheets/kuva/application.css +13 -0
  20. data/app/assets/stylesheets/kuva/justified_gallery.min.css +7 -0
  21. data/app/assets/stylesheets/kuva/kuva.css.sass +42 -0
  22. data/app/controllers/kuva/application_controller.rb +17 -0
  23. data/app/controllers/kuva/photos_controller.rb +10 -0
  24. data/app/controllers/kuva/sets_controller.rb +24 -0
  25. data/app/helpers/kuva/application_helper.rb +31 -0
  26. data/app/views/kuva/photos/show.html.haml +6 -0
  27. data/app/views/kuva/sets/index.html.haml +8 -0
  28. data/app/views/kuva/sets/show.html.haml +8 -0
  29. data/app/views/layouts/kuva/application.html.haml +10 -0
  30. data/config/locales/cli.yml +8 -0
  31. data/config/locales/frontend.yml +4 -0
  32. data/config/routes.rb +9 -0
  33. data/kuva.gemspec +25 -0
  34. data/lib/generators/kuva/install_generator.rb +20 -0
  35. data/lib/generators/kuva/templates/kuva.rb +34 -0
  36. data/lib/generators/kuva/views_generator.rb +23 -0
  37. data/lib/kuva.rb +23 -0
  38. data/lib/kuva/authorizer.rb +50 -0
  39. data/lib/kuva/elements/photo.rb +41 -0
  40. data/lib/kuva/elements/photoset.rb +49 -0
  41. data/lib/kuva/elements/photoset_collection.rb +25 -0
  42. data/lib/kuva/elements/url_info.rb +6 -0
  43. data/lib/kuva/engine.rb +9 -0
  44. data/lib/kuva/version.rb +3 -0
  45. data/lib/tasks/kuva_task.rake +6 -0
  46. data/spec/controllers/kuva/application_controller_spec.rb +42 -0
  47. data/spec/controllers/kuva/photos_controller_spec.rb +22 -0
  48. data/spec/controllers/kuva/sets_controller_spec.rb +51 -0
  49. data/spec/dummy/README.md +1 -0
  50. data/spec/dummy/Rakefile +6 -0
  51. data/spec/dummy/app/assets/images/.keep +0 -0
  52. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  53. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  54. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  55. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  56. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  57. data/spec/dummy/app/mailers/.keep +0 -0
  58. data/spec/dummy/app/models/.keep +0 -0
  59. data/spec/dummy/app/models/concerns/.keep +0 -0
  60. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  61. data/spec/dummy/bin/bundle +3 -0
  62. data/spec/dummy/bin/rails +4 -0
  63. data/spec/dummy/bin/rake +4 -0
  64. data/spec/dummy/config.ru +4 -0
  65. data/spec/dummy/config/application.rb +30 -0
  66. data/spec/dummy/config/boot.rb +5 -0
  67. data/spec/dummy/config/database.yml +25 -0
  68. data/spec/dummy/config/environment.rb +5 -0
  69. data/spec/dummy/config/environments/development.rb +29 -0
  70. data/spec/dummy/config/environments/production.rb +80 -0
  71. data/spec/dummy/config/environments/test.rb +39 -0
  72. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  73. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  74. data/spec/dummy/config/initializers/inflections.rb +16 -0
  75. data/spec/dummy/config/initializers/kuva.rb +29 -0
  76. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  77. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  78. data/spec/dummy/config/initializers/session_store.rb +3 -0
  79. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  80. data/spec/dummy/config/locales/en.yml +23 -0
  81. data/spec/dummy/config/routes.rb +4 -0
  82. data/spec/dummy/lib/assets/.keep +0 -0
  83. data/spec/dummy/log/.keep +0 -0
  84. data/spec/dummy/public/404.html +58 -0
  85. data/spec/dummy/public/422.html +58 -0
  86. data/spec/dummy/public/500.html +57 -0
  87. data/spec/dummy/public/favicon.ico +0 -0
  88. data/spec/features/photo_spec.rb +40 -0
  89. data/spec/features/photoset_collection_spec.rb +25 -0
  90. data/spec/features/photoset_spec.rb +42 -0
  91. data/spec/generators/kuva/install_generator_spec.rb +30 -0
  92. data/spec/generators/kuva/views_generator_spec.rb +37 -0
  93. data/spec/helpers/kuva/application_helper_spec.rb +26 -0
  94. data/spec/kuva/authorizer_spec.rb +83 -0
  95. data/spec/kuva/elements/photo_spec.rb +76 -0
  96. data/spec/kuva/elements/photoset_collection_spec.rb +42 -0
  97. data/spec/kuva/elements/photoset_spec.rb +106 -0
  98. data/spec/kuva/elements/url_info_spec.rb +25 -0
  99. data/spec/kuva_spec.rb +81 -0
  100. data/spec/spec_helper.rb +68 -0
  101. data/spec/support/vcr/cassettes/Kuva_ApplicationController/configuring_Kuva/sets_the_API_key.yml +160 -0
  102. data/spec/support/vcr/cassettes/Kuva_ApplicationController/configuring_Kuva/sets_the_access_secret.yml +160 -0
  103. data/spec/support/vcr/cassettes/Kuva_ApplicationController/configuring_Kuva/sets_the_access_token.yml +160 -0
  104. data/spec/support/vcr/cassettes/Kuva_ApplicationHelper/_breadcrumbs_for/when_the_current_page_is_NOT_the_set_page/creates_a_breadcrumb_with_the_set_URL.yml +65 -0
  105. data/spec/support/vcr/cassettes/Kuva_ApplicationHelper/_breadcrumbs_for/when_the_current_page_is_the_set_page/creates_a_breadcrumb_without_the_set_URL.yml +222 -0
  106. data/spec/support/vcr/cassettes/Kuva_Elements_Photo/_find/fetches_the_photo_from_Flickr_specified_by_id.yml +95 -0
  107. data/spec/support/vcr/cassettes/Kuva_Elements_Photo/_find/instantiates_a_new_Kuva_Elements_Photo_object.yml +252 -0
  108. data/spec/support/vcr/cassettes/Kuva_Elements_Photo/_initialize/does_NOT_set_the_is_primary_boolean.yml +252 -0
  109. data/spec/support/vcr/cassettes/Kuva_Elements_Photo/_initialize/returns_itself.yml +95 -0
  110. data/spec/support/vcr/cassettes/Kuva_Elements_Photo/_initialize/saves_a_reference_to_the_description.yml +95 -0
  111. data/spec/support/vcr/cassettes/Kuva_Elements_Photo/_initialize/saves_a_reference_to_the_farm.yml +95 -0
  112. data/spec/support/vcr/cassettes/Kuva_Elements_Photo/_initialize/saves_a_reference_to_the_id.yml +95 -0
  113. data/spec/support/vcr/cassettes/Kuva_Elements_Photo/_initialize/saves_a_reference_to_the_secret.yml +95 -0
  114. data/spec/support/vcr/cassettes/Kuva_Elements_Photo/_initialize/saves_a_reference_to_the_server.yml +252 -0
  115. data/spec/support/vcr/cassettes/Kuva_Elements_Photo/_initialize/saves_a_reference_to_the_title.yml +95 -0
  116. data/spec/support/vcr/cassettes/Kuva_Elements_Photo/image_URLs/generates_an_image_URL_for_a_default_sized_medium_image.yml +95 -0
  117. data/spec/support/vcr/cassettes/Kuva_Elements_Photo/image_URLs/generates_an_image_URL_for_a_n-sized_small_320_image.yml +252 -0
  118. data/spec/support/vcr/cassettes/Kuva_Elements_Photo/image_URLs/instantiates_a_new_URL_info_object_to_create_image_URLs.yml +95 -0
  119. data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_find/fetches_the_photoset_from_Flickr_specified_by_id.yml +65 -0
  120. data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_find/instantiates_a_new_Kuva_Elements_Photoset_object.yml +65 -0
  121. data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_image_url/generates_an_image_URL_for_a_large_square_image.yml +65 -0
  122. data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_image_url/instantiates_a_new_URL_info_object_to_create_an_image_URL.yml +222 -0
  123. data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_initialize/returns_itself.yml +65 -0
  124. data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_initialize/saves_a_reference_to_the_created_at_date.yml +65 -0
  125. data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_initialize/saves_a_reference_to_the_description.yml +65 -0
  126. data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_initialize/saves_a_reference_to_the_farm.yml +65 -0
  127. data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_initialize/saves_a_reference_to_the_id.yml +65 -0
  128. data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_initialize/saves_a_reference_to_the_number_of_photos.yml +65 -0
  129. data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_initialize/saves_a_reference_to_the_number_of_views.yml +65 -0
  130. data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_initialize/saves_a_reference_to_the_primary_id.yml +222 -0
  131. data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_initialize/saves_a_reference_to_the_secret.yml +65 -0
  132. data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_initialize/saves_a_reference_to_the_server.yml +65 -0
  133. data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_initialize/saves_a_reference_to_the_title.yml +222 -0
  134. data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_initialize/saves_a_reference_to_the_updated_at_date.yml +65 -0
  135. data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_with_photos/returns_an_array.yml +162 -0
  136. data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_with_photos/returns_an_array_with_the_size_specified_by_number_of_photos.yml +162 -0
  137. data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_with_photos/wraps_the_photos_into_a_Kuva_Elements_Photo_element.yml +319 -0
  138. data/spec/support/vcr/cassettes/Kuva_Elements_PhotosetCollection/_photosets/retrieves_all_photosets.yml +2761 -0
  139. data/spec/support/vcr/cassettes/Kuva_Elements_PhotosetCollection/_photosets/returns_an_array.yml +2918 -0
  140. data/spec/support/vcr/cassettes/Kuva_Elements_PhotosetCollection/_photosets/wraps_the_photosets_into_a_Kuva_Elements_Photoset_element.yml +2761 -0
  141. data/spec/support/vcr/cassettes/Kuva_Elements_PhotosetCollection/_retrieve/fetches_all_photosets_from_Flickr.yml +2918 -0
  142. data/spec/support/vcr/cassettes/Kuva_Elements_PhotosetCollection/_retrieve/instantiates_a_new_Kuva_Elements_PhotosetCollection_object.yml +2761 -0
  143. data/spec/support/vcr/cassettes/Kuva_PhotosController/_show/assigns_the_photo.yml +314 -0
  144. data/spec/support/vcr/cassettes/Kuva_PhotosController/_show/finds_the_photo.yml +157 -0
  145. data/spec/support/vcr/cassettes/Kuva_SetsController/_index/assigns_the_photoset_collection_with_photosets.yml +2761 -0
  146. data/spec/support/vcr/cassettes/Kuva_SetsController/_index/knows_its_type.yml +2918 -0
  147. data/spec/support/vcr/cassettes/Kuva_SetsController/_index/retrieves_the_entire_photoset_collection.yml +160 -0
  148. data/spec/support/vcr/cassettes/Kuva_SetsController/_show/assigns_the_photos_of_the_specified_photoset.yml +2858 -0
  149. data/spec/support/vcr/cassettes/Kuva_SetsController/_show/finds_the_specified_photoset_within_the_entire_photoset_collection.yml +2858 -0
  150. data/spec/support/vcr/cassettes/Kuva_SetsController/_show/knows_its_type.yml +2858 -0
  151. data/spec/support/vcr/cassettes/photo/navigating_back_to_the_photoset_page.yml +3169 -0
  152. data/spec/support/vcr/cassettes/photo/viewing_the_first_photo_of_the_photoset.yml +157 -0
  153. data/spec/support/vcr/cassettes/photoset/navigating_back_to_the_photoset_collection_page.yml +5616 -0
  154. data/spec/support/vcr/cassettes/photoset/navigating_to_the_page_with_details_of_the_first_photo.yml +3012 -0
  155. data/spec/support/vcr/cassettes/photoset/viewing_the_first_photo_of_the_photoset.yml +314 -0
  156. data/spec/support/vcr/cassettes/photoset/viewing_the_first_photoset_of_the_photoset_collection.yml +3015 -0
  157. data/spec/support/vcr/cassettes/photoset_collection/navigating_to_the_page_with_photos_of_the_first_photoset.yml +5616 -0
  158. data/spec/support/vcr/cassettes/photoset_collection/viewing_the_photoset_collection.yml +2761 -0
  159. data/spec/support/vcr/vcr.rb +17 -0
  160. metadata +398 -0
@@ -0,0 +1,49 @@
1
+ module Kuva
2
+ module Elements
3
+ class Photoset
4
+
5
+ attr_reader :id, :title, :description, :views, :number_of_photos, :farm, :server, :secret, :primary, :created_at, :updated_at
6
+
7
+ def initialize(attributes = {})
8
+ @id = attributes.try :id
9
+ @title = attributes.try :title
10
+ @description = attributes.try :description
11
+ @views = attributes.try :count_views
12
+ @number_of_photos = attributes.try :photos
13
+ @farm = attributes.try :farm
14
+ @server = attributes.try :server
15
+ @secret = attributes.try :secret
16
+ @primary = attributes.try :primary
17
+ @created_at = attributes.try :date_create
18
+ @updated_at = attributes.try :date_update
19
+
20
+ self
21
+ end
22
+
23
+ def self.find(id)
24
+ Rails.cache.fetch "photoset-#{id}", expires_in: Kuva.cache_expiration do
25
+ new flickr.photosets.getInfo(photoset_id: id)
26
+ end
27
+ end
28
+
29
+ def with_photos
30
+ @with_photos ||= photos.each_with_object([]) do |photo, collection|
31
+ collection << Kuva::Elements::Photo.new(photo)
32
+ end
33
+ end
34
+
35
+ def image_url
36
+ FlickRaw.url_q Kuva::Elements::UrlInfo.new primary, farm, server, secret
37
+ end
38
+
39
+ private
40
+
41
+ def photos
42
+ Rails.cache.fetch "photos-from-photoset-#{id}-#{updated_at}", expires_in: Kuva.cache_expiration do
43
+ flickr.photosets.getPhotos(photoset_id: id).photo
44
+ end
45
+ end
46
+
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,25 @@
1
+ module Kuva
2
+ module Elements
3
+ class PhotosetCollection
4
+
5
+ def self.retrieve
6
+ new.photosets
7
+ end
8
+
9
+ def photosets
10
+ @photosets ||= cached.each_with_object([]) do |photoset, collection|
11
+ collection << Kuva::Elements::Photoset.find(photoset.id)
12
+ end
13
+ end
14
+
15
+ private
16
+
17
+ def cached
18
+ Rails.cache.fetch "photosets", expires_in: Kuva.cache_expiration do
19
+ flickr.photosets.getList
20
+ end
21
+ end
22
+
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,6 @@
1
+ module Kuva
2
+ module Elements
3
+ class UrlInfo < Struct.new(:id, :farm, :server, :secret)
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,9 @@
1
+ module Kuva
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace Kuva
4
+
5
+ config.generators do |generator|
6
+ generator.test_framework :rspec
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ module Kuva
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,6 @@
1
+ namespace :kuva do
2
+ desc "Authorize the Kuva Rails Engine with Flickr."
3
+ task authorize: :environment do
4
+ Kuva::Authorizer.authorize
5
+ end
6
+ end
@@ -0,0 +1,42 @@
1
+ require "spec_helper"
2
+
3
+ module Kuva
4
+ describe ApplicationController do
5
+ controller(ApplicationController) do
6
+ def index
7
+ render text: "testing before_action with anonymous controller"
8
+ end
9
+ end
10
+
11
+ context "configuring Kuva", :vcr do
12
+ it "sets the API key" do
13
+ allow(Kuva).to receive(:api_key).and_return "<api_key>"
14
+ get :index
15
+
16
+ expect(FlickRaw.api_key).to eq "<api_key>"
17
+ end
18
+
19
+ it "sets the shared secret" do
20
+ allow(Kuva).to receive(:shared_secret).and_return "<shared_secret>"
21
+ get :index
22
+
23
+ expect(FlickRaw.shared_secret).to eq "<shared_secret>"
24
+ end
25
+
26
+ it "sets the access token" do
27
+ allow(Kuva).to receive(:access_token).and_return "<access_token>"
28
+ get :index
29
+
30
+ expect(flickr.access_token).to eq "<access_token>"
31
+ end
32
+
33
+ it "sets the access secret" do
34
+ allow(Kuva).to receive(:access_secret).and_return "<access_secret>"
35
+ get :index
36
+
37
+ expect(flickr.access_secret).to eq "<access_secret>"
38
+ end
39
+ end
40
+
41
+ end
42
+ end
@@ -0,0 +1,22 @@
1
+ require "spec_helper"
2
+
3
+ module Kuva
4
+ describe PhotosController, :vcr do
5
+ let(:view_photo) { get :show, id: photo_id, set_id: "72157632367381040", use_route: :kuva }
6
+
7
+ let(:photo_id) { "8317914535" }
8
+ let(:photo) { assigns :photo }
9
+
10
+ describe "#show" do
11
+ it "assigns the photo" do
12
+ view_photo
13
+ expect(photo).to be_a Kuva::Elements::Photo
14
+ end
15
+
16
+ it "finds the photo" do
17
+ expect(Kuva::Elements::Photo).to receive(:find).with(photo_id).and_call_original
18
+ view_photo
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,51 @@
1
+ require "spec_helper"
2
+
3
+ module Kuva
4
+ describe SetsController, :vcr do
5
+ describe "#index" do
6
+ let(:view_index) { get :index, use_route: :kuva }
7
+
8
+ let(:photosets) { assigns :photosets }
9
+
10
+ it "knows its type" do
11
+ view_index
12
+ expect(photosets).to be_an Array
13
+ end
14
+
15
+ it "assigns the photoset collection with photosets" do
16
+ view_index
17
+ photosets.each do |photoset|
18
+ expect(photoset).to be_a Kuva::Elements::Photoset
19
+ end
20
+ end
21
+
22
+ it "retrieves the entire photoset collection" do
23
+ expect(Kuva::Elements::PhotosetCollection).to receive :retrieve
24
+ view_index
25
+ end
26
+ end
27
+
28
+ describe "#show" do
29
+ let(:view_photoset) { get :show, id: "72157632367381040", use_route: :kuva }
30
+
31
+ let(:collection) { Kuva::Elements::PhotosetCollection.retrieve }
32
+ let(:photoset) { assigns :photoset }
33
+ let(:photos) { assigns :photos }
34
+
35
+ it "knows its type" do
36
+ view_photoset
37
+ expect(photoset).to be_a Kuva::Elements::Photoset
38
+ end
39
+
40
+ it "assigns the photos of the specified photoset" do
41
+ expect_any_instance_of(Kuva::Elements::Photoset).to receive(:with_photos).and_call_original
42
+ view_photoset
43
+ end
44
+
45
+ it "finds the specified photoset within the entire photoset collection" do
46
+ expect(Kuva::Elements::Photoset).to receive(:find).at_least(1).times.and_call_original
47
+ view_photoset
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1 @@
1
+ # Kuva
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Dummy::Application.load_tasks
File without changes
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,5 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
5
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
File without changes
File without changes
File without changes
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
6
+ <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Rails.application
@@ -0,0 +1,30 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ # Pick the frameworks you want:
4
+ require "active_record/railtie"
5
+ require "action_controller/railtie"
6
+ require "action_mailer/railtie"
7
+ require "sprockets/railtie"
8
+ # require "rails/test_unit/railtie"
9
+
10
+ Bundler.require(*Rails.groups)
11
+ require "kuva"
12
+
13
+ module Dummy
14
+ class Application < Rails::Application
15
+ # Settings in config/environments/* take precedence over those specified here.
16
+ # Application configuration should go into files in config/initializers
17
+ # -- all .rb files in that directory are automatically loaded.
18
+
19
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
20
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
21
+ # config.time_zone = 'Central Time (US & Canada)'
22
+
23
+ config.i18n.enforce_available_locales = true
24
+
25
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
26
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
27
+ # config.i18n.default_locale = :de
28
+ end
29
+ end
30
+
@@ -0,0 +1,5 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
5
+ $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,25 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ development:
7
+ adapter: sqlite3
8
+ database: db/development.sqlite3
9
+ pool: 5
10
+ timeout: 5000
11
+
12
+ # Warning: The database defined as "test" will be erased and
13
+ # re-generated from your development database when you run "rake".
14
+ # Do not set this db to the same as development or production.
15
+ test:
16
+ adapter: sqlite3
17
+ database: db/test.sqlite3
18
+ pool: 5
19
+ timeout: 5000
20
+
21
+ production:
22
+ adapter: sqlite3
23
+ database: db/production.sqlite3
24
+ pool: 5
25
+ timeout: 5000
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the Rails application.
5
+ Dummy::Application.initialize!
@@ -0,0 +1,29 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the web server when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Do not eager load code on boot.
10
+ config.eager_load = false
11
+
12
+ # Show full error reports and disable caching.
13
+ config.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send.
17
+ config.action_mailer.raise_delivery_errors = false
18
+
19
+ # Print deprecation notices to the Rails logger.
20
+ config.active_support.deprecation = :log
21
+
22
+ # Raise an error on page load if there are pending migrations
23
+ config.active_record.migration_error = :page_load
24
+
25
+ # Debug mode disables concatenation and preprocessing of assets.
26
+ # This option may cause significant delays in view rendering with a large
27
+ # number of complex assets.
28
+ config.assets.debug = true
29
+ end
@@ -0,0 +1,80 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # Code is not reloaded between requests.
5
+ config.cache_classes = true
6
+
7
+ # Eager load code on boot. This eager loads most of Rails and
8
+ # your application in memory, allowing both thread web servers
9
+ # and those relying on copy on write to perform better.
10
+ # Rake tasks automatically ignore this option for performance.
11
+ config.eager_load = true
12
+
13
+ # Full error reports are disabled and caching is turned on.
14
+ config.consider_all_requests_local = false
15
+ config.action_controller.perform_caching = true
16
+
17
+ # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
+ # Add `rack-cache` to your Gemfile before enabling this.
19
+ # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
20
+ # config.action_dispatch.rack_cache = true
21
+
22
+ # Disable Rails's static asset server (Apache or nginx will already do this).
23
+ config.serve_static_assets = false
24
+
25
+ # Compress JavaScripts and CSS.
26
+ config.assets.js_compressor = :uglifier
27
+ # config.assets.css_compressor = :sass
28
+
29
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
30
+ config.assets.compile = false
31
+
32
+ # Generate digests for assets URLs.
33
+ config.assets.digest = true
34
+
35
+ # Version of your assets, change this if you want to expire all your assets.
36
+ config.assets.version = '1.0'
37
+
38
+ # Specifies the header that your server uses for sending files.
39
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
40
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
41
+
42
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
43
+ # config.force_ssl = true
44
+
45
+ # Set to :debug to see everything in the log.
46
+ config.log_level = :info
47
+
48
+ # Prepend all log lines with the following tags.
49
+ # config.log_tags = [ :subdomain, :uuid ]
50
+
51
+ # Use a different logger for distributed setups.
52
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
53
+
54
+ # Use a different cache store in production.
55
+ # config.cache_store = :mem_cache_store
56
+
57
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
58
+ # config.action_controller.asset_host = "http://assets.example.com"
59
+
60
+ # Precompile additional assets.
61
+ # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
62
+ # config.assets.precompile += %w( search.js )
63
+
64
+ # Ignore bad email addresses and do not raise email delivery errors.
65
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
66
+ # config.action_mailer.raise_delivery_errors = false
67
+
68
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
69
+ # the I18n.default_locale when a translation can not be found).
70
+ config.i18n.fallbacks = true
71
+
72
+ # Send deprecation notices to registered listeners.
73
+ config.active_support.deprecation = :notify
74
+
75
+ # Disable automatic flushing of the log to improve performance.
76
+ # config.autoflush_log = false
77
+
78
+ # Use default logging formatter so that PID and timestamp are not suppressed.
79
+ config.log_formatter = ::Logger::Formatter.new
80
+ end