Module: Qcourses
- Defined in:
- lib/qcourses.rb,
lib/qcourses/models.rb,
lib/qcourses/version.rb,
lib/qcourses/web_app.rb,
lib/qcourses/renderers.rb,
lib/qcourses/models/event.rb,
lib/qcourses/view_helpers.rb,
lib/qcourses/configuration.rb,
lib/qcourses/models/course.rb,
lib/qcourses/models/postman.rb,
lib/qcourses/resource_paths.rb,
lib/qcourses/models/location.rb,
lib/qcourses/controllers/base.rb,
lib/qcourses/models/registration.rb,
lib/qcourses/models/course_repository.rb,
lib/qcourses/controllers/events_controller.rb,
lib/qcourses/controllers/courses_controller.rb,
lib/qcourses/controllers/registrations_controller.rb
Defined Under Namespace
Modules: Configuration, Helpers, Renderers, ResourcePaths, ViewHelpers
Classes: BaseController, Company, Course, CourseRepository, CoursesController, Employee, Event, EventsController, Location, MemoryCourseRepository, Postman, Registration, RegistrationNotification, RegistrationsController, WebApp
Constant Summary
collapse
- EMAIL_REGEXP =
/\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i
- VERSION =
"0.1.11"
Class Method Summary
collapse
Class Method Details
.config ⇒ Object
7
8
9
|
# File 'lib/qcourses.rb', line 7
def self.config
@@config
end
|
13
14
15
16
17
18
19
20
21
|
# File 'lib/qcourses.rb', line 13
def self.configure(&configuration_block)
@@config = Configuration.instance
@@config.local_root = File.expand_path('..', File.dirname(__FILE__))
self.config.configure(&configuration_block)
require 'qcourses/date_ex'
require 'qcourses/string_ex'
require 'qcourses/models'
Postman.allow_delivery_failure if env == 'development'
end
|
.create_connection(environment = Qcourses.env) ⇒ Object
9
10
11
12
13
14
15
|
# File 'lib/qcourses/models.rb', line 9
def self.create_connection(environment = Qcourses.env)
environment = environment.to_s
connection = Sequel.connect(YAML::load(File.read(File.join(config.root, 'config', 'database.yml')))[environment])
connection.logger = Logger.new(Qcourses.log_file())
schema_definition.apply(connection, :up) if environment == 'test'
connection
end
|
.db ⇒ Object
6
7
8
|
# File 'lib/qcourses/models.rb', line 6
def self.db
@@db ||= create_connection
end
|
.env ⇒ Object
4
5
6
|
# File 'lib/qcourses.rb', line 4
def self.env
@@env ||= (ENV['RACK_ENV'] || ENV['QCOURSES_ENV'] || 'development')
end
|
.log_file ⇒ Object
10
11
12
|
# File 'lib/qcourses.rb', line 10
def self.log_file
config.file("log/#{env}.log")
end
|
.schema_definition ⇒ Object
17
18
19
|
# File 'lib/qcourses/models.rb', line 17
def self.schema_definition
eval(`sequel -d sqlite://data/development.sqlite3`)
end
|