public
Description: Sequel Model plugin to implicitly set created_at and updated_at
Clone URL: git://github.com/bricooke/sequel_timestamped.git
Search Repo:
sequel_timestamped / Rakefile
100644 155 lines (127 sloc) 4.591 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
##############################################################################
# Constants
##############################################################################
 
PluginName = "sequel_timestamped"
Version = "0.0.1"
Title = "Timestamped Sequel Plugin"
Summary = "Sequel Plugin"
Authors = "Brian Cooke"
Emails = "cookebri@gmail.com"
Homepage = "http://sequel.rubyforge.org"
 
##############################################################################
# Gem Management
##############################################################################
require "rake"
require "rake/clean"
require "rake/gempackagetask"
require "rake/rdoctask"
require "fileutils"
 
include FileUtils
 
CLEAN.include ["**/.*.sw?", "pkg/*", ".config", "doc/*", "coverage/*"]
 
RDocOptions = [
  "--quiet", "--title", Title,
  "--opname", "index.html",
  "--line-numbers",
  "--main", "README",
  "--inline-source"
]
 
desc "Packages up the Sequel Plugin: #{PluginName}."
task :default => [:package]
task :package => [:clean]
 
task :doc => [:rdoc]
 
Rake::RDocTask.new do |rdoc|
  rdoc.rdoc_dir = "doc/rdoc"
  rdoc.options += RDocOptions
  rdoc.main = "README"
  rdoc.title = Title
  rdoc.rdoc_files.add ["README", "COPYING", "lib/#{PluginName}.rb", "lib/**/*.rb"]
end
 
spec = Gem::Specification.new do |s|
  s.name = PluginName
  s.version = Version
  s.platform = Gem::Platform::RUBY
  s.has_rdoc = true
  s.extra_rdoc_files = ["README", "CHANGELOG", "COPYING"]
  s.rdoc_options += RDocOptions# +
    #["--exclude", "^(examples|extras)\/", "--exclude", "lib/sequel.rb"]
  s.summary = Summary
  s.description = Summary
  s.author = Authors
  s.email = Emails
  s.homepage = Homepage
  # change this to the plugin name, if the plugin has command line portion
  #s.executables = ["sequel"]
 
  s.add_dependency("sequel_model")
  
  s.files = %w(COPYING README Rakefile) + Dir.glob("{bin,doc,spec,lib}/**/*")
  
  s.require_path = "lib"
  s.bindir = "bin"
end
 
Rake::GemPackageTask.new(spec) do |p|
  p.need_tar = true
  p.gem_spec = spec
end
 
task :release => [:package] do
  sh %{rubyforge login}
  sh %{rubyforge add_release sequel #{PluginName} #{Version} pkg/#{PluginName}-#{Version}.tgz}
  sh %{rubyforge add_file sequel #{PluginName} #{Version} pkg/#{PluginName}-#{Version}.gem}
end
 
task :install do
  sh %{rake package}
  sh %{sudo gem install pkg/#{PluginName}-#{Version}.gem}
end
 
task :install_no_docs do
  sh %{rake package}
  sh %{sudo gem install pkg/#{PluginName}-#{Version}.gem --no-rdoc --no-ri}
end
 
task :uninstall => [:clean] do
  sh %{sudo gem uninstall #{PluginName}}
end
 
desc "Update docs and upload to rubyforge.org"
task :doc_rforge do
  sh %{rake doc}
  sh %{scp -r doc/rdoc/* ciconia@rubyforge.org:/var/www/gforge-projects/sequel/plugins/#{PluginName}}
end
 
##############################################################################
# rSpec
##############################################################################
 
require "spec/rake/spectask"
 
desc "Run specs with coverage"
Spec::Rake::SpecTask.new("spec") do |spec_task|
  spec_task.spec_opts = File.read("spec/spec.opts").split("\n")
  spec_task.spec_files = FileList["spec/*_spec.rb"].sort
  spec_task.rcov = true
end
 
desc "Run specs without coverage"
Spec::Rake::SpecTask.new("spec_no_cov") do |spec_task|
  spec_task.spec_opts = File.read("spec/spec.opts").split("\n")
  spec_task.spec_files = FileList["spec/*_spec.rb"].sort
end
 
desc "Run all specs with coverage"
Spec::Rake::SpecTask.new("specs") do |spec_task|
  spec_task.spec_opts = File.read("spec/spec.opts").split("\n")
  spec_task.spec_files = FileList["spec/**/*_spec.rb"].sort
  spec_task.rcov = true
end
 
desc "Run all specs without coverage"
Spec::Rake::SpecTask.new("specs_no_cov") do |spec_task|
  spec_task.spec_opts = File.read("spec/spec.opts").split("\n")
  spec_task.spec_files = FileList["spec/**/*_spec.rb"].sort
end
 
desc "Run all specs and output html"
Spec::Rake::SpecTask.new("specs_html") do |spec_task|
  spec_task.spec_opts = ["--format", "html"]
  spec_task.spec_files = Dir["spec/**/*_spec.rb"].sort
end
 
##############################################################################
# Statistics
##############################################################################
 
STATS_DIRECTORIES = [
  %w(Code lib/),
  %w(Spec spec/)
].collect { |name, dir| [ name, "./#{dir}" ] }.select { |name, dir| File.directory?(dir) }
 
desc "Report code statistics (KLOCs, etc) from the application"
task :stats do
  require "extra/stats"
  verbose = true
  CodeStatistics.new(*STATS_DIRECTORIES).to_s
end