63 |
63 |
64 task :test => 'test:spec' |
64 task :test => 'test:spec' |
65 task :default => :test |
65 task :default => :test |
66 # task :default => [ :test, :package ] |
66 # task :default => [ :test, :package ] |
67 |
67 |
|
68 |
|
69 ### Tasks: testing via rspec |
|
70 ### |
68 namespace :test do |
71 namespace :test do |
69 desc 'Generate verbose and pretty output' |
72 desc 'Generate verbose and pretty output' |
70 RSpec::Core::RakeTask.new( :spec ) do |task| |
73 RSpec::Core::RakeTask.new( :spec ) do |task| |
71 task.pattern = SPEC_FILES |
74 task.pattern = SPEC_FILES |
72 task.rspec_opts = ['-b', '-fd', '-c'] |
75 task.rspec_opts = ['-b', '-fd', '-c'] |
76 RSpec::Core::RakeTask.new( :quiet ) do |task| |
79 RSpec::Core::RakeTask.new( :quiet ) do |task| |
77 task.pattern = SPEC_FILES |
80 task.pattern = SPEC_FILES |
78 task.rspec_opts = ['-f', 'p'] |
81 task.rspec_opts = ['-f', 'p'] |
79 end |
82 end |
80 end |
83 end |
|
84 |
81 |
85 |
82 ### Task: generate ctags |
86 ### Task: generate ctags |
83 ### This assumes exuberant ctags, since ctags 'native' doesn't support ruby anyway. |
87 ### This assumes exuberant ctags, since ctags 'native' doesn't support ruby anyway. |
84 ### |
88 ### |
85 desc "Generate a ctags 'tags' file from Chunker source" |
89 desc "Generate a ctags 'tags' file from Chunker source" |
96 gem.version = PKG_VERSION |
100 gem.version = PKG_VERSION |
97 gem.author = 'Mahlon E. Smith' |
101 gem.author = 'Mahlon E. Smith' |
98 gem.email = 'mahlon@martini.nu' |
102 gem.email = 'mahlon@martini.nu' |
99 gem.homepage = 'http://projects.martini.nu/ruby-modules/wiki/Chunker' |
103 gem.homepage = 'http://projects.martini.nu/ruby-modules/wiki/Chunker' |
100 gem.has_rdoc = true |
104 gem.has_rdoc = true |
|
105 gem.extra_rdoc_files = ['README'] |
|
106 gem.rdoc_options << '--main' << 'README' |
|
107 |
101 |
108 |
102 gem.files = RELEASE_FILES. |
109 gem.files = RELEASE_FILES. |
103 collect {|f| f.relative_path_from(BASEDIR).to_s } |
110 collect {|f| f.relative_path_from(BASEDIR).to_s } |
104 gem.test_files = SPEC_FILES. |
111 gem.test_files = SPEC_FILES. |
105 collect {|f| f.relative_path_from(BASEDIR).to_s } |
112 collect {|f| f.relative_path_from(BASEDIR).to_s } |
106 |
113 |
107 gem.description = <<-EOF |
114 gem.description = "Embed arbitrary data and multiple, distinct documents within ruby files." |
108 Ruby provides an automatic constant called DATA, which is an IO object |
|
109 that references all text in the current file under an __END__ token. |
|
110 |
|
111 I find it convenient to use the __END__ area to store all sorts of |
|
112 stuff, rather than have to worry about distributing separate files. |
|
113 |
|
114 The DATA constant is determined from whatever ruby believes $0 to be. |
|
115 It doesn't work inside of other required libraries, so you'll see stuff |
|
116 like this all the time: |
|
117 |
|
118 END = File.open( __FILE__ ).read.split( /^__END__/, 2 ).last |
|
119 |
|
120 It works, but it's more work than I want to do. |
|
121 |
|
122 Chunker solves this by parsing __END__ tokens for you, and making it |
|
123 available in the form of a 'DATA_END' constant. It installs this |
|
124 constant into the class that includes Chunker, so you can use it again |
|
125 and again, assuming you use a different file for each class. |
|
126 |
|
127 It also automatically parses out other things that look like tokens, so |
|
128 you can easily have multiple, distinct documents all embedded into the |
|
129 __END__ block. |
|
130 EOF |
|
131 end |
115 end |
132 |
116 |
133 Rake::GemPackageTask.new( gem ) do |pkg| |
117 Rake::GemPackageTask.new( gem ) do |pkg| |
134 pkg.need_zip = true |
118 pkg.need_zip = true |
135 pkg.need_tar = true |
119 pkg.need_tar = true |