Initial commit of foodsoft 2

This commit is contained in:
Benjamin Meichsner 2009-01-06 11:49:19 +01:00
commit 5b9a7e05df
657 changed files with 70444 additions and 0 deletions

109
config/boot.rb Normal file
View file

@ -0,0 +1,109 @@
# 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 if defined? Gem::RubyGemsVersion
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'
unless rubygems_version >= '0.9.4'
$stderr.puts %(Rails requires RubyGems >= 0.9.4 (you have #{rubygems_version}). Please `gem update --system` and try again.)
exit 1
end
rescue LoadError
$stderr.puts %(Rails requires RubyGems >= 0.9.4. 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
end
# All that for this:
Rails.boot!

View file

@ -0,0 +1,62 @@
# MySQL (default setup). Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
# gem install mysql
# On MacOS X:
# gem install mysql -- --include=/usr/local/lib
# On Windows:
# There is no gem for Windows. Install mysql.so from RubyForApache.
# http://rubyforge.org/projects/rubyforapache
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
#
# Note: to properly connect to MySQL 5 running under Ubuntu, you need to
# specify the connection socket (add to every connection):
# socket: /var/run/mysqld/mysqld.sock
#
development:
adapter: mysql
database: foodsoft_development
username: root
password:
host: localhost
encoding: utf8
# 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: mysql
database: foodsoft_test
username: root
password:
host: localhost
encoding: utf8
production:
adapter: mysql
database: foodsoft_production
username: root
password:
host: localhost
encoding: utf8
test1:
adapter: mysql
database: foodsoft_development
username: root
password:
host: localhost
encoding: utf8
#socket: /opt/lampp/var/mysql/mysql.sock
test2:
adapter: mysql
database: foodsoft_test2
username: root
password:
host: localhost
encoding: utf8
#socket: /opt/lampp/var/mysql/mysql.sock

97
config/environment.rb Normal file
View file

@ -0,0 +1,97 @@
# Be sure to restart your web 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.1.0' unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
# Need gettext for i18n
require 'gettext/rails'
# Loads the "FoodSoft" module and configuration:
require 'foodsoft'
Rails::Initializer.run do |config|
# Settings in config/environments/* take precedence over those specified here
# Skip frameworks you're not going to use (only works if using vendor/rails)
# config.frameworks -= [ :action_web_service, :action_mailer ]
# Only load the plugins named here, by default all plugins in vendor/plugins are loaded
# config.plugins = %W( exception_notification ssl_requirement )
# 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
# Disable colorized logging output for ActiveRecord:
config.active_record.colorize_logging = false
# Use the database for sessions instead of the file system
# (create the session table with 'rake db:sessions:create')
# config.action_controller.session_store = :active_record_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
# config.active_record.observers = :cacher, :garbage_collector
# Make Active Record use UTC-base instead of local time
# config.active_record.default_timezone = :utc
# 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 => '_foodsoft_session',
:secret => FoodSoft.get_session_secret
}
# See Rails::Configuration for more options
end
# Add new inflection rules using the following format
# (all these examples are active by default):
# Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )decimal
# end
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register "application/x-mobile", :mobile
# Include your application configuration below
# library for parsing/writing files from/to csv-file
# doc: http://fastercsv.rubyforge.org/
require 'faster_csv'
# Attention: Don't forget to set the locale through LocalizationSimplified plugin!
# Defines custom logging format.
class Logger
def format_message(severity, timestamp, progname, msg)
format("%s %-5.5s %s\n", timestamp.strftime('%H:%M:%S'), severity, msg)
end
end
# Configuration of the exception_notification plugin
# Mailadresses are set in config/foodsoft.yaml
ExceptionNotifier.exception_recipients = FoodSoft.get_notification_config[:error_recipients]
ExceptionNotifier.sender_address = FoodSoft.get_notification_config[:sender_address]
ExceptionNotifier.email_prefix = FoodSoft.get_notification_config[:email_prefix]

View file

@ -0,0 +1,29 @@
# 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
# 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
config.action_view.debug_rjs = true
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false
# Configure an SMTP server for email sending in development mode:
# (cf. http://rails.rubyonrails.com/classes/ActionMailer/Base.html for info on options)
#config.action_mailer.smtp_settings = {
# :address => "smtp.dresdener27.de",
# :port => 25,
# :domain => "dresdener27",
# :authentication => :login,
# :user_name => "benni@dresdener27.de",
# :password => "ben234go"
#}

View file

@ -0,0 +1,29 @@
# 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
# 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
config.action_view.debug_rjs = true
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false
# Configure an SMTP server for email sending in development mode:
# (cf. http://rails.rubyonrails.com/classes/ActionMailer/Base.html for info on options)
config.action_mailer.smtp_settings = {
:address => "smtp.your_host.de",
:port => 25,
:domain => "your-domain",
:authentication => :login,
:user_name => "username",
:password => "secret"
}

View file

@ -0,0 +1,19 @@
# 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
# Use a different logger for distributed setups
# config.logger = SyslogLogger.new
config.log_level = :warn
# Full error reports are disabled and caching is turned on
config.action_controller.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Enable serving of images, stylesheets, and javascripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"
# Disable delivery errors if you bad email addresses should just be ignored
# config.action_mailer.raise_delivery_errors = false

View file

@ -0,0 +1,19 @@
# 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
# Tell ActionMailer 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

View file

@ -0,0 +1,48 @@
# Foodcoops configuration
# test1 is the subdomain. e.g. test1.foodcoops.net
test1:
# name of this foodcoop
name: FC Test
# foodcoop contact information (used for FAX messages)
contact:
street: Grüne Straße 103
zip_code: "10997"
city: Berlin
country: Deutschland
email: foodsoft@myfoodcoop.org
phone: "030 323 23249"
# base URL for this installation
base_url: http://www.fctest.de
# foodsoft documentation URL
help_url: http://foodsoft.fcschinke09.de/trac/wiki/FoodsoftDoku
# price markup in percent
price_markup: 2.0
# email address to be used as sender
email_sender: foodsoft@myfoodcoop.org
# localized date/time formats
date_format: %d.%m.%Y
time_format: %H:%M
#test2:
# name: FC Test2
# contact:
# street: Grüne Straße 103
# zip_code: "10997"
# city: Berlin
# country: Deutschland
# email: foodsoft@fctest2.org
# phone: "030 323 23249"
# base_url: http://www.fctest2.de
# help_url: http://foodsoft.fcschinke09.de/trac/wiki/FoodsoftDoku
# price_markup: 1.0
# email_sender: foodsoft@fctest2.org
# date_format: %d.%m.%Y
# time_format: %H:%M

View file

@ -0,0 +1,38 @@
# Foodsoft configuration
# Config for the exception_notification plugin
notification:
error_recipients:
- foo@bar.tld
sender_address: FoodSoft Error <foodsoft@foodcoops.net>
email_prefix: "[FoodSoft]"
# Access to sharedLists, the external article-database
shared_lists:
adapter: mysql
host: localhost
database: sharedLists_development
username: root
password:
encoding: utf8
socket: /opt/lampp/var/mysql/mysql.sock
# secret to generate an integrity hash for cookie session data
# the string should have at least 30 characters
session_secret: dhjfuez47892nsl39fh83ham3jsdfjkh4879sdh
# auto-units-conversion
# this is used for automatic article-synchronization to handle different units
# e.g. when foodcoop-unit should be 500g and supplier-unit is 1kg
units:
KG: 1
1kg: 1
500g: 0.5
400g: 0.4
300g: 0.3
250g: 0.25
200g: 0.2
150g: 0.15
125g: 0.125
100g: 0.1
50g: 0.05

24
config/routes.rb Normal file
View file

@ -0,0 +1,24 @@
ActionController::Routing::Routes.draw do |map|
map.my_profile 'my_profile', :controller => 'index', :action => 'myProfile'
# The priority is based upon order of creation: first created -> highest priority.
# Sample of regular route:
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
# This route can be invoked with purchase_url(:id => product.id)
# You can have the root of your site routed by hooking up ''
# -- just remember to delete public/index.html.
#map.connect '', :controller => 'login'
# Allow downloading Web Service WSDL as a file with an extension
# instead of a file named 'wsdl'
map.connect ':controller/service.wsdl', :action => 'wsdl'
# Install the default route as the lowest priority.
map.connect ':controller/:action/:id', :controller => 'index'
end