Browse Source

init

pull/1/head
Nicolae Claudius 13 years ago
parent
commit
6ad41d8150
  1. 1
      .gitignore
  2. 7
      Rakefile
  3. BIN
      app/assets/images/rails.png
  4. 10
      app/assets/javascripts/application.js
  5. 16
      app/assets/stylesheets/application.css
  6. 14
      app/assets/stylesheets/web_app_theme.css
  7. 5
      app/controllers/application_controller.rb
  8. 4
      app/controllers/domains_controller.rb
  9. 4
      app/controllers/records_controller.rb
  10. 4
      app/controllers/supermasters_controller.rb
  11. 17
      app/helpers/application_helper.rb
  12. 2
      app/helpers/domains_helper.rb
  13. 2
      app/helpers/records_helper.rb
  14. 2
      app/helpers/supermasters_helper.rb
  15. 0
      app/mailers/.gitkeep
  16. 0
      app/models/.gitkeep
  17. 2
      app/models/domain.rb
  18. 2
      app/models/record.rb
  19. 2
      app/models/supermaster.rb
  20. 16
      app/models/user.rb
  21. 12
      app/views/devise/confirmations/new.html.erb
  22. 5
      app/views/devise/mailer/confirmation_instructions.html.erb
  23. 8
      app/views/devise/mailer/reset_password_instructions.html.erb
  24. 7
      app/views/devise/mailer/unlock_instructions.html.erb
  25. 16
      app/views/devise/passwords/edit.html.erb
  26. 12
      app/views/devise/passwords/new.html.erb
  27. 35
      app/views/devise/registrations/edit.html.erb
  28. 26
      app/views/devise/registrations/new.html.erb
  29. 24
      app/views/devise/sessions/new.html.erb
  30. 25
      app/views/devise/shared/_links.erb
  31. 12
      app/views/devise/unlocks/new.html.erb
  32. 5
      app/views/fragments/_bottom.html.erb
  33. 12
      app/views/fragments/_sidebar.html.erb
  34. 9
      app/views/fragments/_top.html.erb
  35. 9
      app/views/fragments/_user_navigation.html.erb
  36. 35
      app/views/layouts/application.html.erb
  37. 23
      app/views/layouts/devise.html.erb
  38. 4
      config.ru
  39. 57
      config/application.rb
  40. 6
      config/boot.rb
  41. 25
      config/database.yml
  42. 5
      config/environment.rb
  43. 34
      config/environments/development.rb
  44. 60
      config/environments/production.rb
  45. 42
      config/environments/test.rb
  46. 6
      config/initializers/active_scaffold.rb
  47. 7
      config/initializers/backtrace_silencers.rb
  48. 211
      config/initializers/devise.rb
  49. 10
      config/initializers/inflections.rb
  50. 5
      config/initializers/mime_types.rb
  51. 7
      config/initializers/secret_token.rb
  52. 8
      config/initializers/session_store.rb
  53. 14
      config/initializers/wrap_parameters.rb
  54. 58
      config/locales/devise.en.yml
  55. 5
      config/locales/en.yml
  56. 73
      config/routes.rb
  57. 28
      db/migrate/20110917082609_devise_create_users.rb
  58. 16
      db/migrate/20110917084645_create_domains.rb
  59. 19
      db/migrate/20110917084816_create_records.rb
  60. 11
      db/migrate/20110917084834_create_supermasters.rb
  61. 79
      db/schema.rb
  62. 3
      db/seeds.rb
  63. 2
      doc/README_FOR_APP
  64. 0
      lib/assets/.gitkeep
  65. 0
      lib/tasks/.gitkeep
  66. 0
      log/.gitkeep
  67. 26
      public/404.html
  68. 26
      public/422.html
  69. 26
      public/500.html
  70. 0
      public/favicon.ico
  71. 5
      public/robots.txt
  72. 6
      script/rails
  73. 157
      spec/controllers/domains_controller_spec.rb
  74. 157
      spec/controllers/records_controller_spec.rb
  75. 157
      spec/controllers/supermasters_controller_spec.rb
  76. 15
      spec/helpers/domains_helper_spec.rb
  77. 15
      spec/helpers/records_helper_spec.rb
  78. 15
      spec/helpers/supermasters_helper_spec.rb
  79. 5
      spec/models/domain_spec.rb
  80. 5
      spec/models/record_spec.rb
  81. 5
      spec/models/supermaster_spec.rb
  82. 5
      spec/models/user_spec.rb
  83. 11
      spec/requests/domains_spec.rb
  84. 11
      spec/requests/records_spec.rb
  85. 11
      spec/requests/supermasters_spec.rb
  86. 35
      spec/routing/domains_routing_spec.rb
  87. 35
      spec/routing/records_routing_spec.rb
  88. 35
      spec/routing/supermasters_routing_spec.rb
  89. 15
      spec/views/domains/edit.html.erb_spec.rb
  90. 14
      spec/views/domains/index.html.erb_spec.rb
  91. 15
      spec/views/domains/new.html.erb_spec.rb
  92. 11
      spec/views/domains/show.html.erb_spec.rb
  93. 15
      spec/views/records/edit.html.erb_spec.rb
  94. 14
      spec/views/records/index.html.erb_spec.rb
  95. 15
      spec/views/records/new.html.erb_spec.rb
  96. 11
      spec/views/records/show.html.erb_spec.rb
  97. 15
      spec/views/supermasters/edit.html.erb_spec.rb
  98. 14
      spec/views/supermasters/index.html.erb_spec.rb
  99. 15
      spec/views/supermasters/new.html.erb_spec.rb
  100. 11
      spec/views/supermasters/show.html.erb_spec.rb
  101. Some files were not shown because too many files have changed in this diff Show More

1
.gitignore vendored

@ -3,3 +3,4 @@ db/*.sqlite3
log/*.log
tmp/
.sass-cache/
nbproject/

7
Rakefile

@ -0,0 +1,7 @@
#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
Simpledns::Application.load_tasks

BIN
app/assets/images/rails.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

10
app/assets/javascripts/application.js

@ -0,0 +1,10 @@
// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
//= require jquery
//= require jquery_ujs
//= require pjax
//= require active_scaffold

16
app/assets/stylesheets/application.css

@ -0,0 +1,16 @@
/*
* This is a manifest file that'll automatically include all the stylesheets available in this directory
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
* the top of the compiled file, but it's generally better to create a new file per style scope.
*= require_self
*= require web_app_theme
*= require active_scaffold
*/
#main .block .content h2 {
margin-left: 0;
}
#main .block .content .active-scaffold-header h2 {
font-size: 200%;
}

14
app/assets/stylesheets/web_app_theme.css

@ -0,0 +1,14 @@
/*
* This css will include all web-app-theme css you need
*
*= require web-app-theme/base
*= require web-app-theme/themes/default/style.css
*= require_self
*/
/* Write here your css for overriding the theme's rules */
.flash .alert {
border: 1px solid #e0d300;
background-color: #ffffcc;
}

5
app/controllers/application_controller.rb

@ -0,0 +1,5 @@
class ApplicationController < ActionController::Base
before_filter :authenticate_user!
include SentientController
protect_from_forgery
end

4
app/controllers/domains_controller.rb

@ -0,0 +1,4 @@
class DomainsController < ApplicationController
active_scaffold :domain do |conf|
end
end

4
app/controllers/records_controller.rb

@ -0,0 +1,4 @@
class RecordsController < ApplicationController
active_scaffold :record do |conf|
end
end

4
app/controllers/supermasters_controller.rb

@ -0,0 +1,4 @@
class SupermastersController < ApplicationController
active_scaffold :supermaster do |conf|
end
end

17
app/helpers/application_helper.rb

