daylite-models 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,10 +15,10 @@ app/models/daylite/task.rb
15
15
  app/models/daylite/user.rb
16
16
  config/database.yml.exmp
17
17
  daylite_models.gemspec
18
- daylite_models.rb
19
18
  init.rb
20
19
  install.rb
21
20
  lib/active_record/connection_adapters/openbase_adapter.rb
21
+ lib/daylite_models.rb
22
22
  tasks/users_plugin_tasks.rake
23
23
  test/daylite_models_plugin_test.rb
24
24
  test/test_helper.rb
@@ -30,18 +30,27 @@ Add _daylite_ section to you database.yml
30
30
  password: my_password
31
31
 
32
32
 
33
- Add the following line to you environment.rb
33
+ Add the following line to you environment.rb:
34
34
 
35
- Daylite::Base.establish_connection(:daylite)
35
+ Daylite::Base.establish_connection(:daylite)
36
36
 
37
37
  You are ready to rock! Now you can use Daylite classes in you application as usual Rails models.
38
38
 
39
39
  Usage as a standalone library
40
40
  -----------------------------
41
- The easiest way is to create file config/database.yml relative to you running script and place _daylite_ config in it (see Usage as Rails plugin for example). After this you need to place
41
+ Place
42
42
 
43
43
  require 'daylite_models'
44
44
 
45
- somewhere in you initialization code and you are done.
45
+ somewhere in you initialization code and provide connection info through Daylite::Base.establish_connection call. You will need to provide adapter, database, host, username and password params. See ActiveRecord::Base.establish_connection and Openbase documentation for more info. You may use the following piece of code:
46
46
 
47
- Another way is to provide connection info directly throw Daylite::Base.establish_connection call. You will need to provide adapter, database, host, username and password params. See ActiveRecord::Base.establish_connection and Opnebase documentation for more info.
47
+ DAYLITE_DATABASE_CONFIG = 'config/database.yml'
48
+ DAYLITE_CONFIG_SECTION = 'daylite'
49
+
50
+ if File.exist?(DAYLITE_DATABASE_CONFIG)
51
+ yaml = YAML::load(File.read(DAYLITE_DATABASE_CONFIG))
52
+
53
+ if yaml[DAYLITE_CONFIG_SECTION]
54
+ Daylite::Base.establish_connection( yaml[DAYLITE_CONFIG_SECTION] )
55
+ end
56
+ end
data/Rakefile CHANGED
@@ -13,7 +13,7 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
13
13
  end
14
14
 
15
15
  begin
16
- require 'daylite_models'
16
+ require 'lib/daylite_models'
17
17
  require 'hoe'
18
18
 
19
19
  #oh, shit
@@ -27,7 +27,6 @@ begin
27
27
 
28
28
  Hoe.new('daylite-models', DayliteModels::VERSION) do |s|
29
29
  s.name = "daylite-models"
30
- s.version = "0.1.0"
31
30
  s.author = "Dmitriy Dzema"
32
31
  s.email = "dimad.ag@gmail.com"
33
32
  s.summary = "Set of ActiveRecord classes to work with the Daylite 3 database"
@@ -38,5 +37,5 @@ begin
38
37
  s.extra_deps = [ ["activesupport", ">= 2.0.0"], ["activerecord", ">= 2.0.0"], ["activerecord", ">= 0.8.3"]]
39
38
  end
40
39
  rescue LoadError => e
41
-
40
+
42
41
  end
@@ -1,13 +1,13 @@
1
1
  Gem::Specification.new do |s|
2
- s.name = %q{DayliteModels}
3
- s.version = "0.1.0"
2
+ s.name = %q{daylite-models}
3
+ s.version = "0.1.1"
4
4
 
5
5
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
6
  s.authors = ["Dmitriy Dzema"]
7
7
  s.date = %q{2009-02-11}
8
8
  s.email = %q{dimad.ag@gmail.com}
9
9
  s.extra_rdoc_files = ["History.txt", "Manifest.txt"]
