rdoc_osx_dictionary 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
data/History.txt CHANGED
@@ -1,3 +1,15 @@
1
+ === 1.1.0 / 2010-02-01
2
+
3
+ * 2 minor enhancements:
4
+
5
+ * Added -f to force rebuild.
6
+ * Refactored system calls to a handler so failures are uniformly handled.
7
+
8
+ * 2 bug fixes:
9
+
10
+ * Fixed dictionary entry id munging to avoid errant duplicates.
11
+ * Setting $LC_ALL to C to fix unicode errors discovered in iTerm.
12
+
1
13
  === 1.0.1 / 2010-01-28
2
14
 
3
15
  * 4 bug fixes:
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/ruby -ws
2
2
 
3
3
  $v ||= false
4
+ $f ||= false
4
5
 
5
6
  require 'rubygems'
6
7
  require 'rdoc_osx_dictionary'
@@ -5,9 +5,10 @@ require 'rdoc/ri/driver'
5
5
 
6
6
  # Forces /bin/tr to ignore badly formatted "unicode". (no clue where from)
7
7
  ENV['LANG'] = ""
8
+ ENV['LC_ALL'] = "C"
8
9
 
9
10
  class RDoc::OSXDictionary
10
- VERSION = '1.0.1'
11
+ VERSION = '1.1.0'
11
12
 
12
13
  exclude = %w[ StringScanner#pre_match
13
14
  StringScanner#post_match
@@ -46,6 +47,7 @@ class RDoc::OSXDictionary
46
47
  '=' => 'eq',
47
48
  '?' => 'eh',
48
49
  '`' => 'backtick',
50
+ '::' => '__',
49
51
  }
50
52
 
51
53
  NAME_MAP_RE = Regexp.new(NAME_MAP.keys.sort_by { |k| k.length }.map {|s|
@@ -119,7 +121,7 @@ class RDoc::OSXDictionary
119
121
  def display_method_info definition
120
122
  fullname = definition["full_name"]
121
123
  name = definition["name"]
122
- id = fullname.gsub(/:|#/, '_').gsub(/#{NAME_MAP_RE}/) { |x| "_"+NAME_MAP[x] }
124
+ id = fullname.gsub(/#{NAME_MAP_RE}/) { |x| "_#{NAME_MAP[x]}" }
123
125
 
124
126
  params = definition["params"]
125
127
  comment = Array(definition["comment"]).join("\n")
@@ -193,6 +195,7 @@ class RDoc::OSXDictionary
193
195
  seen = {}
194
196
  ri = RDoc::RI::Driver.new
195
197
  dirty = false
198
+ force = $f || false
196
199
  dict = ri.class_cache
197
200
  base = File.expand_path "~/.ri/"
198
201
 
@@ -217,13 +220,13 @@ class RDoc::OSXDictionary
217
220
  methods.each do |k,v|
218
221
  result << d_entry(k, v)
219
222
  end
220
- result = result.join("\n")
221
- f.puts result
223
+
224
+ f.puts result.join("\n")
222
225
  end
223
226
  end
224
227
  end
225
228
 
226
- return unless dirty
229
+ return unless dirty unless force
227
230
 
228
231
  dict_src_path = "#{base}/RubyGemsDictionary.xml"
229
232
 
@@ -242,17 +245,17 @@ class RDoc::OSXDictionary
242
245
  dict_path = File.expand_path "~/Library/Dictionaries"
243
246
 
244
247
  Dir.chdir base do
245
- system("/Developer/Extras/Dictionary Development Kit/bin/build_dict.sh",
246
- dict_name, dict_src_path,
247
- "#{data}/RubyGemsDictionary.css",
248
- "#{data}/RubyGemsInfo.plist")
248
+ run("/Developer/Extras/Dictionary Development Kit/bin/build_dict.sh",
249
+ dict_name, dict_src_path,
250
+ "#{data}/RubyGemsDictionary.css",
251
+ "#{data}/RubyGemsInfo.plist")
249
252
  end
250
253
 
251
254
  warn "installing"
252
255
 
253
256
  FileUtils.mkdir_p dict_path
254
257
 
255
- system "rsync", "-r", "#{base}/objects/#{dict_name}.dictionary", dict_path
258
+ run "rsync", "-r", "#{base}/objects/#{dict_name}.dictionary", dict_path
256
259
 
257
260
  FileUtils.touch dict_path
258
261
 
@@ -260,6 +263,11 @@ class RDoc::OSXDictionary
260
263
  warn "Run Dictionary.app to use the new dictionary. (activate in prefs!)"
261
264
  end
262
265
 
266
+ def run(*cmd)
267
+ warn "running: " + cmd.map { |s| s.inspect }.join(" ") if $v
268
+ abort "command failed" unless system(*cmd)
269
+ end
270
+
263
271
  @hooked = false
264
272
 
265
273
  def self.install_gem_hooks
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdoc_osx_dictionary
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -30,7 +30,7 @@ cert_chain:
30
30
  FBHgymkyj/AOSqKRIpXPhjC6
31
31
  -----END CERTIFICATE-----
32
32
 
33
- date: 2010-01-28 00:00:00 -08:00
33
+ date: 2010-02-01 00:00:00 -08:00
34
34
  default_executable:
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
metadata.gz.sig CHANGED
Binary file