- <%= link_to t(:chart_of_accounts, :scope => :layout), accounts_path %> diff --git a/config.ru b/config.ru new file mode 100644 index 0000000..e809629 --- /dev/null +++ b/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 Lodo::Application diff --git a/config/application.rb b/config/application.rb new file mode 100644 index 0000000..c18cbf0 --- /dev/null +++ b/config/application.rb @@ -0,0 +1,76 @@ +require File.expand_path('../boot', __FILE__) + +require 'rails/all' + +# If you have a Gemfile, require the gems listed there, including any gems +# you've limited to :test, :development, or :production. +Bundler.require(:default, Rails.env) if defined?(Bundler) + +module Lodo + 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. + + # Add additional load paths for your own custom dirs + # config.load_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 generators values. Many other options are available, be sure to check the documentation. + # config.generators do |g| + # g.orm :active_record + # g.template_engine :erb + # g.test_framework :test_unit, :fixture => true + # end + + # 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] + + config.time_zone = 'UTC' + + # The internationalization framework can be changed to have another default locale (standard is :en) or more load paths. + # All files from config/locales/*.rb,yml are added automatically. + # config.i18n.load_path << Dir[File.join(RAILS_ROOT, 'my', 'locales', '*.{rb,yml}')] + # config.i18n.default_locale = :de + config.i18n.default_locale = :nb + + # Your secret key for verifying cookie session data integrity. + # If you change this key, all old sessions 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. + config.action_dispatch.session = { + :session_key => '_lodo3_session', + :secret => '29e52c8e64c464b41e52b98c9cceb4e43d1d8870df42124cd96be3c4004179720c0326431b0126f1f27d9c65bd834d1028c8f745ddcc8484e32ff0ac3e7d75fa' + } + + end +end + + + +ActionMailer::Base.delivery_method = :smtp +ActionMailer::Base.smtp_settings = { + :address => "mail.freecodeint.com", + :port => 25, + # :domain => "freecode.no", + # :user_name => "axel.liljencrantz@freecode.no", + # :password => "MyPassword", + :authentication => :plain +} diff --git a/config/boot.rb b/config/boot.rb index 0a51688..712b098 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,109 +1,6 @@ -# Don't change this file! -# Configure your app in config/environment.rb and config/environments/*.rb - -RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) - -module Rails - class << self - def boot! - unless booted? - preinitialize - pick_boot.run - end - end - - def booted? - defined? Rails::Initializer - end - - def pick_boot - (vendor_rails? ? VendorBoot : GemBoot).new - end - - def vendor_rails? - File.exist?("#{RAILS_ROOT}/vendor/rails") - end - - def preinitialize - load(preinitializer_path) if File.exist?(preinitializer_path) - end - - def preinitializer_path - "#{RAILS_ROOT}/config/preinitializer.rb" - end - end - - class Boot - def run - load_initializer - Rails::Initializer.run(:set_load_path) - end - end - - class VendorBoot < Boot - def load_initializer - require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer" - Rails::Initializer.run(:install_gem_spec_stubs) - end - end - - class GemBoot < Boot - def load_initializer - self.class.load_rubygems - load_rails_gem - require 'initializer' - end - - def load_rails_gem - if version = self.class.gem_version - gem 'rails', version - else - gem 'rails' - end - rescue Gem::LoadError => load_error - $stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.) - exit 1 - end - - class << self - def rubygems_version - Gem::RubyGemsVersion rescue nil - end - - def gem_version - if defined? RAILS_GEM_VERSION - RAILS_GEM_VERSION - elsif ENV.include?('RAILS_GEM_VERSION') - ENV['RAILS_GEM_VERSION'] - else - parse_gem_version(read_environment_rb) - end - end - - def load_rubygems - require 'rubygems' - min_version = '1.3.1' - unless rubygems_version >= min_version - $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.) - exit 1 - end - - rescue LoadError - $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org) - exit 1 - end - - def parse_gem_version(text) - $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/ - end - - private - def read_environment_rb - File.read("#{RAILS_ROOT}/config/environment.rb") - end - end - end +require 'rubygems' +# Set up gems listed in the Gemfile. +if File.exist?(File.expand_path('../../Gemfile', __FILE__)) + require 'bundler' + Bundler.setup end - -# All that for this: -Rails.boot! diff --git a/config/database.yml.example b/config/database.yml.example index acb89cd..66fdd64 100644 --- a/config/database.yml.example +++ b/config/database.yml.example @@ -15,10 +15,22 @@ # And be sure to use new-style password hashing: # http://dev.mysql.com/doc/refman/5.0/en/old-client.html development: - adapter: mysql + adapter: postgresql encoding: utf8 - database: lodo + database: lodo_dev + pool: 5 + +# 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: postgresql + encoding: utf8 + database: lodo_test + pool: 5 + +production: + adapter: postgresql + encoding: utf8 + database: lodo_prod pool: 5 - username: root - password: SOMETHINGYOUWANNAKNOW - host: localhost diff --git a/config/environment.rb b/config/environment.rb index 3022752..40d860c 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,99 +1,5 @@ -# Be sure to restart your server when you modify this file - -# Uncomment below to force Rails into production mode when -# you don't control web/app server and can't set it the proper way -# ENV['RAILS_ENV'] ||= 'production' - -# Specifies gem version of Rails to use when vendor/rails is not present -RAILS_GEM_VERSION = '2.3.8' unless defined? RAILS_GEM_VERSION - -# Bootstrap the Rails environment, frameworks, and default configuration -require File.join(File.dirname(__FILE__), 'boot') - -Rails::Initializer.run do |config| - # 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. - # See Rails::Configuration for more options. - - # Skip frameworks you're not going to use. To use Rails without a database - # you must remove the Active Record framework. - # config.frameworks -= [ :active_record, :active_resource, :action_mailer ] - - # Specify gems that this application depends on. - # They can then be installed with "rake gems:install" on new installations. - # You have to specify the :lib option for libraries, where the Gem name (sqlite3-ruby) differs from the file itself (sqlite3) - # config.gem "bj" - # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net" - # config.gem "sqlite3-ruby", :lib => "sqlite3" - # config.gem "aws-s3", :lib => "aws/s3" - - config.gem "pg" #postgresql - config.gem "machinist" - config.gem "faker" - - config.gem "devise", "1.0.7" - config.gem "warden" - - config.gem "declarative_authorization" - - # Only load the plugins named here, in the order given. By default, all plugins - # in vendor/plugins are loaded in alphabetical order. - # :all can be used as a placeholder for all plugins not explicitly named - # config.plugins = [ :exception_notification, :ssl_requirement, :all ] - - # Add additional load paths for your own custom dirs - # config.load_paths += %W( #{RAILS_ROOT}/extras ) - - # Force all environments to use the same logger level - # (by default production uses :info, the others :debug) - # config.log_level = :debug - - # Make Time.zone default to the specified zone, and make Active Record store time values - # in the database in UTC, and return them converted to the specified local zone. - # Run "rake -D time" for a list of tasks for finding time zone names. Comment line to use default local time. - config.time_zone = 'UTC' - - # The internationalization framework can be changed to have another default locale (standard is :en) or more load paths. - # All files from config/locales/*.rb,yml are added automatically. - # config.i18n.load_path << Dir[File.join(RAILS_ROOT, 'my', 'locales', '*.{rb,yml}')] - # config.i18n.default_locale = :de - config.i18n.default_locale = :nb - - # Your secret key for verifying cookie session data integrity. - # If you change this key, all old sessions 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. - config.action_controller.session = { - :session_key => '_lodo3_session', - :secret => '29e52c8e64c464b41e52b98c9cceb4e43d1d8870df42124cd96be3c4004179720c0326431b0126f1f27d9c65bd834d1028c8f745ddcc8484e32ff0ac3e7d75fa' - } - - # 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 "rake db:sessions:create") - # config.action_controller.session_store = :active_record_store - #config.action_controller.session_store = :active_record_store - config.action_controller.session_store = :cookie_store - - # 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 - - # Activate observers that should always be running - # Please note that observers generated using script/generate observer need to have an _observer suffix - # config.active_record.observers = :cacher, :garbage_collector, :forum_observer - - config.action_mailer.delivery_method = :smtp - config.action_mailer.smtp_settings = { - :address => "mail.freecodeint.com", - :port => 25, - # :domain => "freecode.no", - # :user_name => "axel.liljencrantz@freecode.no", - # :password => "MyPassword", - :authentication => :plain - } - -end +# Load the rails application +require File.expand_path('../application', __FILE__) +# Initialize the rails application +Lodo::Application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb index cf3aa45..c3cf97e 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,20 +1,19 @@ -# Settings specified here will take precedence over those in config/environment.rb +Lodo::Application.configure do + # Settings specified here will take precedence over those in config/environment.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 webserver when you make code changes. -config.cache_classes = false + # 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 webserver when you make code changes. + config.cache_classes = false -# Log error messages when you accidentally call methods on nil. -config.whiny_nils = true + # Log error messages when you accidentally call methods on nil. + config.whiny_nils = true -# Show full error reports and disable caching -config.action_controller.consider_all_requests_local = true -config.action_view.debug_rjs = true -config.action_controller.perform_caching = false - -# Don't care if the mailer can't send -config.action_mailer.raise_delivery_errors = false - -config.action_mailer.default_url_options = {:host => "localhost:3000"} + # Show full error reports and disable caching + config.consider_all_requests_local = true + config.action_view.debug_rjs = true + config.action_controller.perform_caching = false + # Don't care if the mailer can't send + config.action_mailer.raise_delivery_errors = false +end diff --git a/config/environments/production.rb b/config/environments/production.rb index ec5b7bc..4508588 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,24 +1,42 @@ -# Settings specified here will take precedence over those in config/environment.rb +Lodo::Application.configure do + # Settings specified here will take precedence over those in config/environment.rb -# The production environment is meant for finished, "live" apps. -# Code is not reloaded between requests -config.cache_classes = true + # The production environment is meant for finished, "live" apps. + # Code is not reloaded between requests + config.cache_classes = true -# Enable threaded mode -# config.threadsafe! + # Full error reports are disabled and caching is turned on + config.consider_all_requests_local = false + config.action_controller.perform_caching = true -# Use a different logger for distributed setups -# config.logger = SyslogLogger.new + # Specifies the header that your server uses for sending files + config.action_dispatch.x_sendfile_header = "X-Sendfile" -# Full error reports are disabled and caching is turned on -config.action_controller.consider_all_requests_local = false -config.action_controller.perform_caching = true + # For nginx: + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' -# Use a different cache store in production -# config.cache_store = :mem_cache_store + # If you have no front-end server that supports something like X-Sendfile, + # just comment this out and Rails will serve the files -# Enable serving of images, stylesheets, and javascripts from an asset server -# config.action_controller.asset_host = "http://assets.example.com" + # See everything in the log (default is :info) + # config.log_level = :debug -# Disable delivery errors, bad email addresses will be ignored -# config.action_mailer.raise_delivery_errors = false + # Use a different logger for distributed setups + # config.logger = SyslogLogger.new + + # Use a different cache store in production + # config.cache_store = :mem_cache_store + + # Disable Rails's static asset server + # In production, Apache or nginx will already do this + config.serve_static_assets = false + + # Enable serving of images, stylesheets, and javascripts from an asset server + # config.action_controller.asset_host = "http://assets.example.com" + + # Disable delivery errors, bad email addresses will be ignored + # config.action_mailer.raise_delivery_errors = false + + # Enable threaded mode + # config.threadsafe! +end diff --git a/config/environments/test.rb b/config/environments/test.rb index a381ca0..27b78c6 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,26 +1,32 @@ -# Settings specified here will take precedence over those in config/environment.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 - -# Log error messages when you accidentally call methods on nil. -config.whiny_nils = true - -# Show full error reports and disable caching -config.action_controller.consider_all_requests_local = true -config.action_controller.perform_caching = 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 - - -config.action_mailer.default_url_options = {:host => "localhost:3000"} - +Lodo::Application.configure do + # Settings specified here will take precedence over those in config/environment.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 + + # 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 +end diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb new file mode 100644 index 0000000..59385cd --- /dev/null +++ b/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! diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 3b5ff67..8c1e682 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -2,12 +2,26 @@ # four configuration values can also be set straight in your models. Devise.setup do |config| # Configure the e-mail address which will be shown in DeviseMailer. - config.mailer_sender = "post@lodo.no" - - # Configure the content type of DeviseMailer mails (defaults to text/html") - # config.mailer_content_type = "text/plain" + config.mailer_sender = "please-change-me@config-initializers-devise.com" - # ==> Configuration for :authenticatable + # ==> Configuration for any authentication mechanism + # Configure which keys are used when authenticating an user. By default is + # just :email. You can configure it to use [:username, :subdomain], so for + # authenticating an 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. + # config.authentication_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. True by default. + # config.http_authenticatable = true + + # The realm used in Http Basic Authentication + # config.http_authentication_realm = "Application" + + # ==> Configuration for :database_authenticatable # Invoke `rake secret` and use the printed value to setup a pepper to generate # the encrypted password. By default no pepper is used. # config.pepper = "rake secret output" @@ -22,16 +36,6 @@ # (then you should set stretches to 10, and copy REST_AUTH_SITE_KEY to pepper) # config.encryptor = :sha1 - # Configure which keys are used when authenticating an user. By default is - # just :email. You can configure it to use [:username, :subdomain], so for - # authenticating an 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. - # config.authentication_keys = [ :email ] - - # The realm used in Http Basic Authentication - # config.http_authentication_realm = "Application" - # ==> Configuration for :confirmable # The time you want give to your user to confirm his account. During this time # he will be able to access your application without confirming. Default is nil. @@ -41,21 +45,35 @@ # The time the user will be remembered without asking for credentials again. # config.remember_for = 2.weeks + # ==> Configuration for :validatable + # Range for password length + # config.password_length = 6..20 + + # Regex to use to validate the email address + # config.email_regexp = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i + # ==> 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. # config.timeout_in = 10.minutes # ==> Configuration for :lockable - # Number of authentication tries before locking an account. - # config.maximum_attempts = 20 + # 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 strategy will be used to unlock an account. # :email = Sends an unlock link to the user email # :time = Reanables login after a certain ammount of time (see :unlock_in below) - # :both = enables both strategies + # :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 @@ -64,10 +82,9 @@ # config.token_authentication_key = :auth_token # ==> General configuration - # Load and configure the ORM. Supports :active_record (default), :mongo_mapper + # Load and configure the ORM. Supports :active_record (default), :mongoid # (requires mongo_ext installed) and :data_mapper (experimental). - # require 'devise/orm/mongo_mapper' - # config.orm = :mongo_mapper + require 'devise/orm/active_record' # Turn scoped views on. Before rendering "sessions/new", it will first check for # "sessions/users/new". It's turned off by default because it's slower if you @@ -94,12 +111,6 @@ # twitter.consumer_key =
The page you were looking for doesn't exist.
You may have mistyped the address or the page may have moved.
The change you wanted was rejected.
Maybe you tried to change something you didn't have access to.