@ -0,0 +1,17 @@
module ApplicationHelper
# for each record in the rails flash this
# function wraps the message in an appropriate div
# and displays it
def flash_display(clazz = '')
flashes = flash.select{|key, msg| msg.present?}.collect { |key, msg|
content_tag :div, (content_tag :p, msg), :class => "message #{key}"
}.join
if flashes.present?
content_tag :div, flashes.html_safe, :class => clazz
else
nil
end
end
end

2
app/helpers/domains_helper.rb

@ -0,0 +1,2 @@
module DomainsHelper
end

2
app/helpers/records_helper.rb

@ -0,0 +1,2 @@
module RecordsHelper
end

2
app/helpers/supermasters_helper.rb

@ -0,0 +1,2 @@
module SupermastersHelper
end

0
app/mailers/.gitkeep

0
app/models/.gitkeep

2
app/models/domain.rb

@ -0,0 +1,2 @@
class Domain < ActiveRecord::Base
end

2
app/models/record.rb

@ -0,0 +1,2 @@
class Record < ActiveRecord::Base
end

2
app/models/supermaster.rb

@ -0,0 +1,2 @@
class Supermaster < ActiveRecord::Base
end

16
app/models/user.rb

@ -0,0 +1,16 @@
class User < ActiveRecord::Base
include SentientUser
# Include default devise modules. Others available are:
# :token_authenticatable, :encryptable, :timeoutable and :omniauthable
devise :database_authenticatable,
:registerable,
:recoverable,
:rememberable,
:trackable,
:validatable,
:confirmable,
:lockable
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me
end

12
app/views/devise/confirmations/new.html.erb

@ -0,0 +1,12 @@
<h2>Resend confirmation instructions</h2>
<%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %>
<%= devise_error_messages! %>
<div><%= f.label :email %><br />
<%= f.email_field :email %></div>
<div><%= f.submit "Resend confirmation instructions" %></div>
<% end %>
<%= render :partial => "devise/shared/links" %>

5
app/views/devise/mailer/confirmation_instructions.html.erb

@ -0,0 +1,5 @@
<p>Welcome <%= @resource.email %>!</p>
<p>You can confirm your account through the link below:</p>
<p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %></p>

8
app/views/devise/mailer/reset_password_instructions.html.erb

@ -0,0 +1,8 @@
<p>Hello <%= @resource.email %>!</p>
<p>Someone has requested a link to change your password, and you can do this through the link below.</p>
<p><%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %></p>
<p>If you didn't request this, please ignore this email.</p>
<p>Your password won't change until you access the link above and create a new one.</p>

7
app/views/devise/mailer/unlock_instructions.html.erb

@ -0,0 +1,7 @@
<p>Hello <%= @resource.email %>!</p>
<p>Your account has been locked due to an excessive amount of unsuccessful sign in attempts.</p>
<p>Click the link below to unlock your account:</p>
<p><%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %></p>

16
app/views/devise/passwords/edit.html.erb

@ -0,0 +1,16 @@
<h2>Change your password</h2>
<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %>
<%= devise_error_messages! %>
<%= f.hidden_field :reset_password_token %>
<div><%= f.label :password, "New password" %><br />
<%= f.password_field :password %></div>
<div><%= f.label :password_confirmation, "Confirm new password" %><br />
<%= f.password_field :password_confirmation %></div>
<div><%= f.submit "Change my password" %></div>
<% end %>
<%= render :partial => "devise/shared/links" %>

12
app/views/devise/passwords/new.html.erb

@ -0,0 +1,12 @@
<h2>Forgot your password?</h2>
<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %>
<%= devise_error_messages! %>
<div><%= f.label :email %><br />
<%= f.email_field :email %></div>
<div><%= f.submit "Send me reset password instructions" %></div>
<% end %>
<%= render :partial => "devise/shared/links" %>

35
app/views/devise/registrations/edit.html.erb

@ -0,0 +1,35 @@
<div id="box">
<div class="block" id="block-login">
<h2>Edit <%= resource_name.to_s.humanize %></h2>
<div class="content login">
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
<%= devise_error_messages! %>
<div><%= f.label :email %><br />
<%= f.email_field :email %></div>
<div><%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
<%= f.password_field :password %></div>
<div><%= f.label :password_confirmation %><br />
<%= f.password_field :password_confirmation %></div>
<div><%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
<%= f.password_field :current_password %></div>
<div><%= f.submit "Update" %></div>
<% end %>
<h3>Cancel my account</h3>
<p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.</p>
<%= link_to "Back", :back %>
</div>
</div>
</div>

26
app/views/devise/registrations/new.html.erb

@ -0,0 +1,26 @@
<div id="box">
<div class="block" id="block-login">
<h2>Sign up</h2>
<div class="content login">
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
<%= devise_error_messages! %>
<div><%= f.label :email %><br />
<%= f.email_field :email %></div>
<div><%= f.label :password %><br />
<%= f.password_field :password %></div>
<div><%= f.label :password_confirmation %><br />
<%= f.password_field :password_confirmation %></div>
<div><%= f.submit "Sign up" %></div>
<% end %>
<%= render :partial => "devise/shared/links" %>
</div>
</div>
</div>

24
app/views/devise/sessions/new.html.erb

@ -0,0 +1,24 @@
<div id="box">
<div class="block" id="block-login">
<h2>Sign in</h2>
<div class="content login">
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
<div><%= f.label :email %><br />
<%= f.email_field :email %></div>
<div><%= f.label :password %><br />
<%= f.password_field :password %></div>
<% if devise_mapping.rememberable? -%>
<div><%= f.check_box :remember_me %> <%= f.label :remember_me %></div>
<% end -%>
<div><%= f.submit "Sign in" %></div>
<% end %>
<%= render :partial => "devise/shared/links" %>
</div>
</div>
</div>

25
app/views/devise/shared/_links.erb

@ -0,0 +1,25 @@
<%- if controller_name != 'sessions' %>
<%= link_to "Sign in", new_session_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
<%= link_to "Sign up", new_registration_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.omniauthable? %>
<%- resource_class.omniauth_providers.each do |provider| %>
<%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %><br />
<% end -%>
<% end -%>

12
app/views/devise/unlocks/new.html.erb

@ -0,0 +1,12 @@
<h2>Resend unlock instructions</h2>
<%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| %>
<%= devise_error_messages! %>
<div><%= f.label :email %><br />
<%= f.email_field :email %></div>
<div><%= f.submit "Resend unlock instructions" %></div>
<% end %>
<%= render :partial => "devise/shared/links" %>

5
app/views/fragments/_bottom.html.erb

@ -0,0 +1,5 @@
<div id="footer">
<div class="block">
<p>Copyright &copy; <%= Time.now.year %> Nicolae Claudis</p>
</div>
</div>

12
app/views/fragments/_sidebar.html.erb

@ -0,0 +1,12 @@
<div id="sidebar">
<div class="block">
<h3>Menu</h3>
<ul class="navigation">
<li><%= link_to 'Domains', domains_path, :data => {:pjax => '#main'} %></li>
<li><%= link_to 'Records', records_path, :data => {:pjax => '#main'} %></li>
<li><%= link_to 'Supermasters', supermasters_path, :data => {:pjax => '#main'} %></li>
</ul>
</div>
</div>

9
app/views/fragments/_top.html.erb

@ -0,0 +1,9 @@
<div id="header">
<h1><a href="/">Simple DNS</a></h1>
<div id="user-navigation">
<%= render :partial => 'fragments/user_navigation' %>
</div>
<div id="main-navigation">
<ul class="wat-cf"></ul>
</div>
</div>

9
app/views/fragments/_user_navigation.html.erb

@ -0,0 +1,9 @@
<ul class="wat-cf">
<% if user_signed_in? %>
<li><%= link_to('Account', edit_user_registration_path) %></li>
<li><%= link_to('Sign out', destroy_user_session_path, :method => :delete) %></li>
<% else %>
<li><%= link_to('Sign up', new_user_registration_path) %></li>
<li><%= link_to('Sign in', new_user_session_path) %></li>
<% end %>
</ul>

35
app/views/layouts/application.html.erb

@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<title>Simple DNS</title>
<%= stylesheet_link_tag "application" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tag %>
</head>
<body>
<div id="container">
<%= render :partial => 'fragments/top' %>
<div id="wrapper" class="wat-cf">
<%= flash_display 'flash' %>
<div id="main">
<div class="block">
<div class="secondary-navigation">
<ul class="wat-cf">
<li><a href="#">Manage</a></li>
</ul>
</div>
<div class="content">
<div class="inner" data-pjax-container="true">
<%= yield %>
</div>
</div>
</div>
</div>
<%= render :partial => 'fragments/sidebar' %>
</div>
<%= render :partial => 'fragments/bottom' %>
</div>
</body>
</html>

23
app/views/layouts/devise.html.erb

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<title>Simple DNS</title>
<%= stylesheet_link_tag "application" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tag %>
</head>
<body>
<div id="container">
<%= render :partial => 'fragments/top' %>
<div id="box" class="wat-cf">
<%= flash_display 'flash' %>
<div id="main">
<%= yield %>
</div>
</div>
<%= render :partial => 'fragments/bottom' %>
</div>
</body>
</html>

4
config.ru

@ -0,0 +1,4 @@
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run Simpledns::Application

57
config/application.rb

@ -0,0 +1,57 @@
require File.expand_path('../boot', __FILE__)
require 'rails/all'
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require *Rails.groups(:assets => %w(development test))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
module Simpledns
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Custom directories with classes and modules you want to be autoloadable.
# config.autoload_paths += %W(#{config.root}/extras)
# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named.
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
# Activate observers that should always be running.
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"
# Configure sensitive parameters which will be filtered from the log file.
config.filter_parameters += [:password]
# Enable the asset pipeline
config.assets.enabled = true
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'
config.to_prepare do
Devise::SessionsController.layout "devise"
Devise::RegistrationsController.layout proc{ |controller| user_signed_in? ? "application" : "devise" }
Devise::ConfirmationsController.layout "devise"
Devise::UnlocksController.layout "devise"
Devise::PasswordsController.layout "devise"
end
end
end

6
config/boot.rb

@ -0,0 +1,6 @@
require 'rubygems'
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])

25
config/database.yml

@ -0,0 +1,25 @@
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: sqlite3
database: db/production.sqlite3
pool: 5
timeout: 5000

5
config/environment.rb

@ -0,0 +1,5 @@
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
Simpledns::Application.initialize!

34
config/environments/development.rb

@ -0,0 +1,34 @@
Simpledns::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
config.action_mailer.raise_delivery_errors = true
# Print deprecation notices to the Rails logger
config.active_support.deprecation = :log
# Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin
# Do not compress assets
config.assets.compress = false
# Expands the lines which load the assets
config.assets.debug = true
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {:address => "localhost", :port => 1025}
end

60
config/environments/production.rb

@ -0,0 +1,60 @@
Simpledns::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
# Compress JavaScripts and CSS
config.assets.compress = true
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = false
# Generate digests for assets URLs
config.assets.digest = true
# Defaults to Rails.root.join("public/assets")
# config.assets.manifest = YOUR_PATH
# Specifies the header that your server uses for sending files
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# See everything in the log (default is :info)
# config.log_level = :debug
# Use a different logger for distributed setups
# config.logger = SyslogLogger.new
# Use a different cache store in production
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
# config.assets.precompile += %w( search.js )
# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false
# Enable threaded mode
# config.threadsafe!
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
end

42
config/environments/test.rb

@ -0,0 +1,42 @@
Simpledns::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
# Configure static asset server for tests with Cache-Control for performance
config.serve_static_assets = true
config.static_cache_control = "public, max-age=3600"
# Log error messages when you accidentally call methods on nil
config.whiny_nils = true
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Raise exceptions instead of rendering exception templates
config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment
config.action_controller.allow_forgery_protection = false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
# Use SQL instead of Active Record's schema dumper when creating the test database.
# This is necessary if your schema can't be completely dumped by the schema dumper,
# like if you have constraints or database-specific column types
# config.active_record.schema_format = :sql
# Print deprecation notices to the stderr
config.active_support.deprecation = :stderr
# Allow pass debug_assets=true as a query parameter to load pages with unpackaged assets
config.assets.allow_debugging = true
end

6
config/initializers/active_scaffold.rb

@ -0,0 +1,6 @@
ActiveScaffold.js_framework = :jquery
ActiveScaffold.set_defaults do |conf|
# conf.security.default_permission = false
ActiveScaffold::Config::Mark.mark_all_mode = :page
end

7
config/initializers/backtrace_silencers.rb

@ -0,0 +1,7 @@
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
# Rails.backtrace_cleaner.remove_silencers!

211
config/initializers/devise.rb

