images 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +8 -14
  3. data/Gemfile +13 -1
  4. data/Gemfile.lock +146 -0
  5. data/{LICENSE.txt → MIT-LICENSE} +1 -3
  6. data/README.md +15 -0
  7. data/Rakefile +32 -4
  8. data/app/assets/javascripts/images.js.erb +1 -1
  9. data/images.gemspec +23 -17
  10. data/lib/images/builder.rb +3 -2
  11. data/lib/images/engine.rb +10 -1
  12. data/lib/images/options.rb +6 -0
  13. data/lib/images/url_helper.rb +1 -3
  14. data/lib/images/version.rb +2 -2
  15. data/lib/images.rb +9 -4
  16. data/test/builder_test.rb +13 -13
  17. data/test/dummy/README.rdoc +28 -0
  18. data/test/dummy/Rakefile +6 -0
  19. data/{circle.yml → test/dummy/app/assets/images/.keep} +0 -0
  20. data/test/dummy/app/assets/images/brewhouse/design/pat.jpg +0 -0
  21. data/test/dummy/app/assets/images/brewhouse/software/gabe.jpg +0 -0
  22. data/test/dummy/app/assets/javascripts/application.js +14 -0
  23. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  24. data/test/dummy/app/controllers/application_controller.rb +5 -0
  25. data/test/dummy/app/controllers/concerns/.keep +0 -0
  26. data/test/dummy/app/controllers/welcome_controller.rb +4 -0
  27. data/test/dummy/app/helpers/application_helper.rb +2 -0
  28. data/test/dummy/app/mailers/.keep +0 -0
  29. data/test/dummy/app/models/.keep +0 -0
  30. data/test/dummy/app/models/concerns/.keep +0 -0
  31. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  32. data/test/dummy/app/views/welcome/index.html.erb +0 -0
  33. data/test/dummy/bin/bundle +3 -0
  34. data/test/dummy/bin/rails +4 -0
  35. data/test/dummy/bin/rake +4 -0
  36. data/test/dummy/bin/setup +29 -0
  37. data/test/dummy/config/application.rb +26 -0
  38. data/test/dummy/config/boot.rb +5 -0
  39. data/test/dummy/config/database.yml +25 -0
  40. data/test/dummy/config/environment.rb +5 -0
  41. data/test/dummy/config/environments/development.rb +41 -0
  42. data/test/dummy/config/environments/production.rb +79 -0
  43. data/test/dummy/config/environments/test.rb +42 -0
  44. data/test/dummy/config/initializers/assets.rb +11 -0
  45. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  46. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  47. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  48. data/test/dummy/config/initializers/inflections.rb +16 -0
  49. data/test/dummy/config/initializers/mime_types.rb +4 -0
  50. data/test/dummy/config/initializers/session_store.rb +3 -0
  51. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  52. data/test/dummy/config/locales/en.yml +23 -0
  53. data/test/dummy/config/routes.rb +57 -0
  54. data/test/dummy/config/secrets.yml +22 -0
  55. data/test/dummy/config.ru +4 -0
  56. data/test/dummy/db/schema.rb +16 -0
  57. data/test/dummy/lib/assets/.keep +0 -0
  58. data/test/dummy/log/.keep +0 -0
  59. data/test/dummy/public/404.html +67 -0
  60. data/test/dummy/public/422.html +67 -0
  61. data/test/dummy/public/500.html +66 -0
  62. data/test/dummy/public/favicon.ico +0 -0
  63. data/test/images_test.rb +41 -0
  64. data/test/integration_test_helper.rb +15 -0
  65. data/test/test_helper.rb +19 -0
  66. metadata +182 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: feedb77e3f8fe894b5e6aa2aee41612a4c4c1d96
4
- data.tar.gz: 034a32f25d188816a098f64b3ea6b176f57b1720
3
+ metadata.gz: 172495945000043ea025a0cc3e22a97a029f55f1
4
+ data.tar.gz: 4a42fe568c5c7b54a7542ee4369624de91d8bde3
5
5
  SHA512:
