restpack_core_service 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 59751865a14101a724e7516baa32731a1945a1b5
4
- data.tar.gz: 882a57076fa66e64b8e778bc1b5f1637edf298e4
3
+ metadata.gz: b0079ea5beff672cf761cf26dd696dc7d9301bf2
4
+ data.tar.gz: 3d6daa7f407bc0968314d4db0575532debdd20e8
5
5
  SHA512:
6
- metadata.gz: 19e07a281795fce937509cc7255c13538e59d520d90044279281114ddcf2dfea1fc2915b33e1ea0f6d65385efef9fc53d22f8cd42cb2e57d2355169c459ff771
7
- data.tar.gz: cfc2397c3885d3bef36be70f90029e2b8efdb857ca086953228edaaa909599091bf490f12c5629b16001187643be1e7f3cae30ee94dfd4f62847e9ae0f9ded97
6
+ metadata.gz: fdbf81e2a85258b4ac37a4ff9f1ca06aba231c5e389dea47414055e1277a4e3144e96e6107dbec42827a74c63b3e6bb7b9621f1722c4ea797e0ac6c657c6bc2a
7
+ data.tar.gz: fb5573d6972ed389a731f03a9cd4e04b46c2ee03ab6b2bfe0357253329b4b3152128491d72471d61efe8988da3a717252865a2f49388e0cffded2256513c1773
@@ -1,6 +1,10 @@
1
1
  class CreateApplications < ActiveRecord::Migration
2
+ def table_name
3
+ RestPack::Core::Service.config.prefix_db_table(:applications)
4
+ end
5
+
2
6
  def change
3
- create_table :applications do |t|
7
+ create_table table_name do |t|
4
8
  t.string :name, :null => false, :limit => 256
5
9
  t.integer :account_id, :null => false
6
10
 
@@ -1,6 +1,10 @@
1
1
  class CreateDomains < ActiveRecord::Migration
2
+ def table_name
3
+ RestPack::Core::Service.config.prefix_db_table(:domains)
4
+ end
5
+
2
6
  def change
3
- create_table :domains do |t|
7
+ create_table table_name do |t|
4
8
  t.string :host, :null => false, :limit => 512
5
9
  t.integer :application_id, :null => false
6
10
 
@@ -1,5 +1,6 @@
1
- module RestPack::Models
2
- class Application < ActiveRecord::Base
1
+ module RestPack::Core::Service::Models
2
+ class Application < Base
3
+ restpack_table_name :applications
3
4
  attr_accessible :name, :account_id
4
5
 
5
6
  validates_presence_of :name, :account_id
@@ -0,0 +1,9 @@
1
+ module RestPack::Core::Service::Models
2
+ class Base < ActiveRecord::Base
3
+ self.abstract_class = true
4
+
5
+ def self.restpack_table_name(name)
6
+ self.table_name = RestPack::Core::Service.config.prefix_db_table(name)
7
+ end
8
+ end
9
+ end
@@ -1,5 +1,6 @@
1
- module RestPack::Models
2
- class Domain < ActiveRecord::Base
1
+ module RestPack::Core::Service::Models
2
+ class Domain < Base
3
+ restpack_table_name :domains
3
4
  attr_accessible :host, :application
4
5
 
5
6
  validates_presence_of :host
@@ -1,7 +1,7 @@
1
1
  module RestPack
2
2
  module Core
3
3
  module Service
4
- VERSION = "0.0.3"
4
+ VERSION = "0.0.4"
5
5
  end
6
6
  end
7
7
  end
@@ -4,6 +4,7 @@ require "active_support/core_ext"
4
4
  require "restpack_core_service/version"
5
5
  require "restpack_core_service/configuration"
6
6
 
7
+ require "restpack_core_service/models/base"
7
8
  require "restpack_core_service/models/application"
8
9
  require "restpack_core_service/models/domain"
9
10
 
@@ -1,6 +1,7 @@
1
- describe RestPack::Models::Application do
1
+ describe RestPack::Core::Service::Models::Application do
2
2
  it { should validate_presence_of(:name) }
3
3
  it { should validate_presence_of(:account_id) }
4
4
  it { should ensure_length_of(:name).is_at_most(256) }
5
5
  it { should have_many(:domains) }
6
+ it { subject.class.table_name.should == 'restpack_applications' }
6
7
  end
@@ -1,5 +1,6 @@
1
- describe RestPack::Models::Domain do
1
+ describe RestPack::Core::Service::Models::Domain do
2
2
  it { should validate_presence_of(:host) }
3
3
  it { should ensure_length_of(:host).is_at_most(512) }
4
4
  it { should belong_to(:application) }
5
+ it { subject.class.table_name.should == 'restpack_domains' }
5
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restpack_core_service
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Joyce
@@ -183,6 +183,7 @@ files:
183
183
  - lib/restpack_core_service.rb
184
184
  - lib/restpack_core_service/configuration.rb
185
185
  - lib/restpack_core_service/models/application.rb
186
+ - lib/restpack_core_service/models/base.rb
186
187
  - lib/restpack_core_service/models/domain.rb
187
188
  - lib/restpack_core_service/tasks.rb
188
189
  - lib/restpack_core_service/tasks/db.rake