@ -0,0 +1,211 @@
# Use this hook to configure devise mailer, warden hooks and so forth. The first
# four configuration values can also be set straight in your models.
Devise.setup do |config|
# ==> Mailer Configuration
# Configure the e-mail address which will be shown in Devise::Mailer,
# note that it will be overwritten if you use your own mailer class with default "from" parameter.
config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com"
# Configure the class responsible to send e-mails.
# config.mailer = "Devise::Mailer"
# ==> ORM configuration
# Load and configure the ORM. Supports :active_record (default) and
# :mongoid (bson_ext recommended) by default. Other ORMs may be
# available as additional gems.
require 'devise/orm/active_record'
# ==> Configuration for any authentication mechanism
# Configure which keys are used when authenticating a user. The default is
# just :email. You can configure it to use [:username, :subdomain], so for
# authenticating a user, both parameters are required. Remember that those
# parameters are used only when authenticating and not when retrieving from
# session. If you need permissions, you should implement that in a before filter.
# You can also supply a hash where the value is a boolean determining whether
# or not authentication should be aborted when the value is not present.
# config.authentication_keys = [ :email ]
# Configure parameters from the request object used for authentication. Each entry
# given should be a request method and it will automatically be passed to the
# find_for_authentication method and considered in your model lookup. For instance,
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
# The same considerations mentioned for authentication_keys also apply to request_keys.
# config.request_keys = []
# Configure which authentication keys should be case-insensitive.
# These keys will be downcased upon creating or modifying a user and when used
# to authenticate or find a user. Default is :email.
config.case_insensitive_keys = [ :email ]
# Configure which authentication keys should have whitespace stripped.
# These keys will have whitespace before and after removed upon creating or
# modifying a user and when used to authenticate or find a user. Default is :email.
config.strip_whitespace_keys = [ :email ]
# Tell if authentication through request.params is enabled. True by default.
# config.params_authenticatable = true
# Tell if authentication through HTTP Basic Auth is enabled. False by default.
# config.http_authenticatable = false
# If http headers should be returned for AJAX requests. True by default.
# config.http_authenticatable_on_xhr = true
# The realm used in Http Basic Authentication. "Application" by default.
# config.http_authentication_realm = "Application"
# It will change confirmation, password recovery and other workflows
# to behave the same regardless if the e-mail provided was right or wrong.
# Does not affect registerable.
# config.paranoid = true
# ==> Configuration for :database_authenticatable
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
# using other encryptors, it sets how many times you want the password re-encrypted.
#
# Limiting the stretches to just one in testing will increase the performance of
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
# a value less than 10 in other environments.
config.stretches = Rails.env.test? ? 1 : 10
# Setup a pepper to generate the encrypted password.
# config.pepper = "4e26db4e43573a80f2101e6aa59f13e0e39b899705eaddcb2259b0e7cb654a7e006385742175fb0676b84a26ab6f82f993e013388fa6d8624f8242a2142d920f"
# ==> Configuration for :confirmable
# The time you want to give your user to confirm his account. During this time
# he will be able to access your application without confirming. Default is 0.days
# When confirm_within is zero, the user won't be able to sign in without confirming.
# You can use this to let your user access some features of your application
# without confirming the account, but blocking it after a certain period
# (ie 2 days).
# config.confirm_within = 2.days
# Defines which key will be used when confirming an account
# config.confirmation_keys = [ :email ]
# ==> Configuration for :rememberable
# The time the user will be remembered without asking for credentials again.
# config.remember_for = 2.weeks
# If true, a valid remember token can be re-used between multiple browsers.
# config.remember_across_browsers = true
# If true, extends the user's remember period when remembered via cookie.
# config.extend_remember_period = false
# If true, uses the password salt as remember token. This should be turned
# to false if you are not using database authenticatable.
config.use_salt_as_remember_token = true
# Options to be passed to the created cookie. For instance, you can set
# :secure => true in order to force SSL only cookies.
# config.cookie_options = {}
# ==> Configuration for :validatable
# Range for password length. Default is 6..128.
# config.password_length = 6..128
# Email regex used to validate email formats. It simply asserts that
# an one (and only one) @ exists in the given string. This is mainly
# to give user feedback and not to assert the e-mail validity.
# config.email_regexp = /\A[^@]+@[^@]+\z/
# ==> Configuration for :timeoutable
# The time you want to timeout the user session without activity. After this
# time the user will be asked for credentials again. Default is 30 minutes.
# config.timeout_in = 30.minutes
# ==> Configuration for :lockable
# Defines which strategy will be used to lock an account.
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
# :none = No lock strategy. You should handle locking by yourself.
# config.lock_strategy = :failed_attempts
# Defines which key will be used when locking and unlocking an account
# config.unlock_keys = [ :email ]
# Defines which strategy will be used to unlock an account.
# :email = Sends an unlock link to the user email
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
# :both = Enables both strategies
# :none = No unlock strategy. You should handle unlocking by yourself.
# config.unlock_strategy = :both
# Number of authentication tries before locking an account if lock_strategy
# is failed attempts.
# config.maximum_attempts = 20
# Time interval to unlock the account if :time is enabled as unlock_strategy.
# config.unlock_in = 1.hour
# ==> Configuration for :recoverable
#
# Defines which key will be used when recovering the password for an account
# config.reset_password_keys = [ :email ]
# Time interval you can reset your password with a reset password key.
# Don't put a too small interval or your users won't have the time to
# change their passwords.
config.reset_password_within = 2.hours
# ==> Configuration for :encryptable
# Allow you to use another encryption algorithm besides bcrypt (default). You can use
# :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
# :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
# and :restful_authentication_sha1 (then you should set stretches to 10, and copy
# REST_AUTH_SITE_KEY to pepper)
# config.encryptor = :sha512
# ==> Configuration for :token_authenticatable
# Defines name of the authentication token params key
# config.token_authentication_key = :auth_token
# If true, authentication through token does not store user in session and needs
# to be supplied on each request. Useful if you are using the token as API token.
# config.stateless_token = false
# ==> Scopes configuration
# Turn scoped views on. Before rendering "sessions/new", it will first check for
# "users/sessions/new". It's turned off by default because it's slower if you
# are using only default views.
# config.scoped_views = false
# Configure the default scope given to Warden. By default it's the first
# devise role declared in your routes (usually :user).
# config.default_scope = :user
# Configure sign_out behavior.
# Sign_out action can be scoped (i.e. /users/sign_out affects only :user scope).
# The default is true, which means any logout action will sign out all active scopes.
# config.sign_out_all_scopes = true
# ==> Navigation configuration
# Lists the formats that should be treated as navigational. Formats like
# :html, should redirect to the sign in page when the user does not have
# access, but formats like :xml or :json, should return 401.
#
# If you have any extra navigational formats, like :iphone or :mobile, you
# should add them to the navigational formats lists.
#
# The :"*/*" and "*/*" formats below is required to match Internet
# Explorer requests.
# config.navigational_formats = [:"*/*", "*/*", :html]
# The default HTTP method used to sign out a resource. Default is :delete.
config.sign_out_via = :delete
# ==> OmniAuth
# Add a new OmniAuth provider. Check the wiki for more information on setting
# up on your models and hooks.
# config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
# ==> Warden configuration
# If you want to use other strategies, that are not supported by Devise, or
# change the failure app, you can configure them inside the config.warden block.
#
# config.warden do |manager|
# manager.failure_app = AnotherApp
# manager.intercept_401 = false
# manager.default_strategies(:scope => :user).unshift :some_external_strategy
# end
end

10
config/initializers/inflections.rb

@ -0,0 +1,10 @@
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
# end

5
config/initializers/mime_types.rb

@ -0,0 +1,5 @@
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone

7
config/initializers/secret_token.rb

@ -0,0 +1,7 @@
# Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
Simpledns::Application.config.secret_token = '0ce1f02a4b3fc4d1a1c8d22973b21e8589e9314dc338294953f0b985e3f44f12c8af74f2d9ba6f7c7bdb736c4efc5ea3f8135e23b1a036d033cd23331383ac75'

8
config/initializers/session_store.rb

@ -0,0 +1,8 @@
# Be sure to restart your server when you modify this file.
Simpledns::Application.config.session_store :cookie_store, key: '_simpledns_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rails generate session_migration")
# Simpledns::Application.config.session_store :active_record_store

14
config/initializers/wrap_parameters.rb

@ -0,0 +1,14 @@
# Be sure to restart your server when you modify this file.
#
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
wrap_parameters format: [:json]
end
# Disable root element in JSON by default.
ActiveSupport.on_load(:active_record) do
self.include_root_in_json = false
end

58
config/locales/devise.en.yml

@ -0,0 +1,58 @@
# Additional translations at http://github.com/plataformatec/devise/wiki/I18n
en:
errors:
messages:
expired: "has expired, please request a new one"
not_found: "not found"
already_confirmed: "was already confirmed, please try signing in"
not_locked: "was not locked"
not_saved:
one: "1 error prohibited this %{resource} from being saved:"
other: "%{count} errors prohibited this %{resource} from being saved:"
devise:
failure:
already_authenticated: 'You are already signed in.'
unauthenticated: 'You need to sign in or sign up before continuing.'
unconfirmed: 'You have to confirm your account before continuing.'
locked: 'Your account is locked.'
invalid: 'Invalid email or password.'
invalid_token: 'Invalid authentication token.'
timeout: 'Your session expired, please sign in again to continue.'
inactive: 'Your account was not activated yet.'
sessions:
signed_in: 'Signed in successfully.'
signed_out: 'Signed out successfully.'
passwords:
send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.'
updated: 'Your password was changed successfully. You are now signed in.'
updated_not_active: 'Your password was changed successfully.'
send_paranoid_instructions: "If your e-mail exists on our database, you will receive a password recovery link on your e-mail"
confirmations:
send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
send_paranoid_instructions: 'If your e-mail exists on our database, you will receive an email with instructions about how to confirm your account in a few minutes.'
confirmed: 'Your account was successfully confirmed. You are now signed in.'
registrations:
signed_up: 'Welcome! You have signed up successfully.'
inactive_signed_up: 'You have signed up successfully. However, we could not sign you in because your account is %{reason}.'
updated: 'You updated your account successfully.'
destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
reasons:
inactive: 'inactive'
unconfirmed: 'unconfirmed'
locked: 'locked'
unlocks:
send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
unlocked: 'Your account was successfully unlocked. You are now signed in.'
send_paranoid_instructions: 'If your account exists, you will receive an email with instructions about how to unlock it in a few minutes.'
omniauth_callbacks:
success: 'Successfully authorized from %{kind} account.'
failure: 'Could not authorize you from %{kind} because "%{reason}".'
mailer:
confirmation_instructions:
subject: 'Confirmation instructions'
reset_password_instructions:
subject: 'Reset password instructions'
unlock_instructions:
subject: 'Unlock Instructions'

