forked from jeffp/enumerated_attribute
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
107 lines (95 loc) · 3.38 KB
/
Rakefile
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
#require 'rake/testtask'
require 'rake/rdoctask'
require 'rake/gempackagetask'
require 'rake/contrib/sshpublisher'
gem 'gem_version', '>=0.0.6'
require 'gem_version'
spec = Gem::Specification.new do |s|
s.name = 'enumerated_attribute'
s.version = GemVersion.next_version
s.platform = Gem::Platform::RUBY
s.description = 'Enumerated model attributes and view helpers'
s.summary = 'Add enumerated attributes to your models and expose them in drop-down lists in your views'
s.add_dependency('meta_programming', '>= 0.2.1')
exclude_folders = 'spec/rails/{doc,lib,log,nbproject,tmp,vendor,test}'
exclude_files = FileList['**/*.log'] + FileList[exclude_folders+'/**/*'] + FileList[exclude_folders]
s.files = FileList['{examples,lib,tasks,spec}/**/*'] + %w(CHANGELOG.rdoc init.rb LICENSE Rakefile README.rdoc .gitignore) - exclude_files
s.require_path = 'lib'
s.has_rdoc = true
s.test_files = Dir['spec/*_spec.rb']
s.author = 'Jeff Patmon'
s.email = 'jpatmon@gmail.com'
s.homepage = 'http://github.com/jeffp/enumerated_attribute/tree/master'
end
require 'spec/version'
require 'spec/rake/spectask'
desc "Run specs"
namespace :spec do
task :default=>:all
Spec::Rake::SpecTask.new(:object) do |t|
t.spec_files = FileList['spec/*_spec.rb']
t.libs << 'lib' << 'spec'
t.rcov = false
t.spec_opts = ['--options', 'spec/spec.opts']
#t.rcov_dir = 'coverage'
#t.rcov_opts = ['--exclude', "kernel,load-diff-lcs\.rb,instance_exec\.rb,lib/spec.rb,lib/spec/runner.rb,^spec/*,bin/spec,examples,/gems,/Library/Ruby,\.autotest,#{ENV['GEM_HOME']}"]
end
=begin
Spec::Rake::SpecTask.new(:sub) do |t|
t.spec_files = FileList['spec/inheritance_spec.rb']
t.libs << 'lib' << 'spec'
t.rcov = false
t.spec_opts = ['--options', 'spec/spec.opts']
end
Spec::Rake::SpecTask.new(:poro) do |t|
t.spec_files = FileList['spec/poro_spec.rb']
t.libs << 'lib' << 'spec'
t.rcov = false
t.spec_opts = ['--options', 'spec/spec.opts']
end
=end
desc "Run ActiveRecord integration specs"
Spec::Rake::SpecTask.new(:ar) do |t|
t.spec_files = FileList['spec/active_record/*_spec.rb']
t.libs << 'lib' << 'spec/active_record'
t.spec_opts = ['--options', 'spec/spec.opts']
t.rcov = false
end
Spec::Rake::SpecTask.new(:forms) do |t|
t.spec_files = FileList['spec/rails/spec/integrations/*_spec.rb']
t.libs << 'lib' << 'spec/rails/spec'
t.spec_opts = ['--options', 'spec/spec.opts']
t.rcov = false
end
# Spec::Rake::SpecTask.new(:associations) do |t|
# t.spec_files = FileList['spec/active_record/associations_spec.rb']
# t.libs << 'lib' << 'spec/active_record'
# t.rcov = false
# end
desc "Run all specs"
task :all=>[:object, :ar, :forms]
end
desc "Generate documentation for the #{spec.name} plugin."
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = spec.name
#rdoc.template = '../rdoc_template.rb'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README.rdoc', 'CHANGELOG.rdoc', 'LICENSE', 'lib/**/*.rb')
end
desc 'Generate a gemspec file.'
task :gemspec do
File.open("#{spec.name}.gemspec", 'w') do |f|
f.write spec.to_ruby
end
GemVersion.increment_version
GemVersion.commit_and_push do |git|
git.add("#{spec.name}.gemspec")
end
end
Rake::GemPackageTask.new(spec) do |p|
p.gem_spec = spec
p.need_tar = RUBY_PLATFORM =~ /mswin/ ? false : true
p.need_zip = true
end
Dir['tasks/**/*.rake'].each {|rake| load rake}