├── VERSION ├── public ├── favicon.ico ├── robots.txt ├── 500.html ├── 422.html └── 404.html ├── Procfile ├── .coveralls.yml ├── CHANGELOG.md ├── .slugignore ├── config ├── initializers │ ├── puma_auto_tune.rb │ ├── rack_timeout.rb │ ├── cookies_serializer.rb │ ├── session_store.rb │ ├── mime_types.rb │ ├── bullet.rb │ ├── filter_parameter_logging.rb │ ├── backtrace_silencers.rb │ ├── assets.rb │ ├── wrap_parameters.rb │ └── inflections.rb ├── boot.rb ├── environment.rb ├── puma.rb ├── locales │ └── en.yml ├── i18n-js.yml ├── secrets.yml ├── application.rb ├── environments │ ├── development.rb │ ├── test.rb │ └── production.rb ├── routes.rb ├── database.yml └── newrelic.yml ├── bin ├── rake ├── bundle ├── rails ├── spring └── setup ├── app ├── assets │ ├── images │ │ └── apple-touch-icon-precomposed.png │ ├── javascripts │ │ ├── turbolinks-progress-bar.coffee │ │ ├── twbs.coffee │ │ ├── application.coffee.erb │ │ └── i18n │ │ │ └── translations.js │ └── stylesheets │ │ ├── maze.scss │ │ ├── twbs-variables.scss │ │ ├── turbolinks-progress-bar.scss │ │ ├── twbs.scss │ │ └── application.css ├── controllers │ ├── welcome_controller.rb │ └── application_controller.rb ├── views │ ├── shared │ │ ├── _footer.html.slim │ │ └── _navbar.html.slim │ ├── welcome │ │ └── index.html.slim │ └── layouts │ │ └── application.html.slim ├── helpers │ └── application_helper.rb └── models │ └── maze.rb ├── .travis.yml ├── config.ru ├── .rubocop.yml ├── spec ├── features │ └── welcome_spec.rb ├── support │ ├── mailer_macros.rb │ └── database_cleaner.rb ├── spec_helper.rb └── models │ └── maze_spec.rb ├── db ├── seeds.rb └── schema.rb ├── Rakefile ├── app.json ├── .gitignore ├── README.md ├── Gemfile ├── LICENSE └── Gemfile.lock /VERSION: -------------------------------------------------------------------------------- 1 | 13.7.2 2 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: bundle exec puma -C config/puma.rb 2 | -------------------------------------------------------------------------------- /.coveralls.yml: -------------------------------------------------------------------------------- 1 | repo_token: nXAHlJbFjmzCRrHmcf4Mp3yZyNdTsAGBO 2 | 3 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## 0.0.1 4 | 5 | * Initial version 6 | -------------------------------------------------------------------------------- /.slugignore: -------------------------------------------------------------------------------- 1 | spec 2 | CHANGELOG.md 3 | LICENSE 4 | README.md 5 | VERSION 6 | -------------------------------------------------------------------------------- /config/initializers/puma_auto_tune.rb: -------------------------------------------------------------------------------- 1 | PumaAutoTune.start if defined?(PumaAutoTune) 2 | -------------------------------------------------------------------------------- /config/initializers/rack_timeout.rb: -------------------------------------------------------------------------------- 1 | Rack::Timeout.timeout = 20.seconds if defined?(Rack::Timeout) 2 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require_relative '../config/boot' 3 | require 'rake' 4 | Rake.application.run 5 | -------------------------------------------------------------------------------- /app/assets/images/apple-touch-icon-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diowa/amazed/HEAD/app/assets/images/apple-touch-icon-precomposed.png -------------------------------------------------------------------------------- /app/assets/javascripts/turbolinks-progress-bar.coffee: -------------------------------------------------------------------------------- 1 | # TODO: Remove with Turbolinks 3 2 | Turbolinks.enableProgressBar() if window.Turbolinks 3 | -------------------------------------------------------------------------------- /app/assets/stylesheets/maze.scss: -------------------------------------------------------------------------------- 1 | @import "twbs-variables"; 2 | 3 | td.maze-cell { 4 | border: 3px solid black; 5 | padding: 10px; 6 | } 7 | -------------------------------------------------------------------------------- /bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 2 | 3 | require 'bundler/setup' # Set up gems listed in the Gemfile. 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: ruby 2 | sudo: false 3 | rvm: 4 | - 2.2.3 5 | before_install: 6 | - "export DISPLAY=:99.0" 7 | - "sh -e /etc/init.d/xvfb start" 8 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | APP_PATH = File.expand_path('../../config/application', __FILE__) 3 | require_relative '../config/boot' 4 | require 'rails/commands' 5 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 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 5 | -------------------------------------------------------------------------------- /app/controllers/welcome_controller.rb: -------------------------------------------------------------------------------- 1 | class WelcomeController < ApplicationController 2 | def index 3 | @maze = Maze.new 4 | @maze.construct_and_solve 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.action_dispatch.cookies_serializer = :json 4 | -------------------------------------------------------------------------------- /config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.session_store :cookie_store, key: '_amazed_session' 4 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require File.expand_path('../application', __FILE__) 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /app/views/shared/_footer.html.slim: -------------------------------------------------------------------------------- 1 | footer 2 | .container 3 | hr 4 | p 5 | = link_to 'https://github.com/diowa/amazed' do 6 | span.fa.fa-github> 7 | | diowa/amazed 8 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | -------------------------------------------------------------------------------- /config/initializers/bullet.rb: -------------------------------------------------------------------------------- 1 | if defined? Bullet 2 | # Bullet.enable = true 3 | # Bullet.alert = true 4 | # Bullet.bullet_logger = true 5 | # Bullet.console = true 6 | # Bullet.rails_logger = true 7 | end 8 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file 2 | # 3 | # To ban all spiders from the entire site uncomment the next two lines: 4 | # User-agent: * 5 | # Disallow: / 6 | -------------------------------------------------------------------------------- /app/assets/stylesheets/twbs-variables.scss: -------------------------------------------------------------------------------- 1 | /* Override Bootstrap variables here 2 | * Example: $brand-primary: navy; 3 | */ 4 | 5 | $brand-primary: #955251; 6 | 7 | /* Do not edit below this line */ 8 | @import "twbs/bootstrap/variables"; 9 | -------------------------------------------------------------------------------- /config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure sensitive parameters which will be filtered from the log file. 4 | Rails.application.config.filter_parameters += [:password] 5 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 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 6 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | AllCops: 2 | Exclude: 3 | - 'bin/*' 4 | - 'db/**/*' 5 | - 'spec/**/*' 6 | - 'vendor/bundle/**/*' 7 | RunRailsCops: true 8 | 9 | Metrics/LineLength: 10 | Enabled: false 11 | 12 | Style/Documentation: 13 | Enabled: false 14 | -------------------------------------------------------------------------------- /app/assets/stylesheets/turbolinks-progress-bar.scss: -------------------------------------------------------------------------------- 1 | @import "twbs-variables"; 2 | @import "twbs/bootstrap/mixins"; 3 | 4 | html.turbolinks-progress-bar::before { 5 | background-color: $progress-bar-bg !important; 6 | z-index: $zindex-navbar-fixed + 1 !important; 7 | } 8 | -------------------------------------------------------------------------------- /app/assets/javascripts/twbs.coffee: -------------------------------------------------------------------------------- 1 | jQuery -> 2 | # For performance reasons, the Tooltip and Popover data-apis are opt in. 3 | # Uncomment the following line to enable tooltips 4 | # $("[data-toggle='tooltip']").tooltip() 5 | 6 | # Uncomment the following line to enable popovers 7 | # $("[data-toggle='popover']").popover() 8 | -------------------------------------------------------------------------------- /spec/features/welcome_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'Welcome' do 4 | context 'Index' do 5 | it "has title and a maze with 100 cells" do 6 | visit root_path 7 | 8 | expect(page).to have_title I18n.t('hello') 9 | expect(page).to have_css 'td', count: 100 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should contain all the record creation needed to seed the database with its default values. 2 | # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). 3 | # 4 | # Examples: 5 | # 6 | # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) 7 | # Mayor.create(name: 'Emanuel', city: cities.first) 8 | -------------------------------------------------------------------------------- /spec/support/mailer_macros.rb: -------------------------------------------------------------------------------- 1 | module MailerMacros 2 | def last_email 3 | ActionMailer::Base.deliveries.last 4 | end 5 | 6 | def reset_emails 7 | ActionMailer::Base.deliveries = [] 8 | end 9 | end 10 | 11 | RSpec.configure do |config| 12 | config.include MailerMacros 13 | 14 | config.before(:each) do 15 | reset_emails 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /spec/support/database_cleaner.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | RSpec.configure do |config| 3 | config.before(:suite) do 4 | DatabaseCleaner.clean_with :truncation 5 | end 6 | 7 | config.around(:each) do |example| 8 | DatabaseCleaner.strategy = example.metadata[:js] ? :truncation : :transaction 9 | DatabaseCleaner.start 10 | 11 | example.run 12 | 13 | DatabaseCleaner.clean 14 | end 15 | end 16 | =end 17 | -------------------------------------------------------------------------------- /config/puma.rb: -------------------------------------------------------------------------------- 1 | workers Integer(ENV['PUMA_WORKERS'] || 3) 2 | threads Integer(ENV['MIN_THREADS'] || 0), Integer(ENV['MAX_THREADS'] || 16) 3 | 4 | preload_app! 5 | 6 | rackup DefaultRackup 7 | port ENV['PORT'] || 3000 8 | environment ENV['RACK_ENV'] || 'development' 9 | 10 | on_worker_boot do 11 | # worker specific setup 12 | # ActiveSupport.on_load(:active_record) do 13 | # ActiveRecord::Base.establish_connection 14 | # end 15 | end 16 | -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /app/views/shared/_navbar.html.slim: -------------------------------------------------------------------------------- 1 | nav.navbar.navbar-default 2 | .container 3 | .navbar-header 4 | button.navbar-toggle.collapsed type='button' data-toggle='collapse' data-target='.navbar-collapse' 5 | span.sr-only= t('.toggle_navigation') 6 | span.icon-bar 7 | span.icon-bar 8 | span.icon-bar 9 | = link_to Rails.application.class.parent_name, root_path, class: 'navbar-brand' 10 | .collapse.navbar-collapse 11 | ul.nav.navbar-nav 12 | -------------------------------------------------------------------------------- /config/initializers/assets.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Version of your assets, change this if you want to expire all your assets. 4 | Rails.application.config.assets.version = '1.0' 5 | 6 | # Add additional assets to the asset load path 7 | # Rails.application.config.assets.paths << Emoji.images_path 8 | 9 | # Precompile additional assets. 10 | # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. 11 | # Rails.application.config.assets.precompile += %w( search.js ) 12 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 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 | begin 7 | require 'rubocop/rake_task' 8 | RuboCop::RakeTask.new 9 | rescue LoadError 10 | desc 'Run RuboCop' 11 | task :rubocop do 12 | $stderr.puts 'Rubocop is disabled' 13 | end 14 | end 15 | 16 | task test: :spec 17 | 18 | task default: [:rubocop, :spec] 19 | 20 | Rails.application.load_tasks 21 | -------------------------------------------------------------------------------- /bin/spring: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | # This file loads spring without using Bundler, in order to be fast 4 | # It gets overwritten when you run the `spring binstub` command 5 | 6 | unless defined?(Spring) 7 | require "rubygems" 8 | require "bundler" 9 | 10 | if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ spring \((.*?)\)$.*?^$/m) 11 | ENV["GEM_PATH"] = ([Bundler.bundle_path.to_s] + Gem.path).join(File::PATH_SEPARATOR) 12 | ENV["GEM_HOME"] = "" 13 | Gem.paths = ENV 14 | 15 | gem "spring", match[1] 16 | require "spring/binstub" 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /app/assets/stylesheets/twbs.scss: -------------------------------------------------------------------------------- 1 | /* Use twbs-variables to define new variables and override Bootstrap defaults. 2 | * Import "twbs-variables" instead of "twbs/bootstrap/variables" 3 | * in each new stylesheet. 4 | */ 5 | @import "twbs-variables"; 6 | 7 | /* Start editing below this line */ 8 | @import "twbs/bootstrap"; 9 | 10 | /* Bootstrap Theme */ 11 | //@import "twbs/bootstrap/theme"; 12 | 13 | /* Glyphs */ 14 | //@import "twbs/bootstrap/glyphicons"; 15 | @import "fontawesome/font-awesome"; 16 | 17 | /* Standard Rails form errors */ 18 | .field_with_errors { 19 | @extend .has-error; 20 | } 21 | -------------------------------------------------------------------------------- /config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] if respond_to?(:wrap_parameters) 9 | end 10 | 11 | # To enable root element in JSON for ActiveRecord objects. 12 | # ActiveSupport.on_load(:active_record) do 13 | # self.include_root_in_json = true 14 | # end 15 | -------------------------------------------------------------------------------- /config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format. Inflections 4 | # are locale specific, and you may define rules for as many different 5 | # locales as you wish. All of these examples are active by default: 6 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 7 | # inflect.plural /^(ox)$/i, '\1en' 8 | # inflect.singular /^(ox)en/i, '\1' 9 | # inflect.irregular 'person', 'people' 10 | # inflect.uncountable %w( fish sheep ) 11 | # end 12 | 13 | # These inflection rules are supported but not enabled by default: 14 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 15 | # inflect.acronym 'RESTful' 16 | # end 17 | -------------------------------------------------------------------------------- /app/assets/stylesheets/application.css: -------------------------------------------------------------------------------- 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 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_self 14 | *= stub twbs-variables 15 | *= require twbs 16 | *= require_tree . 17 | */ 18 | -------------------------------------------------------------------------------- /config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Files in the config/locales directory are used for internationalization 2 | # and are automatically loaded by Rails. If you want to use locales other 3 | # than English, add the necessary files in this directory. 4 | # 5 | # To use the locales, use `I18n.t`: 6 | # 7 | # I18n.t 'hello' 8 | # 9 | # In views, this is aliased to just `t`: 10 | # 11 | # <%= t('hello') %> 12 | # 13 | # To use a different locale, set it with `I18n.locale`: 14 | # 15 | # I18n.locale = :es 16 | # 17 | # This would use the information in config/locales/es.yml. 18 | # 19 | # To learn more, please read the Rails Internationalization guide 20 | # available at http://guides.rubyonrails.org/i18n.html. 21 | 22 | en: 23 | hello: "Amazed" 24 | shared: 25 | navbar: 26 | toggle_navigation: Toggle Navigation 27 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | def title(page_title) 3 | content_for(:title) { page_title.to_s } 4 | end 5 | 6 | def yield_or_default(section, default = '') 7 | content_for?(section) ? content_for(section) : default 8 | end 9 | 10 | def style_for_cell(cell_position) 11 | style = [] 12 | @maze.carving_steps.each do |step| 13 | style << "border-#{border_from(step[2])}: 0;" if [step[0], step[1]] == cell_position 14 | end 15 | @maze.solution_steps.each do |step| 16 | style << 'background: #7AF7A1;' if step == cell_position 17 | end 18 | style.join 19 | end 20 | 21 | def border_from(direction) 22 | case direction 23 | when :U then 'top' 24 | when :D then 'bottom' 25 | when :L then 'left' 26 | when :R then 'right' 27 | end 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /db/schema.rb: -------------------------------------------------------------------------------- 1 | # encoding: UTF-8 2 | # This file is auto-generated from the current state of the database. Instead 3 | # of editing this file, please use the migrations feature of Active Record to 4 | # incrementally modify your database, and then regenerate this schema definition. 5 | # 6 | # Note that this schema.rb definition is the authoritative source for your 7 | # database schema. If you need to create the application database on another 8 | # system, you should be using db:schema:load, not running all the migrations 9 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations 10 | # you'll amass, the slower it'll run and the greater likelihood for issues). 11 | # 12 | # It's strongly recommended that you check this file into your version control system. 13 | 14 | ActiveRecord::Schema.define(version: 0) do 15 | 16 | end 17 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 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 30 | -------------------------------------------------------------------------------- /config/i18n-js.yml: -------------------------------------------------------------------------------- 1 | # Split context in several files. 2 | # By default only one file with all translations is exported and 3 | # no configuration is required. Your settings for asset pipeline 4 | # are automatically recognized. 5 | # 6 | # If you want to split translations into several files or specify 7 | # locale contexts that will be exported, just use this file to do 8 | # so. 9 | # 10 | # If you're going to use the Rails 3.1 asset pipeline, change 11 | # the following configuration to something like this: 12 | # 13 | # translations: 14 | # - file: "app/assets/javascripts/i18n/translations.js" 15 | # 16 | # If you're running an old version, you can use something 17 | # like this: 18 | # 19 | # translations: 20 | # - file: "public/javascripts/translations.js" 21 | # only: "*" 22 | # 23 | 24 | translations: 25 | - file: 'app/assets/javascripts/i18n/translations.js' 26 | only: ['*.date', '*.time', '*.datetime'] 27 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Amazed", 3 | "description": "Application to create and solve a perfect maze", 4 | "keywords": [ 5 | "Maze", 6 | "Ruby 2", 7 | "Rails 4", 8 | "Bootstrap", 9 | "Font Awesome", 10 | "Nitrous.IO" 11 | ], 12 | "website": "http://amazed.herokuapp.com/", 13 | "repository": "https://github.com/diowa/amazed", 14 | "success_url": "/", 15 | "env": { 16 | "NEW_RELIC_APP_NAME": { 17 | "description": "Sets the name of your application as it will appear on the New Relic dashboard.", 18 | "value": "Amazed App" 19 | }, 20 | "RAILS_ENV": "production", 21 | "RAILS_SERVE_STATIC_FILES": "enabled", 22 | "RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR": { 23 | "description": "Reduces RGenGC's memory consumption", 24 | "value": "1.3" 25 | }, 26 | "SECRET_KEY_BASE": { 27 | "description": "This gets generated", 28 | "generator": "secret" 29 | } 30 | }, 31 | "addons": [ 32 | "papertrail", 33 | "newrelic" 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /config/secrets.yml: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Your secret key is used for verifying the integrity of signed cookies. 4 | # If you change this key, all old signed cookies will become invalid! 5 | 6 | # Make sure the secret is at least 30 characters and all random, 7 | # no regular words or you'll be exposed to dictionary attacks. 8 | # You can use `rake secret` to generate a secure secret key. 9 | 10 | # Make sure the secrets in this file are kept private 11 | # if you're sharing your code publicly. 12 | 13 | development: 14 | secret_key_base: 5d4338b7c5670da523290f759352904fb2791e2e3fac31daebf541376d090d455f319888ccb48d5b26d2f287b423fc626f72c5392842134d9dd2f6ccbac9bb90 15 | 16 | test: 17 | secret_key_base: 334452fcb32cd42a8e301e6c846618cbbbf4292384ad44268bec4d28ebdd69ebb67fd68b7de057fb8ce91d7baa1318e88470b6fcd59badc9414e75b294a90324 18 | 19 | # Do not keep production secrets in the repository, 20 | # instead read values from the environment. 21 | production: 22 | secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> 23 | -------------------------------------------------------------------------------- /app/assets/javascripts/application.coffee.erb: -------------------------------------------------------------------------------- 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 jquery 14 | #= require jquery_ujs 15 | #= require jquery.turbolinks 16 | #= require turbolinks 17 | 18 | # BOOTSTRAP 19 | #= require twbs/bootstrap 20 | 21 | # I18n 22 | #= require i18n 23 | #= require i18n/translations 24 | 25 | # ALL THE REST 26 | #= require_tree . 27 | 28 | I18n.defaultLocale = '<%= I18n.default_locale.to_s %>' 29 | I18n.locale = document.getElementsByTagName('html')[0].getAttribute('lang') 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Linux.gitignore 2 | .* 3 | !.coveralls.yml 4 | !.gitignore 5 | !.rspec 6 | !.rubocop.yml 7 | !.slugignore 8 | !.travis.yml 9 | *~ 10 | 11 | 12 | 13 | # OSX.gitignore 14 | .DS_Store 15 | .AppleDouble 16 | .LSOverride 17 | Icon 18 | 19 | 20 | # Thumbnails 21 | ._* 22 | 23 | # Files that might appear on external disk 24 | .Spotlight-V100 25 | .Trashes 26 | 27 | 28 | 29 | # Rails.gitignore 30 | *.rbc 31 | *.sassc 32 | .sass-cache 33 | capybara-*.html 34 | .rvmrc 35 | /.bundle 36 | /vendor/bundle 37 | /log/* 38 | /tmp/* 39 | /db/*.sqlite3 40 | /public/system/* 41 | /coverage/ 42 | /spec/tmp/* 43 | **.orig 44 | rerun.txt 45 | pickle-email-*.html 46 | .project 47 | 48 | 49 | 50 | # Ignore Redis' dataset snapshot 51 | dump.rdb 52 | 53 | # Ignore chrome driver log 54 | chromedriver.log 55 | 56 | # Ignore rails_best_practices report 57 | rails_best_practices_output.html 58 | 59 | # Ignore brakeman report 60 | brakeman.html 61 | 62 | # Ignore file uploads 63 | /public/uploads 64 | 65 | # Ignore precompiled assets and source maps 66 | /public/assets 67 | 68 | # Ignore sensitive data 69 | /config/settings/local.rb 70 | -------------------------------------------------------------------------------- /app/views/welcome/index.html.slim: -------------------------------------------------------------------------------- 1 | - title t('hello') 2 | 3 | .container 4 | .row 5 | .col-sm-8.col-sm-offset-2 6 | h1.text-center 7 | | Amazed 8 | p 9 | | Amazed is an application that creates and solves perfect mazes using the recursive backtracker algorithm. 10 | p 11 | | Amazed has been developed using the following technology stack: 12 | ul 13 | li Ruby 2.2.3 14 | li Rails 4.2.5 15 | li RSpec 4 16 | li Twitter Bootstrap for Sass 3.3.6 17 | li Autoprefixer 18 | li Font Awesome 4.5.0 19 | li SLIM 20 | li RuboCop 21 | p 22 | | Source code available at: 23 | = " " 24 | = link_to "github.com/diowa/amazed", "https://github.com/diowa/amazed" 25 | 26 | h3 Update the page to see different mazes. 27 | 28 | .row 29 | .col-sm-6.col-sm-offset-3 30 | table.table-responsive 31 | - @maze.height.times do |y| 32 | tr 33 | - @maze.width.times do |x| 34 | td.maze-cell style=style_for_cell([x, y]) 35 | .small= "#{x},#{y}" 36 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.slim: -------------------------------------------------------------------------------- 1 | doctype html 2 | html lang=I18n.locale.to_s 3 | head 4 | title= yield_or_default :title, action_name.titlecase 5 | meta charset='utf-8' 6 | meta name='viewport' content='width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0' 7 | meta content='IE=edge' http-equiv='X-UA-Compatible' 8 | = csrf_meta_tags 9 | = yield :head 10 | 11 | = stylesheet_link_tag 'application', media: 'all', data: { turbolinks_track: true } 12 | 13 | /! Favicons 14 | link href=asset_path('apple-touch-icon-precomposed.png') rel='apple-touch-icon-precomposed' sizes='144x144' 15 | 16 | /! Turbolinks require javascript tags inside the head 17 | = javascript_include_tag 'application', data: { turbolinks_track: true } 18 | 19 | /! HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries 20 | /[if lt IE 9] 21 | = javascript_include_tag '//oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js', 'respond.js' 22 | 23 | body 24 | == render 'shared/navbar' 25 | 26 | #main-container.container= yield 27 | 28 | == render 'shared/footer' 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Amazed 2 | [![Build Status](https://travis-ci.org/diowa/amazed.svg?branch=master)](https://travis-ci.org/diowa/amazed) [![Dependency Status](https://gemnasium.com/diowa/amazed.svg)](https://gemnasium.com/diowa/amazed) [![Code Climate](https://codeclimate.com/github/diowa/amazed/badges/gpa.svg)](https://codeclimate.com/github/diowa/amazed) [![Coverage Status](https://coveralls.io/repos/diowa/amazed/badge.svg?branch=master)](https://coveralls.io/r/diowa/amazed?branch=master) 3 | 4 | [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy) 5 | 6 | 7 | Application to create and solve perfect mazes based on the following technology stack: 8 | 9 | * [Ruby 2.2.3][1] 10 | * [Rails 4.2.5][2] 11 | * [Puma][3] 12 | * [RSpec][4] 13 | * [Twitter Bootstrap for Sass 3.3.6][5] 14 | * [Autoprefixer][6] 15 | * [Font Awesome 4.5.0][7] 16 | * [SLIM][8] 17 | * [RuboCop][9] 18 | 19 | [1]: http://www.ruby-lang.org/en/ 20 | [2]: http://rubyonrails.org/ 21 | [3]: http://puma.io/ 22 | [4]: http://rspec.info/ 23 | [5]: http://getbootstrap.com/ 24 | [6]: http://github.com/ai/autoprefixer/ 25 | [7]: http://fontawesome.io/ 26 | [8]: http://slim-lang.com/ 27 | [9]: http://github.com/bbatsov/rubocop 28 | 29 | Amazed is deployable on [Heroku](http://www.heroku.com/). Demo: http://diowa-amazed.herokuapp.com/ 30 | -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../boot', __FILE__) 2 | 3 | require 'action_controller/railtie' 4 | require 'action_mailer/railtie' 5 | require 'sprockets/railtie' 6 | require 'rails/test_unit/railtie' 7 | 8 | # Require the gems listed in Gemfile, including any gems 9 | # you've limited to :test, :development, or :production. 10 | Bundler.require(*Rails.groups) 11 | 12 | module Amazed 13 | class Application < Rails::Application 14 | # Settings in config/environments/* take precedence over those specified here. 15 | # Application configuration should go into files in config/initializers 16 | # -- all .rb files in that directory are automatically loaded. 17 | 18 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. 19 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. 20 | # config.time_zone = 'Central Time (US & Canada)' 21 | 22 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. 23 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] 24 | # config.i18n.default_locale = :de 25 | 26 | # Do not swallow errors in after_commit/after_rollback callbacks. 27 | # config.active_record.raise_in_transactional_callbacks = true 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | if ENV['CI'] 2 | require 'coveralls' 3 | Coveralls.wear! 'rails' 4 | end 5 | 6 | require 'simplecov' 7 | SimpleCov.start 'rails' 8 | 9 | # This file is copied to spec/ when you run 'rails generate rspec:install' 10 | ENV['RAILS_ENV'] ||= 'test' 11 | require File.expand_path('../../config/environment', __FILE__) 12 | require 'rspec/rails' 13 | 14 | # Requires supporting ruby files with custom matchers and macros, etc, 15 | # in spec/support/ and its subdirectories. 16 | Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f } 17 | 18 | require 'webmock/rspec' 19 | require 'capybara/rspec' 20 | 21 | # Capybara.ignore_hidden_elements = false # testing hidden fields 22 | 23 | RSpec.configure do |config| 24 | # == Mock Framework 25 | # 26 | # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: 27 | # 28 | # config.mock_with :mocha 29 | # config.mock_with :flexmock 30 | # config.mock_with :rr 31 | # config.mock_with :rspec 32 | 33 | # Run specs in random order to surface order dependencies. If you find an 34 | # order dependency and want to debug it, you can fix the order by providing 35 | # the seed, which is printed after each run. 36 | # --seed 1234 37 | config.order = 'random' 38 | 39 | config.infer_spec_type_from_file_location! 40 | config.color = true 41 | config.formatter = :documentation 42 | end 43 | -------------------------------------------------------------------------------- /app/assets/javascripts/i18n/translations.js: -------------------------------------------------------------------------------- 1 | var I18n = I18n || {}; 2 | I18n.translations = {"en":{"date":{"formats":{"default":"%Y-%m-%d","short":"%b %d","long":"%B %d, %Y"},"day_names":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"abbr_day_names":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"month_names":[null,"January","February","March","April","May","June","July","August","September","October","November","December"],"abbr_month_names":[null,"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],"order":["year","month","day"]},"time":{"formats":{"default":"%a, %d %b %Y %H:%M:%S %z","short":"%d %b %H:%M","long":"%B %d, %Y %H:%M"},"am":"am","pm":"pm"},"datetime":{"distance_in_words":{"half_a_minute":"half a minute","less_than_x_seconds":{"one":"less than 1 second","other":"less than %{count} seconds"},"x_seconds":{"one":"1 second","other":"%{count} seconds"},"less_than_x_minutes":{"one":"less than a minute","other":"less than %{count} minutes"},"x_minutes":{"one":"1 minute","other":"%{count} minutes"},"about_x_hours":{"one":"about 1 hour","other":"about %{count} hours"},"x_days":{"one":"1 day","other":"%{count} days"},"about_x_months":{"one":"about 1 month","other":"about %{count} months"},"x_months":{"one":"1 month","other":"%{count} months"},"about_x_years":{"one":"about 1 year","other":"about %{count} years"},"over_x_years":{"one":"over 1 year","other":"over %{count} years"},"almost_x_years":{"one":"almost 1 year","other":"almost %{count} years"}},"prompts":{"year":"Year","month":"Month","day":"Day","hour":"Hour","minute":"Minute","second":"Seconds"}}}}; -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | ruby '2.2.3' 4 | gem 'rails', '4.2.5' 5 | 6 | # Servers 7 | gem 'puma' 8 | 9 | # Multi-environment configuration 10 | # gem 'figaro' 11 | 12 | # API 13 | # gem 'rabl' 14 | 15 | # ORM 16 | # gem 'pg' 17 | 18 | # Pagination 19 | # gem 'kaminari' 20 | 21 | # App monitoring 22 | # gem 'airbrake' 23 | gem 'newrelic_rpm' 24 | 25 | # Security 26 | # gem 'secure_headers' 27 | 28 | # Miscellanea 29 | # gem 'google-analytics-rails' 30 | # gem 'http_accept_language' 31 | # gem 'resque', require: 'resque/server' # Resque web interface 32 | gem 'slim-rails' 33 | 34 | # Assets 35 | gem 'autoprefixer-rails' 36 | gem 'coffee-rails', '~> 4.1.0' 37 | gem 'i18n-js' 38 | gem 'jquery-rails' 39 | gem 'jquery-turbolinks' 40 | gem 'sass-rails', '~> 5.0' 41 | gem 'slim_assets' 42 | gem 'turbolinks' 43 | gem 'twbs_sass_rails' 44 | gem 'uglifier', '>= 1.3.0' 45 | 46 | group :development, :test do 47 | gem 'byebug' 48 | gem 'factory_girl_rails' 49 | gem 'faker' 50 | gem 'pry' 51 | gem 'pry-byebug' 52 | gem 'pry-rails' 53 | gem 'rspec-rails' 54 | gem 'web-console' 55 | end 56 | 57 | group :development do 58 | gem 'better_errors' 59 | gem 'binding_of_caller' 60 | gem 'bullet' 61 | gem 'meta_request' 62 | gem 'quiet_assets' 63 | gem 'spring' 64 | gem 'spring-commands-rspec' 65 | end 66 | 67 | group :test do 68 | gem 'capybara' 69 | gem 'coveralls', require: false 70 | gem 'database_cleaner' 71 | gem 'email_spec' 72 | gem 'rspec' 73 | gem 'rubocop', require: false 74 | gem 'selenium-webdriver' 75 | gem 'simplecov', require: false 76 | gem 'webmock', require: false 77 | end 78 | 79 | group :staging, :production do 80 | # gem 'puma_auto_tune' 81 | gem 'rack-timeout' 82 | gem 'rails_12factor' 83 | end 84 | -------------------------------------------------------------------------------- /public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

