forked from jberkel/sms-backup-plus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
118 lines (103 loc) · 3.54 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
require 'rake/clean'
require 'rbconfig'
require 'rexml/document'
CLEAN.include('tmp', 'bin')
[:device, :emu].each do |t|
flag = (t == :device ? '-d' : '-e')
namespace :db do
task :pull do
sh "adb #{flag} pull /data/data/com.android.providers.telephony/databases/mmssms.db ."
end
task :push do
sh "adb #{flag} push mmssms.db /data/data/com.android.providers.telephony/databases/mmssms.db"
end
end
namespace :parts do
task :pull do
sh "adb #{flag} pull /data/data/com.android.providers.telephony/app_parts/ app_parts"
end
task :push do
sh "adb #{flag} push app_parts /data/data/com.android.providers.telephony/app_parts/"
end
end
namespace :log do
task :pull do
sh "adb #{flag} pull /sdcard/sms_backup_plus.log ."
end
end
namespace :prefs do
desc "get prefs from #{t}"
task :pull do
sh "adb #{flag} pull /data/data/#{package}/shared_prefs/#{package}_preferences.xml ."
sh "adb #{flag} pull /data/data/#{package}/shared_prefs/credentials.xml ."
end
task :push do
sh "adb #{flag} push #{package}_preferences.xml /data/data/#{package}/shared_prefs/#{package}_preferences.xml"
sh "adb #{flag} push credentials.xml /data/data/#{package}/shared_prefs/credentials.xml"
end
end
end
desc "check release"
task :check_version do
# make sure new version is propagated everywhere
raise "CHANGES not updated" unless IO.read('CHANGES') =~ /#{version}/
raise "about not updated" unless IO.read('assets/about.html') =~ /SMS Backup\+ #{version}/
end
desc "tag the current version"
task :tag => [:check_version] do
unless `git branch` =~ /^\* master$/
puts "You must be on the master branch to release!"
exit!
end
sh "git commit --allow-empty -a -m 'Release #{version}'"
sh "git tag #{version}"
sh "git push origin master --tags"
end
desc "spellcheck README"
task :spell do
system "aspell", "--mode", "html", "--dont-backup", "check", 'README.md'
end
namespace :doc do
desc "Render markdown as if it were shown on github"
task :preview do
infile = File.expand_path('README.md')
outfile = "/tmp/#{File.basename(infile)}.html"
revision = `git rev-parse HEAD`.strip
markdown = `which markdown`.strip
unless $?.success?
puts "Make sure you have 'markdown' in your path, usage: brew install markdown"
exit 1
end
File.open(outfile, "w") do |out|
body = `#{markdown} #{infile}`
template = <<-END
<html>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<head>
<link href="https://assets0.github.com/stylesheets/bundle_common.css?#{revision}" media="screen" rel="stylesheet" type="text/css" />
<link href="https://assets3.github.com/stylesheets/bundle_github.css?#{revision}" media="screen" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="readme" class="blob">
<div class="wikistyle">
#{body}
</div>
</div>
</body>
</html>
END
out.write(template)
end
case Config::CONFIG['host_os']
when /darwin/
puts "Launching: open #{outfile}"
sh "open", outfile
end
end
end
def manifest
@manifest ||= REXML::Document.new(File.read('AndroidManifest.xml'))
end
def package() manifest.root.attribute('package') end
def version() manifest.root.attribute('versionName') end