Initial import
This commit is contained in:
49
config/application.rb
Normal file
49
config/application.rb
Normal file
@@ -0,0 +1,49 @@
|
||||
# Geral
|
||||
App.language = "pt-br"
|
||||
App.title = "Wiki UFC"
|
||||
|
||||
# Limites
|
||||
App.max_upload_file_size = 5.megabytes
|
||||
|
||||
# Forum
|
||||
App.forum_uri = "http://127.0.0.1:3001/"
|
||||
|
||||
# Tema
|
||||
App.default_color = 6
|
||||
App.default_avatar = "http://engsoft.isoron.org/images/avatar.png"
|
||||
App.color_schemes = [
|
||||
# Default
|
||||
[ "#000", "#069", "#455", "#455" ],
|
||||
|
||||
# Aqua
|
||||
[ "#7b7", "#455", "#899", "#abb" ],
|
||||
[ "#005B9A", "#455", "#899", "#abb" ],
|
||||
[ "#8D009A", "#455", "#899", "#abb" ],
|
||||
[ "#9A000D", "#455", "#899", "#abb" ],
|
||||
[ "#5A9A00", "#455", "#899", "#abb" ],
|
||||
|
||||
# Mono
|
||||
[ "#037", "#069", "#455", "#778" ],
|
||||
[ "#900", "#c00", "#444", "#888" ],
|
||||
|
||||
# Complementar
|
||||
[ "#037", "#c60", "#457", "#568" ],
|
||||
[ "#070", "#c00", "#474", "#585" ],
|
||||
|
||||
# Pink
|
||||
[ "#d18", "#d18", "#457", "#668" ],
|
||||
[ "#609", "#455", "#547", "#658" ],
|
||||
|
||||
# Sand
|
||||
[ "#900", "#663", "#888", "#cc9" ],
|
||||
[ "#036", "#663", "#888", "#cc9" ],
|
||||
[ "#680", "#663", "#888", "#cc9" ],
|
||||
|
||||
# Original
|
||||
[ "#000", "#690", "#444", "#666" ]
|
||||
]
|
||||
|
||||
|
||||
# Templates
|
||||
App.inital_wiki_pages = ['Ementa', 'Notas de Aula']
|
||||
App.initial_wiki_page_content = "Página em branco."
|
||||
9
config/asset_packages.yml
Normal file
9
config/asset_packages.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
---
|
||||
javascripts:
|
||||
- base:
|
||||
- lib/prototype
|
||||
- lib/effects
|
||||
- lib/controls
|
||||
- lib/dragdrop
|
||||
- lib/event-selectors
|
||||
- application
|
||||
108
config/boot.rb
Normal file
108
config/boot.rb
Normal file
@@ -0,0 +1,108 @@
|
||||
# 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"
|
||||
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!
|
||||
36
config/database.yml.example
Normal file
36
config/database.yml.example
Normal file
@@ -0,0 +1,36 @@
|
||||
# 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 passaword hashing:
|
||||
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
|
||||
|
||||
development:
|
||||
adapter: mysql
|
||||
database: engsoft_development
|
||||
username: root
|
||||
password:
|
||||
host: localhost
|
||||
|
||||
# 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: engsoft_test
|
||||
username: root
|
||||
password:
|
||||
host: localhost
|
||||
|
||||
production:
|
||||
adapter: mysql
|
||||
database: engsoft_production
|
||||
username: root
|
||||
password:
|
||||
host: localhost
|
||||
59
config/environment.rb
Normal file
59
config/environment.rb
Normal file
@@ -0,0 +1,59 @@
|
||||
# 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.0.2' 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 (only works if using vendor/rails).
|
||||
# To use Rails without a database, you must remove the Active Record framework
|
||||
# config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
|
||||
|
||||
# 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
|
||||
|
||||
# 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 => '_wikiufc_session_id',
|
||||
:secret => '9194c999d4c15148e1fe79e5afe2b77f9f0878f8f8391b72ff62d2ee7243d21d809096b5171be863f56701aa21efbc487d725b3660e86d0022968c19797f6f75'
|
||||
}
|
||||
|
||||
# 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
|
||||
|
||||
# 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
|
||||
end
|
||||
21
config/environments/development.rb
Normal file
21
config/environments/development.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
# 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
|
||||
|
||||
# Enable the breakpoint server that script/breakpointer connects to
|
||||
# config.breakpoint_server = 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.cache_template_extensions = false
|
||||
config.action_view.debug_rjs = true
|
||||
|
||||
# Don't care if the mailer can't send
|
||||
config.action_mailer.raise_delivery_errors = false
|
||||
18
config/environments/production.rb
Normal file
18
config/environments/production.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
# 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
|
||||
|
||||
# Full error reports are disabled and caching is turned on
|
||||
config.action_controller.consider_all_requests_local = false
|
||||
config.action_controller.perform_caching = false
|
||||
|
||||
# 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
|
||||
22
config/environments/test.rb
Normal file
22
config/environments/test.rb
Normal file
@@ -0,0 +1,22 @@
|
||||
# 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
|
||||
|
||||
# Disable request forgery protection in test environment
|
||||
config.action_controller.allow_forgery_protection = false
|
||||
22
config/initializers/load_app_config.rb
Normal file
22
config/initializers/load_app_config.rb
Normal file
@@ -0,0 +1,22 @@
|
||||
require 'ostruct'
|
||||
::App = OpenStruct.new
|
||||
|
||||
# Define os campos essenciais
|
||||
required_fields = %w(
|
||||
title
|
||||
language
|
||||
max_upload_file_size
|
||||
default_color
|
||||
forum_uri
|
||||
)
|
||||
|
||||
# Carrega as configuracoes personalizadas
|
||||
require "#{RAILS_ROOT}/config/application.rb"
|
||||
|
||||
# Verifica se todas os campos essenciais foram instanciados
|
||||
required_fields.each do |field|
|
||||
raise "Required configuration not found: App.#{field}" unless App.respond_to?(field)
|
||||
end
|
||||
|
||||
# Internacionalizacao
|
||||
Gibberish.current_language = App.language if RAILS_ENV != 'test'
|
||||
4
config/initializers/load_gems.rb
Normal file
4
config/initializers/load_gems.rb
Normal file
@@ -0,0 +1,4 @@
|
||||
require 'hpricot'
|
||||
require 'icalendar'
|
||||
require 'tzinfo'
|
||||
require 'assert_valid_xhtml'
|
||||
21
config/initializers/localization.rb
Normal file
21
config/initializers/localization.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
TzTime.zone = TZInfo::Timezone.new("America/Fortaleza")
|
||||
|
||||
class Time
|
||||
alias :strftime_nolocale :strftime
|
||||
|
||||
def strftime(format)
|
||||
format = format.dup
|
||||
format.gsub!(/%a/, Date::ABBR_DAYNAMES[self.wday])
|
||||
format.gsub!(/%A/, Date::DAYNAMES[self.wday])
|
||||
format.gsub!(/%b/, Date::ABBR_MONTHNAMES[self.mon])
|
||||
format.gsub!(/%B/, Date::MONTHNAMES[self.mon])
|
||||
self.strftime_nolocale(format)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.merge!(
|
||||
:default => '%d/%m/%Y %H:%M',
|
||||
:date_time12 => "%d/%m/%Y %I:%M%p",
|
||||
:date_time24 => "%d/%m/%Y %H:%M"
|
||||
)
|
||||
10
config/initializers/nasty_hacks.rb
Normal file
10
config/initializers/nasty_hacks.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
# Carrega as classes Message e LogEntry. O lazy loading do Rails gera
|
||||
# problemas se voce definir varias classes por arquivos.
|
||||
require "app/models/message.rb"
|
||||
require "app/models/log_entry.rb"
|
||||
|
||||
class String
|
||||
def is_numeric?
|
||||
Float self rescue false
|
||||
end
|
||||
end
|
||||
1
config/languages/es.yml
Normal file
1
config/languages/es.yml
Normal file
@@ -0,0 +1 @@
|
||||
"Hello %%, nice to meet you!": "¡Ola %%, encantado de conocerlo!"
|
||||
1
config/languages/pt_BR.yml
Normal file
1
config/languages/pt_BR.yml
Normal file
@@ -0,0 +1 @@
|
||||
"Hello %%, nice to meet you!": "Ola %%, prazer em conhecê-lo!"
|
||||
81
config/routes.rb
Normal file
81
config/routes.rb
Normal file
@@ -0,0 +1,81 @@
|
||||
# Engenharia de Software 2007.1
|
||||
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
ActionController::Routing::Routes.draw do |map|
|
||||
|
||||
# Resources
|
||||
map.resources :users
|
||||
map.resources(:courses,
|
||||
:member => {
|
||||
:enroll => :get,
|
||||
:unenroll => :get
|
||||
}
|
||||
) do |course|
|
||||
|
||||
course.resources :events,
|
||||
:member => {
|
||||
:undelete => :post
|
||||
}
|
||||
|
||||
course.resources :news,
|
||||
:member => {
|
||||
:undelete => :post
|
||||
}
|
||||
|
||||
course.resources :wiki,
|
||||
:member => {
|
||||
:diff => :get,
|
||||
:versions => :get,
|
||||
:move_up => :get,
|
||||
:move_down => :get,
|
||||
:undelete => :post
|
||||
}
|
||||
|
||||
course.resources :attachments,
|
||||
:member => {
|
||||
:download => :get,
|
||||
:undelete => :post
|
||||
}
|
||||
end
|
||||
|
||||
# Log
|
||||
map.with_options :controller => 'log' do |log|
|
||||
log.course_log 'courses/:course_id/log', :action => 'index', :format => 'html'
|
||||
log.undo_course_log 'courses/:course_id/log/:id/undo', :action => 'undo', :format => 'html'
|
||||
|
||||
log.formatted_course_log 'courses/:course_id/log.:format', :action => 'index'
|
||||
end
|
||||
|
||||
# Wiki pages
|
||||
map.preview 'services/preview', :controller => 'wiki', :action => 'preview'
|
||||
|
||||
# Widgets
|
||||
map.connect 'widgets/calendar/:id/:year/:month', :controller => 'events', :action => 'mini_calendar'
|
||||
|
||||
# Login, logout, signup, etc
|
||||
map.with_options :controller => 'users' do |user|
|
||||
user.login 'login', :action => 'login'
|
||||
user.logout 'logout', :action => 'logout'
|
||||
user.signup 'signup', :action => 'signup'
|
||||
user.settings 'settings', :action => 'settings'
|
||||
end
|
||||
|
||||
# Pagina pessoal
|
||||
map.dashboard '/dashboard', :controller => 'users', :action => 'dashboard'
|
||||
|
||||
# Stylesheets
|
||||
map.connect 'stylesheets/themes/:action.:color.:format', :controller => 'stylesheets'
|
||||
|
||||
# Front page
|
||||
map.connect '', :controller => 'courses', :action => 'index'
|
||||
end
|
||||
Reference in New Issue
Block a user