Module: Fakecrm
- Defined in:
- lib/fakecrm.rb,
lib/fakecrm/drop.rb,
lib/fakecrm/fetch.rb,
lib/fakecrm/server.rb,
lib/fakecrm/version.rb,
lib/fakecrm/embedded.rb,
lib/fakecrm/application.rb,
lib/fakecrm/server/roles.rb,
lib/fakecrm/configuration.rb,
lib/fakecrm/resource/role.rb,
lib/fakecrm/server/events.rb,
lib/fakecrm/resource/event.rb,
lib/fakecrm/server/accounts.rb,
lib/fakecrm/server/contacts.rb,
lib/fakecrm/server/mailings.rb,
lib/fakecrm/resource/account.rb,
lib/fakecrm/resource/contact.rb,
lib/fakecrm/resource/mailing.rb,
lib/fakecrm/server/templates.rb,
lib/fakecrm/resource/activity.rb,
lib/fakecrm/resource/password.rb,
lib/fakecrm/resource/template.rb,
lib/fakecrm/server/activities.rb,
lib/fakecrm/server/custom_types.rb,
lib/fakecrm/resource/custom_type.rb,
lib/fakecrm/resource/custom_type.rb,
lib/fakecrm/server/event_contacts.rb,
lib/fakecrm/resource/event_contact.rb,
lib/fakecrm/tolerant_mass_assignment.rb,
lib/fakecrm/resource/custom_attribute.rb,
lib/fakecrm/resource/extensions/kinds.rb,
lib/fakecrm/resource/views/resource_view.rb,
lib/fakecrm/resource/extensions/type_extender.rb,
lib/fakecrm/resource/extensions/type_extension.rb
Overview
workaround circular reference
Defined Under Namespace
Modules: Accounts, Activities, Contacts, CustomTypes, Drop, EventContacts, Events, Fetch, Kinds, Mailings, Roles, Templates, TolerantMassAssignment
Classes: Account, Activity, Application, Contact, CustomAttribute, CustomType, Event, EventContact, Logger, Mailing, Password, ResourceView, Role, Server, Template, TypeExtender, TypeExtension
Constant Summary
collapse
- VERSION =
"0.9.9.3"
- Configuration =
Struct
.new(:database, :port, :log_level, :silent)
.new("sqlite3:///tmp/fakecrm.sqlite3", 3276, :debug, false)
Class Method Summary
collapse
Class Method Details
.embedded! ⇒ Object
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/fakecrm/embedded.rb', line 2
def self.embedded!
require 'fakecrm/configuration'
port = 4000 + rand(10000)
url = "http://localhost:#{port}/crm"
if defined?(Infopark::Crm)
Infopark::Crm.configure do |configuration|
configuration.url = url
configuration.login = "root"
configuration.api_key = "deadbeef"
end
end
pid = fork do
require 'fakecrm'
Fakecrm::Configuration.port = port
Fakecrm::Configuration.database = 'sqlite::memory:'
Fakecrm::Configuration.silent = true
self.run!
exit!
end
sleep(1)
at_exit do
Process.kill("INT", pid)
Process.wait(pid)
end
return [port, pid]
end
|
.logger ⇒ Object
28
29
30
|
# File 'lib/fakecrm.rb', line 28
def self.logger
Application.instance.logger
end
|
.run! ⇒ Object
32
33
34
|
# File 'lib/fakecrm.rb', line 32
def self.run!
Application.instance.run!
end
|