rails_sequel 0.0.2

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.md ADDED
@@ -0,0 +1,37 @@
1
+ Sequel for Rails
2
+ ================
3
+
4
+ Installation
5
+ ------------
6
+
7
+ ### Using Rails plugin script:
8
+
9
+ script/plugin install git://github.com/pusewicz/rails_sequel.git
10
+
11
+ ### Using Rails 2.1 Gem dependencies
12
+
13
+ Install the gem
14
+
15
+ gem sources -a http://gems.github.com
16
+ gem install pusewicz-rails_sequel
17
+
18
+ Load the gem in `environment.rb`
19
+
20
+ Rails::Initializer.run do |config|
21
+ config.gem 'pusewicz-rails_sequel', :version => '~> 0.0.2', :lib => 'rails_sequel', :source => 'http://gems.github.com'
22
+ end
23
+
24
+ Optional
25
+ --------
26
+
27
+ Remove ActiveRecord framework in `environment.rb` file:
28
+
29
+ config.frameworks -= [ :active_record ]
30
+
31
+ Community
32
+ =========
33
+
34
+ IRC Channel
35
+ -----------
36
+
37
+ You can find us on #sequel channel ([irc://irc.freenode.net/#sequel](irc://irc.freenode.net/#sequel))
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/lib/rails_sequel')
@@ -0,0 +1,27 @@
1
+ module Rails
2
+ module SequelConnection
3
+ # Load configuration for current environment
4
+ CONFIG = YAML::load(ERB.new(IO.read(Rails.root + "/config/database.yml")).result)[Rails.env].with_indifferent_access unless defined?(CONFIG)
5
+
6
+ # Connects to database using constructed Database Connection URI
7
+ def self.connect
8
+ Sequel.connect uri, :loggers => [Rails.logger]
9
+ end
10
+
11
+ # Returns loaded database.yml configuration for current environment
12
+ def self.config
13
+ CONFIG
14
+ end
15
+
16
+ # Constructs Database Connection URI
17
+ def self.uri
18
+ uri = config[:adapter] << "://"
19
+ uri << config[:username] if config[:username]
20
+ uri << ':' << config[:password] if config[:password]
21
+ uri << '@' if config[:username] || config[:password]
22
+ uri << ':' << config[:port] if config[:port]
23
+ uri << (config[:host] || 'localhost')
24
+ uri << '/' << config[:database]
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,12 @@
1
+ class Sequel::Model
2
+
3
+ # Allows Rails resource path helpers to work correctly
4
+ def to_param
5
+ pk.to_s
6
+ end
7
+
8
+ # Make new? play nice with Rails
9
+ def new_record?
10
+ new?
11
+ end
12
+ end
@@ -0,0 +1,15 @@
1
+ module Rails
2
+ module SequelConnection
3
+ module Version
4
+ MAJOR = 0
5
+ MINOR = 0
6
+ TINY = 2
7
+
8
+ STRING = [MAJOR, MINOR, TINY].join('.')
9
+ end
10
+
11
+ def self.version
12
+ Version::STRING
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,8 @@
1
+ gem 'sequel'
2
+ require 'sequel'
3
+
4
+ require File.expand_path(File.dirname(__FILE__) + '/rails_sequel/rails_sequel')
5
+ require File.expand_path(File.dirname(__FILE__) + '/rails_sequel/version')
6
+ require File.expand_path(File.dirname(__FILE__) + '/rails_sequel/sequel_ext')
7
+
8
+ Rails::SequelConnection.connect
metadata ADDED
@@ -0,0 +1,58 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rails_sequel
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Piotr Usewicz
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-01-10 00:00:00 +00:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: rails_sequel allows you to quickly use Sequel Toolkit as your ORM in Ruby on Rails
17
+ email: piotr@layer22.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - lib/rails_sequel/rails_sequel.rb
26
+ - lib/rails_sequel/sequel_ext.rb
27
+ - lib/rails_sequel/version.rb
28
+ - lib/rails_sequel.rb
29
+ - init.rb
30
+ - README.md
31
+ has_rdoc: false
32
+ homepage: http://github.com/pusewicz/rails_sequel/wikis
33
+ post_install_message:
34
+ rdoc_options: []
35
+
36
+ require_paths:
37
+ - lib
38
+ required_ruby_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: "0"
43
+ version:
44
+ required_rubygems_version: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: "0"
49
+ version:
50
+ requirements: []
51
+
52
+ rubyforge_project:
53
+ rubygems_version: 1.3.1
54
+ signing_key:
55
+ specification_version: 2
56
+ summary: Sequel plugin for Ruby on Rails
57
+ test_files: []
58
+