-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
127 lines (106 loc) · 3.59 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Copyright (c) Jade Systems Inc. 2013, 2014
require_relative "lib/screencaster-gtk/version"
require "rake/clean"
# Some of these aren't needed by this file, but they're the GNU
# standard names from makefiles, so I'll leave them here for now
# so I don't have to go looking for them
DESTDIR = ENV['DESTDIR'].nil? ? "": ENV['DESTDIR']
PREFIX = File.join DESTDIR, "usr"
BINDIR = File.join PREFIX, "bin"
DATAROOTDIR = File.join PREFIX, "share"
DOCDIR = File.join DATAROOTDIR, "doc"
MANDIR = File.join DATAROOTDIR, "man"
MAN1DIR = File.join MANDIR, "man1"
SYSCONFDIR = File.join DESTDIR, "etc"
TMPDIR = File.join DESTDIR, "tmp"
GEM = "screencaster-gtk-#{ScreencasterGtk::VERSION}.gem"
=begin
Modify and test the code
Build the gem
Test it locally
Commit everything -- not sure I want to automate this yet
Tag the gem part of the tree -- not sure I want to automate this yet
Push it to rubygems (:release)
Rubygems lets me put things are pre-release -- I should use this somehow
Rev the gem version -- not sure I want to automate this yet
Build the .deb (:debian)
Test it locally
Commit everything -- not sure I want to automate this yet
Tag the debian part of the tree -- not sure I want to automate this yet
Push it to ???
Rev the .deb version -- not sure I want to automate this yet
=end
LINUX_FILES = FileList.new(File.join(MAN1DIR, "screencaster.1.gz"),
File.join(DATAROOTDIR, "applications", "screencaster.desktop"),
File.join(DATAROOTDIR, "pixmaps", "screencaster.svg"))
# These get clobbered, so they have to be only the files we move, not source files
DEBIAN_FILES = LINUX_FILES.collect do |f| File.join("debian", f) end
desc "Build the gem."
task :build => GEM
file GEM =>
FileList.new("lib/*.rb",
"lib/screencaster-gtk/*.rb",
"bin/screencaster",
"screencaster-gtk.gemspec",
"Rakefile") do
system "gem build screencaster-gtk.gemspec"
end
desc "Push the gem to RubyGems.org"
task :release => :build do
system "gem push #{GEM}"
end
desc "Build the .deb file"
task :debian => "screencaster.deb"
#file "screencaster.deb" => :release # This revs the gem too soon, before it's been tested.
file "screencaster.deb" => FileList.new("debian/DEBIAN/*", DEBIAN_FILES) do |t|
rm Dir.glob("debian/DEBIAN/*~")
system "fakeroot dpkg-deb --build debian"
mv "debian.deb", t.name
# puts "Built #{t.name}"
end
desc "Install the files, like a GNU makefile would install them."
task :install => LINUX_FILES do
system "gem install screencaster-gtk --pre"
end
CLEAN.include("test/a.mkv",
"test/b.mkv",
"test/c.mkv",
"test/test-final-encode.mp4",
"test/c-from-one.mkv",
"test/c-from-two.mkv",
"screencaster.1.gz")
CLOBBER.include(DEBIAN_FILES,
"screencaster.deb",
GEM,
"bin/screencaster",
DEBIAN_FILES)
# DEBIAN_FILES.each do |f|
# file f => File.basename(f) do |target|
# mkdir_p File.dirname(target.name)
# cp target.prerequisites.first, target.name
# end
# end
file "bin/screencaster" => FileList.new("bin/screencaster.rb") do |f|
cp f.name + ".rb", f.name
File.chmod 0775, f.name
end
rule '.gz' do |r|
system "gzip --best --to-stdout #{File.basename(r.name.ext)} >#{r.name}"
end
rule "" do |r|
file r.name => File.basename(r.name) do |f|
mkdir_p File.dirname(f.name)
cp File.basename(f.name), f.name
end if r.is_a?(Rake::FileTask)
end
##################################
# Testing
require 'rake/testtask'
Rake::TestTask.new do |t|
t.libs << 'test'
end
desc "Run tests"
task :test