Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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