6
- metadata.gz: aa4a02ad345e990d47a2966b041a32ad334ebf8206552e1762438b090755ae8c9660a0fe892a6f258618b81c09b6a60797b6a688fca8489b07b0e4580f910d74
7
- data.tar.gz: 2694d27281087b4e5faea5486ca9ca9c815229055a5ca8b703d613cc2de198a46d2a3aeb2e46a8b900487c38fc2fb40d2899ff9d945b7e649eeef6d6fd0a6e4e
6
+ metadata.gz: 3a5f7c7a46fc7454faa44de2160263a4cb4872482dd6687e4513bffc968c4a2f56e7e970b1c580dd89bff64526703462510393d3966cd663d8ac6d73f223ea0d
7
+ data.tar.gz: 30e08ab318a65c7968d60c417bca32ee8b2857fcdcb2d79617e915babdc99ce0846ea3044f054669c16df80df388a9961993c87ca740a166ac4c35054498fbc2
data/.gitignore CHANGED
@@ -1,14 +1,8 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- *.bundle
11
- *.so
12
- *.o
13
- *.a
14
- mkmf.log
1
+ .bundle/
2
+ log/*.log
3
+ pkg/
4
+ test/dummy/db/*.sqlite3
5
+ test/dummy/db/*.sqlite3-journal
6
+ test/dummy/log/*.log
7
+ test/dummy/tmp/
8
+ test/dummy/.sass-cache
data/Gemfile CHANGED
@@ -1,3 +1,15 @@
1
- source "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
+ # Declare your gem's dependencies in images.gemspec.
4
+ # Bundler will treat runtime dependencies like base dependencies, and
5
+ # development dependencies will be added by default to the :development group.
3
6
  gemspec
7
+
8
+ # Declare any dependencies that are still in development here instead of in
9
+ # your gemspec. These might include edge Rails or gems from your path or
10
+ # Git. Remember to move these dependencies to your gemspec before releasing
11
+ # your gem to rubygems.org.
12
+
13
+ # To use a debugger
14
+ # gem 'byebug', group: [:development, :test]
15
+
data/Gemfile.lock ADDED
@@ -0,0 +1,146 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ images (0.0.2)
5
+ rails (~> 4.2.3)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actionmailer (4.2.3)
11
+ actionpack (= 4.2.3)
12
+ actionview (= 4.2.3)
13
+ activejob (= 4.2.3)
14
+ mail (~> 2.5, >= 2.5.4)
15
+ rails-dom-testing (~> 1.0, >= 1.0.5)
16
+ actionpack (4.2.3)
17
+ actionview (= 4.2.3)
18
+ activesupport (= 4.2.3)
19
+ rack (~> 1.6)
20
+ rack-test (~> 0.6.2)
21
+ rails-dom-testing (~> 1.0, >= 1.0.5)
22
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
23
+ actionview (4.2.3)
24
+ activesupport (= 4.2.3)
25
+ builder (~> 3.1)
26
+ erubis (~> 2.7.0)
27
+ rails-dom-testing (~> 1.0, >= 1.0.5)
28
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
29
+ activejob (4.2.3)
30
+ activesupport (= 4.2.3)
31
+ globalid (>= 0.3.0)
32
+ activemodel (4.2.3)
33
+ activesupport (= 4.2.3)
34
+ builder (~> 3.1)
35
+ activerecord (4.2.3)
36
+ activemodel (= 4.2.3)
37
+ activesupport (= 4.2.3)
38
+ arel (~> 6.0)
39
+ activesupport (4.2.3)
40
+ i18n (~> 0.7)
41
+ json (~> 1.7, >= 1.7.7)
42
+ minitest (~> 5.1)
43
+ thread_safe (~> 0.3, >= 0.3.4)
44
+ tzinfo (~> 1.1)
45
+ addressable (2.3.8)
46
+ arel (6.0.2)
47
+ builder (3.2.2)
48
+ capybara (2.4.4)
49
+ mime-types (>= 1.16)
50
+ nokogiri (>= 1.3.3)
51
+ rack (>= 1.0.0)
52
+ rack-test (>= 0.5.4)
53
+ xpath (~> 2.0)
54
+ capybara-webkit (1.3.0)
55
+ capybara (>= 2.0.2, < 2.5.0)
56
+ json
57
+ childprocess (0.5.3)
58
+ ffi (~> 1.0, >= 1.0.11)
59
+ coderay (1.1.0)
60
+ erubis (2.7.0)
61
+ ffi (1.9.8)
62
+ globalid (0.3.5)
63
+ activesupport (>= 4.1.0)
64
+ i18n (0.7.0)
65
+ json (1.8.3)
66
+ launchy (2.4.3)
67
+ addressable (~> 2.3)
68
+ loofah (2.0.2)
69
+ nokogiri (>= 1.5.9)
70
+ mail (2.6.3)
71
+ mime-types (>= 1.16, < 3)
72
+ method_source (0.8.2)
73
+ mime-types (2.6.1)
74
+ mini_portile (0.6.2)
75
+ minitest (5.7.0)
76
+ multi_json (1.11.1)
77
+ nokogiri (1.6.6.2)
78
+ mini_portile (~> 0.6.0)
79
+ pry (0.10.1)
80
+ coderay (~> 1.1.0)
81
+ method_source (~> 0.8.1)
82
+ slop (~> 3.4)
83
+ rack (1.6.4)
84
+ rack-test (0.6.3)
85
+ rack (>= 1.0)
86
+ rails (4.2.3)
87
+ actionmailer (= 4.2.3)
88
+ actionpack (= 4.2.3)
89
+ actionview (= 4.2.3)
90
+ activejob (= 4.2.3)
91
+ activemodel (= 4.2.3)
92
+ activerecord (= 4.2.3)
93
+ activesupport (= 4.2.3)
94
+ bundler (>= 1.3.0, < 2.0)
95
+ railties (= 4.2.3)
96
+ sprockets-rails
97
+ rails-deprecated_sanitizer (1.0.3)
98
+ activesupport (>= 4.2.0.alpha)
99
+ rails-dom-testing (1.0.6)
100
+ activesupport (>= 4.2.0.beta, < 5.0)
101
+ nokogiri (~> 1.6.0)
102
+ rails-deprecated_sanitizer (>= 1.0.1)
103
+ rails-html-sanitizer (1.0.2)
104
+ loofah (~> 2.0)
105
+ railties (4.2.3)
106
+ actionpack (= 4.2.3)
107
+ activesupport (= 4.2.3)
108
+ rake (>= 0.8.7)
109
+ thor (>= 0.18.1, < 2.0)
110
+ rake (10.4.2)
111
+ rubyzip (1.1.6)
112
+ selenium-webdriver (2.42.0)
113
+ childprocess (>= 0.5.0)
114
+ multi_json (~> 1.0)
115
+ rubyzip (~> 1.0)
116
+ websocket (~> 1.0.4)
117
+ slop (3.6.0)
118
+ sprockets (3.2.0)
119
+ rack (~> 1.0)
120
+ sprockets-rails (2.3.2)
121
+ actionpack (>= 3.0)
122
+ activesupport (>= 3.0)
123
+ sprockets (>= 2.8, < 4.0)
124
+ sqlite3 (1.3.10)
125
+ thor (0.19.1)
126
+ thread_safe (0.3.5)
127
+ tzinfo (1.2.2)
128
+ thread_safe (~> 0.1)
129
+ websocket (1.0.7)
130
+ xpath (2.0.0)
131
+ nokogiri (~> 1.3)
132
+
133
+ PLATFORMS
134
+ ruby
135
+
136
+ DEPENDENCIES
137
+ bundler (~> 1.6)
138
+ capybara
139
+ capybara-webkit
140
+ images!
141
+ launchy
142
+ minitest (~> 5.7.0)
143
+ pry
144
+ rake (~> 10.0)
145
+ selenium-webdriver
146
+ sqlite3
@@ -1,6 +1,4 @@
1
- Copyright (c) 2015 Gabe Scholz, Brewhouse Software
2
-
3
- MIT License
1
+ Copyright 2015 Gabe Scholz, Brewhouse Software
4
2
 
5
3
  Permission is hereby granted, free of charge, to any person obtaining
6
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -57,6 +57,21 @@ Will create:
57
57
  }
58
58
  ```
59
59
 
60
+ ## Configuration
61
+
62
+ By default this gem uses all of the image types included in `Mime::EXTENSION_LOOKUP` plus `svg`.
63
+ To add other file types to this list, simply append the file extension to `config.images.whitelist`
64
+ in your `application.rb`. For example,
65
+
66
+ ```ruby
67
+ module MyApp
68
+ class Application < Rails::Application
69
+ # ...
70
+ config.images.whitelist += ['exe']
71
+ end
72
+ end
73
+ ```
74
+
60
75
  ## Contributing
61
76
 
62
77
  1. Fork it ( https://github.com/BrewhouseTeam/images/fork )
data/Rakefile CHANGED
@@ -1,6 +1,34 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
3
8
 
4
- Rake::TestTask.new do |t|
5
- t.test_files = Dir.glob("test/**/*_test.rb")
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Images'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
6
15
  end