5
config/locales/en.yml

@ -0,0 +1,5 @@
# Sample localization file for English. Add more files in this directory for other locales.
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
en:
hello: "Hello world"

73
config/routes.rb

@ -0,0 +1,73 @@
Simpledns::Application.routes.draw do
devise_for :users
resources :domains do
as_routes
end
resources :records do
as_routes
end
resources :supermasters do
as_routes
end
root :to => lambda { |env| [200, {'Content-Type' => 'text/plain'}, ["Hello world!"]] }
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Sample resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Sample resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Sample resource route with more complex sub-resources
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', :on => :collection
# end
# end
# Sample resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
# root :to => 'welcome#index'
# See how all your routes lay out with "rake routes"
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
# match ':controller(/:action(/:id(.:format)))'
end

28
db/migrate/20110917082609_devise_create_users.rb

@ -0,0 +1,28 @@
class DeviseCreateUsers < ActiveRecord::Migration
def self.up
create_table(:users) do |t|
t.database_authenticatable :null => false
t.recoverable
t.rememberable
t.trackable
t.confirmable
t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both
# t.encryptable
# t.token_authenticatable
t.timestamps
end
add_index :users, :email, :unique => true
add_index :users, :reset_password_token, :unique => true
add_index :users, :confirmation_token, :unique => true
add_index :users, :unlock_token, :unique => true
# add_index :users, :authentication_token, :unique => true
end
def self.down
drop_table :users
end
end

16
db/migrate/20110917084645_create_domains.rb

@ -0,0 +1,16 @@
class CreateDomains < ActiveRecord::Migration
def change
create_table :domains do |t|
t.string :name, :limit => 255, :null => false
t.string :master, :limit => 128
t.integer :last_check, :limit => 50, :null => false
t.string :type, :limit => 6, :null => false
t.integer :notified_serial
t.string :account, :limit => 40
t.timestamps
end
add_index :domains, :name, :name => 'name_index'
end
end

19
db/migrate/20110917084816_create_records.rb

@ -0,0 +1,19 @@
class CreateRecords < ActiveRecord::Migration
def change
create_table :records do |t|
t.references :domain
t.string :name, :limit => 255
t.string :type, :limit => 10
t.string :content, :limit => 255
t.integer :ttl
t.integer :prio
t.integer :change_date
t.timestamps
end
add_index :records, :name, :name => 'rec_name_index'
add_index :records, [:name, :type], :name => 'nametype_index'
add_index :records, :domain_id, :name => 'domain_id'
end
end

11
db/migrate/20110917084834_create_supermasters.rb

@ -0,0 +1,11 @@
class CreateSupermasters < ActiveRecord::Migration
def change
create_table :supermasters do |t|
t.string :ip, :limit => 25, :null => false
t.string :nameserver, :limit => 25, :null => false
t.string :account, :limit => 255
t.timestamps
end
end
end

79
db/schema.rb

@ -0,0 +1,79 @@
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20110917084834) do
create_table "domains", :force => true do |t|
t.string "name", :null => false
t.string "master", :limit => 128
t.integer "last_check", :limit => 50, :null => false
t.string "type", :limit => 6, :null => false
t.integer "notified_serial"
t.string "account", :limit => 40
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "domains", ["name"], :name => "name_index"
create_table "records", :force => true do |t|
t.integer "domain_id"
t.string "name"
t.string "type", :limit => 10
t.string "content"
t.integer "ttl"
t.integer "prio"
t.integer "change_date"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "records", ["domain_id"], :name => "domain_id"
add_index "records", ["name", "type"], :name => "nametype_index"
add_index "records", ["name"], :name => "rec_name_index"
create_table "supermasters", :force => true do |t|
t.string "ip", :limit => 25, :null => false
t.string "nameserver", :limit => 25, :null => false
t.string "account"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "users", :force => true do |t|
t.string "email", :default => "", :null => false
t.string "encrypted_password", :limit => 128, :default => "", :null => false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", :default => 0
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.string "confirmation_token"
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
t.integer "failed_attempts", :default => 0
t.string "unlock_token"
t.datetime "locked_at"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "users", ["confirmation_token"], :name => "index_users_on_confirmation_token", :unique => true
add_index "users", ["email"], :name => "index_users_on_email", :unique => true
add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
add_index "users", ["unlock_token"], :name => "index_users_on_unlock_token", :unique => true
end

3
db/seeds.rb

@ -0,0 +1,3 @@
User.create :email => 'user@app.com',
:password => 'useruser',
:password_confirmation => 'useruser'

2
doc/README_FOR_APP

@ -0,0 +1,2 @@
Use this README file to introduce your application and point to useful places in the API for learning more.
Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries.

0
lib/assets/.gitkeep

0
lib/tasks/.gitkeep

0
log/.gitkeep

26
public/404.html

@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<title>The page you were looking for doesn't exist (404)</title>
<style type="text/css">
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
div.dialog {
width: 25em;
padding: 0 4em;
margin: 4em auto 0 auto;
border: 1px solid #ccc;
border-right-color: #999;
border-bottom-color: #999;
}
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
</style>
</head>
<body>
<!-- This file lives in public/404.html -->
<div class="dialog">
<h1>The page you were looking for doesn't exist.</h1>
<p>You may have mistyped the address or the page may have moved.</p>
</div>
</body>
</html>

26
public/422.html

@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<title>The change you wanted was rejected (422)</title>
<style type="text/css">
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
div.dialog {
width: 25em;
padding: 0 4em;
margin: 4em auto 0 auto;
border: 1px solid #ccc;
border-right-color: #999;
border-bottom-color: #999;
}
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
</style>
</head>
<body>
<!-- This file lives in public/422.html -->
<div class="dialog">
<h1>The change you wanted was rejected.</h1>
<p>Maybe you tried to change something you didn't have access to.</p>
</div>
</body>
</html>

26
public/500.html

@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<title>We're sorry, but something went wrong (500)</title>
<style type="text/css">
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
div.dialog {
width: 25em;
padding: 0 4em;
margin: 4em auto 0 auto;
border: 1px solid #ccc;
border-right-color: #999;
border-bottom-color: #999;
}
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
</style>
</head>
<body>
<!-- This file lives in public/500.html -->
<div class="dialog">
<h1>We're sorry, but something went wrong.</h1>
<p>We've been notified about this issue and we'll take a look at it shortly.</p>
</div>
</body>
</html>

0
public/favicon.ico

5
public/robots.txt

@ -0,0 +1,5 @@
# See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
#
# To ban all spiders from the entire site uncomment the next two lines:
# User-Agent: *
# Disallow: /

6
script/rails

@ -0,0 +1,6 @@
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
APP_PATH = File.expand_path('../../config/application', __FILE__)
require File.expand_path('../../config/boot', __FILE__)
require 'rails/commands'

157
spec/controllers/domains_controller_spec.rb