We're sorry, but something went wrong.

62 |
63 |

If you are the application owner check the logs for more information.

64 |
65 | 66 | 67 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | Rails.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 | 30 | # Asset digests allow you to set far-future HTTP expiration dates on all assets, 31 | # yet still be able to expire them through the digest params. 32 | config.assets.digest = true 33 | 34 | # Adds additional error checking when serving assets at runtime. 35 | # Checks for improperly declared sprockets dependencies. 36 | # Raises helpful error messages. 37 | config.assets.raise_runtime_errors = true 38 | 39 | # Raises error for missing translations 40 | # config.action_view.raise_on_missing_translations = true 41 | end 42 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails.application.routes.draw do 2 | # The priority is based upon order of creation: first created -> highest priority. 3 | # See how all your routes lay out with "rake routes". 4 | 5 | # You can have the root of your site routed with "root" 6 | root 'welcome#index' 7 | 8 | # Example of regular route: 9 | # get 'products/:id' => 'catalog#view' 10 | 11 | # Example of named route that can be invoked with purchase_url(id: product.id) 12 | # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase 13 | 14 | # Example resource route (maps HTTP verbs to controller actions automatically): 15 | # resources :products 16 | 17 | # Example resource route with options: 18 | # resources :products do 19 | # member do 20 | # get 'short' 21 | # post 'toggle' 22 | # end 23 | # 24 | # collection do 25 | # get 'sold' 26 | # end 27 | # end 28 | 29 | # Example resource route with sub-resources: 30 | # resources :products do 31 | # resources :comments, :sales 32 | # resource :seller 33 | # end 34 | 35 | # Example resource route with more complex sub-resources: 36 | # resources :products do 37 | # resources :comments 38 | # resources :sales do 39 | # get 'recent', on: :collection 40 | # end 41 | # end 42 | 43 | # Example resource route with concerns: 44 | # concern :toggleable do 45 | # post 'toggle' 46 | # end 47 | # resources :posts, concerns: :toggleable 48 | # resources :photos, concerns: :toggleable 49 | 50 | # Example resource route within a namespace: 51 | # namespace :admin do 52 | # # Directs /admin/products/* to Admin::ProductsController 53 | # # (app/controllers/admin/products_controller.rb) 54 | # resources :products 55 | # end 56 | end 57 | -------------------------------------------------------------------------------- /public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The change you wanted was rejected.

