active_wrapper 0.3.4 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ .DS_Store
2
+ *.gem
3
+ *.log
4
+ coverage
5
+ pkg
6
+ tmp
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010 Winton Welsh
1
+ Copyright (c) 2010
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of
4
4
  this software and associated documentation files (the "Software"), to deal in
data/README.md CHANGED
@@ -22,7 +22,7 @@ Usage
22
22
  require 'rubygems'
23
23
  require 'active_wrapper'
24
24
 
25
- $db, $log, $mail = ActiveWrapper.setup(
25
+ $db, $log = ActiveWrapper.setup(
26
26
  :base => File.dirname(__FILE__),
27
27
  :env => 'development',
28
28
  :log => 'custom',
@@ -37,13 +37,11 @@ $db.migrate('001')
37
37
  $db.migrate_reset
38
38
  $log.info('log this')
39
39
  $log.clear
40
- $mail.deliver(:from => 'me@me.com', :to => 'you@you.com', :subject => 'subject', :body => 'body')
41
40
  </pre>
42
41
 
43
42
  <code>ActiveWrapper</code> looks for the following files within the <code>:base</code> directory:
44
43
 
45
44
  * <b>config/database.yml</b>
46
- * <b>config/mail.yml</b>
47
45
  * <b>db/migrate/*.rb</b>
48
46
 
49
47
  The <code>:env</code> option is <code>"development"</code> by default.
@@ -59,25 +57,6 @@ You may also set <code>:log</code> to false to disable logging entirely.
59
57
 
60
58
  Setting <code>:stdout</code> to true causes stdout and stderr to redirect to the logger. It is false by default.
61
59
 
62
- Mailer
63
- ------
64
-
65
- Your <b>mail.yml</b> should look something like this:
66
-
67
- <pre>
68
- development:
69
- smtp:
70
- address: smtp.gmail.com
71
- authentication: :plain
72
- domain: gmail.com
73
- password: password
74
- port: 587
75
- enable_starttls_auto: true
76
- user_name: user@gmail.com
77
- </pre>
78
-
79
- This file is optional.
80
-
81
60
  Rakefile
82
61
  --------
83
62
 
data/Rakefile ADDED
@@ -0,0 +1,72 @@
1
+ require File.dirname(__FILE__) + '/lib/active_wrapper/gems'
2
+
3
+ ActiveWrapper::Gems.activate %w(rake rspec)
4
+
5
+ require 'rake'
6
+ require 'rake/gempackagetask'
7
+ require 'spec/rake/spectask'
8
+
9
+ def gemspec
10
+ @gemspec ||= begin
11
+ file = File.expand_path('../active_wrapper.gemspec', __FILE__)
12
+ eval(File.read(file), binding, file)
13
+ end
14
+ end
15
+
16
+ if defined?(Rake::GemPackageTask)
17
+ Rake::GemPackageTask.new(gemspec) do |pkg|
18
+ pkg.gem_spec = gemspec
19
+ end
20
+ task :gem => :gemspec
21
+ end
22
+
23
+ if defined?(Spec::Rake::SpecTask)
24
+ desc "Run specs"
25
+ Spec::Rake::SpecTask.new do |t|
26
+ t.spec_files = FileList['spec/**/*_spec.rb']
27
+ t.spec_opts = %w(-fs --color)
28
+ end
29
+ task :spec
30
+ end
31
+
32
+ namespace :gems do
33
+ desc "Install gems (DEV=0 DOCS=0 GEMSPEC=default SUDO=0)"
34
+ task :install do
35
+ dev = ENV['DEV'] == '1'
36
+ docs = ENV['DOCS'] == '1' ? '' : '--no-ri --no-rdoc'
37
+ gemset = ENV['GEMSET']
38
+ sudo = ENV['SUDO'] == '1' ? 'sudo' : ''
39
+
40
+ ActiveWrapper::Gems.gemset = gemset if gemset
41
+
42
+ if dev
43
+ gems = ActiveWrapper::Gems.gemspec.development_dependencies
44
+ else
45
+ gems = ActiveWrapper::Gems.gemspec.dependencies
46
+ end
47
+
48
+ gems.each do |name|
49
+ name = name.to_s
50
+ version = ActiveWrapper::Gems.versions[name]
51
+ if Gem.source_index.find_name(name, version).empty?
52
+ version = version ? "-v #{version}" : ''
53
+ system "#{sudo} gem install #{name} #{version} #{docs}"
54
+ else
55
+ puts "already installed: #{name} #{version}"
56
+ end
57
+ end
58
+ end
59
+ end
60
+
61
+ desc "Validate the gemspec"
62
+ task :gemspec do
63
+ gemspec.validate
64
+ end
65
+
66
+ desc "Install gem locally"
67
+ task :install => :package do
68
+ sh %{gem install pkg/#{gemspec.name}-#{gemspec.version}}
69
+ end
70
+
71
+ task :default => :spec
72
+ task :package => :gemspec
@@ -0,0 +1,27 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib/', __FILE__)
3
+ $:.unshift lib unless $:.include?(lib)
4
+
5
+ require 'active_wrapper/gems'
6
+ ActiveWrapper::Gems.gemset ||= :default
7
+
8
+ Gem::Specification.new do |s|
9
+ ActiveWrapper::Gems.gemspec.hash.each do |key, value|
10
+ unless %w(dependencies development_dependencies).include?(key)
11
+ s.send "#{key}=", value
12
+ end
13
+ end
14
+
15
+ ActiveWrapper::Gems.gemspec.dependencies.each do |g|
16
+ s.add_dependency g.to_s, ActiveWrapper::Gems.versions[g]
17
+ end
18
+
19
+ ActiveWrapper::Gems.gemspec.development_dependencies.each do |g|
20
+ s.add_development_dependency g.to_s, ActiveWrapper::Gems.versions[g]
21
+ end
22
+
23
+ s.executables = `git ls-files -- {bin}/*`.split("\n").collect { |f| File.basename(f) }
24
+ s.files = `git ls-files`.split("\n")
25
+ s.require_paths = %w(lib)
26
+ s.test_files = `git ls-files -- {features,test,spec}/*`.split("\n")
27
+ end
@@ -0,0 +1,9 @@
1
+ active_wrapper:
2
+ rake: =0.8.7
3
+ rspec: =1.3.1
4
+ default:
5
+ activerecord: =3.0.3
6
+ mysql2: =0.2.6
7
+ activerecord_2:
8
+ activerecord: =2.3.10
9
+ mysql: =2.8.1
@@ -0,0 +1,13 @@
1
+ name: active_wrapper
2
+ version: 0.4.0
3
+ authors:
4
+ - Winton Welsh
5
+ email: mail@wintoni.us
6
+ homepage: http://github.com/winton/active_wrapper
7
+ summary: Wraps ActiveRecord and Logger for use in non-Rails environments
8
+ description: Wraps ActiveRecord and Logger for use in non-Rails environments
9
+ dependencies:
10
+ - activerecord
11
+ - mysql2
12
+ development_dependencies:
13
+ - rspec
@@ -1,42 +1,103 @@
1
1
  unless defined?(ActiveWrapper::Gems)
2
2
 
3
- require 'rubygems'
3
+ require 'yaml'
4
4
 
5
5
  module ActiveWrapper
6
- class Gems
7
-
8
- VERSIONS = {
9
- :activerecord => '=3.0.3',
10
- :mysql2 => '=0.2.6',
11
- :pony => '=1.1',
12
- :rake => '=0.8.7',
13
- :rspec => '=1.3.1'
14
- }
15
-
16
- TYPES = {
17
- :gemspec => [ :activerecord, :mysql2 ],
18
- :gemspec_dev => [ :rspec ],
19
- :lib => [ :activerecord, :mysql2 ],
20
- :rake => [ :rake, :rspec ],
21
- :spec => [ :rspec ]
22
- }
23
-
6
+ module Gems
24
7
  class <<self
25
8
 
26
- def lockfile
27
- file = File.expand_path('../../../gems', __FILE__)
28
- unless File.exists?(file)
29
- File.open(file, 'w') do |f|
30
- Gem.loaded_specs.each do |key, value|
31
- f.puts "#{key} #{value.version.version}"
9
+ attr_accessor :config, :gemset, :gemsets, :versions
10
+
11
+ class SimpleStruct
12
+ attr_accessor :hash
13
+
14
+ def initialize(hash)
15
+ @hash = hash
16
+ @hash.each do |key, value|
17
+ self.class.send(:define_method, key) { hash[key] }
18
+ self.class.send(:define_method, "#{key}=") { |v| hash[key] = v }
19
+ end
20
+ end
21
+ end
22
+
23
+ Gems.config = SimpleStruct.new(
24
+ :gemsets => [ "#{File.expand_path('../../../', __FILE__)}/config/gemsets.yml" ],
25
+ :gemspec => "#{File.expand_path('../../../', __FILE__)}/config/gemspec.yml",
26
+ :warn => true
27
+ )
28
+
29
+ def activate(*gems)
30
+ begin
31
+ require 'rubygems' unless defined?(::Gem)
32
+ rescue LoadError
33
+ puts "rubygems library could not be required" if @config.warn
34
+ end
35
+
36
+ self.gemset = :default unless defined?(@gemset) && @gemset
37
+
38
+ gems.flatten.collect(&:to_sym).each do |name|
39
+ version = @versions[name]
40
+ if defined?(gem)
41
+ gem name.to_s, version
42
+ else
43
+ puts "#{name} #{"(#{version})" if version} failed to activate" if @config.warn
44
+ end
45
+ end
46
+ end
47
+
48
+ def gemset=(gemset)
49
+ if gemset
50
+ @gemset = gemset.to_sym
51
+
52
+ @gemsets = @config.gemsets.reverse.collect { |config|
53
+ if config.is_a?(::String)
54
+ YAML::load(File.read(config)) rescue {}
55
+ elsif config.is_a?(::Hash)
56
+ config
57
+ end
58
+ }.inject({}) do |hash, config|
59
+ deep_merge(hash, symbolize_keys(config))
60
+ end
61
+
62
+ @versions = @gemsets[gemspec.name.to_sym].inject({}) do |hash, (key, value)|
63
+ if value.is_a?(::String)
64
+ hash[key] = value
65
+ elsif value.is_a?(::Hash) && key == @gemset
66
+ value.each { |k, v| hash[k] = v }
32
67
  end
68
+ hash
33
69
  end
70
+ else
71
+ @gemset = nil
72
+ @gemsets = nil
73
+ @versions = nil
34
74
  end
35
75
  end
36
76
 
37
- def require(type=nil)
38
- (TYPES[type] || TYPES.values.flatten.compact).each do |name|
39
- gem name.to_s, VERSIONS[name]
77
+ def gemspec(reload=false)
78
+ if @gemspec && !reload
79
+ @gemspec
80
+ else
81
+ data = YAML::load(File.read(@config.gemspec)) rescue {}
82
+ @gemspec = SimpleStruct.new(data)
83
+ end
84
+ end
85
+
86
+ private
87
+
88
+ def deep_merge(first, second)
89
+ merger = lambda do |key, v1, v2|
90
+ Hash === v1 && Hash === v2 ? v1.merge(v2, &merger) : v2
91
+ end
92
+ first.merge(second, &merger)
93
+ end
94
+
95
+ def symbolize_keys(hash)
96
+ return {} unless hash.is_a?(::Hash)
97
+ hash.inject({}) do |options, (key, value)|
98
+ value = symbolize_keys(value) if value.is_a?(::Hash)
99
+ options[(key.to_sym rescue key) || key] = value
100
+ options
40
101
  end
41
102
  end
42
103
  end
@@ -1,19 +1,21 @@
1
1
  require File.dirname(__FILE__) + '/active_wrapper/gems'
2
2
 
3
- ActiveWrapper::Gems.require(:lib)
3
+ case ActiveWrapper::Gems.gemset
4
+ when :default
5
+ ActiveWrapper::Gems.activate %w(activerecord mysql2)
6
+ when :activerecord_2
7
+ ActiveWrapper::Gems.activate %w(activerecord mysql)
8
+ end
4
9
 
5
10
  require 'active_record'
6
11
  require 'fileutils'
7
12
  require 'logger'
8
- require 'pony'
9
13
  require 'yaml'
10
14
 
11
15
  $:.unshift File.dirname(__FILE__) + '/active_wrapper'
12
16
 
13
17
  require 'db'
14
- require 'email'
15
18
  require 'log'
16
- require 'version'
17
19
 
18
20
  module ActiveWrapper
19
21
  class <<self
@@ -28,10 +30,9 @@ module ActiveWrapper
28
30
  }.merge(options.reject { |k, v| v.nil? })
29
31
 
30
32
  db = Db.new(options)
31
- mail = Email.new(options)
32
33
  log = Log.new(options)
33
34
 
34
- [ db, log, mail ]
35
+ [ db, log ]
35
36
  end
36
37
  end
37
38
  end
@@ -0,0 +1,48 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe ActiveWrapper::Db do
4
+
5
+ before(:each) do
6
+ $db, $log, $mail = ActiveWrapper.setup(
7
+ :base => $root + '/spec/fixtures/example_project',
8
+ :env => 'test'
9
+ )
10
+ $db.drop_db
11
+ $db.create_db
12
+ end
13
+
14
+ it "should establish a connection" do
15
+ $db.disconnect!
16
+ $db.establish_connection
17
+ $db.connected?.should == true
18
+ end
19
+
20
+ it "should create a database" do
21
+ $db.current_database.should == 'active_wrapper'
22
+ end
23
+
24
+ it "should drop a database" do
25
+ $db.drop_db
26
+ $db.current_database.should == nil
27
+ end
28
+
29
+ it "should migrate a database" do
30
+ $db.migrate
31
+ $db.execute('insert into tests () values ()')
32
+ $db.execute('select * from tests').num_rows.should == 1
33
+ end
34
+
35
+ it "should migrate reset a database" do
36
+ $db.migrate
37
+ $db.execute('insert into tests () values ()')
38
+ $db.migrate_reset
39
+ $db.execute('select * from tests').num_rows.should == 0
40
+ end
41
+
42
+ it "should generate a migration" do
43
+ $db.generate_migration 'another_test'
44
+ path = $root + "/spec/fixtures/example_project/db/migrate/002_another_test.rb"
45
+ File.exists?(path).should == true
46
+ FileUtils.rm_f path
47
+ end
48
+ end
@@ -0,0 +1,161 @@
1
+ require 'spec_helper'
2
+
3
+ describe ActiveWrapper::Gems do
4
+
5
+ before(:each) do
6
+ @old_config = ActiveWrapper::Gems.config
7
+
8
+ ActiveWrapper::Gems.config.gemspec = "#{$root}/spec/fixtures/gemspec.yml"
9
+ ActiveWrapper::Gems.config.gemsets = [
10
+ "#{$root}/spec/fixtures/gemsets.yml"
11
+ ]
12
+ ActiveWrapper::Gems.config.warn = true
13
+
14
+ ActiveWrapper::Gems.gemspec true
15
+ ActiveWrapper::Gems.gemset = nil
16
+ end
17
+
18
+ after(:each) do
19
+ ActiveWrapper::Gems.config = @old_config
20
+ end
21
+
22
+ describe :activate do
23
+ it "should activate gems" do
24
+ ActiveWrapper::Gems.stub!(:gem)
25
+ ActiveWrapper::Gems.should_receive(:gem).with('rspec', '=1.3.1')
26
+ ActiveWrapper::Gems.should_receive(:gem).with('rake', '=0.8.7')
27
+ ActiveWrapper::Gems.activate :rspec, 'rake'
28
+ end
29
+ end
30
+
31
+ describe :gemset= do
32
+ before(:each) do
33
+ ActiveWrapper::Gems.config.gemsets = [
34
+ {
35
+ :name => {
36
+ :rake => '>0.8.6',
37
+ :default => {
38
+ :externals => '=1.0.2'
39
+ }
40
+ }
41
+ },
42
+ "#{$root}/spec/fixtures/gemsets.yml"
43
+ ]
44
+ end
45
+
46
+ describe :default do
47
+ before(:each) do
48
+ ActiveWrapper::Gems.gemset = :default
49
+ end
50
+
51
+ it "should set @gemset" do
52
+ ActiveWrapper::Gems.gemset.should == :default
53
+ end
54
+
55
+ it "should set @gemsets" do
56
+ ActiveWrapper::Gems.gemsets.should == {
57
+ :name => {
58
+ :rake => ">0.8.6",
59
+ :default => {
60
+ :externals => '=1.0.2',
61
+ :rspec => "=1.3.1"
62
+ },
63
+ :rspec2 => { :rspec => "=2.3.0" }
64
+ }
65
+ }
66
+ end
67
+
68
+ it "should set Gems.versions" do
69
+ ActiveWrapper::Gems.versions.should == {
70
+ :rake => ">0.8.6",
71
+ :rspec => "=1.3.1",
72
+ :externals => "=1.0.2"
73
+ }
74
+ end
75
+
76
+ it "should set everything to nil if gemset given nil value" do
77
+ ActiveWrapper::Gems.gemset = nil
78
+ ActiveWrapper::Gems.gemset.should == nil
79
+ ActiveWrapper::Gems.gemsets.should == nil
80
+ ActiveWrapper::Gems.versions.should == nil
81
+ end
82
+ end
83
+
84
+ describe :rspec2 do
85
+ before(:each) do
86
+ ActiveWrapper::Gems.gemset = "rspec2"
87
+ end
88
+
89
+ it "should set @gemset" do
90
+ ActiveWrapper::Gems.gemset.should == :rspec2
91
+ end
92
+
93
+ it "should set @gemsets" do
94
+ ActiveWrapper::Gems.gemsets.should == {
95
+ :name => {
96
+ :rake => ">0.8.6",
97
+ :default => {
98
+ :externals => '=1.0.2',
99
+ :rspec => "=1.3.1"
100
+ },
101
+ :rspec2 => { :rspec => "=2.3.0" }
102
+ }
103
+ }
104
+ end
105
+
106
+ it "should set Gems.versions" do
107
+ ActiveWrapper::Gems.versions.should == {
108
+ :rake => ">0.8.6",
109
+ :rspec => "=2.3.0"
110
+ }
111
+ end
112
+ end
113
+
114
+ describe :nil do
115
+ before(:each) do
116
+ ActiveWrapper::Gems.gemset = nil
117
+ end
118
+
119
+ it "should set everything to nil" do
120
+ ActiveWrapper::Gems.gemset.should == nil
121
+ ActiveWrapper::Gems.gemsets.should == nil
122
+ ActiveWrapper::Gems.versions.should == nil
123
+ end
124
+ end
125
+ end
126
+
127
+ describe :reload_gemspec do
128
+ it "should populate @gemspec" do
129
+ ActiveWrapper::Gems.gemspec.hash.should == {
130
+ "name" => "name",
131
+ "version" => "0.1.0",
132
+ "authors" => ["Author"],
133
+ "email" => "email@email.com",
134
+ "homepage" => "http://github.com/author/name",
135
+ "summary" => "Summary",
136
+ "description" => "Description",
137
+ "dependencies" => ["rake"],
138
+ "development_dependencies" => ["rspec"]
139
+ }
140
+ end
141
+
142
+ it "should create methods from keys of @gemspec" do
143
+ ActiveWrapper::Gems.gemspec.name.should == "name"
144
+ ActiveWrapper::Gems.gemspec.version.should == "0.1.0"
145
+ ActiveWrapper::Gems.gemspec.authors.should == ["Author"]
146
+ ActiveWrapper::Gems.gemspec.email.should == "email@email.com"
147
+ ActiveWrapper::Gems.gemspec.homepage.should == "http://github.com/author/name"
148
+ ActiveWrapper::Gems.gemspec.summary.should == "Summary"
149
+ ActiveWrapper::Gems.gemspec.description.should == "Description"
150
+ ActiveWrapper::Gems.gemspec.dependencies.should == ["rake"]
151
+ ActiveWrapper::Gems.gemspec.development_dependencies.should == ["rspec"]
152
+ end
153
+
154
+ it "should produce a valid gemspec" do
155
+ ActiveWrapper::Gems.gemset = :default
156
+ gemspec = File.expand_path("../../../active_wrapper.gemspec", __FILE__)
157
+ gemspec = eval(File.read(gemspec), binding, gemspec)
158
+ gemspec.validate.should == true
159
+ end
160
+ end
161
+ end
@@ -0,0 +1,28 @@
1
+ require File.expand_path("#{File.dirname(__FILE__)}/../spec_helper")
2
+
3
+ describe ActiveWrapper::Log do
4
+
5
+ before(:each) do
6
+ FileUtils.rm_f(@path = $root + "/spec/fixtures/example_project/log/test.log")
7
+ $db, $log, $mail = ActiveWrapper.setup(
8
+ :base => $root + '/spec/fixtures/example_project',
9
+ :env => 'test'
10
+ )
11
+ end
12
+
13
+ it "should create a log file" do
14
+ File.exists?(@path).should == true
15
+ end
16
+
17
+ it "should log to the log file" do
18
+ $log.info "test"
19
+ File.read(@path).include?('test').should == true
20
+ end
21
+
22
+ it "should clear the log file while keeping the logger intact" do
23
+ $log.clear
24
+ File.read(@path).include?('test').should == false
25
+ $log.info "test"
26
+ File.read(@path).include?('test').should == true
27
+ end
28
+ end
@@ -0,0 +1,8 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require File.expand_path(File.dirname(__FILE__) + "/../../lib/active_wrapper/tasks")
4
+
5
+ ActiveWrapper::Tasks.new(
6
+ :base => File.dirname(__FILE__),
7
+ :env => 'test'
8
+ )
@@ -0,0 +1,6 @@
1
+ test:
2
+ database: active_wrapper
3
+ adapter: mysql
4
+ username: root
5
+ password:
6
+ host: localhost
@@ -0,0 +1,10 @@
1
+ class Test < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :tests do |t|
4
+ end
5
+ end
6
+
7
+ def self.down
8
+ drop_table :tests
9
+ end
10
+ end
@@ -0,0 +1,6 @@
1
+ name:
2
+ rake: =0.8.7
3
+ default:
4
+ rspec: =1.3.1
5
+ rspec2:
6
+ rspec: =2.3.0
@@ -0,0 +1,12 @@
1
+ name: name
2
+ version: 0.1.0
3
+ authors:
4
+ - Author
5
+ email: email@email.com
6
+ homepage: http://github.com/author/name
7
+ summary: Summary
8
+ description: Description
9
+ dependencies:
10
+ - rake
11
+ development_dependencies:
12
+ - rspec
data/spec/spec.opts ADDED
@@ -0,0 +1 @@
1
+ --color
@@ -0,0 +1,12 @@
1
+ $root = File.expand_path('../../', __FILE__)
2
+
3
+ require "#{$root}/lib/active_wrapper/gems"
4
+
5
+ ActiveWrapper::Gems.gemset = ENV['GEMSET'] if ENV['GEMSET']
6
+ ActiveWrapper::Gems.activate :rspec
7
+
8
+ require "#{$root}/lib/active_wrapper"
9
+ require 'pp'
10
+
11
+ Spec::Runner.configure do |config|
12
+ end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 3
8
7
  - 4
9
- version: 0.3.4
8
+ - 0
9
+ version: 0.4.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Winton Welsh
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-11-24 00:00:00 -08:00
17
+ date: 2010-12-30 00:00:00 -08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -23,13 +23,11 @@ dependencies:
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
24
  none: false
25
25
  requirements:
26
- - - "="
26
+ - - ">="
27
27
  - !ruby/object:Gem::Version
28
28
  segments:
29
- - 3
30
29
  - 0
31
- - 3
32
- version: 3.0.3
30
+ version: "0"
33
31
  type: :runtime
34
32
  version_requirements: *id001
35
33
  - !ruby/object:Gem::Dependency
@@ -38,13 +36,11 @@ dependencies:
38
36
  requirement: &id002 !ruby/object:Gem::Requirement
39
37
  none: false
40
38
  requirements:
41
- - - "="
39
+ - - ">="
42
40
  - !ruby/object:Gem::Version
43
41
  segments:
44
42
  - 0
45
- - 2
46
- - 6
47
- version: 0.2.6
43
+ version: "0"
48
44
  type: :runtime
49
45
  version_requirements: *id002
50
46
  - !ruby/object:Gem::Dependency
@@ -53,18 +49,15 @@ dependencies:
53
49
  requirement: &id003 !ruby/object:Gem::Requirement
54
50
  none: false
55
51
  requirements:
56
- - - "="
52
+ - - ">="
57
53
  - !ruby/object:Gem::Version
58
54
  segments:
59
- - 1
60
- - 3
61
- - 1
62
- version: 1.3.1
55
+ - 0
56
+ version: "0"
63
57
  type: :development
64
58
  version_requirements: *id003
65
59
  description: Wraps ActiveRecord and Logger for use in non-Rails environments
66
- email:
67
- - mail@wintoni.us
60
+ email: mail@wintoni.us
68
61
  executables: []
69
62
 
70
63
  extensions: []
@@ -72,16 +65,29 @@ extensions: []
72
65
  extra_rdoc_files: []
73
66
 
74
67
  files:
68
+ - .gitignore
69
+ - LICENSE
70
+ - README.md
71
+ - Rakefile
72
+ - active_wrapper.gemspec
73
+ - config/gemsets.yml
74
+ - config/gemspec.yml
75
+ - lib/active_wrapper.rb
75
76
  - lib/active_wrapper/db.rb
76
- - lib/active_wrapper/email.rb
77
77
  - lib/active_wrapper/gems.rb
78
78
  - lib/active_wrapper/log.rb
79
79
  - lib/active_wrapper/tasks.rb
80
- - lib/active_wrapper/version.rb
81
- - lib/active_wrapper.rb
82
80
  - resources/migration.template
83
- - LICENSE
84
- - README.md
81
+ - spec/active_wrapper/db_spec.rb
82
+ - spec/active_wrapper/gems_spec.rb
83
+ - spec/active_wrapper/log_spec.rb
84
+ - spec/fixtures/example_project/Rakefile
85
+ - spec/fixtures/example_project/config/database.yml
86
+ - spec/fixtures/example_project/db/migrate/001_test.rb
87
+ - spec/fixtures/gemsets.yml
88
+ - spec/fixtures/gemspec.yml
89
+ - spec/spec.opts
90
+ - spec/spec_helper.rb
85
91
  has_rdoc: true
86
92
  homepage: http://github.com/winton/active_wrapper
87
93
  licenses: []
@@ -114,5 +120,14 @@ rubygems_version: 1.3.7
114
120
  signing_key:
115
121
  specification_version: 3
116
122
  summary: Wraps ActiveRecord and Logger for use in non-Rails environments
117
- test_files: []
118
-
123
+ test_files:
124
+ - spec/active_wrapper/db_spec.rb
125
+ - spec/active_wrapper/gems_spec.rb
126
+ - spec/active_wrapper/log_spec.rb
127
+ - spec/fixtures/example_project/Rakefile
128
+ - spec/fixtures/example_project/config/database.yml
129
+ - spec/fixtures/example_project/db/migrate/001_test.rb
130
+ - spec/fixtures/gemsets.yml
131
+ - spec/fixtures/gemspec.yml
132
+ - spec/spec.opts
133
+ - spec/spec_helper.rb
@@ -1,41 +0,0 @@
1
- module ActiveWrapper
2
- class Email
3
-
4
- attr_reader :base, :env, :config
5
-
6
- def initialize(options)
7
- @base = options[:base]
8
- @config = {
9
- :smtp => options[:smtp],
10
- :sendmail => options[:sendmail]
11
- }
12
- @env = options[:env].to_s
13
-
14
- path = "#{base}/config/mail.yml"
15
- via = nil
16
-
17
- if File.exists?(path)
18
- yaml = YAML::load(File.open(path))
19
- if yaml && yaml[@env]
20
- yaml = yaml[@env].to_options
21
- [ :sendmail, :smtp ].each do |type|
22
- if yaml[type]
23
- via = type
24
- if yaml[type].respond_to?(:to_options)
25
- @config[type] = yaml[type].to_options
26
- end
27
- end
28
- end
29
- end
30
- end
31
-
32
- if via
33
- ::Pony.options = { :via => via, :via_options => config[via] }
34
- end
35
- end
36
-
37
- def deliver(options)
38
- ::Pony.mail options
39
- end
40
- end
41
- end
@@ -1,3 +0,0 @@
1
- module ActiveWrapper
2
- VERSION = "0.3.4" unless defined?(::ActiveWrapper::VERSION)
3
- end