@ -0,0 +1,157 @@
require 'spec_helper'
# This spec was generated by rspec-rails when you ran the scaffold generator.
# It demonstrates how one might use RSpec to specify the controller code that
# was generated by Rails when you ran the scaffold generator.
#
# It assumes that the implementation code is generated by the rails scaffold
# generator. If you are using any extension libraries to generate different
# controller code, this generated spec may or may not pass.
#
# It only uses APIs available in rails and/or rspec-rails. There are a number
# of tools you can use to make these specs even more expressive, but we're
# sticking to rails and rspec-rails APIs to keep things simple and stable.
#
# Compared to earlier versions of this generator, there is very limited use of
# stubs and message expectations in this spec. Stubs are only used when there
# is no simpler way to get a handle on the object needed for the example.
# Message expectations are only used when there is no simpler way to specify
# that an instance is receiving a specific message.
describe DomainsController do
# This should return the minimal set of attributes required to create a valid
# Domain. As you add validations to Domain, be sure to
# update the return value of this method accordingly.
def valid_attributes
{}
end
describe "GET index" do
it "assigns all domains as @domains" do
domain = Domain.create! valid_attributes
get :index
assigns(:domains).should eq([domain])
end
end
describe "GET show" do
it "assigns the requested domain as @domain" do
domain = Domain.create! valid_attributes
get :show, :id => domain.id.to_s
assigns(:domain).should eq(domain)
end
end
describe "GET new" do
it "assigns a new domain as @domain" do
get :new
assigns(:domain).should be_a_new(Domain)
end
end
describe "GET edit" do
it "assigns the requested domain as @domain" do
domain = Domain.create! valid_attributes
get :edit, :id => domain.id.to_s
assigns(:domain).should eq(domain)
end
end
describe "POST create" do
describe "with valid params" do
it "creates a new Domain" do
expect {
post :create, :domain => valid_attributes
}.to change(Domain, :count).by(1)
end
it "assigns a newly created domain as @domain" do
post :create, :domain => valid_attributes
assigns(:domain).should be_a(Domain)
assigns(:domain).should be_persisted
end
it "redirects to the created domain" do
post :create, :domain => valid_attributes
response.should redirect_to(Domain.last)
end
end
describe "with invalid params" do
it "assigns a newly created but unsaved domain as @domain" do
# Trigger the behavior that occurs when invalid params are submitted
Domain.any_instance.stub(:save).and_return(false)
post :create, :domain => {}
assigns(:domain).should be_a_new(Domain)
end
it "re-renders the 'new' template" do
# Trigger the behavior that occurs when invalid params are submitted
Domain.any_instance.stub(:save).and_return(false)
post :create, :domain => {}
response.should render_template("new")
end
end
end
describe "PUT update" do
describe "with valid params" do
it "updates the requested domain" do
domain = Domain.create! valid_attributes
# Assuming there are no other domains in the database, this
# specifies that the Domain created on the previous line
# receives the :update_attributes message with whatever params are
# submitted in the request.
Domain.any_instance.should_receive(:update_attributes).with({'these' => 'params'})
put :update, :id => domain.id, :domain => {'these' => 'params'}
end
it "assigns the requested domain as @domain" do
domain = Domain.create! valid_attributes
put :update, :id => domain.id, :domain => valid_attributes
assigns(:domain).should eq(domain)
end
it "redirects to the domain" do
domain = Domain.create! valid_attributes
put :update, :id => domain.id, :domain => valid_attributes
response.should redirect_to(domain)
end
end
describe "with invalid params" do
it "assigns the domain as @domain" do
domain = Domain.create! valid_attributes
# Trigger the behavior that occurs when invalid params are submitted
Domain.any_instance.stub(:save).and_return(false)
put :update, :id => domain.id.to_s, :domain => {}
assigns(:domain).should eq(domain)
end
it "re-renders the 'edit' template" do
domain = Domain.create! valid_attributes
# Trigger the behavior that occurs when invalid params are submitted
Domain.any_instance.stub(:save).and_return(false)
put :update, :id => domain.id.to_s, :domain => {}
response.should render_template("edit")
end
end
end
describe "DELETE destroy" do
it "destroys the requested domain" do
domain = Domain.create! valid_attributes
expect {
delete :destroy, :id => domain.id.to_s
}.to change(Domain, :count).by(-1)
end
it "redirects to the domains list" do
domain = Domain.create! valid_attributes
delete :destroy, :id => domain.id.to_s
response.should redirect_to(domains_url)
end
end
end

157
spec/controllers/records_controller_spec.rb

@ -0,0 +1,157 @@
require 'spec_helper'
# This spec was generated by rspec-rails when you ran the scaffold generator.
# It demonstrates how one might use RSpec to specify the controller code that
# was generated by Rails when you ran the scaffold generator.
#
# It assumes that the implementation code is generated by the rails scaffold
# generator. If you are using any extension libraries to generate different
# controller code, this generated spec may or may not pass.
#
# It only uses APIs available in rails and/or rspec-rails. There are a number
# of tools you can use to make these specs even more expressive, but we're
# sticking to rails and rspec-rails APIs to keep things simple and stable.
#
# Compared to earlier versions of this generator, there is very limited use of
# stubs and message expectations in this spec. Stubs are only used when there
# is no simpler way to get a handle on the object needed for the example.
# Message expectations are only used when there is no simpler way to specify
# that an instance is receiving a specific message.
describe RecordsController do
# This should return the minimal set of attributes required to create a valid
# Record. As you add validations to Record, be sure to
# update the return value of this method accordingly.
def valid_attributes
{}
end
describe "GET index" do
it "assigns all records as @records" do
record = Record.create! valid_attributes
get :index
assigns(:records).should eq([record])
end
end
describe "GET show" do
it "assigns the requested record as @record" do
record = Record.create! valid_attributes
get :show, :id => record.id.to_s
assigns(:record).should eq(record)
end
end
describe "GET new" do
it "assigns a new record as @record" do
get :new
assigns(:record).should be_a_new(Record)
end
end
describe "GET edit" do
it "assigns the requested record as @record" do
record = Record.create! valid_attributes
get :edit, :id => record.id.to_s
assigns(:record).should eq(record)
end
end
describe "POST create" do
describe "with valid params" do
it "creates a new Record" do
expect {
post :create, :record => valid_attributes
}.to change(Record, :count).by(1)
end
it "assigns a newly created record as @record" do
post :create, :record => valid_attributes
assigns(:record).should be_a(Record)
assigns(:record).should be_persisted
end
it "redirects to the created record" do
post :create, :record => valid_attributes
response.should redirect_to(Record.last)
end
end
describe "with invalid params" do
it "assigns a newly created but unsaved record as @record" do
# Trigger the behavior that occurs when invalid params are submitted
Record.any_instance.stub(:save).and_return(false)
post :create, :record => {}
assigns(:record).should be_a_new(Record)
end
it "re-renders the 'new' template" do
# Trigger the behavior that occurs when invalid params are submitted
Record.any_instance.stub(:save).and_return(false)
post :create, :record => {}
response.should render_template("new")
end
end
end
describe "PUT update" do
describe "with valid params" do
it "updates the requested record" do
record = Record.create! valid_attributes
# Assuming there are no other records in the database, this
# specifies that the Record created on the previous line
# receives the :update_attributes message with whatever params are
# submitted in the request.
Record.any_instance.should_receive(:update_attributes).with({'these' => 'params'})
put :update, :id => record.id, :record => {'these' => 'params'}
end
it "assigns the requested record as @record" do
record = Record.create! valid_attributes
put :update, :id => record.id, :record => valid_attributes
assigns(:record).should eq(record)
end
it "redirects to the record" do
record = Record.create! valid_attributes
put :update, :id => record.id, :record => valid_attributes
response.should redirect_to(record)
end
end
describe "with invalid params" do
it "assigns the record as @record" do
record = Record.create! valid_attributes
# Trigger the behavior that occurs when invalid params are submitted
Record.any_instance.stub(:save).and_return(false)
put :update, :id => record.id.to_s, :record => {}
assigns(:record).should eq(record)
end
it "re-renders the 'edit' template" do
record = Record.create! valid_attributes
# Trigger the behavior that occurs when invalid params are submitted
Record.any_instance.stub(:save).and_return(false)
put :update, :id => record.id.to_s, :record => {}
response.should render_template("edit")
end
end
end
describe "DELETE destroy" do
it "destroys the requested record" do
record = Record.create! valid_attributes
expect {
delete :destroy, :id => record.id.to_s
}.to change(Record, :count).by(-1)
end
it "redirects to the records list" do
record = Record.create! valid_attributes
delete :destroy, :id => record.id.to_s
response.should redirect_to(records_url)
end
end
end

