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 ADDED
@@ -0,0 +1,4 @@
1
+ scope 'merb-gen' do
2
+ dir = File.join(File.dirname(__FILE__), 'lib', 'generators/')
3
+ Merb.add_generators dir + 'migration', dir + 'model', dir + 'resource_controller', dir + 'session_migration'
4
+ end
data/LICENSE CHANGED
@@ -1,4 +1,5 @@
1
- Copyright (c) 2007 YOUR NAME
1
+ Copyright (c) 2007-2008,
2
+ Duane Johnson, Wayne E. Seguin, Lance Carlson, Michael S. Klishin.
2
3
 
3
4
  Permission is hereby granted, free of charge, to any person obtaining
4
5
  a copy of this software and associated documentation files (the
data/README CHANGED
@@ -1,10 +1,47 @@
1
1
  = merb_sequel
2
2
 
3
- A plugin for the Merb framework that provides Sequel access
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
- originally written by Duane Johnson (canadaduane@gmail.com).
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.8") + PKG_BUILD
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.8")
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,specs,sequel_generators}/**/*")
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
@@ -1,5 +1,2 @@
1
1
  TODO:
2
- Fix LICENSE with your name
3
- Fix Rakefile with your name and contact info
4
- Add your code to lib/merb_sequel.rb
5
- Add your Merb rake tasks to lib/merb_sequel/merbtasks.rb
2
+ * More meaningful messages for cases with misconfigured database.yml.
@@ -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
- options[:host] = (config[:host] || "localhost")
50
- options[:user] = (config[:username] || config[:user] || "root")
51
- options[:password] = config[:password] if config[:password]
52
- if (config[:encoding] || config[:charset])
53
- options[:encoding] = (config[:encoding] || config[:charset])
54
- end
55
- options[:database] = config[:database] if config[:database]
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
 
@@ -0,0 +1,7 @@
1
+ module Sequel
2
+ class Model
3
+ def new_record?
4
+ self.new?
5
+ end
6
+ end
7
+ end
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.8
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-07 00:00:00 +03:00
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.8
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
- - specs/merb_sequel_session_spec.rb
89
- - specs/merb_sequel_spec.rb
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
@@ -1,15 +0,0 @@
1
- require File.dirname(__FILE__) + "/spec_helper"
2
-
3
- describe "merb_sequel" do
4
-
5
- it "should do nothing" do
6
- true.should == true
7
- end
8
-
9
- end
10
-
11
- describe "merb_sequel Generators" do
12
- it "should description" do
13
-
14
- end
15
- end
data/specs/spec_helper.rb DELETED
@@ -1 +0,0 @@
1
- $:.push File.join(File.dirname(__FILE__), "..", "lib")