redcar 0.8 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGES CHANGED
@@ -1,3 +1,10 @@
1
+
2
+ Version 0.8.1 (26 October 2010)
3
+ ===============================
4
+
5
+ * Remove files with multi-byte names from the gem so windows rubygems is happy (Dan Lucraft)
6
+ * Replace all is a single undo operation (Steven Hancock)
7
+
1
8
  Version 0.8 (26 October 2010)
2
9
  =============================
3
10
 
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
- REDCAR_VERSION = "0.8" # also change in lib/redcar.rb!
1
+ REDCAR_VERSION = "0.8.1" # also change in lib/redcar.rb!
2
2
  require 'rubygems'
3
3
  require 'fileutils'
4
4
  require 'spec/rake/spectask'
@@ -129,6 +129,21 @@ def remove_matching_files(list, string)
129
129
  list.reject {|entry| entry.include?(string)}
130
130
  end
131
131
 
132
+ def gem_manifest
133
+ r = %w(CHANGES LICENSE Rakefile README.md) +
134
+ Dir.glob("bin/redcar") +
135
+ Dir.glob("config/**/*") +
136
+ Dir.glob("share/**/*") +
137
+ remove_gitignored_files(Dir.glob("lib/**/*")) +
138
+ remove_matching_files(remove_gitignored_files(Dir.glob("plugins/**/*")), "redcar-bundles") +
139
+ Dir.glob("plugins/textmate/vendor/redcar-bundles/Bundles/*.tmbundle/Syntaxes/**/*") +
140
+ Dir.glob("plugins/textmate/vendor/redcar-bundles/Bundles/*.tmbundle/Preferences/**/*") +
141
+ Dir.glob("plugins/textmate/vendor/redcar-bundles/Bundles/*.tmbundle/Snippets/**/*") +
142
+ Dir.glob("plugins/textmate/vendor/redcar-bundles/Bundles/*.tmbundle/info.plist") +
143
+ Dir.glob("plugins/textmate/vendor/redcar-bundles/Themes/*.tmTheme")
144
+ remove_matching_files(r, "multi-byte")
145
+ end
146
+
132
147
  Spec = spec = Gem::Specification.new do |s|
133
148
  s.name = "redcar"
134
149
  s.version = REDCAR_VERSION
@@ -140,20 +155,8 @@ Spec = spec = Gem::Specification.new do |s|
140
155
  s.has_rdoc = true
141
156
  s.extra_rdoc_files = %w(README.md)
142
157
  s.rdoc_options = %w(--main README.md)
143
-
144
-
145
158
 
146
- s.files = %w(CHANGES LICENSE Rakefile README.md) +
147
- Dir.glob("bin/redcar") +
148
- Dir.glob("config/**/*") +
149
- Dir.glob("share/**/*") +
150
- remove_gitignored_files(Dir.glob("lib/**/*")) +
151
- remove_matching_files(remove_gitignored_files(Dir.glob("plugins/**/*")), "redcar-bundles") +
152
- Dir.glob("plugins/textmate/vendor/redcar-bundles/Bundles/*.tmbundle/Syntaxes/**/*") +
153
- Dir.glob("plugins/textmate/vendor/redcar-bundles/Bundles/*.tmbundle/Preferences/**/*") +
154
- Dir.glob("plugins/textmate/vendor/redcar-bundles/Bundles/*.tmbundle/Snippets/**/*") +
155
- Dir.glob("plugins/textmate/vendor/redcar-bundles/Bundles/*.tmbundle/info.plist") +
156
- Dir.glob("plugins/textmate/vendor/redcar-bundles/Themes/*.tmTheme")
159
+ s.files = gem_manifest
157
160
  s.executables = FileList["bin/redcar"].map { |f| File.basename(f) }
158
161
 
159
162
  s.require_paths = ["lib"]
@@ -51,10 +51,10 @@ end
51
51
  #
52
52
  # and so on.
53
53
  module Redcar
54
- VERSION = '0.8' # also change in the Rakefile!
54
+ VERSION = '0.8.1' # also change in the Rakefile!
55
55
  VERSION_MAJOR = 0
56
56
  VERSION_MINOR = 8
57
- VERSION_RELEASE = 0
57
+ VERSION_RELEASE = 1
58
58
 
59
59
  ENVIRONMENTS = [:user, :debug, :test]
60
60
 
@@ -1,16 +1,16 @@
1
1
  module DocumentSearch
2
2
  class ReplaceNextCommand < Redcar::DocumentCommand
3
-
3
+
4
4
  attr_reader :query, :replace, :search_method
