-
Notifications
You must be signed in to change notification settings - Fork 21
/
Rakefile
39 lines (34 loc) · 820 Bytes
/
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
require 'rake'
require 'rubygems'
require 'zip/zip'
require 'zip/zipfilesystem'
require 'fileutils'
PROJECT_NAME = 'redmine_ics_export'
task :default => [:clean, :dist]
desc 'Cleans up'
task :clean do
Dir.glob("*.zip").each {|file|
puts "Deleting #{file}"
File.unlink(file)
}
end
desc 'Packages the distribution'
task :dist do
project_version = get_version_from_plugin_init
source_files = Dir.glob('**/*') - ['Rakefile']
Zip::ZipFile.open("#{PROJECT_NAME}-#{project_version}.zip", 'w') {|zipfile|
puts "Adding to #{zipfile}"
source_files.each {|file|
puts "\t#{file}"
zipfile.add("#{PROJECT_NAME}/#{file}", file)
}
}
end
def get_version_from_plugin_init
File.open( 'init.rb' ) do |f|
f.grep( /^\s+version '(.*)'/ ) do
return $1
end
end
'snapshot'
end