Module: Takana

Defined in:
lib/rack-takana.rb,
lib/rack-takana/railtie.rb,
lib/rack-takana/middleware.rb,
lib/rack-takana/models/project.rb,
lib/rack-takana/models/load_path.rb,
lib/rack-takana/models/compass_config.rb

Defined Under Namespace

Classes: CompassConfig, LoadPath, Middleware, Project, Railtie

Class Method Summary collapse

Class Method Details

.dbObject



23
24
25
# File 'lib/rack-takana.rb', line 23

def self.db
  @db
end

.initialize_dbObject



17
18
19
20
21
# File 'lib/rack-takana.rb', line 17

def self.initialize_db
  @db = Sequel.connect("sqlite://#{URI.escape(Takana.sqlite_filepath)}") rescue nil

  Sequel::Model.db = @db
end

.migrate!Object



27
28
29
30
31
# File 'lib/rack-takana.rb', line 27

def self.migrate!
  Sequel.extension :migration

  Sequel::Migrator.run(Takana.db, File.expand_path("../sassy_bunny/app/db/migrations").to_s, use_transactions: true)
end

.sqlite_filepathObject



8
9
10
11
12
13
14
15
# File 'lib/rack-takana.rb', line 8

def self.sqlite_filepath
  if ENV['TAKANA_ENV'] == "test"
    File.expand_path("./test.db")
  else
    Pathname.new( File.expand_path("~") ).
      join("Library", "Application Support", "Edge", "takana.db").to_s
  end
end