10
- s.files = ["History.txt", "LICENSE", "Manifest.txt", "README.markdown", "Rakefile", "app/models/daylite.rb", "app/models/daylite/contact.rb", "app/models/daylite/organization.rb", "app/models/daylite/organization_task_join.rb", "app/models/daylite/project.rb", "app/models/daylite/project_task_join.rb", "app/models/daylite/role.rb", "app/models/daylite/role_type.rb", "app/models/daylite/task.rb", "app/models/daylite/user.rb", "config/database.yml.exmp", "daylite_models.gemspec", "daylite_models.rb", "init.rb", "install.rb", "lib/active_record/connection_adapters/openbase_adapter.rb", "tasks/users_plugin_tasks.rake", "test/daylite_models_plugin_test.rb", "test/test_helper.rb", "uninstall.rb"]
10
+ s.files = ["History.txt", "LICENSE", "Manifest.txt", "README.markdown", "Rakefile", "app/models/daylite.rb", "app/models/daylite/contact.rb", "app/models/daylite/organization.rb", "app/models/daylite/organization_task_join.rb", "app/models/daylite/project.rb", "app/models/daylite/project_task_join.rb", "app/models/daylite/role.rb", "app/models/daylite/role_type.rb", "app/models/daylite/task.rb", "app/models/daylite/user.rb", "config/database.yml.exmp", "daylite_models.gemspec", "init.rb", "install.rb", "lib/active_record/connection_adapters/openbase_adapter.rb", "lib/daylite_models.rb", "tasks/users_plugin_tasks.rake", "test/daylite_models_plugin_test.rb", "test/test_helper.rb", "uninstall.rb"]
11
11
  s.has_rdoc = true
12
12
  s.rdoc_options = ["--main", "README.markdown"]
13
13
  s.require_paths = ["lib"]
@@ -24,7 +24,6 @@ Gem::Specification.new do |s|
24
24
  s.add_runtime_dependency(%q<activesupport>, [">= 2.0.0"])
25
25
  s.add_runtime_dependency(%q<activerecord>, [">= 2.0.0"])
26
26
  s.add_runtime_dependency(%q<activerecord>, [">= 0.8.3"])
27
- s.add_development_dependency(%q<hoe>, [">= 1.8.3"])
28
27
  else
29
28
  s.add_dependency(%q<activesupport>, [">= 2.0.0"])
30
29
  s.add_dependency(%q<activerecord>, [">= 2.0.0"])
@@ -0,0 +1,6 @@
1
+ $: << File.join(File.dirname(__FILE__), '../')
2
+ require 'init'
3
+
4
+ module DayliteModels
5
+ VERSION = '0.1.1'
6
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: daylite-models
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitriy Dzema
@@ -79,10 +79,10 @@ files:
79
79
  - app/models/daylite/user.rb
80
80
  - config/database.yml.exmp
81
81
  - daylite_models.gemspec
82
- - daylite_models.rb
83
82
  - init.rb
84
83
  - install.rb
85
84
  - lib/active_record/connection_adapters/openbase_adapter.rb
85
+ - lib/daylite_models.rb
86
86
  - tasks/users_plugin_tasks.rake
87
87
  - test/daylite_models_plugin_test.rb
88
88
  - test/test_helper.rb
@@ -1,17 +0,0 @@
1
- $: << File.join(File.dirname(__FILE__), 'lib')
2
- require 'init'
3
-
4
- module DayliteModels
5
- VERSION = '0.1.0'
6
- end
7
-
8
- DAYLITE_DATABASE_CONFIG = 'config/database.yml'
9
- DAYLITE_CONFIG_SECTION = 'daylite'
10
-
11
- if File.exist?(DAYLITE_DATABASE_CONFIG)
12
- yaml = YAML::load(File.read(DAYLITE_DATABASE_CONFIG))
13
-
14
- if yaml[DAYLITE_CONFIG_SECTION]
15
- Daylite::Base.establish_connection( yaml[DAYLITE_CONFIG_SECTION] )
16
- end
17
- end