forked from cwalcott/braintree_ios_encryption
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
76 lines (60 loc) · 1.92 KB
/
Rakefile
File metadata and controls
76 lines (60 loc) · 1.92 KB
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
WORKSPACE = "braintree-ios-encryption.xcodeproj/project.xcworkspace/"
SDK = "iphonesimulator5.1"
TEST_SCHEME = "test"
BUILD_SCHEME = "braintree-encryption"
DEVELOPER_DIR = "/Applications/Xcode.app/Contents/Developer"
task :default => "test:unit"
namespace :test do
task :unit do
begin
start_simulator
xcode_build("Debug", TEST_SCHEME)
rescue
ensure
kill_simulator
end
end
end
task :build => ["build:debug"]
task :release => ["build:release", "release:archive"]
namespace :release do
task :archive do
version = File.read('src/BraintreeEncryption.m')[/VERSION = @"(.*)";/, 1]
puts version
target_filename = "BraintreeEncryption-#{version}"
puts target_filename
FileUtils.mkdir_p("products/archive/")
Dir.chdir("products/BraintreeEncryption") do
sh "tar cf #{target_filename}.tar --exclude='*.tar' ."
sh "gzip #{target_filename}.tar"
FileUtils.mv("./#{target_filename}.tar.gz", "../../products/archive/")
end
end
end
namespace :build do
task :debug do
xcode_build("Debug", BUILD_SCHEME)
end
task :release do
xcode_build("Release", BUILD_SCHEME)
FileUtils.mkdir_p("products/BraintreeEncryption")
sh "cp -r products/Release-universal/ products/BraintreeEncryption"
end
task :clean do
xcode_build("Debug", BUILD_SCHEME, false)
end
end
def start_simulator
Kernel.system "open #{DEVELOPER_DIR}/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\\ Simulator.app"
end
def kill_simulator
Kernel.system "killall -9 iPhone\\ Simulator"
end
def xcode_build(config, scheme, build=true)
Kernel.system "xcodebuild -workspace #{WORKSPACE} -scheme #{scheme} -sdk #{SDK} -configuration #{config} clean #{build ? "build" : "" }"
end
task :remove_trailing_whitespace do
Dir.glob("test").each do |file_path|
sh %Q{find src test -name "*.[h,m]" -type f -print0 | xargs -0 sed -i '' -E "s/[[:space:]]*$//"}
end
end