@@ -1 +1 @@ | ||
1 | -<pkgref spec="1.12" uuid="F73729C4-3E50-4FBB-880E-8D9DA0609DCC"><config><identifier>jp.sourceforge.aquaskk.pkg</identifier><version>1</version><description/><post-install type="req-logout"/><requireAuthorization/><installFrom includeRoot="true">/Volumes/LaCie/Users/t_suwa/svn/aquaskk/proj/build/Release/AquaSKK.app</installFrom><installTo mod="true">/Library/Input Methods</installTo><flags><followSymbolicLinks/></flags><packageStore type="internal"/><mod>parent</mod><mod>postInstall</mod><mod>relocatable</mod><mod>installTo.path</mod><mod>installTo</mod><mod>identifier</mod></config><contents><file-list>01aquaskk-contents.xml</file-list><component id="jp.sourceforge.inputmethod.aquaskk" path="/Volumes/LaCie/Users/t_suwa/svn/aquaskk/proj/build/Release/AquaSKK.app" version="1.0"><component id="jp.sourceforge.inputmethod.aquaskk.preferences" path="/Volumes/LaCie/Users/t_suwa/svn/aquaskk/proj/build/Release/AquaSKK.app/Contents/SharedSupport/AquaSKKPreferences.app" version="1.0"><mod>isRelocatable</mod></component><mod>isRelocatable</mod></component><filter>/CVS$</filter><filter>/\.svn$</filter><filter>/\.cvsignore$</filter><filter>/\.cvspass$</filter><filter>/\.DS_Store$</filter></contents></pkgref> | |
\ No newline at end of file | ||
1 | +<pkgref spec="1.12" uuid="F73729C4-3E50-4FBB-880E-8D9DA0609DCC"><config><identifier>jp.sourceforge.aquaskk.pkg</identifier><version>1</version><description></description><post-install type="req-logout"/><requireAuthorization/><installFrom relative="true" mod="true" includeRoot="true">build/Release/AquaSKK.app</installFrom><installTo mod="true">/Library/Input Methods</installTo><flags><followSymbolicLinks/></flags><packageStore type="internal"></packageStore><mod>parent</mod><mod>scripts.scriptsDirectoryPath.isRelativeType</mod><mod>scripts.postinstall.isRelativeType</mod><mod>postInstall</mod><mod>installTo.isAbsoluteType</mod><mod>installTo.isRelativeType</mod><mod>relocatable</mod><mod>installFrom.isRelativeType</mod><mod>installTo.path</mod><mod>installTo</mod><mod>identifier</mod></config><scripts><postinstall relative="true" mod="true">script/postflight</postinstall><scripts-dir relative="true" mod="true">script</scripts-dir></scripts><contents><file-list>01aquaskk-contents.xml</file-list><component id="jp.sourceforge.inputmethod.aquaskk" path="/Volumes/LaCie/Users/t_suwa/svn/aquaskk/platform/mac/proj/build/Release/AquaSKK.app" version="1.0" isRelocatable="true"><locator-info><token title="pkmk-token-14"><search-rule><combo identifier="jp.sourceforge.inputmethod.aquaskk" default-path="/Library/Input Methods/AquaSKK.app"/></search-rule></token></locator-info><component id="jp.sourceforge.inputmethod.aquaskk.preferences" path="/Volumes/LaCie/Users/t_suwa/svn/aquaskk/platform/mac/proj/build/Release/AquaSKK.app/Contents/SharedSupport/AquaSKKPreferences.app" version="1.0"/></component><filter>/CVS$</filter><filter>/\.svn$</filter><filter>/\.cvsignore$</filter><filter>/\.cvspass$</filter><filter>/\.DS_Store$</filter></contents></pkgref> | |
\ No newline at end of file |
@@ -1 +1 @@ | ||
1 | -<pkmkdoc spec="1.12"><properties><title>AquaSKK</title><build>/Volumes/LaCie/Users/t_suwa/svn/aquaskk/proj/AquaSKK.pkg</build><organization>jp.sourceforge.aquaskk</organization><userSees ui="easy"/><min-target os="3"/><domain system="true"/></properties><distribution><versions min-spec="1.000000"/><scripts></scripts></distribution><contents><choice title="AquaSKK" id="choice0" starts_selected="true" starts_enabled="true" starts_hidden="false"><pkgref id="jp.sourceforge.aquaskk.pkg"/></choice></contents><resources bg-scale="none" bg-align="topleft"><locale lang="ja"/></resources><flags/><item type="file">01aquaskk.xml</item><mod>properties.title</mod><mod>properties.anywhereDomain</mod><mod>properties.systemDomain</mod></pkmkdoc> | |
\ No newline at end of file | ||
1 | +<pkmkdoc spec="1.12"><properties><title>AquaSKK</title><build>/Volumes/LaCie/Users/t_suwa/svn/aquaskk/proj/AquaSKK.pkg</build><organization>jp.sourceforge.aquaskk</organization><userSees ui="easy"/><min-target os="3"/><domain system="true"/></properties><distribution><versions min-spec="1.000000"/><scripts></scripts></distribution><contents><choice title="AquaSKK" id="choice0" starts_selected="true" starts_enabled="true" starts_hidden="false"><pkgref id="jp.sourceforge.aquaskk.pkg"/></choice></contents><resources bg-scale="none" bg-align="topleft"><locale lang="ja"/></resources><flags/><item type="file">01aquaskk.xml</item><mod>properties.systemDomain</mod><mod>properties.anywhereDomain</mod><mod>properties.title</mod></pkmkdoc> | |
\ No newline at end of file |
@@ -1 +1 @@ | ||
1 | -<pkg-contents spec="1.12"><f n="AquaSKK.app" o="root" g="admin" p="16877" pt="/Volumes/LaCie/Users/t_suwa/svn/aquaskk/proj/build/Release/AquaSKK.app" m="true" t="file"><f n="Contents" o="root" g="admin" p="16877"><f n="Info.plist" o="root" g="admin" p="33188"/><f n="MacOS" o="root" g="admin" p="16877"><f n="AquaSKK" o="root" g="admin" p="33261"/></f><f n="PkgInfo" o="root" g="admin" p="33188"/><f n="Resources" o="root" g="admin" p="16877"><f n="AquaSKK-Ascii.tif" o="root" g="admin" p="33188"/><f n="AquaSKK-Hirakana.tif" o="root" g="admin" p="33188"/><f n="AquaSKK-InputMethod.tif" o="root" g="admin" p="33188"/><f n="AquaSKK-Jisx0201Kana.tif" o="root" g="admin" p="33188"/><f n="AquaSKK-Jisx0208Latin.tif" o="root" g="admin" p="33188"/><f n="AquaSKK-Katakana.tif" o="root" g="admin" p="33188"/><f n="AquaSKK.nib" o="root" g="admin" p="33188"/><f n="AquaSKK.psd" o="root" g="admin" p="33188"/><f n="CandidateWindow.nib" o="root" g="admin" p="33188"/><f n="DictionarySet.plist" o="root" g="admin" p="33188"/><f n="InputModeWindow.nib" o="root" g="admin" p="33188"/><f n="UserDefaults.plist" o="root" g="admin" p="33188"/><f n="kana-rule.conf" o="root" g="admin" p="33188"/><f n="keymap.conf" o="root" g="admin" p="33188"/></f><f n="SharedSupport" o="root" g="admin" p="16877"><f n="AquaSKKPreferences.app" o="root" g="admin" p="16877"><f n="Contents" o="root" g="admin" p="16877"><f n="Info.plist" o="root" g="admin" p="33188"/><f n="MacOS" o="root" g="admin" p="16877"><f n="AquaSKKPreferences" o="root" g="admin" p="33261"/></f><f n="PkgInfo" o="root" g="admin" p="33188"/><f n="Resources" o="root" g="admin" p="16877"><f n="Preferences.nib" o="root" g="admin" p="33188"/></f></f></f></f></f><mod>owner</mod><mod>group</mod></f></pkg-contents> | |
\ No newline at end of file | ||
1 | +<pkg-contents spec="1.12"><f n="AquaSKK.app" o="root" g="admin" p="16877" pt="/Volumes/LaCie/Users/t_suwa/svn/aquaskk/platform/mac/proj/build/Release/AquaSKK.app" m="true" t="file"><f n="Contents" o="root" g="admin" p="16877"><f n="Info.plist" o="root" g="admin" p="33188"/><f n="MacOS" o="root" g="admin" p="16877"><f n="AquaSKK" o="root" g="admin" p="33261"/></f><f n="PkgInfo" o="root" g="admin" p="33188"/><f n="Resources" o="root" g="admin" p="16877"><f n="AquaSKK-Ascii.png" o="root" g="admin" p="33188"/><f n="AquaSKK-Ascii.tif" o="root" g="admin" p="33204"><mod>mode</mod></f><f n="AquaSKK-Hirakana.png" o="root" g="admin" p="33188"/><f n="AquaSKK-Hirakana.tif" o="root" g="admin" p="33204"><mod>mode</mod></f><f n="AquaSKK-InputMethod.tif" o="root" g="admin" p="33188"/><f n="AquaSKK-Jisx0201Kana.png" o="root" g="admin" p="33188"/><f n="AquaSKK-Jisx0201Kana.tif" o="root" g="admin" p="33204"><mod>mode</mod></f><f n="AquaSKK-Jisx0208Latin.png" o="root" g="admin" p="33188"/><f n="AquaSKK-Jisx0208Latin.tif" o="root" g="admin" p="33204"><mod>mode</mod></f><f n="AquaSKK-Katakana.png" o="root" g="admin" p="33188"/><f n="AquaSKK-Katakana.tif" o="root" g="admin" p="33204"><mod>mode</mod></f><f n="AquaSKK.nib" o="root" g="admin" p="33188"/><f n="AquaSKK.psd" o="root" g="admin" p="33204"><mod>mode</mod></f><f n="CandidateWindow.nib" o="root" g="admin" p="33188"/><f n="DictionarySet.plist" o="root" g="admin" p="33188"/><f n="InputModeWindow.nib" o="root" g="admin" p="33188"/><f n="UserDefaults.plist" o="root" g="admin" p="33188"/><f n="kana-rule.conf" o="root" g="admin" p="33188"/><f n="keymap.conf" o="root" g="admin" p="33188"/></f><f n="SharedSupport" o="root" g="admin" p="16877"><f n="AquaSKKPreferences.app" o="root" g="admin" p="16877"><f n="Contents" o="root" g="admin" p="16877"><f n="Info.plist" o="root" g="admin" p="33188"/><f n="MacOS" o="root" g="admin" p="16877"><f n="AquaSKKPreferences" o="root" g="admin" p="33261"/></f><f n="PkgInfo" o="root" g="admin" p="33188"/><f n="Resources" o="root" g="admin" p="16877"><f n="Preferences.nib" o="root" g="admin" p="33188"/></f></f></f></f></f></f></pkg-contents> | |
\ No newline at end of file |
@@ -0,0 +1,119 @@ | ||
1 | +# -*- mode: ruby; coding: utf-8 -*- | |
2 | + | |
3 | +require 'ConstVars' | |
4 | +require 'RuntimeSettings' | |
5 | +require 'UserDefaults' | |
6 | +require 'KeymapTranslator' | |
7 | +require 'DictionarySetTranslator' | |
8 | +require 'ftools' | |
9 | + | |
10 | +class TransitionTask | |
11 | + private | |
12 | + | |
13 | + def initialize | |
14 | + @tsm_settings = RuntimeSettings.new(ConstVars::OLD_LIB_DIR, | |
15 | + "jp.sourceforge.AquaSKKServer", | |
16 | + "skk-jisyo.utf8", | |
17 | + "config", | |
18 | + "kana-rule-list") | |
19 | + | |
20 | + @imk_settings = RuntimeSettings.new(ConstVars::NEW_LIB_DIR, | |
21 | + "jp.sourceforge.inputmethod.aquaskk", | |
22 | + "skk-jisyo.utf8", | |
23 | + "keymap.conf", | |
24 | + "kana-rule.conf") | |
25 | + | |
26 | + @work_settings = @imk_settings.clone | |
27 | + @work_settings.libdir = ConstVars::TEMP_DIR | |
28 | + @work_settings.prefdir = ConstVars::TEMP_DIR | |
29 | + | |
30 | + @tsm_defaults = UserDefaults.new(@tsm_settings.domain) | |
31 | + @imk_defaults = UserDefaults.new(@imk_settings.domain) | |
32 | + @work_defaults = UserDefaults.new(@work_settings.domain) | |
33 | + end | |
34 | + | |
35 | + def copy(src, dest) | |
36 | + if FileTest.exist?(src) then | |
37 | + File.copy(src, dest) | |
38 | + end | |
39 | + end | |
40 | + | |
41 | + def safe_copy(src, dest) | |
42 | + if !FileTest.exist?(dest) then | |
43 | + copy(src, dest) | |
44 | + end | |
45 | + end | |
46 | + | |
47 | + def dict_copy(src, dest) | |
48 | + Dir.foreach(src) { |file| | |
49 | + next unless file =~ /SKK-JISYO/ | |
50 | + | |
51 | + safe_copy(src + '/' + file, dest + '/' + file) | |
52 | + } | |
53 | + end | |
54 | + | |
55 | + def task01 | |
56 | + copy(@tsm_defaults.path, @work_defaults.path) | |
57 | + copy(@tsm_settings.config, @work_settings.config) | |
58 | + copy(@tsm_settings.dictionary_set, @work_settings.dictionary_set) | |
59 | + end | |
60 | + | |
61 | + def task02 | |
62 | + if @work_defaults.exist? then | |
63 | + @work_defaults.rename('candidates_font_name', 'candidate_window_font_name') | |
64 | + @work_defaults.rename('candidates_font_size', 'candidate_window_font_size') | |
65 | + @work_defaults.rename('egg_like_newline', 'suppress_newline_on_commit') | |
66 | + @work_defaults.rename('skkserv_enabled', 'enable_skkserv') | |
67 | + | |
68 | + @work_defaults.delete('candidates_count') | |
69 | + @work_defaults.delete('candidates_window_alpha') | |
70 | + @work_defaults.delete('candidates_window_color') | |
71 | + @work_defaults.delete('candidates_window_show_after_nth_cand') | |
72 | + @work_defaults.delete('force_ascii_mode_startup') | |
73 | + @work_defaults.delete('keyboard_layout_id') | |
74 | + @work_defaults.delete('numkeypad_use_halfwidth') | |
75 | + @work_defaults.delete('use_brand_new_engine') | |
76 | + end | |
77 | + end | |
78 | + | |
79 | + def task03 | |
80 | + if FileTest.exist?(@work_settings.config) then | |
81 | + translator = KeymapTranslator.new(@work_settings.config, @work_defaults) | |
82 | + | |
83 | + translator.execute() | |
84 | + | |
85 | + translator.save(@work_settings.config) | |
86 | + end | |
87 | + end | |
88 | + | |
89 | + def task04 | |
90 | + translator = DictionarySetTranslator.new(@work_settings.dictionary_set) | |
91 | + | |
92 | + translator.execute() | |
93 | + | |
94 | + translator.save(@work_settings.dictionary_set) | |
95 | + end | |
96 | + | |
97 | + def task05 | |
98 | + dict_copy(ConstVars::OLD_LIB_DIR, ConstVars::NEW_LIB_DIR) | |
99 | + | |
100 | + safe_copy(@work_defaults.path, @imk_defaults.path) | |
101 | + safe_copy(@work_settings.config, @imk_settings.config) | |
102 | + safe_copy(@work_settings.dictionary_set, @imk_settings.dictionary_set) | |
103 | + | |
104 | + safe_copy(@tsm_settings.user_dictionary, @imk_settings.user_dictionary) | |
105 | + safe_copy(@tsm_settings.rule, @imk_settings.rule) | |
106 | + end | |
107 | + | |
108 | + public | |
109 | + | |
110 | + def execute | |
111 | + File.rm_f(ConstVars::TEMP_DIR) | |
112 | + File.mkpath(ConstVars::TEMP_DIR) | |
113 | + File.mkpath(ConstVars::NEW_LIB_DIR) | |
114 | + | |
115 | + private_methods.sort.each { |task| | |
116 | + method(task).call if(task =~ /task/) | |
117 | + } | |
118 | + end | |
119 | +end |
@@ -0,0 +1,151 @@ | ||
1 | +# -*- mode: ruby; coding: utf-8 -*- | |
2 | + | |
3 | +class KeymapTranslator | |
4 | + # ------------------------------------------------------------ | |
5 | + private | |
6 | + def initialize(path, user_defaults) | |
7 | + @path = path | |
8 | + @user_defaults = user_defaults | |
9 | + @events = { | |
10 | + 'SKK_ENTER' => [ 'group::hex::0x03,0x0a,0x0d', 'ctrl::m' ], | |
11 | + 'SKK_BACKSPACE' => [ 'hex::0x08', 'ctrl::h' ], | |
12 | + 'SKK_DELETE' => [ 'hex::0x7f', 'ctrl::d' ], | |
13 | + 'SKK_TAB' => [ 'hex::0x09', 'ctrl::i' ], | |
14 | + 'SKK_LEFT' => [ 'hex::0x1c', 'ctrl::b' ], | |
15 | + 'SKK_RIGHT' => [ 'hex::0x1d', 'ctrl::f' ], | |
16 | + 'SKK_UP' => [ 'hex::0x1e', 'ctrl::a' ], | |
17 | + 'SKK_DOWN' => [ 'hex::0x1f', 'ctrl::e' ], | |
18 | + 'SKK_PING' => [ 'ctrl::l' ], | |
19 | + } | |
20 | + | |
21 | + @attributes = { | |
22 | + 'UpperCases' => [ 'group::A-K,M-P,R-Z' ], | |
23 | + 'Direct' => [ 'group::keycode::0x41,0x43,0x45,0x4b,0x4e,0x51-0x59,0x5b,0x5c,0x5f' ], | |
24 | + 'PrevCompletion' => [ ',' ], | |
25 | + 'NextCompletion' => [ '.' ], | |
26 | + } | |
27 | + end | |
28 | + | |
29 | + def convert(value) | |
30 | + value.sub(/\\"/, 'hex::0x22').gsub(/"/, '').sub(/\\C-/, 'ctrl::').sub(/\\/, '') | |
31 | + end | |
32 | + | |
33 | + def update(hash, symbol, value) | |
34 | + result = convert(value) | |
35 | + | |
36 | + if hash[symbol] then | |
37 | + hash[symbol].push(result) | |
38 | + else | |
39 | + hash[symbol] = [ result ] | |
40 | + end | |
41 | + end | |
42 | + | |
43 | + def defaults(path, symbol, value) | |
44 | + p = path.sub(/\.plist$/, '') | |
45 | + | |
46 | + system('defaults write #{}') | |
47 | + end | |
48 | + | |
49 | + def write(file, hash, comment) | |
50 | + file.print <<EOF | |
51 | + | |
52 | +# ============================================================ | |
53 | +# #{comment} | |
54 | +# ============================================================ | |
55 | + | |
56 | +EOF | |
57 | + | |
58 | + hash.each_key { |key| | |
59 | + file.printf("%-24s%s\n", key, hash[key].uniq.join('||')) | |
60 | + } | |
61 | + end | |
62 | + | |
63 | + # ------------------------------------------------------------ | |
64 | + public | |
65 | + | |
66 | + def execute | |
67 | + File.new(@path).each_line { |line| | |
68 | + next if line.empty? or line =~ /^#/ | |
69 | + | |
70 | + symbol, value = line.sub(/" "/, 'hex::0x20').split | |
71 | + | |
72 | + hash = @events; | |
73 | + | |
74 | + case symbol | |
75 | + when 'kana-mode-key' | |
76 | + update(hash, 'SKK_JMODE', value) | |
77 | + | |
78 | + when 'cancel-key' | |
79 | + update(hash, 'SKK_CANCEL', value); | |
80 | + | |
81 | + when 'paste-key' | |
82 | + update(hash, 'SKK_PASTE', value); | |
83 | + end | |
84 | + | |
85 | + hash = @attributes; | |
86 | + | |
87 | + case symbol | |
88 | + when 'toggle-kana-key' | |
89 | + update(hash, 'ToggleKana', value); | |
90 | + | |
91 | + when 'toggle-katakana-key' | |
92 | + update(hash, 'ToggleJisx0201Kana', value); | |
93 | + | |
94 | + when 'latin-mode-key' | |
95 | + update(hash, 'SwitchToAscii', value); | |
96 | + | |
97 | + when 'jisx0208-latin-mode-key' | |
98 | + update(hash, 'SwitchToJisx0208Latin', value); | |
99 | + | |
100 | + when 'abbrev-mode-key' | |
101 | + update(hash, 'EnterAbbrev', value); | |
102 | + | |
103 | + when 'prev-kouho-key' | |
104 | + update(hash, 'PrevCandidate', value); | |
105 | + | |
106 | + when 'next-kouho-key' | |
107 | + update(hash, 'NextCandidate', value); | |
108 | + | |
109 | + when 'purge-from-jisyo-key' | |
110 | + update(hash, 'RemoveTrigger', value); | |
111 | + | |
112 | + when 'abbrev-prev-key' | |
113 | + update(hash, 'PrevCompletion', value); | |
114 | + | |
115 | + when 'abbrev-next-key' | |
116 | + update(hash, 'NextCompletion', value); | |
117 | + | |
118 | + when 'set-henkan-point-key' | |
119 | + update(hash, 'EnterJapanese', value); | |
120 | + | |
121 | + when 'use-eisuu-to-set-henkan-point' | |
122 | + if value == 'true' then | |
123 | + update(hash, 'EnterJapanese', 'keycode::0x66') | |
124 | + end | |
125 | + | |
126 | + when 'use-kana-to-set-henkan-point' | |
127 | + if value == 'true' then | |
128 | + update(hash, 'EnterJapanese', 'keycode::0x68') | |
129 | + end | |
130 | + end | |
131 | + | |
132 | + if symbol == 'fix-n' then | |
133 | + @user_defaults.write('fix_intermediate_conversion', value == 'true' ? '1' : '0') | |
134 | + end | |
135 | + | |
136 | + if symbol == 'candidate-labels' then | |
137 | + @user_defaults.write('candidate_labels', value) | |
138 | + end | |
139 | + } | |
140 | + end | |
141 | + | |
142 | + def save(path) | |
143 | + File.open(path, File::CREAT|File::TRUNC|File::WRONLY) { |file| | |
144 | + write(file, @events, 'event section') | |
145 | + write(file, @attributes, 'attribute section (for SKK_CHAR)') | |
146 | + } | |
147 | + end | |
148 | +end | |
149 | + | |
150 | + | |
151 | + |
@@ -0,0 +1,11 @@ | ||
1 | +# -*- mode: ruby; coding: utf-8 -*- | |
2 | + | |
3 | +module ConstVars | |
4 | + PREF_DIR = File.expand_path("~/Library/Preferences") | |
5 | + | |
6 | + OLD_LIB_DIR = File.expand_path("~/Library/AquaSKK") | |
7 | + NEW_LIB_DIR = File.expand_path("~/Library/Application Support/AquaSKK") | |
8 | + TEMP_DIR = "/tmp/aquaskk" | |
9 | + | |
10 | + DICTIONARY_SET = "DictionarySet.plist" | |
11 | +end |
@@ -0,0 +1,47 @@ | ||
1 | +# -*- mode: ruby; coding: utf-8 -*- | |
2 | + | |
3 | +require 'ConstVars' | |
4 | + | |
5 | +class RuntimeSettings | |
6 | + include ConstVars | |
7 | + | |
8 | + def initialize(libdir, domain, dictionary, config, rule) | |
9 | + @libdir = libdir | |
10 | + @prefdir = PREF_DIR | |
11 | + @domain = domain | |
12 | + @dictionary = dictionary | |
13 | + @config = config | |
14 | + @rule = rule | |
15 | + end | |
16 | + | |
17 | + def pref(path) | |
18 | + @prefdir + "/" + path | |
19 | + end | |
20 | + | |
21 | + def lib(path) | |
22 | + @libdir + "/" + path | |
23 | + end | |
24 | + | |
25 | + def domain | |
26 | + pref(@domain) | |
27 | + end | |
28 | + | |
29 | + def dictionary_set | |
30 | + lib(DICTIONARY_SET) | |
31 | + end | |
32 | + | |
33 | + def user_dictionary | |
34 | + lib(@dictionary) | |
35 | + end | |
36 | + | |
37 | + def config | |
38 | + lib(@config) | |
39 | + end | |
40 | + | |
41 | + def rule | |
42 | + lib(@rule) | |
43 | + end | |
44 | + | |
45 | + attr_writer :libdir, :prefdir | |
46 | + attr_reader :libdir | |
47 | +end |
@@ -0,0 +1,34 @@ | ||
1 | +# -*- mode: ruby; coding: utf-8 -*- | |
2 | + | |
3 | +class UserDefaults | |
4 | + def initialize(path) | |
5 | + @domain = path | |
6 | + @path = path + '.plist' | |
7 | + end | |
8 | + | |
9 | + def invoke(command, *args) | |
10 | + system('defaults', command, @domain, *args) | |
11 | + end | |
12 | + | |
13 | + def exist? | |
14 | + FileTest.exist?(@path) | |
15 | + end | |
16 | + | |
17 | + def read(key) | |
18 | + invoke('read', key) | |
19 | + end | |
20 | + | |
21 | + def write(key, value) | |
22 | + invoke('write', key, value) | |
23 | + end | |
24 | + | |
25 | + def delete(key) | |
26 | + invoke('delete', key) | |
27 | + end | |
28 | + | |
29 | + def rename(oldkey, newkey) | |
30 | + invoke('rename', oldkey, newkey) | |
31 | + end | |
32 | + | |
33 | + attr_reader :path | |
34 | +end |
@@ -0,0 +1,40 @@ | ||
1 | +# -*- mode: ruby; coding: utf-8 -*- | |
2 | + | |
3 | +require 'rexml/document' | |
4 | + | |
5 | +class DictionarySetTranslator | |
6 | + def initialize(path) | |
7 | + File.open(path) { |file| | |
8 | + @plist = REXML::Document.new(file) | |
9 | + } | |
10 | + end | |
11 | + | |
12 | + def execute | |
13 | + root = @plist.root | |
14 | + | |
15 | + root.elements.each('array/dict') { |dict| | |
16 | + elem = dict.elements["integer"] | |
17 | + type = elem.text.to_i | |
18 | + | |
19 | + case type | |
20 | + when 10, 11 | |
21 | + elem.text = type - 10 | |
22 | + | |
23 | + when 20 | |
24 | + elem.text = '3' | |
25 | + | |
26 | + when 30 | |
27 | + elem.text = '2' | |
28 | + | |
29 | + else | |
30 | + root.delete_element(dict.xpath) | |
31 | + end | |
32 | + } | |
33 | + end | |
34 | + | |
35 | + def save(path) | |
36 | + File.open(path, File::CREAT|File::TRUNC|File::WRONLY) { |file| | |
37 | + @plist.write file | |
38 | + } | |
39 | + end | |
40 | +end |
@@ -4,10 +4,14 @@ | ||
4 | 4 | |
5 | 5 | TARGET = AquaSKK.app |
6 | 6 | DEST = /Library/Input\ Methods |
7 | +WORKDIR = /tmp/AquaSKK | |
7 | 8 | XCODE = xcodebuild -project proj/AquaSKK.xcodeproj |
8 | 9 | DEBUG_BUILD = $(XCODE) -configuration Debug |
9 | 10 | RELEASE_BUILD = $(XCODE) -configuration Release |
11 | +PKGMAKER = /Developer/usr/bin/packagemaker | |
12 | +HDIMAGE = hdiutil create -ov -srcfolder $(WORKDIR) | |
10 | 13 | BUILD = proj/build/Debug |
14 | +TODAY = `date +%Y%m%d` | |
11 | 15 | |
12 | 16 | all: |
13 | 17 | $(DEBUG_BUILD) build |
@@ -14,6 +18,7 @@ | ||
14 | 18 | |
15 | 19 | clean: |
16 | 20 | $(DEBUG_BUILD) clean |
21 | + $(RELEASE_BUILD) clean | |
17 | 22 | |
18 | 23 | install: copy |
19 | 24 | @pid=`ps -A|awk '/[A]quaSKK.app/ { print $$1; }'`; \ |
@@ -32,8 +37,13 @@ | ||
32 | 37 | release_build: |
33 | 38 | $(RELEASE_BUILD) build |
34 | 39 | |
35 | -beta: release_build | |
36 | - cd Package; make beta; cd .. | |
40 | +beta: package | |
41 | + $(HDIMAGE) /tmp/AquaSKK-$(TODAY).dmg | |
37 | 42 | |
38 | -release: release_build | |
39 | - cd Package; make release; cd .. | |
43 | +release: package | |
44 | + $(HDIMAGE) /tmp/AquaSKK.dmg | |
45 | + | |
46 | +package: release_build | |
47 | + rm -fr $(WORKDIR) | |
48 | + mkdir $(WORKDIR) | |
49 | + cd proj; $(PKGMAKER) -d AquaSKK.pmdoc -o $(WORKDIR)/AquaSKK.pkg --target 10.5; cd .. |