vizzuality-sequel-rails 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/.document +5 -0
  2. data/.gitignore +29 -0
  3. data/Gemfile +3 -0
  4. data/Gemfile.lock +112 -0
  5. data/History.md +77 -0
  6. data/LICENSE +20 -0
  7. data/README.rdoc +102 -0
  8. data/Rakefile +9 -0
  9. data/autotest/discover.rb +1 -0
  10. data/lib/generators/sequel.rb +83 -0
  11. data/lib/generators/sequel/migration/migration_generator.rb +45 -0
  12. data/lib/generators/sequel/migration/templates/migration.rb +48 -0
  13. data/lib/generators/sequel/model/model_generator.rb +29 -0
  14. data/lib/generators/sequel/model/templates/migration.rb +16 -0
  15. data/lib/generators/sequel/model/templates/model.rb +6 -0
  16. data/lib/generators/sequel/observer/observer_generator.rb +19 -0
  17. data/lib/generators/sequel/observer/templates/observer.rb +7 -0
  18. data/lib/sequel-rails.rb +7 -0
  19. data/lib/sequel-rails/configuration.rb +63 -0
  20. data/lib/sequel-rails/migrations.rb +30 -0
  21. data/lib/sequel-rails/railtie.rb +93 -0
  22. data/lib/sequel-rails/railties/benchmarking_mixin.rb +23 -0
  23. data/lib/sequel-rails/railties/controller_runtime.rb +43 -0
  24. data/lib/sequel-rails/railties/database.rake +167 -0
  25. data/lib/sequel-rails/railties/i18n_support.rb +12 -0
  26. data/lib/sequel-rails/railties/log_subscriber.rb +31 -0
  27. data/lib/sequel-rails/runtime.rb +14 -0
  28. data/lib/sequel-rails/session_store.rb +82 -0
  29. data/lib/sequel-rails/setup.rb +27 -0
  30. data/lib/sequel-rails/storage.rb +222 -0
  31. data/lib/sequel-rails/version.rb +5 -0
  32. data/lib/sequel/plugins/rails_extensions.rb +35 -0
  33. data/spec/rcov.opts +6 -0
  34. data/spec/spec.opts +4 -0
  35. data/spec/spec_helper.rb +7 -0
  36. data/tasks/ci.rake +1 -0
  37. data/tasks/clean.rake +6 -0
  38. data/tasks/metrics.rake +37 -0
  39. data/tasks/spec.rake +30 -0
  40. data/tasks/yard.rake +9 -0
  41. data/tasks/yardstick.rake +20 -0
  42. data/vizzuality-sequel-rails.gemspec +29 -0
  43. metadata +208 -0