16
+
17
+
18
+
19
+
20
+
21
+
22
+ Bundler::GemHelper.install_tasks
23
+
24
+ require 'rake/testtask'
25
+
26
+ Rake::TestTask.new(:test) do |t|
27
+ t.libs << 'lib'
28
+ t.libs << 'test'
29
+ t.pattern = 'test/**/*_test.rb'
30
+ t.verbose = false
31
+ end
32
+
33
+
34
+ task default: :test
@@ -1,5 +1,5 @@
1
1
  (function (window, undefined) {
2
- var Images = <%= Images.load.to_json %>;
2
+ var Images = <%= Images.generate.to_json %>;
3
3
 
4
4
  function deepFreeze (obj) {
5
5
  Object.freeze(obj);
data/images.gemspec CHANGED
@@ -3,23 +3,29 @@ lib = File.expand_path("../lib", __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require "images/version"
5
5
 
6
- Gem::Specification.new do |spec|
7
- spec.name = "images"
8
- spec.version = Images::VERSION
9
- spec.authors = ["Gabe Scholz"]
10
- spec.email = ["gabe@brewhouse.io"]
11
- spec.summary = %q{Loads all image urls in your Rails project into a global JavaScript constant.}
12
- spec.description = %q{Loads all image urls in your Rails project into a global JavaScript constant.}
13
- spec.homepage = "https://www.github.com/BrewhouseTeam/images"
14
- spec.license = "MIT"
6
+ Gem::Specification.new do |s|
7
+ s.name = "images"
8
+ s.version = Images::VERSION
9
+ s.authors = ["Gabe Scholz"]
10
+ s.email = ["gabe@brewhouse.io"]
11
+ s.summary = %q{Loads all image urls in your Rails project into a global JavaScript constant.}
12
+ s.description = %q{Loads all image urls in your Rails project into a global JavaScript constant.}
13
+ s.homepage = "https://www.github.com/BrewhouseTeam/images"
14
+ s.license = "MIT"
15
15
 
16
- spec.files = `git ls-files -z`.split("\x0")
17
- spec.test_files = spec.files.grep(%r{^(test)/})
18
- spec.require_paths = ["lib"]
16
+ s.files = `git ls-files -z`.split("\x0")
17
+ s.test_files = s.files.grep(%r{^(test)/})
18
+ s.require_paths = ["lib"]
19
19
 
20
- spec.add_development_dependency "bundler", "~> 1.6"
21
- spec.add_development_dependency "rake", "~> 10.0"
22
- spec.add_development_dependency "minitest", "~> 5.7.0"
23
- spec.add_dependency "rails", "~> 4"
24
- spec.add_dependency "actionview", "~> 4"
20
+ s.add_development_dependency "bundler", "~> 1.6"
21
+ s.add_development_dependency "rake", "~> 10.0"
22
+ s.add_development_dependency "minitest", "~> 5.7.0"
23
+ s.add_development_dependency "sqlite3"
24
+ s.add_development_dependency "capybara"
25
+ s.add_development_dependency "capybara-webkit"
26
+ s.add_development_dependency "selenium-webdriver"
27
+ s.add_development_dependency "launchy"
28
+ s.add_development_dependency "pry"
29
+
30
+ s.add_dependency "rails", "~> 4.2.3"
25
31
  end
@@ -1,4 +1,4 @@
1
- module Images
1
+ class Images
2
2
  class Builder
3
3
 
4
4
  def initialize(args)
@@ -6,9 +6,10 @@ module Images
6
6
  @helper = args.fetch(:helper)
7
7
  end
8
8
 
9
- def call
9
+ def call(options)
10
10
  images_paths
11
11
  .map { |path| get_short_path(path) }
12
+ .select { |path| options.whitelist.include?(path.extname.slice(1,10)) }
12
13
  .reduce({}) { |acc, path|
13
14
  split = split_path(path)
14
15
  asset = @helper.call(path)
data/lib/images/engine.rb CHANGED
@@ -1,6 +1,15 @@
1
1
  require "rails"
2
2
 
3
- module Images
3
+ class Images
4
4
  class Engine < ::Rails::Engine
5
+ config.images = ActiveSupport::OrderedOptions.new
6
+
7
+ # by default use the image mime types provided by Mime + svg
8
+ default_image_extnames =
9
+ Mime::EXTENSION_LOOKUP
10
+ .select { |ext, mime| mime.to_s.match("image/") }
11
+ .keys
12
+
13
+ config.images.whitelist = default_image_extnames + ["svg"]
5
14
  end
6
15
  end
@@ -0,0 +1,6 @@
1
+ class Images
2
+ OPTION_KEYS = [:whitelist]
3
+
4
+ class Options < Struct.new(*OPTION_KEYS)
5
+ end
6
+ end
@@ -1,6 +1,4 @@
1
- require "actionview"
2
-
3
- module Images
1
+ class Images
4
2
  class UrlHelper
5
3
  include ::ActionView::Helpers::AssetUrlHelper
6
4
 
@@ -1,3 +1,3 @@
1
- module Images
2
- VERSION = "0.0.1"
1
+ class Images
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/images.rb CHANGED
@@ -1,18 +1,23 @@
1
1
  require "images/version"
2
2
  require "images/engine"
3
- require "images/url_helper"
4
3
  require "images/builder"
4
+ require "images/url_helper"
5
+ require "images/options"
5
6
 
6
- module Images
7
+ class Images
7
8
 
8
- def load
9
+ def self.generate
9
10
  directory = ::Rails.root.join('app', 'assets', 'images')
10
11
  helper = Images::UrlHelper.new
11
12
 
13
+ options = Images::Options.new(
14
+ Rails.configuration.images.whitelist
15
+ )
16
+
12
17
  Images::Builder.new({
13
18
  directory: directory,
14
19
  helper: helper
15
- }).call
20
+ }).call(options)
16
21
  end
17
22
 
18
23
  end
data/test/builder_test.rb CHANGED
@@ -1,30 +1,30 @@
1
- require "minitest/autorun"
2
- require "pathname"
3
- require_relative "../lib/images/builder"
1
+ require "test_helper"
4
2
 
5
3
  class Images::BuilderTest < Minitest::Test
6
4
  def setup
7
- @directory = Pathname.new(Dir.pwd).join("test", "fixtures")
8
- @helper = ->(path) { "stub" }
5
+ directory = Pathname.new(Dir.pwd).join("test", "fixtures")
6
+ helper = ->(path) { "#{path}--stub" }
9
7
 
10
8
  @builder = Images::Builder.new({
11
- directory: @directory,
12
- helper: @helper
9
+ directory: directory,
10
+ helper: helper
13
11
  })
14
12
  end
15
13
 
16
14
  def test_builder
17
- result = @builder.call
15
+ options = OpenStruct.new({whitelist: ['jpg', 'bmp', 'svg']})
16
+ result = @builder.call(options)
17
+
18
18
  expected = {
19
19
  "nested" => {
20
- "Image3_bmp_path" => "stub",
21
- "Image4_bmp_path" => "stub",
20
+ "Image3_bmp_path" => "nested/Image3.bmp--stub",
21
+ "Image4_bmp_path" => "nested/Image4.bmp--stub",
22
22
  "deeply_nested" => {
23
- "Image5_svg_path" => "stub"
23
+ "Image5_svg_path" => "nested/deeply_nested/Image5.svg--stub"
24
24
  }
25
25
  },
26
- "image1_jpg_path" => "stub",
27
- "image2_svg_path" => "stub"
26
+ "image1_jpg_path" => "image1.jpg--stub",
27
+ "image2_svg_path" => "image2.svg--stub"
28
28
  }
29
29
 
30
30
  assert_equal(result, expected)
@@ -0,0 +1,28 @@
1
+ == README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
25
+
26
+
27
+ Please feel free to use a different markup language if you do not plan to run
28
+ <tt>rake doc:app</tt>.
@@ -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
+ Rails.application.load_tasks
File without changes
@@ -0,0 +1,14 @@
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 any plugin's vendor/assets/javascripts directory 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/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
14
+ //= require images
@@ -0,0 +1,15 @@
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 any plugin's vendor/assets/stylesheets directory 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 bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -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
File without changes
@@ -0,0 +1,4 @@
1
+ class WelcomeController < ApplicationController
2
+ def index
3
+ end
4
+ 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>
File without changes
@@ -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,29 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pathname'
3
+
4
+ # path to your application root.
5
+ APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
6
+
7
+ Dir.chdir APP_ROOT do
8
+ # This script is a starting point to setup your application.
9
+ # Add necessary setup steps to this file:
10
+
11
+ puts "== Installing dependencies =="
12
+ system "gem install bundler --conservative"
13
+ system "bundle check || bundle install"
14
+
15
+ # puts "\n== Copying sample files =="
16
+ # unless File.exist?("config/database.yml")
17
+ # system "cp config/database.yml.sample config/database.yml"
18
+ # end
19
+
20
+ puts "\n== Preparing database =="
21
+ system "bin/rake db:setup"
22
+
23
+ puts "\n== Removing old logs and tempfiles =="
24
+ system "rm -f log/*"
25
+ system "rm -rf tmp/cache"
26
+
27
+ puts "\n== Restarting application server =="
28
+ system "touch tmp/restart.txt"
29
+ end
@@ -0,0 +1,26 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ Bundler.require(*Rails.groups)
6
+ require "images"
7
+
8
+ module Dummy
9
+ class Application < Rails::Application
10
+ # Settings in config/environments/* take precedence over those specified here.
11
+ # Application configuration should go into files in config/initializers
12
+ # -- all .rb files in that directory are automatically loaded.
13
+
14
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
15
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
16
+ # config.time_zone = 'Central Time (US & Canada)'
17
+
18
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
19
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
20
+ # config.i18n.default_locale = :de
21
+
22
+ # Do not swallow errors in after_commit/after_rollback callbacks.
23
+ config.active_record.raise_in_transactional_callbacks = true
24
+ end
25
+ end
26
+
@@ -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.exist?(ENV['BUNDLE_GEMFILE'])
5
+ $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)