5
-
5
+
6
6
  def initialize(query, replace, search_method)
7
7
  @query, @replace, @search_method = query, replace, search_method
8
8
  end
9
-
9
+
10
10
  def body
11
11
  Search.method(search_method)
12
12
  end
13
-
13
+
14
14
  def execute
15
15
  # The current selection is usually not used for the next replacement, unless
16
16
  # it matches the query string, in which case we assume that the user meant replace it, too
@@ -26,10 +26,10 @@ module DocumentSearch
26
26
  cursor_line_offset = latest_point - doc.offset_at_line(curr_line_number)
27
27
  curr_line = doc.get_line(curr_line_number)
28
28
  line_seg = curr_line[cursor_line_offset..-1]
29
-
29
+
30
30
  # Call the search method passed by the caller
31
31
  new_line, startoff, endoff = body.call(line_seg, query, replace)
32
-
32
+
33
33
  # The passed in method returns the string replacement or nil
34
34
  if new_line
35
35
  # Add the replacment to the end of the line, and then replace in the document
@@ -39,7 +39,7 @@ module DocumentSearch
39
39
  doc.set_selection_range(cursor_line_offset + line_offset + startoff, cursor_line_offset + line_offset + endoff)
40
40
  return 1
41
41
  end
42
-
42
+
43
43
  #Look at the rest of the lines starting at the next line
44
44
  start_line = doc.cursor_line
45
45
  (start_line+1..doc.line_count-1).each do |i|
@@ -52,12 +52,12 @@ module DocumentSearch
52
52
  return 1
53
53
  end
54
54
  end
55
-
55
+
56
56
  #Look at the rest of the lines starting at the beginning
57
57
  start_line = doc.cursor_line
58
58
  (0..start_line-1).each do |i|
59
59
  new_line, startoff, endoff = body.call(doc.get_line(i), query, replace)
60
-
60
+
61
61
  if new_line
62
62
  doc.replace_line(i, new_line.chomp)
63
63
  line_offset = doc.offset_at_line(i)
@@ -69,34 +69,36 @@ module DocumentSearch
69
69
  0
70
70
  end
71
71
  end
72
-
72
+
73
73
  class ReplaceAllCommand < Redcar::DocumentCommand
74
-
74
+
75
75
  attr_reader :query, :replace, :search_method
76
-
76
+
77
77
  # Replace All starts at the begnning of the doc and iterates over all of the lines.
78
78
  def initialize(query, replace, search_method)
79
79
  @query, @replace, @search_method = query, replace, search_method
80
80
  end
81
-
81
+
82
82
  def body
83
83
  Search.method(search_method)
84
84
  end
85
-
85
+
86
86
  def execute
87
87
  count = 0
88
88
  last_match_line = nil
89
89
  startoff = nil
90
90
  endoff = nil
91
- (0..(doc.line_count-1)).each do |i|
92
- begin
93
- line, a, b = body.call(doc.get_line(i), query, replace)
94
- if line
95
- startoff = a
96
- endoff = b
97
- last_match_line = i
98
- doc.replace_line(i, line.chomp)
99
- count += 1
91
+ doc.compound do
92
+ (0..(doc.line_count-1)).each do |i|
93
+ begin
94
+ line, a, b = body.call(doc.get_line(i), query, replace)
95
+ if line
96
+ startoff = a
97
+ endoff = b
98
+ last_match_line = i
99
+ doc.replace_line(i, line.chomp)
100
+ count += 1
101
+ end
100
102
  end
101
103
  end
102
104
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redcar
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 61
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 8
9
- version: "0.8"
9
+ - 1
10
+ version: 0.8.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Daniel Lucraft
@@ -3996,8 +3997,6 @@ files:
3996
3997
  - plugins/project/lib/project/support/trash.rb
3997
3998
  - plugins/project/lib/project.rb
3998
3999
  - plugins/project/plugin.rb
3999
- - "plugins/project/spec/fixtures/multi-byte-files/a\xE1\x84\x80\xE1\x85\xA7\xE1\x86\xBC\xE1\x84\x85\xE1\x85\xA9/foo"
4000
- - "plugins/project/spec/fixtures/multi-byte-files/\xE1\x84\x90\xE1\x85\xA6\xE1\x84\x89\xE1\x85\xB3\xE1\x84\x90\xE1\x85\xB3.py"
4001
4000
  - plugins/project/spec/fixtures/myproject/lib/foo_lib.rb
4002
4001
  - plugins/project/spec/fixtures/myproject/README
4003
4002
  - plugins/project/spec/fixtures/myproject/spec/foo_spec.rb