157
spec/controllers/supermasters_controller_spec.rb

@ -0,0 +1,157 @@
require 'spec_helper'
# This spec was generated by rspec-rails when you ran the scaffold generator.
# It demonstrates how one might use RSpec to specify the controller code that
# was generated by Rails when you ran the scaffold generator.
#
# It assumes that the implementation code is generated by the rails scaffold
# generator. If you are using any extension libraries to generate different
# controller code, this generated spec may or may not pass.
#
# It only uses APIs available in rails and/or rspec-rails. There are a number
# of tools you can use to make these specs even more expressive, but we're
# sticking to rails and rspec-rails APIs to keep things simple and stable.
#
# Compared to earlier versions of this generator, there is very limited use of
# stubs and message expectations in this spec. Stubs are only used when there
# is no simpler way to get a handle on the object needed for the example.
# Message expectations are only used when there is no simpler way to specify
# that an instance is receiving a specific message.
describe SupermastersController do
# This should return the minimal set of attributes required to create a valid
# Supermaster. As you add validations to Supermaster, be sure to
# update the return value of this method accordingly.
def valid_attributes
{}
end
describe "GET index" do
it "assigns all supermasters as @supermasters" do
supermaster = Supermaster.create! valid_attributes
get :index
assigns(:supermasters).should eq([supermaster])
end
end
describe "GET show" do
it "assigns the requested supermaster as @supermaster" do
supermaster = Supermaster.create! valid_attributes
get :show, :id => supermaster.id.to_s
assigns(:supermaster).should eq(supermaster)
end
end
describe "GET new" do
it "assigns a new supermaster as @supermaster" do
get :new
assigns(:supermaster).should be_a_new(Supermaster)
end
end
describe "GET edit" do
it "assigns the requested supermaster as @supermaster" do
supermaster = Supermaster.create! valid_attributes
get :edit, :id => supermaster.id.to_s
assigns(:supermaster).should eq(supermaster)
end
end
describe "POST create" do
describe "with valid params" do
it "creates a new Supermaster" do
expect {
post :create, :supermaster => valid_attributes
}.to change(Supermaster, :count).by(1)
end
it "assigns a newly created supermaster as @supermaster" do
post :create, :supermaster => valid_attributes
assigns(:supermaster).should be_a(Supermaster)
assigns(:supermaster).should be_persisted
end
it "redirects to the created supermaster" do
post :create, :supermaster => valid_attributes
response.should redirect_to(Supermaster.last)
end
end
describe "with invalid params" do
it "assigns a newly created but unsaved supermaster as @supermaster" do
# Trigger the behavior that occurs when invalid params are submitted
Supermaster.any_instance.stub(:save).and_return(false)
post :create, :supermaster => {}
assigns(:supermaster).should be_a_new(Supermaster)
end
it "re-renders the 'new' template" do
# Trigger the behavior that occurs when invalid params are submitted
Supermaster.any_instance.stub(:save).and_return(false)
post :create, :supermaster => {}
response.should render_template("new")
end
end
end
describe "PUT update" do
describe "with valid params" do
it "updates the requested supermaster" do
supermaster = Supermaster.create! valid_attributes
# Assuming there are no other supermasters in the database, this
# specifies that the Supermaster created on the previous line
# receives the :update_attributes message with whatever params are
# submitted in the request.
Supermaster.any_instance.should_receive(:update_attributes).with({'these' => 'params'})
put :update, :id => supermaster.id, :supermaster => {'these' => 'params'}
end
it "assigns the requested supermaster as @supermaster" do
supermaster = Supermaster.create! valid_attributes
put :update, :id => supermaster.id, :supermaster => valid_attributes
assigns(:supermaster).should eq(supermaster)
end
it "redirects to the supermaster" do
supermaster = Supermaster.create! valid_attributes
put :update, :id => supermaster.id, :supermaster => valid_attributes
response.should redirect_to(supermaster)
end
end
describe "with invalid params" do
it "assigns the supermaster as @supermaster" do
supermaster = Supermaster.create! valid_attributes
# Trigger the behavior that occurs when invalid params are submitted
Supermaster.any_instance.stub(:save).and_return(false)
put :update, :id => supermaster.id.to_s, :supermaster => {}
assigns(:supermaster).should eq(supermaster)
end
it "re-renders the 'edit' template" do
supermaster = Supermaster.create! valid_attributes
# Trigger the behavior that occurs when invalid params are submitted
Supermaster.any_instance.stub(:save).and_return(false)
put :update, :id => supermaster.id.to_s, :supermaster => {}
response.should render_template("edit")
end
end
end
describe "DELETE destroy" do
it "destroys the requested supermaster" do
supermaster = Supermaster.create! valid_attributes
expect {
delete :destroy, :id => supermaster.id.to_s
}.to change(Supermaster, :count).by(-1)
end
it "redirects to the supermasters list" do
supermaster = Supermaster.create! valid_attributes
delete :destroy, :id => supermaster.id.to_s
response.should redirect_to(supermasters_url)
end
end
end

15
spec/helpers/domains_helper_spec.rb

@ -0,0 +1,15 @@
require 'spec_helper'
# Specs in this file have access to a helper object that includes
# the DomainsHelper. For example:
#
# describe DomainsHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# helper.concat_strings("this","that").should == "this that"
# end
# end
# end
describe DomainsHelper do
pending "add some examples to (or delete) #{__FILE__}"
end

15
spec/helpers/records_helper_spec.rb

@ -0,0 +1,15 @@
require 'spec_helper'
# Specs in this file have access to a helper object that includes
# the RecordsHelper. For example:
#
# describe RecordsHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# helper.concat_strings("this","that").should == "this that"
# end
# end
# end
describe RecordsHelper do
pending "add some examples to (or delete) #{__FILE__}"
end

15
spec/helpers/supermasters_helper_spec.rb

@ -0,0 +1,15 @@
require 'spec_helper'
# Specs in this file have access to a helper object that includes
# the SupermastersHelper. For example:
#
# describe SupermastersHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# helper.concat_strings("this","that").should == "this that"
# end
# end
# end
describe SupermastersHelper do
pending "add some examples to (or delete) #{__FILE__}"
end

5
spec/models/domain_spec.rb

@ -0,0 +1,5 @@
require 'spec_helper'
describe Domain do
pending "add some examples to (or delete) #{__FILE__}"
end

5
spec/models/record_spec.rb

@ -0,0 +1,5 @@
require 'spec_helper'
describe Record do
pending "add some examples to (or delete) #{__FILE__}"
end

5
spec/models/supermaster_spec.rb

@ -0,0 +1,5 @@
require 'spec_helper'
describe Supermaster do
pending "add some examples to (or delete) #{__FILE__}"
end

5
spec/models/user_spec.rb

@ -0,0 +1,5 @@
require 'spec_helper'
describe User do
pending "add some examples to (or delete) #{__FILE__}"
end

