-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
108 lines (94 loc) · 3.36 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
$:.unshift("/Library/RubyMotion/lib")
require 'motion/project/template/osx'
begin
require 'bundler'
if ARGV.join(' ') =~ /spec/
Bundler.require :default, :spec
RUBYMOTION_ENV = 'test'
else
Bundler.require
RUBYMOTION_ENV = 'development'
end
rescue LoadError
end
require 'sugarcube-files'
require 'sugarcube-attributedstring'
Motion::Project::App.setup do |app|
app.name = 'AeroSKK'
app.identifier = 'com.runnable-inc.inputmethod.AeroSKK'
app.icon = 'aero_skk.png'
app.frameworks << 'InputMethodKit'
app.redgreen_style = :full if app.respond_to?(:redgreen_style)
app.info_plist['CFBundleDevelopmentRegion'] = 'ja_JP'
app.info_plist['NSHumanReadableCopyright'] = 'Copyright 2013 Runnable Inc. All rights reserved.'
app.info_plist['InputMethodConnectionName'] = "AeroSKKConnection_#{RUBYMOTION_ENV}"
app.info_plist['InputMethodServerControllerClass'] = 'AeroSKKInputController'
app.info_plist['LSBackgroundOnly'] = 1
app.info_plist['ComponentInputModeDict'] = {
'tsInputModeListKey' => {
'com.apple.inputmethod.Japanese' => {
'TISInputSourceID' => 'com.runnable-inc.inputmethod.AeroSKK.Japanese',
'TISIntendedLanguage' => 'ja',
'tsInputModeDefaultStateKey' => false,
'tsInputModeIsVisibleKey' => true,
'tsInputModeJISKeyboardShortcutKey' => 0,
'tsInputModeMenuIconFileKey' => 'japanese.tiff',
'tsInputModeAlternateMenuIconFileKey' => 'japanese.tiff',
'tsInputModePaletteIconFileKey' => 'japanese.tiff',
'tsInputModePrimaryInScriptKey' => true,
'tsInputModeScriptKey' => 'smJapanese'
},
'com.apple.inputmethod.Roman' => {
'TISInputSourceID' => 'com.runnable-inc.inputmethod.AeroSKK.Roman',
'TISIntendedLanguage' => 'en',
'tsInputModeDefaultStateKey' => true,
'tsInputModeIsVisibleKey' => true,
'tsInputModeJISKeyboardShortcutKey' => 1,
'tsInputModeMenuIconFileKey' => 'roman.tiff',
'tsInputModeAlternateMenuIconFileKey' => 'roman.tiff',
'tsInputModePaletteIconFileKey' => 'roman.tiff',
'tsInputModePrimaryInScriptKey' => true,
'tsInputModeScriptKey' => 'smRoman',
},
},
'tsVisibleInputModeOrderedArrayKey' =>
[
'com.apple.inputmethod.Japanese',
'com.apple.inputmethod.Roman'
]
}
app.info_plist['tsInputMethodCharacterRepertoireKey'] = %w(Hira Latn)
app.info_plist['tsInputMethodIconFileKey'] = 'aero_skk.png'
end
$app = App.config.app_bundle_raw(App.config.local_platform)
$dst_dir = '~/Library/Input Methods/'
$dst_app = File.join($dst_dir, File.basename($app))
task :install => ['build:development', 'uninstall'] do
if $app && $dst_dir
puts "copy: #{$dst_app}"
`cp -r #{$app.gsub(/ /, '\\ ')} #{$dst_dir.gsub(/ /, '\\ ')}`
end
end
task :uninstall do
line = `ps x`.lines.grep(Regexp.new(Regexp.escape(File.expand_path($dst_app)))).first
if line
puts "kill: #{line}"
`kill #{line.split.first}`
end
if File.exist?(File.expand_path($dst_app))
puts "remove: #{$dst_app}"
`rm -rf #{$dst_app.gsub(/ /, '\\ ')}`
end
end
$config_dir = File.expand_path('~/.aero_skk/')
task :init_config => [File.join($config_dir, 'skk_servers')]
file File.join($config_dir, 'skk_servers') => [$config_dir] do |t|
file = t.name
puts "create: #{file}"
open(file, 'w+') do |io|
io << <<EOS
localhost 1178 euc-jp
EOS
end
end
directory $config_dir