@@ -0,0 +1,5 @@
1
+ module Rails
2
+ module Sequel
3
+ VERSION = "0.3.4"
4
+ end
5
+ end
@@ -0,0 +1,35 @@
1
+ require 'sequel'
2
+
3
+ module Sequel
4
+ module Plugins
5
+ # The RailsExtensions plugin adds a single class method to Sequel::Model in
6
+ # order to make its use in controllers a little more like ActiveRecord's.
7
+ # The +find!+ method is added which will raise an exception if no object is
8
+ # found. By adding the following code to a Railtie:
9
+ #
10
+ # config.action_dispatch.rescue_responses.merge!(
11
+ # 'Sequel::Plugins::RailsExtensions::ModelNotFound' => :not_found
12
+ # )
13
+ #
14
+ # Usage:
15
+ #
16
+ # # Apply plugin to all models:
17
+ # Sequel::Model.plugin :rails_extensions
18
+ #
19
+ # # Apply plugin to a single model:
20
+ # Album.plugin :rails_extensions
21
+ module RailsExtensions
22
+ class ModelNotFound < Sequel::Error
23
+ end
24
+
25
+ module ClassMethods
26
+ def find!(args)
27
+ m = self[args]
28
+ raise ModelNotFound, "Couldn't find #{self} matching #{args}." unless m
29
+ m
30
+ end
31
+ end
32
+
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,6 @@
1
+ --exclude-only "spec\/,^\/"
2
+ --sort coverage
3
+ --callsites
4
+ --xrefs
5
+ --profile
6
+ --text-summary
@@ -0,0 +1,4 @@
1
+ --color
2
+ --loadby random
3
+ --format profile
4
+ --backtrace
@@ -0,0 +1,7 @@
1
+ require "sequel-rails"
2
+
3
+ # Load support files
4
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
5
+
6
+ RSpec.configure do |config|
7
+ end
@@ -0,0 +1 @@
1
+ task :ci => [ 'metrics:all' ]
@@ -0,0 +1,6 @@
1
+ require 'rake/clean'
2
+
3
+ File.foreach('.gitignore') do |line|
4
+ line.strip!
5
+ CLOBBER << line unless line.empty? || line[0, 1] == '#'
6
+ end
@@ -0,0 +1,37 @@
1
+ begin
2
+ require 'metric_fu'
3
+ rescue LoadError
4
+ namespace :metrics do
5
+ task :all do
6
+ abort 'metric_fu is not available. In order to run metrics:all, you must: gem install metric_fu'
7
+ end
8
+ end
9
+ end
10
+
11
+ begin
12
+ require 'reek/adapters/rake_task'
13
+
14
+ Reek::RakeTask.new do |t|
15
+ t.fail_on_error = true
16
+ t.verbose = false
17
+ t.source_files = 'lib/**/*.rb'
18
+ end
19
+ rescue LoadError
20
+ task :reek do
21
+ abort 'Reek is not available. In order to run reek, you must: gem install reek'
22
+ end
23
+ end
24
+
25
+ begin
26
+ require 'roodi'
27
+ require 'rake/tasklib'
28
+ require 'roodi_task'
29
+
30
+ RoodiTask.new do |t|
31
+ t.verbose = false
32
+ end
33
+ rescue LoadError
34
+ task :roodi do
35
+ abort 'Roodi is not available. In order to run roodi, you must: gem install roodi'
36
+ end
37
+ end
@@ -0,0 +1,30 @@
1
+ begin
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new('spec')
5
+
6
+ task :default => :spec
7
+
8
+ rescue LoadError
9
+ task :spec do
10
+ abort 'rspec is not available. In order to run spec, you must: bundle install'
11
+ end
12
+ end
13
+
14
+ begin
15
+ namespace :spec do
16
+ desc "Run all specs in spec directory with RCov (excluding plugin specs)"
17
+ RSpec::Core::RakeTask.new(:rcov) do |t|
18
+ t.rcov = true
19
+ t.rcov_opts = lambda do
20
+ IO.readlines("spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
21
+ end
22
+ end
23
+ end
24
+ rescue LoadError
25
+ namespace :spec do
26
+ task :rcov do
27
+ abort "rcov is not available. In order to run #{name}, you must: bundle install"
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,9 @@
1
+ begin
2
+ require 'yard'
3
+
4
+ YARD::Rake::YardocTask.new
5
+ rescue LoadError
6
+ task :yard do
7
+ abort 'YARD is not available. In order to run yard, you must: gem install yard'
8
+ end
9
+ end
@@ -0,0 +1,20 @@
1
+ begin
2
+ require 'pathname'
3
+ require 'yardstick'
4
+ require 'yardstick/rake/measurement'
5
+ require 'yardstick/rake/verify'
6
+
7
+ # yardstick_measure task
8
+ Yardstick::Rake::Measurement.new
9
+
10
+ # verify_measurements task
11
+ Yardstick::Rake::Verify.new do |verify|
12
+ verify.threshold = 100
13
+ end
14
+ rescue LoadError
15
+ %w[ yardstick_measure verify_measurements ].each do |name|
16
+ task name.to_s do
17
+ abort "Yardstick is not available. In order to run #{name}, you must: gem install yardstick"
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,29 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+
4
+ require "sequel-rails/version"
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "vizzuality-sequel-rails"
8
+ s.version = Rails::Sequel::VERSION
9
+ s.platform = Gem::Platform::RUBY
10
+ s.authors = ["Brasten Sager (brasten)", "Jonathan TRON"]
11
+ s.email = ["brasten@gmail.com", "jonathan.tron@thetalentbox.com"]
12
+ s.homepage = "https://github.com/Vizzuality/sequel-rails"
13
+ s.description = "Integrate Sequel with Rails 3"
14
+ s.summary = "Use Sequel with Rails 3"
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
+ s.require_paths = ["lib"]
19
+ s.extra_rdoc_files = ["LICENSE", "README.rdoc"]
20
+ s.rdoc_options = ["--charset=UTF-8"]
21
+ s.add_runtime_dependency("sequel", ["~> 3.28"])
22
+ s.add_runtime_dependency("rails", ["~> 3.2.0"])
23
+
24
+ s.add_development_dependency("rake", ["~> 0.8.7"])
25
+ s.add_development_dependency("yard", ["~> 0.5"])
26
+ s.add_development_dependency("rspec", ["~> 2.7.0"])
27
+ s.add_development_dependency("autotest", ["~> 4.4.6"])
28
+ s.add_development_dependency("rcov", ["~> 0.9.11"])
29
+ end
metadata ADDED
@@ -0,0 +1,208 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vizzuality-sequel-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.4
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Brasten Sager (brasten)
9
+ - Jonathan TRON
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2012-08-03 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: sequel
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: '3.28'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ~>
29
+ - !ruby/object:Gem::Version
30
+ version: '3.28'
31
+ - !ruby/object:Gem::Dependency
32
+ name: rails
33
+ requirement: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ~>
37
+ - !ruby/object:Gem::Version
38
+ version: 3.2.0
39
+ type: :runtime
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ~>
45
+ - !ruby/object:Gem::Version
46
+ version: 3.2.0
47
+ - !ruby/object:Gem::Dependency
48
+ name: rake
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 0.8.7
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ~>
61
+ - !ruby/object:Gem::Version
62
+ version: 0.8.7
63
+ - !ruby/object:Gem::Dependency
64
+ name: yard
65
+ requirement: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ~>
69
+ - !ruby/object:Gem::Version
70
+ version: '0.5'
71
+ type: :development
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ~>
77
+ - !ruby/object:Gem::Version
78
+ version: '0.5'
79
+ - !ruby/object:Gem::Dependency
80
+ name: rspec
81
+ requirement: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ~>
85
+ - !ruby/object:Gem::Version
86
+ version: 2.7.0
87
+ type: :development
88
+ prerelease: false
89
+ version_requirements: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ~>
93
+ - !ruby/object:Gem::Version
94
+ version: 2.7.0
95
+ - !ruby/object:Gem::Dependency
96
+ name: autotest
97
+ requirement: !ruby/object:Gem::Requirement
98
+ none: false
99
+ requirements:
100
+ - - ~>
101
+ - !ruby/object:Gem::Version
102
+ version: 4.4.6
103
+ type: :development
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: 4.4.6
111
+ - !ruby/object:Gem::Dependency
112
+ name: rcov
113
+ requirement: !ruby/object:Gem::Requirement
114
+ none: false
115
+ requirements:
116
+ - - ~>
117
+ - !ruby/object:Gem::Version
118
+ version: 0.9.11
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ none: false
123
+ requirements:
124
+ - - ~>
125
+ - !ruby/object:Gem::Version
126
+ version: 0.9.11
127
+ description: Integrate Sequel with Rails 3
128
+ email:
129
+ - brasten@gmail.com
130
+ - jonathan.tron@thetalentbox.com
131
+ executables: []
132
+ extensions: []
133
+ extra_rdoc_files:
134
+ - LICENSE
135
+ - README.rdoc
136
+ files:
137
+ - .document
138
+ - .gitignore
139
+ - Gemfile
140
+ - Gemfile.lock
141
+ - History.md
142
+ - LICENSE
143
+ - README.rdoc
144
+ - Rakefile
145
+ - autotest/discover.rb
146
+ - lib/generators/sequel.rb
147
+ - lib/generators/sequel/migration/migration_generator.rb
148
+ - lib/generators/sequel/migration/templates/migration.rb
149
+ - lib/generators/sequel/model/model_generator.rb
150
+ - lib/generators/sequel/model/templates/migration.rb
151
+ - lib/generators/sequel/model/templates/model.rb
152
+ - lib/generators/sequel/observer/observer_generator.rb
153
+ - lib/generators/sequel/observer/templates/observer.rb
154
+ - lib/sequel-rails.rb
155
+ - lib/sequel-rails/configuration.rb
156
+ - lib/sequel-rails/migrations.rb
157
+ - lib/sequel-rails/railtie.rb
158
+ - lib/sequel-rails/railties/benchmarking_mixin.rb
159
+ - lib/sequel-rails/railties/controller_runtime.rb
160
+ - lib/sequel-rails/railties/database.rake
161
+ - lib/sequel-rails/railties/i18n_support.rb
162
+ - lib/sequel-rails/railties/log_subscriber.rb
163
+ - lib/sequel-rails/runtime.rb
164
+ - lib/sequel-rails/session_store.rb
165
+ - lib/sequel-rails/setup.rb
166
+ - lib/sequel-rails/storage.rb
167
+ - lib/sequel-rails/version.rb
168
+ - lib/sequel/plugins/rails_extensions.rb
169
+ - spec/rcov.opts
170
+ - spec/spec.opts
171
+ - spec/spec_helper.rb
172
+ - tasks/ci.rake
173
+ - tasks/clean.rake
174
+ - tasks/metrics.rake
175
+ - tasks/spec.rake
176
+ - tasks/yard.rake
177
+ - tasks/yardstick.rake
178
+ - vizzuality-sequel-rails.gemspec
179
+ homepage: https://github.com/Vizzuality/sequel-rails
180
+ licenses: []
181
+ post_install_message:
182
+ rdoc_options:
183
+ - --charset=UTF-8
184
+ require_paths:
185
+ - lib
186
+ required_ruby_version: !ruby/object:Gem::Requirement
187
+ none: false
188
+ requirements:
189
+ - - ! '>='
190
+ - !ruby/object:Gem::Version
191
+ version: '0'
192
+ required_rubygems_version: !ruby/object:Gem::Requirement
193
+ none: false
194
+ requirements:
195
+ - - ! '>='
196
+ - !ruby/object:Gem::Version
197
+ version: '0'
198
+ requirements: []
199
+ rubyforge_project:
200
+ rubygems_version: 1.8.24
201
+ signing_key:
202
+ specification_version: 3
203
+ summary: Use Sequel with Rails 3
204
+ test_files:
205
+ - spec/rcov.opts
206
+ - spec/spec.opts
207
+ - spec/spec_helper.rb
208
+ has_rdoc: