QaDeS-qades-sequel 2.11.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +2322 -0
- data/COPYING +19 -0
- data/README.rdoc +670 -0
- data/Rakefile +180 -0
- data/bin/sequel +104 -0
- metadata +64 -0
data/Rakefile
ADDED
@@ -0,0 +1,180 @@
|
|
1
|
+
require "rake"
|
2
|
+
require "rake/clean"
|
3
|
+
require "rake/gempackagetask"
|
4
|
+
require "spec/rake/spectask"
|
5
|
+
begin
|
6
|
+
require "hanna/rdoctask"
|
7
|
+
rescue LoadError
|
8
|
+
require "rake/rdoctask"
|
9
|
+
end
|
10
|
+
require "fileutils"
|
11
|
+
require "lib/sequel_core/version"
|
12
|
+
|
13
|
+
include FileUtils
|
14
|
+
|
15
|
+
NAME = 'sequel'
|
16
|
+
VERS = Sequel.version
|
17
|
+
CLEAN.include ["**/.*.sw?", "pkg", ".config", "rdoc", "coverage", "www/public/*.html"]
|
18
|
+
RDOC_OPTS = ["--quiet", "--line-numbers", "--inline-source", '--title', \
|
19
|
+
'Sequel: The Database Toolkit for Ruby', '--main', 'README.rdoc']
|
20
|
+
|
21
|
+
# Gem Packaging and Release
|
22
|
+
|
23
|
+
desc "Packages sequel"
|
24
|
+
task :package=>[:clean]
|
25
|
+
spec = Gem::Specification.new do |s|
|
26
|
+
s.name = NAME
|
27
|
+
s.rubyforge_project = 'sequel'
|
28
|
+
s.version = VERS
|
29
|
+
s.platform = Gem::Platform::RUBY
|
30
|
+
s.has_rdoc = true
|
31
|
+
s.extra_rdoc_files = ["README.rdoc", "CHANGELOG", "COPYING"] + Dir["doc/*.rdoc"] + Dir['doc/release_notes/*.txt']
|
32
|
+
s.rdoc_options += RDOC_OPTS
|
33
|
+
s.summary = "The Database Toolkit for Ruby"
|
34
|
+
s.description = s.summary
|
35
|
+
s.author = "Jeremy Evans"
|
36
|
+
s.email = "code@jeremyevans.net"
|
37
|
+
s.homepage = "http://sequel.rubyforge.org"
|
38
|
+
s.required_ruby_version = ">= 1.8.4"
|
39
|
+
s.files = %w(COPYING CHANGELOG README.rdoc Rakefile) + Dir.glob("{bin,doc,spec,lib}/**/*")
|
40
|
+
s.require_path = "lib"
|
41
|
+
s.bindir = 'bin'
|
42
|
+
s.executables << 'sequel'
|
43
|
+
end
|
44
|
+
Rake::GemPackageTask.new(spec) do |p|
|
45
|
+
p.need_tar = true
|
46
|
+
p.gem_spec = spec
|
47
|
+
end
|
48
|
+
|
49
|
+
desc "Install sequel gem"
|
50
|
+
task :install=>[:package] do
|
51
|
+
sh %{sudo gem install pkg/#{NAME}-#{VERS} --local}
|
52
|
+
end
|
53
|
+
|
54
|
+
desc "Install sequel gem without RDoc"
|
55
|
+
task :install_no_docs=>[:package] do
|
56
|
+
sh %{sudo gem install pkg/#{NAME}-#{VERS} --no-rdoc --no-ri --local}
|
57
|
+
end
|
58
|
+
|
59
|
+
desc "Uninstall sequel gem"
|
60
|
+
task :uninstall=>[:clean] do
|
61
|
+
sh %{sudo gem uninstall #{NAME}}
|
62
|
+
end
|
63
|
+
|
64
|
+
desc "Upload sequel and sequel_core gems to rubyforge"
|
65
|
+
task :release=>[:package] do
|
66
|
+
sh %{rubyforge login}
|
67
|
+
sh %{rubyforge add_release sequel #{NAME} #{VERS} pkg/#{NAME}-#{VERS}.tgz}
|
68
|
+
sh %{rubyforge add_file sequel #{NAME} #{VERS} pkg/#{NAME}-#{VERS}.gem}
|
69
|
+
end
|
70
|
+
|
71
|
+
### RDoc
|
72
|
+
|
73
|
+
Rake::RDocTask.new do |rdoc|
|
74
|
+
rdoc.rdoc_dir = "rdoc"
|
75
|
+
rdoc.options += RDOC_OPTS
|
76
|
+
rdoc.rdoc_files.add %w"README.rdoc CHANGELOG COPYING lib/**/*.rb doc/*.rdoc doc/release_notes/*.txt"
|
77
|
+
end
|
78
|
+
|
79
|
+
### Website
|
80
|
+
|
81
|
+
desc "Update Non-RDoc section of sequel.rubyforge.org"
|
82
|
+
task :website_base do
|
83
|
+
sh %{www/make_www.rb}
|
84
|
+
sh %{scp -r www/public/* rubyforge.org:/var/www/gforge-projects/sequel/}
|
85
|
+
end
|
86
|
+
|
87
|
+
desc "Update RDoc section of sequel.rubyforge.org"
|
88
|
+
task :website_rdoc=>[:rerdoc] do
|
89
|
+
sh %{scp -r rdoc/* rubyforge.org:/var/www/gforge-projects/sequel/rdoc/}
|
90
|
+
end
|
91
|
+
|
92
|
+
desc "Update sequel.rubyforge.org"
|
93
|
+
task :website=>[:website_base, :website_rdoc]
|
94
|
+
|
95
|
+
### Specs
|
96
|
+
|
97
|
+
lib_dir = File.join(File.dirname(__FILE__), 'lib')
|
98
|
+
fixRUBYLIB = Proc.new{ENV['RUBYLIB'] ? (ENV['RUBYLIB'] += ":#{lib_dir}") : (ENV['RUBYLIB'] = lib_dir)}
|
99
|
+
sequel_core_specs = "spec/sequel_core/*_spec.rb"
|
100
|
+
sequel_model_specs = "spec/sequel_model/*_spec.rb"
|
101
|
+
sequel_plugin_specs = "spec/extensions/*_spec.rb"
|
102
|
+
spec_opts = proc{File.read("spec/spec.opts").split("\n")}
|
103
|
+
rcov_opts = proc{File.read("spec/rcov.opts").split("\n")}
|
104
|
+
|
105
|
+
desc "Run core and model specs with coverage"
|
106
|
+
Spec::Rake::SpecTask.new("spec_coverage") do |t|
|
107
|
+
fixRUBYLIB.call
|
108
|
+
t.spec_files = FileList[sequel_core_specs, sequel_model_specs]
|
109
|
+
t.spec_opts = spec_opts.call
|
110
|
+
t.rcov_opts = rcov_opts.call
|
111
|
+
t.rcov = true
|
112
|
+
end
|
113
|
+
|
114
|
+
desc "Run core and model specs"
|
115
|
+
task :default => [:spec]
|
116
|
+
Spec::Rake::SpecTask.new("spec") do |t|
|
117
|
+
fixRUBYLIB.call
|
118
|
+
t.spec_files = FileList[sequel_core_specs, sequel_model_specs]
|
119
|
+
t.spec_opts = spec_opts.call
|
120
|
+
end
|
121
|
+
|
122
|
+
desc "Run core specs"
|
123
|
+
Spec::Rake::SpecTask.new("spec_core") do |t|
|
124
|
+
fixRUBYLIB.call
|
125
|
+
t.spec_files = FileList[sequel_core_specs]
|
126
|
+
t.spec_opts = spec_opts.call
|
127
|
+
end
|
128
|
+
|
129
|
+
desc "Run model specs"
|
130
|
+
Spec::Rake::SpecTask.new("spec_model") do |t|
|
131
|
+
fixRUBYLIB.call
|
132
|
+
t.spec_files = FileList[sequel_model_specs]
|
133
|
+
t.spec_opts = spec_opts.call
|
134
|
+
end
|
135
|
+
|
136
|
+
desc "Run extension/plugin specs"
|
137
|
+
Spec::Rake::SpecTask.new("spec_plugin") do |t|
|
138
|
+
fixRUBYLIB.call
|
139
|
+
t.spec_files = FileList[sequel_plugin_specs]
|
140
|
+
t.spec_opts = spec_opts.call
|
141
|
+
end
|
142
|
+
|
143
|
+
desc "Run integration tests"
|
144
|
+
Spec::Rake::SpecTask.new("integration") do |t|
|
145
|
+
fixRUBYLIB.call
|
146
|
+
t.spec_files = FileList["spec/integration/*_test.rb"]
|
147
|
+
t.spec_opts = spec_opts.call
|
148
|
+
end
|
149
|
+
|
150
|
+
%w'postgres sqlite mysql informix oracle ado'.each do |adapter|
|
151
|
+
desc "Run #{adapter} specs without coverage"
|
152
|
+
Spec::Rake::SpecTask.new("spec_#{adapter}") do |t|
|
153
|
+
t.spec_files = ["spec/adapters/#{adapter}_spec.rb"]
|
154
|
+
t.spec_opts = spec_opts.call
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
desc "check documentation coverage"
|
159
|
+
task :dcov do
|
160
|
+
sh %{find lib -name '*.rb' | xargs dcov}
|
161
|
+
end
|
162
|
+
|
163
|
+
### Statistics
|
164
|
+
|
165
|
+
STATS_DIRECTORIES = [
|
166
|
+
%w(Code lib/),
|
167
|
+
%w(Spec spec),
|
168
|
+
].collect { |name, dir| [ name, "./#{dir}" ] }.select { |name, dir| File.directory?(dir) }
|
169
|
+
|
170
|
+
desc "Report code statistics (KLOCs, etc) from the application"
|
171
|
+
task :stats do
|
172
|
+
require "extra/stats"
|
173
|
+
verbose = true
|
174
|
+
CodeStatistics.new(*STATS_DIRECTORIES).to_s
|
175
|
+
end
|
176
|
+
|
177
|
+
desc "Print Sequel version"
|
178
|
+
task :version do
|
179
|
+
puts VERS
|
180
|
+
end
|
data/bin/sequel
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'optparse'
|
5
|
+
require 'sequel'
|
6
|
+
|
7
|
+
db_opts = {}
|
8
|
+
echo = nil
|
9
|
+
env = nil
|
10
|
+
logfile = nil
|
11
|
+
migrate_dir = nil
|
12
|
+
migrate_ver = nil
|
13
|
+
load_dir = nil
|
14
|
+
|
15
|
+
opts = OptionParser.new do |opts|
|
16
|
+
opts.banner = "Sequel: The Database Toolkit for Ruby"
|
17
|
+
opts.define_head "Usage: sequel <uri|path> [options]"
|
18
|
+
opts.separator ""
|
19
|
+
opts.separator "Examples:"
|
20
|
+
opts.separator " sequel sqlite://blog.db"
|
21
|
+
opts.separator " sequel postgres://localhost/my_blog"
|
22
|
+
opts.separator " sequel config/database.yml"
|
23
|
+
opts.separator ""
|
24
|
+
opts.separator "For more information see http://sequel.rubyforge.org"
|
25
|
+
opts.separator ""
|
26
|
+
opts.separator "Options:"
|
27
|
+
|
28
|
+
opts.on_tail("-?", "--help", "Show this message") do
|
29
|
+
puts opts
|
30
|
+
exit
|
31
|
+
end
|
32
|
+
|
33
|
+
opts.on("-e", "--env ENV", "use environment config for database") do |v|
|
34
|
+
env = v
|
35
|
+
end
|
36
|
+
|
37
|
+
opts.on("-E", "--echo", "echo SQL statements") do
|
38
|
+
echo = true
|
39
|
+
end
|
40
|
+
|
41
|
+
opts.on("-l", "--log logfile", "log SQL statements to log file") do |v|
|
42
|
+
logfile = v
|
43
|
+
end
|
44
|
+
|
45
|
+
opts.on("-L", "--load-dir DIR", "loads all *.rb from specifed directory") do |v|
|
46
|
+
load_dir = v
|
47
|
+
end
|
48
|
+
|
49
|
+
opts.on("-m", "--migrate-directory DIR", "run the migrations in directory") do |v|
|
50
|
+
migrate_dir = v
|
51
|
+
end
|
52
|
+
|
53
|
+
opts.on("-M", "--migrate-version VER", "migrate the database to version given") do |v|
|
54
|
+
migrate_ver = Integer(v)
|
55
|
+
end
|
56
|
+
|
57
|
+
opts.on_tail("-v", "--version", "Show version") do
|
58
|
+
puts "sequel #{Sequel.version}"
|
59
|
+
exit
|
60
|
+
end
|
61
|
+
end
|
62
|
+
opts.parse!
|
63
|
+
|
64
|
+
db = ARGV.shift
|
65
|
+
|
66
|
+
if db.blank?
|
67
|
+
puts opts
|
68
|
+
exit 1
|
69
|
+
end
|
70
|
+
|
71
|
+
if logfile || echo
|
72
|
+
require 'logger'
|
73
|
+
db_opts[:loggers] = []
|
74
|
+
db_opts[:loggers] << Logger.new(logfile) if logfile
|
75
|
+
db_opts[:loggers] << Logger.new($stdout) if echo
|
76
|
+
end
|
77
|
+
|
78
|
+
if File.exist?(db)
|
79
|
+
require 'yaml'
|
80
|
+
env ||= "development"
|
81
|
+
db_config = YAML.load_file(db)
|
82
|
+
db_config = db_config[env] || db_config[env.to_sym] || db_config
|
83
|
+
db_config.each{|(k,v)| db_config[k.to_sym] = db_config.delete(k)}
|
84
|
+
db_config.merge!(db_opts)
|
85
|
+
end
|
86
|
+
|
87
|
+
begin
|
88
|
+
DB = Sequel.connect(*(db_config ? [db_config] : [db, db_opts]))
|
89
|
+
DB.test_connection
|
90
|
+
if migrate_dir
|
91
|
+
Sequel::Migrator.apply(DB, migrate_dir, migrate_ver)
|
92
|
+
exit
|
93
|
+
end
|
94
|
+
rescue => e
|
95
|
+
puts "#{e.class}: #{e.message}"
|
96
|
+
puts e.backtrace.first
|
97
|
+
exit 1
|
98
|
+
end
|
99
|
+
|
100
|
+
Dir["#{load_dir}/**/*.rb"].each{|f| load(f)} if load_dir
|
101
|
+
|
102
|
+
require 'irb'
|
103
|
+
puts "Your database is stored in DB..."
|
104
|
+
IRB.start
|
metadata
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: QaDeS-qades-sequel
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.11.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Michael Klaus
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-02-25 00:00:00 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: The Database Toolkit for Ruby
|
17
|
+
email: Michael.Klaus@gmx.net
|
18
|
+
executables:
|
19
|
+
- sequel
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README.rdoc
|
24
|
+
- CHANGELOG
|
25
|
+
- COPYING
|
26
|
+
files:
|
27
|
+
- COPYING
|
28
|
+
- CHANGELOG
|
29
|
+
- README.rdoc
|
30
|
+
- Rakefile
|
31
|
+
has_rdoc: true
|
32
|
+
homepage: http://sequel.rubyforge.org
|
33
|
+
post_install_message:
|
34
|
+
rdoc_options:
|
35
|
+
- --quiet
|
36
|
+
- --line-numbers
|
37
|
+
- --inline-source
|
38
|
+
- --title
|
39
|
+
- "Sequel: The Database Toolkit for Ruby"
|
40
|
+
- --main
|
41
|
+
- README.rdoc
|
42
|
+
require_paths:
|
43
|
+
- lib
|
44
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 1.8.4
|
49
|
+
version:
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: "0"
|
55
|
+
version:
|
56
|
+
requirements: []
|
57
|
+
|
58
|
+
rubyforge_project: sequel
|
59
|
+
rubygems_version: 1.2.0
|
60
|
+
signing_key:
|
61
|
+
specification_version: 2
|
62
|
+
summary: The Database Toolkit for Ruby
|
63
|
+
test_files: []
|
64
|
+
|