11
spec/requests/domains_spec.rb

@ -0,0 +1,11 @@
require 'spec_helper'
describe "Domains" do
describe "GET /domains" do
it "works! (now write some real specs)" do
# Run the generator again with the --webrat flag if you want to use webrat methods/matchers
get domains_path
response.status.should be(200)
end
end
end

11
spec/requests/records_spec.rb

@ -0,0 +1,11 @@
require 'spec_helper'
describe "Records" do
describe "GET /records" do
it "works! (now write some real specs)" do
# Run the generator again with the --webrat flag if you want to use webrat methods/matchers
get records_path
response.status.should be(200)
end
end
end

11
spec/requests/supermasters_spec.rb

@ -0,0 +1,11 @@
require 'spec_helper'
describe "Supermasters" do
describe "GET /supermasters" do
it "works! (now write some real specs)" do
# Run the generator again with the --webrat flag if you want to use webrat methods/matchers
get supermasters_path
response.status.should be(200)
end
end
end

35
spec/routing/domains_routing_spec.rb

@ -0,0 +1,35 @@
require "spec_helper"
describe DomainsController do
describe "routing" do
it "routes to #index" do
get("/domains").should route_to("domains#index")
end
it "routes to #new" do
get("/domains/new").should route_to("domains#new")
end
it "routes to #show" do
get("/domains/1").should route_to("domains#show", :id => "1")
end
it "routes to #edit" do
get("/domains/1/edit").should route_to("domains#edit", :id => "1")
end
it "routes to #create" do
post("/domains").should route_to("domains#create")
end
it "routes to #update" do
put("/domains/1").should route_to("domains#update", :id => "1")
end
it "routes to #destroy" do
delete("/domains/1").should route_to("domains#destroy", :id => "1")
end
end
end

35
spec/routing/records_routing_spec.rb

@ -0,0 +1,35 @@
require "spec_helper"
describe RecordsController do
describe "routing" do
it "routes to #index" do
get("/records").should route_to("records#index")
end
it "routes to #new" do
get("/records/new").should route_to("records#new")
end
it "routes to #show" do
get("/records/1").should route_to("records#show", :id => "1")
end
it "routes to #edit" do
get("/records/1/edit").should route_to("records#edit", :id => "1")
end
it "routes to #create" do
post("/records").should route_to("records#create")
end
it "routes to #update" do
put("/records/1").should route_to("records#update", :id => "1")
end
it "routes to #destroy" do
delete("/records/1").should route_to("records#destroy", :id => "1")
end
end
end

35
spec/routing/supermasters_routing_spec.rb

@ -0,0 +1,35 @@
require "spec_helper"
describe SupermastersController do
describe "routing" do
it "routes to #index" do
get("/supermasters").should route_to("supermasters#index")
end
it "routes to #new" do
get("/supermasters/new").should route_to("supermasters#new")
end
it "routes to #show" do
get("/supermasters/1").should route_to("supermasters#show", :id => "1")
end
it "routes to #edit" do
get("/supermasters/1/edit").should route_to("supermasters#edit", :id => "1")
end
it "routes to #create" do
post("/supermasters").should route_to("supermasters#create")
end
it "routes to #update" do
put("/supermasters/1").should route_to("supermasters#update", :id => "1")
end
it "routes to #destroy" do
delete("/supermasters/1").should route_to("supermasters#destroy", :id => "1")
end
end
end

15
spec/views/domains/edit.html.erb_spec.rb

@ -0,0 +1,15 @@
require 'spec_helper'
describe "domains/edit.html.erb" do
before(:each) do
@domain = assign(:domain, stub_model(Domain))
end
it "renders the edit domain form" do
render
# Run the generator again with the --webrat flag if you want to use webrat matchers
assert_select "form", :action => domains_path(@domain), :method => "post" do
end
end
end

14
spec/views/domains/index.html.erb_spec.rb

@ -0,0 +1,14 @@
require 'spec_helper'
describe "domains/index.html.erb" do
before(:each) do
assign(:domains, [
stub_model(Domain),
stub_model(Domain)
])
end
it "renders a list of domains" do
render
end
end

15
spec/views/domains/new.html.erb_spec.rb

@ -0,0 +1,15 @@
require 'spec_helper'
describe "domains/new.html.erb" do
before(:each) do
assign(:domain, stub_model(Domain).as_new_record)
end
it "renders new domain form" do
render
# Run the generator again with the --webrat flag if you want to use webrat matchers
assert_select "form", :action => domains_path, :method => "post" do
end
end
end

11
spec/views/domains/show.html.erb_spec.rb

@ -0,0 +1,11 @@
require 'spec_helper'
describe "domains/show.html.erb" do
before(:each) do
@domain = assign(:domain, stub_model(Domain))
end
it "renders attributes in <p>" do
render
end
end

15
spec/views/records/edit.html.erb_spec.rb

@ -0,0 +1,15 @@
require 'spec_helper'
describe "records/edit.html.erb" do
before(:each) do
@record = assign(:record, stub_model(Record))
end
it "renders the edit record form" do
render
# Run the generator again with the --webrat flag if you want to use webrat matchers
assert_select "form", :action => records_path(@record), :method => "post" do
end
end
end

14
spec/views/records/index.html.erb_spec.rb

@ -0,0 +1,14 @@
require 'spec_helper'
describe "records/index.html.erb" do
before(:each) do
assign(:records, [
stub_model(Record),
stub_model(Record)
])
end
it "renders a list of records" do
render
end
end

15
spec/views/records/new.html.erb_spec.rb

@ -0,0 +1,15 @@
require 'spec_helper'
describe "records/new.html.erb" do
before(:each) do
assign(:record, stub_model(Record).as_new_record)
end
it "renders new record form" do
render
# Run the generator again with the --webrat flag if you want to use webrat matchers
assert_select "form", :action => records_path, :method => "post" do
end
end
end

11
spec/views/records/show.html.erb_spec.rb

@ -0,0 +1,11 @@
require 'spec_helper'
describe "records/show.html.erb" do
before(:each) do
@record = assign(:record, stub_model(Record))
end
it "renders attributes in <p>" do
render
end
end

15
spec/views/supermasters/edit.html.erb_spec.rb

@ -0,0 +1,15 @@
require 'spec_helper'
describe "supermasters/edit.html.erb" do
before(:each) do
@supermaster = assign(:supermaster, stub_model(Supermaster))
end
it "renders the edit supermaster form" do
render
# Run the generator again with the --webrat flag if you want to use webrat matchers
assert_select "form", :action => supermasters_path(@supermaster), :method => "post" do
end
end
end

14
spec/views/supermasters/index.html.erb_spec.rb

@ -0,0 +1,14 @@
require 'spec_helper'
describe "supermasters/index.html.erb" do
before(:each) do
assign(:supermasters, [
stub_model(Supermaster),
stub_model(Supermaster)
])
end
it "renders a list of supermasters" do
render
end
end

15
spec/views/supermasters/new.html.erb_spec.rb

@ -0,0 +1,15 @@
require 'spec_helper'
describe "supermasters/new.html.erb" do
before(:each) do
assign(:supermaster, stub_model(Supermaster).as_new_record)
end
it "renders new supermaster form" do
render
# Run the generator again with the --webrat flag if you want to use webrat matchers
assert_select "form", :action => supermasters_path, :method => "post" do
end
end
end

11
spec/views/supermasters/show.html.erb_spec.rb

@ -0,0 +1,11 @@
require 'spec_helper'
describe "supermasters/show.html.erb" do
before(:each) do
@supermaster = assign(:supermaster, stub_model(Supermaster))
end
it "renders attributes in <p>" do
render
end
end

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save