winton-active_wrapper 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.markdown CHANGED
@@ -17,7 +17,7 @@ Usage
17
17
  require 'rubygems'
18
18
  require 'active_wrapper'
19
19
 
20
- $db, $log = ActiveWrapper.new(
20
+ $db, $log = ActiveWrapper.setup(
21
21
  :base => File.dirname('__FILE__'),
22
22
  :env => 'development',
23
23
  :log => 'custom',
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{active_wrapper}
5
- s.version = "0.1.0"
5
+ s.version = "0.1.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Winton Welsh"]
data/gemspec.rb CHANGED
@@ -13,5 +13,5 @@ GEM_SPEC = Gem::Specification.new do |s|
13
13
  s.name = GEM_NAME
14
14
  s.platform = Gem::Platform::RUBY
15
15
  s.require_path = "lib"
16
- s.version = "0.1.0"
16
+ s.version = "0.1.1"
17
17
  end
@@ -1,16 +1,23 @@
1
+ require 'rubygems'
2
+ require 'activerecord'
3
+ require 'logger'
4
+ require 'yaml'
5
+
1
6
  require File.dirname(__FILE__) + "/active_wrapper/db"
2
7
  require File.dirname(__FILE__) + "/active_wrapper/log"
3
8
 
4
- class ActiveWrapper
5
-
6
- def initialize(options={})
9
+ module ActiveWrapper
10
+ class <<self
7
11
 
8
- options = {
9
- :base => File.dirname($0),
10
- :env => 'development',
11
- :log => 'development'
12
- }.merge(options)
12
+ def setup(options={})
13
+
14
+ options = {
15
+ :base => File.dirname($0),
16
+ :env => 'development',
17
+ :log => 'development'
18
+ }.merge(options.reject { |k, v| v.nil? })
13
19
 
14
- [ Db.new(options), Log.new(options) ]
20
+ [ Db.new(options), Log.new(options) ]
21
+ end
15
22
  end
16
23
  end
@@ -6,8 +6,9 @@ module ActiveWrapper
6
6
  def initialize(options={}, &block)
7
7
 
8
8
  task :environment do
9
- $db, $log = ActiveWrapper.new(options)
10
- yield
9
+ $db, $log = ActiveWrapper.setup(options)
10
+ $db.establish_connection
11
+ yield if block
11
12
  end
12
13
 
13
14
  namespace :db do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: winton-active_wrapper
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
  - Winton Welsh