62 |

Maybe you tried to change something you didn't have access to.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The page you were looking for doesn't exist.

62 |

You may have mistyped the address or the page may have moved.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # The test environment is used exclusively to run your application's 5 | # test suite. You never need to work with it otherwise. Remember that 6 | # your test database is "scratch space" for the test suite and is wiped 7 | # and recreated between test runs. Don't rely on the data there! 8 | config.cache_classes = true 9 | 10 | # Do not eager load code on boot. This avoids loading your whole application 11 | # just for the purpose of running a single test. If you are using a tool that 12 | # preloads Rails for running tests, you may have to set it to true. 13 | config.eager_load = false 14 | 15 | # Configure static file server for tests with Cache-Control for performance. 16 | config.serve_static_files = true 17 | config.static_cache_control = 'public, max-age=3600' 18 | 19 | # Show full error reports and disable caching. 20 | config.consider_all_requests_local = true 21 | config.action_controller.perform_caching = false 22 | 23 | # Raise exceptions instead of rendering exception templates. 24 | config.action_dispatch.show_exceptions = false 25 | 26 | # Disable request forgery protection in test environment. 27 | config.action_controller.allow_forgery_protection = false 28 | 29 | # Tell Action Mailer not to deliver emails to the real world. 30 | # The :test delivery method accumulates sent emails in the 31 | # ActionMailer::Base.deliveries array. 32 | config.action_mailer.delivery_method = :test 33 | config.action_mailer.default_url_options = { host: 'localhost' } 34 | 35 | # Randomize the order test cases are executed. 36 | config.active_support.test_order = :random 37 | 38 | # Print deprecation notices to the stderr. 39 | config.active_support.deprecation = :stderr 40 | 41 | # Raises error for missing translations 42 | # config.action_view.raise_on_missing_translations = true 43 | end 44 | -------------------------------------------------------------------------------- /app/models/maze.rb: -------------------------------------------------------------------------------- 1 | class Maze 2 | DIRECTIONS = [:U, :D, :R, :L] 3 | OPPOSITE = { U: :D, D: :U, R: :L, L: :R } 4 | 5 | attr_reader :carving_steps, :solution_steps, :width, :height, :initial_x, :initial_y, :final_x, :final_y 6 | 7 | def initialize(width = 10, height = 10) 8 | @width = width 9 | @height = height 10 | @grid = Array.new(height) { Array.new(width, false) } 11 | end 12 | 13 | def construct_and_solve(initial_x = 0, initial_y = 0, final_x = 9, final_y = 9) 14 | return false unless point_inside_grid?(initial_x, initial_y) && point_inside_grid?(final_x, final_y) 15 | @initial_x = initial_x 16 | @initial_y = initial_y 17 | @final_x = final_x 18 | @final_y = final_y 19 | @carving_steps = [] 20 | mark_point_visited initial_x, initial_y 21 | @solution_steps = [[initial_x, initial_y]] 22 | carve_passages_from initial_x, initial_y 23 | @solution_found 24 | end 25 | 26 | private 27 | 28 | def carve_passages_from(current_x, current_y) 29 | DIRECTIONS.shuffle.each do |direction| 30 | next_x, next_y = next_position(current_x, current_y, direction) 31 | next unless point_inside_grid?(next_x, next_y) && point_not_visited?(next_x, next_y) 32 | mark_point_visited next_x, next_y 33 | @carving_steps.push [current_x, current_y, direction], [next_x, next_y, OPPOSITE[direction]] 34 | @solution_steps.push [next_x, next_y] unless @solution_found 35 | @solution_found = true if ending_point?(next_x, next_y) 36 | carve_passages_from next_x, next_y 37 | @solution_steps.pop unless @solution_found 38 | end 39 | end 40 | 41 | def point_inside_grid?(x, y) 42 | y.between?(0, height - 1) && x.between?(0, width - 1) 43 | end 44 | 45 | def point_not_visited?(x, y) 46 | @grid[y][x] == false 47 | end 48 | 49 | def mark_point_visited(x, y) 50 | @grid[y][x] = true 51 | end 52 | 53 | def ending_point?(x, y) 54 | x == @final_x && y == @final_y 55 | end 56 | 57 | def next_position(x, y, direction) 58 | case direction 59 | when :U then [x, y - 1] 60 | when :D then [x, y + 1] 61 | when :L then [x - 1, y] 62 | when :R then [x + 1, y] 63 | end 64 | end 65 | end 66 | -------------------------------------------------------------------------------- /spec/models/maze_spec.rb: -------------------------------------------------------------------------------- 1 | require "spec_helper" 2 | 3 | describe Maze do 4 | let(:maze) { Maze.new(4, 5) } 5 | 6 | describe ".initialize" do 7 | it "sets height and width" do 8 | expect(maze.width).to be 4 9 | expect(maze.height).to be 5 10 | end 11 | 12 | it "sets a grid" do 13 | expect(maze.instance_variable_get(:@grid)).to eq Array.new(5) { Array.new(4, false) } 14 | end 15 | end 16 | 17 | describe "#construct_and_solve" do 18 | context "with correct initial and final points" do 19 | it "sets initial_x, initial_y, final_x, final_y" do 20 | maze.construct_and_solve(0, 0, 3, 3) 21 | expect(maze.initial_x).to be 0 22 | expect(maze.initial_y).to be 0 23 | expect(maze.final_x).to be 3 24 | expect(maze.final_y).to be 3 25 | end 26 | 27 | it "stores starting point in solution_steps" do 28 | expect(maze).to receive(:carve_passages_from).with(3, 1) 29 | maze.construct_and_solve(3, 1, 3, 4) 30 | expect(maze.solution_steps).to include [3, 1] 31 | end 32 | 33 | it "sets carving_steps" do 34 | expect(maze).to receive(:carve_passages_from).with(3, 1) 35 | maze.construct_and_solve(3, 1, 3, 4) 36 | expect(maze.carving_steps).to eq [] 37 | end 38 | 39 | it "returns true" do 40 | expect(maze.construct_and_solve(3, 1, 3, 4)).to be true 41 | end 42 | 43 | it "sets 38 carving_steps ((height * with) - 1) * 2" do 44 | maze.construct_and_solve(3, 1, 3, 4) 45 | expect(maze.carving_steps.count).to be 38 46 | end 47 | 48 | it "sets many solution_steps" do 49 | maze.construct_and_solve(3, 1, 3, 4) 50 | expect(maze.solution_steps).to be_many 51 | end 52 | 53 | it "visits all the points in the maze" do 54 | maze.construct_and_solve(3, 1, 3, 4) 55 | expect(maze.instance_variable_get(:@grid)).to eq Array.new(5) { Array.new(4, true) } 56 | end 57 | end 58 | 59 | context "with incorrect initial and final points" do 60 | it "returns false" do 61 | expect(maze.construct_and_solve(3, 1, 99, 99)).to be false 62 | end 63 | end 64 | end 65 | end 66 | -------------------------------------------------------------------------------- /config/environments/production.rb: -------------------------------------------------------------------------------- 1 | Rails.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 threaded 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 20 | # NGINX, varnish or squid. 21 | # config.action_dispatch.rack_cache = true 22 | 23 | # Disable serving static files from the `/public` folder by default since 24 | # Apache or NGINX already handles this. 25 | config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? 26 | 27 | # Compress JavaScripts and CSS. 28 | config.assets.js_compressor = :uglifier 29 | # config.assets.css_compressor = :sass 30 | 31 | # Do not fallback to assets pipeline if a precompiled asset is missed. 32 | config.assets.compile = false 33 | 34 | # Asset digests allow you to set far-future HTTP expiration dates on all assets, 35 | # yet still be able to expire them through the digest params. 36 | config.assets.digest = true 37 | 38 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb 39 | 40 | # Specifies the header that your server uses for sending files. 41 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache 42 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX 43 | 44 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 45 | # config.force_ssl = true 46 | 47 | # Use the lowest log level to ensure availability of diagnostic information 48 | # when problems arise. 49 | config.log_level = :debug 50 | 51 | # Prepend all log lines with the following tags. 52 | # config.log_tags = [ :subdomain, :uuid ] 53 | 54 | # Use a different logger for distributed setups. 55 | # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) 56 | 57 | # Use a different cache store in production. 58 | # config.cache_store = :mem_cache_store 59 | 60 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 61 | # config.action_controller.asset_host = 'http://assets.example.com' 62 | 63 | # Ignore bad email addresses and do not raise email delivery errors. 64 | # Set this to true and configure the email server for immediate delivery to raise delivery errors. 65 | # config.action_mailer.raise_delivery_errors = false 66 | 67 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 68 | # the I18n.default_locale when a translation cannot be found). 69 | config.i18n.fallbacks = true 70 | 71 | # Send deprecation notices to registered listeners. 72 | config.active_support.deprecation = :notify 73 | 74 | # Use default logging formatter so that PID and timestamp are not suppressed. 75 | config.log_formatter = ::Logger::Formatter.new 76 | 77 | # Do not dump schema after migrations. 78 | # config.active_record.dump_schema_after_migration = false 79 | end 80 | -------------------------------------------------------------------------------- /config/database.yml: -------------------------------------------------------------------------------- 1 | # PostgreSQL. Versions 8.2 and up are supported. 2 | # 3 | # Install the pg driver: 4 | # gem install pg 5 | # On OS X with Homebrew: 6 | # gem install pg -- --with-pg-config=/usr/local/bin/pg_config 7 | # On OS X with MacPorts: 8 | # gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config 9 | # On Windows: 10 | # gem install pg 11 | # Choose the win32 build. 12 | # Install PostgreSQL and put its /bin directory on your path. 13 | # 14 | # Configure Using Gemfile 15 | # gem 'pg' 16 | # 17 | default: &default 18 | adapter: postgresql 19 | encoding: unicode 20 | # For details on connection pooling, see rails configuration guide 21 | # http://guides.rubyonrails.org/configuring.html#database-pooling 22 | pool: 5 23 | 24 | development: 25 | <<: *default 26 | database: <%= ENV['STARTER_APP_DEV_DB_DATABASE'] || 'amazed_development' %> 27 | 28 | # The specified database role being used to connect to postgres. 29 | # To create additional roles in postgres see `$ createuser --help`. 30 | # When left blank, postgres will use the default role. This is 31 | # the same name as the operating system user that initialized the database. 32 | username: <%= ENV['STARTER_APP_DEV_DB_USER'] || 'postgres' %> 33 | 34 | # The password associated with the postgres role (username). 35 | password: <%= ENV['STARTER_APP_DEV_DB_PASSWORD'] %> 36 | 37 | # Connect on a TCP socket. Omitted by default since the client uses a 38 | # domain socket that doesn't need configuration. Windows does not have 39 | # domain sockets, so uncomment these lines. 40 | host: <%= ENV['STARTER_APP_DEV_DB_HOST'] || 'localhost' %> 41 | 42 | # The TCP port the server listens on. Defaults to 5432. 43 | # If your server runs on a different port number, change accordingly. 44 | port: <%= ENV['STARTER_APP_DEV_DB_PORT'] || '5432' %> 45 | 46 | # Schema search path. The server defaults to $user,public 47 | #schema_search_path: myapp,sharedapp,public 48 | 49 | # Minimum log levels, in increasing order: 50 | # debug5, debug4, debug3, debug2, debug1, 51 | # log, notice, warning, error, fatal, and panic 52 | # Defaults to warning. 53 | #min_messages: notice 54 | 55 | # Warning: The database defined as "test" will be erased and 56 | # re-generated from your development database when you run "rake". 57 | # Do not set this db to the same as development or production. 58 | test: 59 | <<: *default 60 | database: <%= ENV['STARTER_APP_TEST_DB_DATABASE'] || 'amazed_test' %> 61 | username: <%= ENV['STARTER_APP_TEST_DB_USER'] || 'postgres' %> 62 | password: <%= ENV['STARTER_APP_TEST_DB_PASSWORD'] %> 63 | host: <%= ENV['STARTER_APP_TEST_DB_HOST'] || 'localhost' %> 64 | port: <%= ENV['STARTER_APP_TEST_DB_PORT'] || '5432' %> 65 | 66 | # As with config/secrets.yml, you never want to store sensitive information, 67 | # like your database password, in your source code. If your source code is 68 | # ever seen by anyone, they now have access to your database. 69 | # 70 | # Instead, provide the password as a unix environment variable when you boot 71 | # the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database 72 | # for a full rundown on how to provide these environment variables in a 73 | # production deployment. 74 | # 75 | # On Heroku and other platform providers, you may have a full connection URL 76 | # available as an environment variable. For example: 77 | # 78 | # DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase" 79 | # 80 | # You can use this database configuration with: 81 | # 82 | # production: 83 | # url: <%= ENV['DATABASE_URL'] %> 84 | # 85 | production: 86 | <<: *default 87 | database: amazed_production 88 | username: postgres 89 | password: 90 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, diowa 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 14 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 17 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 20 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 22 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | 24 | 25 | airbrake is licensed by Airbrake 26 | 27 | Autoprefixer Rails is licensed under the MIT License 28 | 29 | better_errors is licensed under the MIT License 30 | 31 | binding_of_caller is licensed under the MIT License 32 | 33 | bullet is licensed under the MIT License 34 | 35 | byebug is licensed under the MIT License 36 | 37 | Bootstrap for Sass is licensed under the MIT License 38 | 39 | Capybara is licensed under the MIT License 40 | 41 | Database Cleaner is licensed under the MIT License 42 | 43 | Email Spec is licensed under the MIT License 44 | 45 | factory_girl_rails is licensed under the MIT License 46 | 47 | faker is licensed under the MIT License 48 | 49 | figaro is licensed under the MIT License 50 | 51 | FontAwesome font is licensed under the SIL Open Font License 52 | 53 | FontAwesome is licensed under the MIT License 54 | 55 | FontAwesome pictograms are licensed under the CC BY 3.0 License 56 | 57 | google-analytics-rails is licensed under the MIT license 58 | 59 | http_accept_language is licensed under the MIT License 60 | 61 | i18n-js is licensed under the MIT License 62 | 63 | jquery is licensed under the MIT License 64 | 65 | jquery-turbolinks is licensed under the MIT License 66 | 67 | kaminari is licensed under the MIT License 68 | 69 | meta_request is licensed under the MIT License 70 | 71 | newrelic_rpm is licensed by New Relic 72 | 73 | nokogiri is licensed under the MIT License 74 | 75 | pg is licensed under the 2-clause BSD License 76 | 77 | pry is licensed under the MIT License 78 | 79 | pry-byebug is licensed under the MIT License 80 | 81 | pry-rails is licensed under the MIT License 82 | 83 | puma is licensed under the BSD License 84 | 85 | puma_auto_tune is licensed under the MIT License 86 | 87 | rabl is licensed under the MIT License 88 | 89 | Rack::Timeout is licensed under the MIT License 90 | 91 | rails_12factor is licensed under the 2-clause BSD License 92 | 93 | resque is licensed under the MIT License 94 | 95 | rest-client is licensed under the MIT License 96 | 97 | rspec is licensed under the MIT License 98 | 99 | rspec-rails is licensed under the MIT License 100 | 101 | rubocop is licensed under the MIT License 102 | 103 | secure_headers is licensed under the Apache License 104 | 105 | selenium-webdriver is licensed under the Apache License 106 | 107 | simplecov is licensed under the MIT License 108 | 109 | slim-rails is licensed under the MIT License 110 | 111 | spring_commands_rspec is licensed under the MIT License 112 | 113 | twbs_sass_rails is licensed under the 2-clause BSD License 114 | 115 | uglifier is licensed under the MIT License 116 | 117 | validates_timeliness is licensed under the MIT License 118 | 119 | webmock is licensed under the MIT License 120 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | actionmailer (4.2.5) 5 | actionpack (= 4.2.5) 6 | actionview (= 4.2.5) 7 | activejob (= 4.2.5) 8 | mail (~> 2.5, >= 2.5.4) 9 | rails-dom-testing (~> 1.0, >= 1.0.5) 10 | actionpack (4.2.5) 11 | actionview (= 4.2.5) 12 | activesupport (= 4.2.5) 13 | rack (~> 1.6) 14 | rack-test (~> 0.6.2) 15 | rails-dom-testing (~> 1.0, >= 1.0.5) 16 | rails-html-sanitizer (~> 1.0, >= 1.0.2) 17 | actionview (4.2.5) 18 | activesupport (= 4.2.5) 19 | builder (~> 3.1) 20 | erubis (~> 2.7.0) 21 | rails-dom-testing (~> 1.0, >= 1.0.5) 22 | rails-html-sanitizer (~> 1.0, >= 1.0.2) 23 | activejob (4.2.5) 24 | activesupport (= 4.2.5) 25 | globalid (>= 0.3.0) 26 | activemodel (4.2.5) 27 | activesupport (= 4.2.5) 28 | builder (~> 3.1) 29 | activerecord (4.2.5) 30 | activemodel (= 4.2.5) 31 | activesupport (= 4.2.5) 32 | arel (~> 6.0) 33 | activesupport (4.2.5) 34 | i18n (~> 0.7) 35 | json (~> 1.7, >= 1.7.7) 36 | minitest (~> 5.1) 37 | thread_safe (~> 0.3, >= 0.3.4) 38 | tzinfo (~> 1.1) 39 | addressable (2.4.0) 40 | arel (6.0.3) 41 | ast (2.1.0) 42 | astrolabe (1.3.1) 43 | parser (~> 2.2) 44 | autoprefixer-rails (6.1.2) 45 | execjs 46 | json 47 | better_errors (2.1.1) 48 | coderay (>= 1.0.0) 49 | erubis (>= 2.6.6) 50 | rack (>= 0.9.0) 51 | binding_of_caller (0.7.2) 52 | debug_inspector (>= 0.0.1) 53 | builder (3.2.2) 54 | bullet (4.14.10) 55 | activesupport (>= 3.0.0) 56 | uniform_notifier (~> 1.9.0) 57 | byebug (8.2.1) 58 | callsite (0.0.11) 59 | capybara (2.5.0) 60 | mime-types (>= 1.16) 61 | nokogiri (>= 1.3.3) 62 | rack (>= 1.0.0) 63 | rack-test (>= 0.5.4) 64 | xpath (~> 2.0) 65 | childprocess (0.5.8) 66 | ffi (~> 1.0, >= 1.0.11) 67 | coderay (1.1.0) 68 | coffee-rails (4.1.0) 69 | coffee-script (>= 2.2.0) 70 | railties (>= 4.0.0, < 5.0) 71 | coffee-script (2.4.1) 72 | coffee-script-source 73 | execjs 74 | coffee-script-source (1.10.0) 75 | concurrent-ruby (1.0.0) 76 | coveralls (0.8.10) 77 | json (~> 1.8) 78 | rest-client (>= 1.6.8, < 2) 79 | simplecov (~> 0.11.0) 80 | term-ansicolor (~> 1.3) 81 | thor (~> 0.19.1) 82 | tins (~> 1.6.0) 83 | crack (0.4.3) 84 | safe_yaml (~> 1.0.0) 85 | database_cleaner (1.5.1) 86 | debug_inspector (0.0.2) 87 | diff-lcs (1.2.5) 88 | docile (1.1.5) 89 | domain_name (0.5.25) 90 | unf (>= 0.0.5, < 1.0.0) 91 | email_spec (1.6.0) 92 | launchy (~> 2.1) 93 | mail (~> 2.2) 94 | erubis (2.7.0) 95 | execjs (2.6.0) 96 | factory_girl (4.5.0) 97 | activesupport (>= 3.0.0) 98 | factory_girl_rails (4.5.0) 99 | factory_girl (~> 4.5.0) 100 | railties (>= 3.0.0) 101 | faker (1.6.1) 102 | i18n (~> 0.5) 103 | ffi (1.9.10) 104 | git-version-bump (0.15.1) 105 | globalid (0.3.6) 106 | activesupport (>= 4.1.0) 107 | hashdiff (0.2.3) 108 | http-cookie (1.0.2) 109 | domain_name (~> 0.5) 110 | i18n (0.7.0) 111 | i18n-js (2.1.2) 112 | i18n 113 | jquery-rails (4.0.5) 114 | rails-dom-testing (~> 1.0) 115 | railties (>= 4.2.0) 116 | thor (>= 0.14, < 2.0) 117 | jquery-turbolinks (2.1.0) 118 | railties (>= 3.1.0) 119 | turbolinks 120 | json (1.8.3) 121 | launchy (2.4.3) 122 | addressable (~> 2.3) 123 | loofah (2.0.3) 124 | nokogiri (>= 1.5.9) 125 | mail (2.6.3) 126 | mime-types (>= 1.16, < 3) 127 | meta_request (0.3.4) 128 | callsite (~> 0.0, >= 0.0.11) 129 | rack-contrib (~> 1.1) 130 | railties (>= 3.0.0, < 5.0.0) 131 | method_source (0.8.2) 132 | mime-types (2.99) 133 | mini_portile2 (2.0.0) 134 | minitest (5.8.3) 135 | multi_json (1.11.2) 136 | netrc (0.11.0) 137 | newrelic_rpm (3.14.1.311) 138 | nokogiri (1.6.7) 139 | mini_portile2 (~> 2.0.0.rc2) 140 | parser (2.2.3.0) 141 | ast (>= 1.1, < 3.0) 142 | powerpack (0.1.1) 143 | pry (0.10.3) 144 | coderay (~> 1.1.0) 145 | method_source (~> 0.8.1) 146 | slop (~> 3.4) 147 | pry-byebug (3.3.0) 148 | byebug (~> 8.0) 149 | pry (~> 0.10) 150 | pry-rails (0.3.4) 151 | pry (>= 0.9.10) 152 | puma (2.15.3) 153 | quiet_assets (1.1.0) 154 | railties (>= 3.1, < 5.0) 155 | rack (1.6.4) 156 | rack-contrib (1.4.0) 157 | git-version-bump (~> 0.15) 158 | rack (~> 1.4) 159 | rack-test (0.6.3) 160 | rack (>= 1.0) 161 | rack-timeout (0.3.2) 162 | rails (4.2.5) 163 | actionmailer (= 4.2.5) 164 | actionpack (= 4.2.5) 165 | actionview (= 4.2.5) 166 | activejob (= 4.2.5) 167 | activemodel (= 4.2.5) 168 | activerecord (= 4.2.5) 169 | activesupport (= 4.2.5) 170 | bundler (>= 1.3.0, < 2.0) 171 | railties (= 4.2.5) 172 | sprockets-rails 173 | rails-deprecated_sanitizer (1.0.3) 174 | activesupport (>= 4.2.0.alpha) 175 | rails-dom-testing (1.0.7) 176 | activesupport (>= 4.2.0.beta, < 5.0) 177 | nokogiri (~> 1.6.0) 178 | rails-deprecated_sanitizer (>= 1.0.1) 179 | rails-html-sanitizer (1.0.2) 180 | loofah (~> 2.0) 181 | rails_12factor (0.0.3) 182 | rails_serve_static_assets 183 | rails_stdout_logging 184 | rails_serve_static_assets (0.0.4) 185 | rails_stdout_logging (0.0.4) 186 | railties (4.2.5) 187 | actionpack (= 4.2.5) 188 | activesupport (= 4.2.5) 189 | rake (>= 0.8.7) 190 | thor (>= 0.18.1, < 2.0) 191 | rainbow (2.0.0) 192 | rake (10.4.2) 193 | rest-client (1.8.0) 194 | http-cookie (>= 1.0.2, < 2.0) 195 | mime-types (>= 1.16, < 3.0) 196 | netrc (~> 0.7) 197 | rspec (3.4.0) 198 | rspec-core (~> 3.4.0) 199 | rspec-expectations (~> 3.4.0) 200 | rspec-mocks (~> 3.4.0) 201 | rspec-core (3.4.1) 202 | rspec-support (~> 3.4.0) 203 | rspec-expectations (3.4.0) 204 | diff-lcs (>= 1.2.0, < 2.0) 205 | rspec-support (~> 3.4.0) 206 | rspec-mocks (3.4.0) 207 | diff-lcs (>= 1.2.0, < 2.0) 208 | rspec-support (~> 3.4.0) 209 | rspec-rails (3.4.0) 210 | actionpack (>= 3.0, < 4.3) 211 | activesupport (>= 3.0, < 4.3) 212 | railties (>= 3.0, < 4.3) 213 | rspec-core (~> 3.4.0) 214 | rspec-expectations (~> 3.4.0) 215 | rspec-mocks (~> 3.4.0) 216 | rspec-support (~> 3.4.0) 217 | rspec-support (3.4.1) 218 | rubocop (0.35.1) 219 | astrolabe (~> 1.3) 220 | parser (>= 2.2.3.0, < 3.0) 221 | powerpack (~> 0.1) 222 | rainbow (>= 1.99.1, < 3.0) 223 | ruby-progressbar (~> 1.7) 224 | tins (<= 1.6.0) 225 | ruby-progressbar (1.7.5) 226 | rubyzip (1.1.7) 227 | safe_yaml (1.0.4) 228 | sass (3.4.20) 229 | sass-rails (5.0.4) 230 | railties (>= 4.0.0, < 5.0) 231 | sass (~> 3.1) 232 | sprockets (>= 2.8, < 4.0) 233 | sprockets-rails (>= 2.0, < 4.0) 234 | tilt (>= 1.1, < 3) 235 | selenium-webdriver (2.48.1) 236 | childprocess (~> 0.5) 237 | multi_json (~> 1.0) 238 | rubyzip (~> 1.0) 239 | websocket (~> 1.0) 240 | simplecov (0.11.1) 241 | docile (~> 1.1.0) 242 | json (~> 1.8) 243 | simplecov-html (~> 0.10.0) 244 | simplecov-html (0.10.0) 245 | slim (3.0.6) 246 | temple (~> 0.7.3) 247 | tilt (>= 1.3.3, < 2.1) 248 | slim-rails (3.0.1) 249 | actionmailer (>= 3.1, < 5.0) 250 | actionpack (>= 3.1, < 5.0) 251 | activesupport (>= 3.1, < 5.0) 252 | railties (>= 3.1, < 5.0) 253 | slim (~> 3.0) 254 | slim_assets (0.0.2) 255 | slim 256 | tilt 257 | slop (3.6.0) 258 | spring (1.5.0) 259 | spring-commands-rspec (1.0.4) 260 | spring (>= 0.9.1) 261 | sprockets (3.5.2) 262 | concurrent-ruby (~> 1.0) 263 | rack (> 1, < 3) 264 | sprockets-rails (2.3.3) 265 | actionpack (>= 3.0) 266 | activesupport (>= 3.0) 267 | sprockets (>= 2.8, < 4.0) 268 | temple (0.7.6) 269 | term-ansicolor (1.3.2) 270 | tins (~> 1.0) 271 | thor (0.19.1) 272 | thread_safe (0.3.5) 273 | tilt (2.0.1) 274 | tins (1.6.0) 275 | turbolinks (2.5.3) 276 | coffee-rails 277 | twbs_sass_rails (3.7.0) 278 | autoprefixer-rails (~> 6.1) 279 | rails (>= 4.0.13, < 5.0.0) 280 | sass-rails (>= 4.0.5, < 6.0.0) 281 | tzinfo (1.2.2) 282 | thread_safe (~> 0.1) 283 | uglifier (2.7.2) 284 | execjs (>= 0.3.0) 285 | json (>= 1.8.0) 286 | unf (0.1.4) 287 | unf_ext 288 | unf_ext (0.0.7.1) 289 | uniform_notifier (1.9.0) 290 | web-console (2.2.1) 291 | activemodel (>= 4.0) 292 | binding_of_caller (>= 0.7.2) 293 | railties (>= 4.0) 294 | sprockets-rails (>= 2.0, < 4.0) 295 | webmock (1.22.3) 296 | addressable (>= 2.3.6) 297 | crack (>= 0.3.2) 298 | hashdiff 299 | websocket (1.2.2) 300 | xpath (2.0.0) 301 | nokogiri (~> 1.3) 302 | 303 | PLATFORMS 304 | ruby 305 | 306 | DEPENDENCIES 307 | autoprefixer-rails 308 | better_errors 309 | binding_of_caller 310 | bullet 311 | byebug 312 | capybara 313 | coffee-rails (~> 4.1.0) 314 | coveralls 315 | database_cleaner 316 | email_spec 317 | factory_girl_rails 318 | faker 319 | i18n-js 320 | jquery-rails 321 | jquery-turbolinks 322 | meta_request 323 | newrelic_rpm 324 | pry 325 | pry-byebug 326 | pry-rails 327 | puma 328 | quiet_assets 329 | rack-timeout 330 | rails (= 4.2.5) 331 | rails_12factor 332 | rspec 333 | rspec-rails 334 | rubocop 335 | sass-rails (~> 5.0) 336 | selenium-webdriver 337 | simplecov 338 | slim-rails 339 | slim_assets 340 | spring 341 | spring-commands-rspec 342 | turbolinks 343 | twbs_sass_rails 344 | uglifier (>= 1.3.0) 345 | web-console 346 | webmock 347 | 348 | BUNDLED WITH 349 | 1.10.6 350 | -------------------------------------------------------------------------------- /config/newrelic.yml: -------------------------------------------------------------------------------- 1 | # 2 | # This file configures the New Relic Agent. New Relic monitors 3 | # Ruby, Java, .NET, PHP, and Python applications with deep visibility and low overhead. 4 | # For more information, visit www.newrelic.com. 5 | # 6 | # Generated June 03, 2013 7 | # 8 | # This configuration file is custom generated for Barsoom 9 | 10 | 11 | # Here are the settings that are common to all environments 12 | common: &default_settings 13 | # ============================== LICENSE KEY =============================== 14 | 15 | # You must specify the license key associated with your New Relic 16 | # account. This key binds your Agent's data to your account in the 17 | # New Relic service. 18 | license_key: '<%= ENV["NEW_RELIC_LICENSE_KEY"] %>' 19 | 20 | # Agent Enabled (Ruby/Rails Only) 21 | # Use this setting to force the agent to run or not run. 22 | # Default is 'auto' which means the agent will install and run only 23 | # if a valid dispatcher such as Mongrel is running. This prevents 24 | # it from running with Rake or the console. Set to false to 25 | # completely turn the agent off regardless of the other settings. 26 | # Valid values are true, false and auto. 27 | # 28 | # agent_enabled: auto 29 | 30 | # Application Name Set this to be the name of your application as 31 | # you'd like it show up in New Relic. The service will then auto-map 32 | # instances of your application into an "application" on your 33 | # dashboard page. If you want to map this instance into multiple 34 | # apps, like "AJAX Requests" and "All UI" then specify a semicolon 35 | # separated list of up to three distinct names, or a yaml list. 36 | # Defaults to the capitalized RAILS_ENV or RACK_ENV (i.e., 37 | # Production, Staging, etc) 38 | # 39 | # Example: 40 | # 41 | # app_name: 42 | # - Ajax Service 43 | # - All Services 44 | # 45 | app_name: <%= ENV["NEW_RELIC_APP_NAME"] %> 46 | 47 | # When "true", the agent collects performance data about your 48 | # application and reports this data to the New Relic service at 49 | # newrelic.com. This global switch is normally overridden for each 50 | # environment below. (formerly called 'enabled') 51 | monitor_mode: true 52 | 53 | # Developer mode should be off in every environment but 54 | # development as it has very high overhead in memory. 55 | developer_mode: false 56 | 57 | # The newrelic agent generates its own log file to keep its logging 58 | # information separate from that of your application. Specify its 59 | # log level here. 60 | log_level: info 61 | 62 | # Optionally set the path to the log file This is expanded from the 63 | # root directory (may be relative or absolute, e.g. 'log/' or 64 | # '/var/log/') The agent will attempt to create this directory if it 65 | # does not exist. 66 | # log_file_path: 'log' 67 | 68 | # Optionally set the name of the log file, defaults to 'newrelic_agent.log' 69 | # log_file_name: 'newrelic_agent.log' 70 | 71 | # The newrelic agent communicates with the service via https by default. This 72 | # prevents eavesdropping on the performance metrics transmitted by the agent. 73 | # The encryption required by SSL introduces a nominal amount of CPU overhead, 74 | # which is performed asynchronously in a background thread. If you'd prefer 75 | # to send your metrics over http uncomment the following line. 76 | # ssl: false 77 | 78 | #============================== Browser Monitoring =============================== 79 | # New Relic Real User Monitoring gives you insight into the performance real users are 80 | # experiencing with your website. This is accomplished by measuring the time it takes for 81 | # your users' browsers to download and render your web pages by injecting a small amount 82 | # of JavaScript code into the header and footer of each page. 83 | browser_monitoring: 84 | # By default the agent automatically injects the monitoring JavaScript 85 | # into web pages. Set this attribute to false to turn off this behavior. 86 | auto_instrument: true 87 | 88 | # Proxy settings for connecting to the New Relic server. 89 | # 90 | # If a proxy is used, the host setting is required. Other settings 91 | # are optional. Default port is 8080. 92 | # 93 | # proxy_host: hostname 94 | # proxy_port: 8080 95 | # proxy_user: 96 | # proxy_pass: 97 | 98 | # The agent can optionally log all data it sends to New Relic servers to a 99 | # separate log file for human inspection and auditing purposes. To enable this 100 | # feature, change 'enabled' below to true. 101 | # See: https://newrelic.com/docs/ruby/audit-log 102 | audit_log: 103 | enabled: false 104 | 105 | # Tells transaction tracer and error collector (when enabled) 106 | # whether or not to capture HTTP params. When true, frameworks can 107 | # exclude HTTP parameters from being captured. 108 | # Rails: the RoR filter_parameter_logging excludes parameters 109 | # Java: create a config setting called "ignored_params" and set it to 110 | # a comma separated list of HTTP parameter names. 111 | # ex: ignored_params: credit_card, ssn, password 112 | capture_params: false 113 | 114 | # Transaction tracer captures deep information about slow 115 | # transactions and sends this to the New Relic service once a 116 | # minute. Included in the transaction is the exact call sequence of 117 | # the transactions including any SQL statements issued. 118 | transaction_tracer: 119 | 120 | # Transaction tracer is enabled by default. Set this to false to 121 | # turn it off. This feature is only available at the Professional 122 | # and above product levels. 123 | enabled: true 124 | 125 | # Threshold in seconds for when to collect a transaction 126 | # trace. When the response time of a controller action exceeds 127 | # this threshold, a transaction trace will be recorded and sent to 128 | # New Relic. Valid values are any float value, or (default) "apdex_f", 129 | # which will use the threshold for an dissatisfying Apdex 130 | # controller action - four times the Apdex T value. 131 | transaction_threshold: apdex_f 132 | 133 | # When transaction tracer is on, SQL statements can optionally be 134 | # recorded. The recorder has three modes, "off" which sends no 135 | # SQL, "raw" which sends the SQL statement in its original form, 136 | # and "obfuscated", which strips out numeric and string literals. 137 | record_sql: obfuscated 138 | 139 | # Threshold in seconds for when to collect stack trace for a SQL 140 | # call. In other words, when SQL statements exceed this threshold, 141 | # then capture and send to New Relic the current stack trace. This is 142 | # helpful for pinpointing where long SQL calls originate from. 143 | stack_trace_threshold: 0.500 144 | 145 | # Determines whether the agent will capture query plans for slow 146 | # SQL queries. Only supported in mysql and postgres. Should be 147 | # set to false when using other adapters. 148 | # explain_enabled: true 149 | 150 | # Threshold for query execution time below which query plans will 151 | # not be captured. Relevant only when `explain_enabled` is true. 152 | # explain_threshold: 0.5 153 | 154 | # Error collector captures information about uncaught exceptions and 155 | # sends them to New Relic for viewing 156 | error_collector: 157 | 158 | # Error collector is enabled by default. Set this to false to turn 159 | # it off. This feature is only available at the Professional and above 160 | # product levels. 161 | enabled: true 162 | 163 | # Rails Only - tells error collector whether or not to capture a 164 | # source snippet around the place of the error when errors are View 165 | # related. 166 | capture_source: true 167 | 168 | # To stop specific errors from reporting to New Relic, set this property 169 | # to comma-separated values. Default is to ignore routing errors, 170 | # which are how 404's get triggered. 171 | ignore_errors: "ActionController::RoutingError,Sinatra::NotFound" 172 | 173 | # If you're interested in capturing memcache keys as though they 174 | # were SQL uncomment this flag. Note that this does increase 175 | # overhead slightly on every memcached call, and can have security 176 | # implications if your memcached keys are sensitive 177 | # capture_memcache_keys: true 178 | 179 | # Application Environments 180 | # ------------------------------------------ 181 | # Environment-specific settings are in this section. 182 | # For Rails applications, RAILS_ENV is used to determine the environment. 183 | # For Java applications, pass -Dnewrelic.environment to set 184 | # the environment. 185 | 186 | # NOTE if your application has other named environments, you should 187 | # provide newrelic configuration settings for these environments here. 188 | 189 | development: 190 | <<: *default_settings 191 | # Turn off communication to New Relic service in development mode (also 192 | # 'enabled'). 193 | # NOTE: for initial evaluation purposes, you may want to temporarily 194 | # turn the agent on in development mode. 195 | monitor_mode: false 196 | 197 | # Rails Only - when running in Developer Mode, the New Relic Agent will 198 | # present performance information on the last 100 transactions you have 199 | # executed since starting the mongrel. 200 | # NOTE: There is substantial overhead when running in developer mode. 201 | # Do not use for production or load testing. 202 | developer_mode: true 203 | 204 | # Enable textmate links 205 | # textmate: true 206 | 207 | test: 208 | <<: *default_settings 209 | # It almost never makes sense to turn on the agent when running 210 | # unit, functional or integration tests or the like. 211 | monitor_mode: false 212 | 213 | # Turn on the agent in production for 24x7 monitoring. NewRelic 214 | # testing shows an average performance impact of < 5 ms per 215 | # transaction, you can leave this on all the time without 216 | # incurring any user-visible performance degradation. 217 | production: 218 | <<: *default_settings 219 | monitor_mode: true 220 | 221 | # Many applications have a staging environment which behaves 222 | # identically to production. Support for that environment is provided 223 | # here. By default, the staging environment has the agent turned on. 224 | staging: 225 | <<: *default_settings 226 | monitor_mode: true 227 | app_name: <%= ENV["NEW_RELIC_APP_NAME"] %> (Staging) 228 | --------------------------------------------------------------------------------