merb_sequel 0.9.8 → 0.9.9
Sign up to get free protection for your applications and to get access to all the features.
- data/Generators +4 -0
- data/LICENSE +2 -1
- data/README +41 -4
- data/Rakefile +3 -3
- data/TODO +1 -4
- data/lib/merb/orms/sequel/connection.rb +16 -8
- data/lib/merb_sequel.rb +1 -0
- data/lib/sequel_ext/model.rb +7 -0
- metadata +6 -6
- data/specs/merb_sequel_session_spec.rb +0 -46
- data/specs/merb_sequel_spec.rb +0 -15
- data/specs/spec_helper.rb +0 -1
data/Generators
ADDED
data/LICENSE
CHANGED
data/README
CHANGED
@@ -1,10 +1,47 @@
|
|
1
1
|
= merb_sequel
|
2
2
|
|
3
|
-
A plugin for the Merb framework that provides Sequel
|
3
|
+
A plugin for the Merb framework that provides support for Sequel models.
|
4
|
+
|
5
|
+
|
6
|
+
= Connection options
|
7
|
+
|
8
|
+
Merb Sequel plugin uses config/database.yml for connection configuration.
|
9
|
+
|
10
|
+
Options are:
|
11
|
+
|
12
|
+
* adapter. :sqlite is assumed by default.
|
13
|
+
* host. localhost is assumed by default.
|
14
|
+
* username or user, default is an empty string
|
15
|
+
* database, default is "hey_dude_configure_your_database". This should be
|
16
|
+
either :memory: or file path for SQLite.
|
17
|
+
* encoding or charset, default is utf8.
|
18
|
+
* password. WARNING: default password is an empty string.
|
19
|
+
* db_type: default is nil. Use "mssql" to connect to MSSQL using ODBC.
|
20
|
+
|
21
|
+
|
22
|
+
= Generators
|
23
|
+
|
24
|
+
After you install the plugin, merb-gen can generate Sequel models for you:
|
25
|
+
|
26
|
+
merb-gen model --orm=sequel Article
|
27
|
+
|
28
|
+
same with resources
|
29
|
+
|
30
|
+
merb-gen resource --orm=sequel Article
|
31
|
+
|
32
|
+
|
33
|
+
Note that if you have specified that you use Sequel in init.rb or environment
|
34
|
+
specific init file (for instance, environments/development.rb)
|
35
|
+
via use_orm :sequel, you need no specify --orm option explicitly when
|
36
|
+
using merb-gen.
|
4
37
|
|
5
|
-
After you install the plugin, you have access to the sequel_migration generator in your merb projects
|
6
|
-
example: /merb/root/script/generate sequel_migration new_migration
|
7
38
|
|
8
39
|
= Contributors
|
9
40
|
|
10
|
-
|
41
|
+
Originally written by Duane Johnson (canadaduane@gmail.com).
|
42
|
+
|
43
|
+
Contributions by:
|
44
|
+
* Wayne E. Seguin
|
45
|
+
* Lance Carlson
|
46
|
+
|
47
|
+
Maintained by Michael S. Klishin (michael at novemberain.com)
|
data/Rakefile
CHANGED
@@ -18,7 +18,7 @@ GEM_EMAIL = "wayneeseguin@gmail.com, lancecarlson@gmail.com"
|
|
18
18
|
|
19
19
|
GEM_NAME = "merb_sequel"
|
20
20
|
PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
|
21
|
-
GEM_VERSION = (Merb::MORE_VERSION rescue "0.9.
|
21
|
+
GEM_VERSION = (Merb::MORE_VERSION rescue "0.9.9") + PKG_BUILD
|
22
22
|
|
23
23
|
RELEASE_NAME = "REL #{GEM_VERSION}"
|
24
24
|
|
@@ -36,9 +36,9 @@ spec = Gem::Specification.new do |s|
|
|
36
36
|
s.author = GEM_AUTHOR
|
37
37
|
s.email = GEM_EMAIL
|
38
38
|
s.homepage = PROJECT_URL
|
39
|
-
s.add_dependency("merb-core", ">= 0.9.
|
39
|
+
s.add_dependency("merb-core", ">= 0.9.9")
|
40
40
|
s.add_dependency("sequel", ">= 1.4.0")
|
41
|
-
s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib
|
41
|
+
s.files = %w(LICENSE README Rakefile TODO Generators) + Dir.glob("{lib}/**/*")
|
42
42
|
end
|
43
43
|
|
44
44
|
Rake::GemPackageTask.new(spec) do |pkg|
|
data/TODO
CHANGED
@@ -20,7 +20,7 @@ module Merb
|
|
20
20
|
# Convert string keys to symbols
|
21
21
|
full_config = Erubis.load_yaml_file(config_file)
|
22
22
|
config = (Merb::Plugins.config[:merb_sequel] = {})
|
23
|
-
(full_config[Merb.environment.to_sym] || full_config[Merb.environment]).each do |key, value|
|
23
|
+
(full_config[Merb.environment.to_sym] || full_config[Merb.environment] || full_config[:development]).each do |key, value|
|
24
24
|
config[key.to_sym] = value
|
25
25
|
end
|
26
26
|
config
|
@@ -45,14 +45,22 @@ module Merb
|
|
45
45
|
|
46
46
|
def config_options(config = {})
|
47
47
|
options = {}
|
48
|
+
|
49
|
+
# Use SQLite by default
|
48
50
|
options[:adapter] = (config[:adapter] || "sqlite")
|
49
|
-
|
50
|
-
options[:
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
51
|
+
# Use localhost as default host
|
52
|
+
options[:host] = (config[:host] || "localhost")
|
53
|
+
# Default user is an empty string. Both username and user keys are supported.
|
54
|
+
options[:user] = (config[:username] || config[:user] || "")
|
55
|
+
|
56
|
+
options[:password] = config[:password] || ""
|
57
|
+
|
58
|
+
# Both encoding and charset options are supported, default is utf8
|
59
|
+
options[:encoding] = (config[:encoding] || config[:charset] || "utf8")
|
60
|
+
# Default database is hey_dude_configure_your_database
|
61
|
+
options[:database] = config[:database] || "hey_dude_configure_your_database"
|
62
|
+
# MSSQL support
|
63
|
+
options[:db_type] = config[:db_type] if config[:db_type]
|
56
64
|
options[:logger] = Merb.logger
|
57
65
|
options
|
58
66
|
end
|
data/lib/merb_sequel.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
if defined?(Merb::Plugins)
|
2
2
|
Merb::Plugins.config[:merb_sequel] = {}
|
3
|
+
require File.join(File.dirname(__FILE__) / "sequel_ext" / "model")
|
3
4
|
require File.join(File.dirname(__FILE__) / "merb" / "orms" / "sequel" / "connection")
|
4
5
|
Merb::Plugins.add_rakefiles "merb_sequel" / "merbtasks"
|
5
6
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: merb_sequel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wayne E. Seguin, Lance Carlson
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-10-
|
12
|
+
date: 2008-10-14 00:00:00 +03:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 0.9.
|
23
|
+
version: 0.9.9
|
24
24
|
version:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: sequel
|
@@ -47,6 +47,7 @@ files:
|
|
47
47
|
- README
|
48
48
|
- Rakefile
|
49
49
|
- TODO
|
50
|
+
- Generators
|
50
51
|
- lib/generators
|
51
52
|
- lib/generators/migration.rb
|
52
53
|
- lib/generators/model.rb
|
@@ -85,9 +86,8 @@ files:
|
|
85
86
|
- lib/merb_sequel
|
86
87
|
- lib/merb_sequel/merbtasks.rb
|
87
88
|
- lib/merb_sequel.rb
|
88
|
-
-
|
89
|
-
-
|
90
|
-
- specs/spec_helper.rb
|
89
|
+
- lib/sequel_ext
|
90
|
+
- lib/sequel_ext/model.rb
|
91
91
|
has_rdoc: true
|
92
92
|
homepage: http://merbivore.com
|
93
93
|
post_install_message:
|
@@ -1,46 +0,0 @@
|
|
1
|
-
$:.push File.join(File.dirname(__FILE__), '..', 'lib')
|
2
|
-
require 'merb-core'
|
3
|
-
require 'merb-core/test'
|
4
|
-
require 'merb-core/test/helpers'
|
5
|
-
|
6
|
-
Merb::BootLoader.before_app_loads do
|
7
|
-
require 'sequel'
|
8
|
-
DB = Sequel.sqlite
|
9
|
-
require "merb/session/sequel_session"
|
10
|
-
end
|
11
|
-
|
12
|
-
Merb.start :environment => 'test', :adapter => 'runner', :session_store => 'sequel'
|
13
|
-
|
14
|
-
Spec::Runner.configure do |config|
|
15
|
-
config.include Merb::Test::RequestHelper
|
16
|
-
end
|
17
|
-
|
18
|
-
# Load up the shared specs from merb-core
|
19
|
-
if (gem_spec = Gem.source_index.search(Gem::Dependency.new('merb-core', '>=0.9.6')).last) &&
|
20
|
-
gem_spec.files.include?('spec/public/session/controllers/sessions.rb')
|
21
|
-
require gem_spec.full_gem_path / 'spec/public/session/controllers/sessions.rb'
|
22
|
-
require gem_spec.full_gem_path / 'spec/public/session/session_spec.rb'
|
23
|
-
end
|
24
|
-
|
25
|
-
describe Merb::SequelSession do
|
26
|
-
|
27
|
-
before do
|
28
|
-
@session_class = Merb::SequelSession
|
29
|
-
@session = @session_class.generate
|
30
|
-
end
|
31
|
-
|
32
|
-
it_should_behave_like "All session-store backends"
|
33
|
-
|
34
|
-
it "should have a session_store_type class attribute" do
|
35
|
-
@session.class.session_store_type.should == :sequel
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
|
40
|
-
describe Merb::SequelSession, "mixed into Merb::Controller" do
|
41
|
-
|
42
|
-
before(:all) { @session_class = Merb::SequelSession }
|
43
|
-
|
44
|
-
it_should_behave_like "All session-stores mixed into Merb::Controller"
|
45
|
-
|
46
|
-
end
|
data/specs/merb_sequel_spec.rb
DELETED
data/specs/spec_helper.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
$:.push File.join(File.dirname(__FILE__), "..", "lib")
|