MongoDB config & TrackData model
This commit is contained in:
parent
a9b4a46c59
commit
3c96c151bd
|
@ -6,6 +6,9 @@ gem 'rails', '3.0.5'
|
||||||
# gem 'rails', :git => 'git://github.com/rails/rails.git'
|
# gem 'rails', :git => 'git://github.com/rails/rails.git'
|
||||||
|
|
||||||
gem 'pg'
|
gem 'pg'
|
||||||
|
gem 'mongo', '1.3.0'
|
||||||
|
gem 'bson_ext', '1.3.0'
|
||||||
|
gem 'mongoid', '~> 2.0'
|
||||||
|
|
||||||
# Use unicorn as the web server
|
# Use unicorn as the web server
|
||||||
# gem 'unicorn'
|
# gem 'unicorn'
|
||||||
|
|
|
@ -29,6 +29,8 @@ GEM
|
||||||
activesupport (= 3.0.5)
|
activesupport (= 3.0.5)
|
||||||
activesupport (3.0.5)
|
activesupport (3.0.5)
|
||||||
arel (2.0.9)
|
arel (2.0.9)
|
||||||
|
bson (1.3.0)
|
||||||
|
bson_ext (1.3.0)
|
||||||
builder (2.1.2)
|
builder (2.1.2)
|
||||||
erubis (2.6.6)
|
erubis (2.6.6)
|
||||||
abstract (>= 1.0.0)
|
abstract (>= 1.0.0)
|
||||||
|
@ -39,6 +41,13 @@ GEM
|
||||||
mime-types (~> 1.16)
|
mime-types (~> 1.16)
|
||||||
treetop (~> 1.4.8)
|
treetop (~> 1.4.8)
|
||||||
mime-types (1.16)
|
mime-types (1.16)
|
||||||
|
mongo (1.3.0)
|
||||||
|
bson (>= 1.3.0)
|
||||||
|
mongoid (2.0.1)
|
||||||
|
activemodel (~> 3.0)
|
||||||
|
mongo (~> 1.3)
|
||||||
|
tzinfo (~> 0.3.22)
|
||||||
|
will_paginate (~> 3.0.pre)
|
||||||
pg (0.10.1)
|
pg (0.10.1)
|
||||||
polyglot (0.3.1)
|
polyglot (0.3.1)
|
||||||
rack (1.2.2)
|
rack (1.2.2)
|
||||||
|
@ -64,10 +73,14 @@ GEM
|
||||||
treetop (1.4.9)
|
treetop (1.4.9)
|
||||||
polyglot (>= 0.3.1)
|
polyglot (>= 0.3.1)
|
||||||
tzinfo (0.3.26)
|
tzinfo (0.3.26)
|
||||||
|
will_paginate (3.0.pre2)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
|
bson_ext (= 1.3.0)
|
||||||
|
mongo (= 1.3.0)
|
||||||
|
mongoid (~> 2.0)
|
||||||
pg
|
pg
|
||||||
rails (= 3.0.5)
|
rails (= 3.0.5)
|
||||||
|
|
|
@ -2,11 +2,11 @@ class Track < ActiveRecord::Base
|
||||||
set_table_name 'musicbrainz.bh_track'
|
set_table_name 'musicbrainz.bh_track'
|
||||||
belongs_to :release
|
belongs_to :release
|
||||||
|
|
||||||
def convertLength
|
|
||||||
(length /= 1000).round!
|
|
||||||
end
|
|
||||||
|
|
||||||
def clearName
|
def clearName
|
||||||
name.gsub('&', 'and').gsub(/[^a-z0-9]/, '').downcase
|
name.gsub('&', 'and').gsub(/[^a-z0-9]/, '').downcase
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def files
|
||||||
|
TrackData(:id => id)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
class TrackData
|
||||||
|
include Mongoid::Document
|
||||||
|
store_in :track_data
|
||||||
|
|
||||||
|
key :id, Integer
|
||||||
|
key :artist, String
|
||||||
|
key :title, String
|
||||||
|
key :length, Integer
|
||||||
|
key :files, Array
|
||||||
|
end
|
|
@ -0,0 +1,23 @@
|
||||||
|
defaults: &defaults
|
||||||
|
host: localhost
|
||||||
|
# slaves:
|
||||||
|
# - host: slave1.local
|
||||||
|
# port: 27018
|
||||||
|
# - host: slave2.local
|
||||||
|
# port: 27019
|
||||||
|
|
||||||
|
development:
|
||||||
|
<<: *defaults
|
||||||
|
database: beathaven
|
||||||
|
|
||||||
|
test:
|
||||||
|
<<: *defaults
|
||||||
|
database: beathaven_test
|
||||||
|
|
||||||
|
# set these environment variables on your prod server
|
||||||
|
production:
|
||||||
|
host: <%= ENV['MONGOID_HOST'] %>
|
||||||
|
port: <%= ENV['MONGOID_PORT'] %>
|
||||||
|
username: <%= ENV['MONGOID_USERNAME'] %>
|
||||||
|
password: <%= ENV['MONGOID_PASSWORD'] %>
|
||||||
|
database: <%= ENV['MONGOID_DATABASE'] %>
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,11 @@
|
||||||
|
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
|
||||||
|
|
||||||
|
# This model initially had no columns defined. If you add columns to the
|
||||||
|
# model remove the '{}' from the fixture names and add the columns immediately
|
||||||
|
# below each fixture, per the syntax in the comments below
|
||||||
|
#
|
||||||
|
one: {}
|
||||||
|
# column: value
|
||||||
|
#
|
||||||
|
two: {}
|
||||||
|
# column: value
|
|
@ -0,0 +1,8 @@
|
||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class TrackDataTest < ActiveSupport::TestCase
|
||||||
|
# Replace this with your real tests.
|
||||||
|
test "the truth" do
|
||||||
|
assert true
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue