redcar 0.7 → 0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. data/CHANGES +42 -0
  2. data/README.md +5 -3
  3. data/Rakefile +39 -81
  4. data/bin/redcar +1 -1
  5. data/lib/redcar.rb +9 -6
  6. data/lib/redcar/installer.rb +1 -1
  7. data/lib/redcar/ruby_extensions.rb +19 -0
  8. data/lib/redcar/runner.rb +1 -1
  9. data/lib/redcar/usage.rb +3 -0
  10. data/lib/redcar_quick_start.rb +11 -11
  11. data/plugins/application/features/step_definitions/tree_steps.rb +22 -5
  12. data/plugins/application/features/step_definitions/window_steps.rb +9 -1
  13. data/plugins/application/features/support/env.rb +5 -2
  14. data/plugins/application/lib/application.rb +51 -46
  15. data/plugins/application/lib/application/window.rb +60 -30
  16. data/plugins/application_swt/lib/application_swt.rb +16 -16
  17. data/plugins/application_swt/lib/application_swt/window.rb +35 -7
  18. data/plugins/auto_completer/features/support/env.rb +0 -2
  19. data/plugins/auto_indenter/features/support/env.rb +0 -1
  20. data/plugins/auto_pairer/features/auto_pairer.feature +50 -45
  21. data/plugins/auto_pairer/features/support/env.rb +0 -1
  22. data/plugins/auto_pairer/lib/auto_pairer/document_controller.rb +11 -6
  23. data/plugins/clipboard-viewer/Screenshot.png +0 -0
  24. data/plugins/clipboard-viewer/lib/clipboard_viewer.rb +50 -0
  25. data/plugins/clipboard-viewer/lib/clipboard_viewer/browser_controller.rb +27 -0
  26. data/plugins/clipboard-viewer/lib/clipboard_viewer/clipboard_bar.rb +67 -0
  27. data/plugins/clipboard-viewer/plugin.rb +9 -0
  28. data/plugins/clipboard-viewer/views/clipboard.html.erb +15 -0
  29. data/plugins/clipboard-viewer/views/default.css +43 -0
  30. data/plugins/clipboard-viewer/views/redcar_small_icon.png +0 -0
  31. data/plugins/comment/features/line_comment.feature +137 -0
  32. data/plugins/comment/features/selection_comment.feature +21 -0
  33. data/plugins/comment/features/step_definitions/comment_steps.rb +7 -0
  34. data/plugins/comment/lib/comment.rb +266 -0
  35. data/plugins/comment/plugin.rb +7 -0
  36. data/plugins/comment/vendor/comment_lib.json +47 -0
  37. data/plugins/declarations/lib/declarations.rb +1 -1
  38. data/plugins/document_search/features/replace.feature +10 -2
  39. data/plugins/document_search/features/support/env.rb +0 -1
  40. data/plugins/document_search/lib/document_search.rb +4 -1
  41. data/plugins/document_search/lib/document_search/replace.rb +11 -3
  42. data/plugins/document_search/lib/document_search/search_and_replace.rb +5 -2
  43. data/plugins/edit_view/features/case_change.feature +9 -9
  44. data/plugins/edit_view/features/cursor_navigation.feature +36 -0
  45. data/plugins/edit_view/features/step_definitions/editing_steps.rb +63 -8
  46. data/plugins/edit_view/features/step_definitions/notebook_steps.rb +2 -0
  47. data/plugins/edit_view/features/step_definitions/tab_steps.rb +8 -5
  48. data/plugins/edit_view/features/support/env.rb +8 -2
  49. data/plugins/edit_view/lib/edit_view.rb +16 -1
  50. data/plugins/edit_view/lib/edit_view/actions/cmd_enter.rb +11 -0
  51. data/plugins/edit_view/lib/edit_view/document.rb +27 -10
  52. data/plugins/edit_view/lib/edit_view/edit_tab.rb +17 -4
  53. data/plugins/edit_view/spec/edit_view/document_spec.rb +3 -0
  54. data/plugins/edit_view_swt/lib/edit_view_swt.rb +42 -3
  55. data/plugins/edit_view_swt/lib/edit_view_swt/word_movement.rb +17 -15
  56. data/plugins/help/lib/help.rb +40 -0
  57. data/plugins/help/plugin.rb +8 -0
  58. data/plugins/html_view/features/step_definitions/html_view_steps.rb +6 -4
  59. data/plugins/line_tools/features/support/env.rb +0 -1
  60. data/plugins/macros/features/step_definitions/macro_steps.rb +0 -55
  61. data/plugins/macros/features/support/env.rb +0 -2
  62. data/plugins/open_default_app/lib/open_default_app.rb +35 -0
  63. data/plugins/open_default_app/plugin.rb +8 -0
  64. data/plugins/open_default_app/screenshot.png +0 -0
  65. data/plugins/plugin_manager_ui/lib/plugin_manager_ui.rb +17 -3
  66. data/plugins/project/features/find_file.feature +3 -2
  67. data/plugins/project/features/highlight_focussed_tab.feature +8 -0
  68. data/plugins/project/features/move_and_rename_files.feature +25 -0
  69. data/plugins/project/features/open_and_save_files.feature +10 -1
  70. data/plugins/project/features/open_directory_tree.feature +32 -2
  71. data/plugins/project/features/step_definitions/directory_steps.rb +17 -0
  72. data/plugins/project/features/step_definitions/project_tree_steps.rb +3 -0
  73. data/plugins/project/features/sub_project.feature +14 -0
  74. data/plugins/project/features/support/env.rb +22 -3
  75. data/plugins/project/features/watch_for_modified_files.feature +32 -9
  76. data/plugins/project/lib/project.rb +53 -21
  77. data/plugins/project/lib/project/adapters/local.rb +21 -16
  78. data/plugins/project/lib/project/adapters/remote.rb +15 -13
  79. data/plugins/project/lib/project/commands.rb +37 -16
  80. data/plugins/project/lib/project/dir_controller.rb +41 -42
  81. data/plugins/project/lib/project/drb_service.rb +35 -21
  82. data/plugins/project/lib/project/file_list.rb +7 -1
  83. data/plugins/project/lib/project/manager.rb +28 -3
  84. data/plugins/project/lib/project/sub_project.rb +17 -0
  85. data/plugins/project/lib/project/support/recycle.js +2 -0
  86. data/plugins/project/lib/project/support/trash.rb +72 -0
  87. data/plugins/project/spec/fixtures/multi-byte-files/a/341/204/200/341/205/247/341/206/274/341/204/205/341/205/251/foo +1 -0
  88. data/plugins/project/spec/fixtures/multi-byte-files//341/204/220/341/205/246/341/204/211/341/205/263/341/204/220/341/205/263.py +1 -0
  89. data/plugins/project/spec/project/file_list_spec.rb +4 -0
  90. data/plugins/redcar/features/goto_line_command.feature +20 -0
  91. data/plugins/redcar/redcar.rb +107 -47
  92. data/plugins/repl/lib/repl.rb +20 -20
  93. data/plugins/repl/lib/repl/clojure_mirror.rb +50 -58
  94. data/plugins/repl/lib/repl/groovy_mirror.rb +22 -41
  95. data/plugins/repl/lib/repl/repl_mirror.rb +85 -14
  96. data/plugins/repl/lib/repl/ruby_mirror.rb +12 -39
  97. data/plugins/repl/spec/repl/groovy_mirror_spec.rb +1 -1
  98. data/plugins/repl/spec/repl/ruby_mirror_spec.rb +12 -12
  99. data/plugins/ruby/README +6 -0
  100. data/plugins/ruby/lib/syntax_check/ruby.rb +28 -0
  101. data/plugins/ruby/plugin.rb +7 -0
  102. data/plugins/runnables/features/command_tree.feature +9 -0
  103. data/plugins/runnables/features/file_runner_input.feature +20 -0
  104. data/plugins/runnables/features/run_alternate_command.feature +14 -0
  105. data/plugins/runnables/features/support/env.rb +42 -5
  106. data/plugins/runnables/lib/runnables.rb +67 -21
  107. data/plugins/runnables/lib/runnables/commands.rb +35 -18
  108. data/plugins/runnables/lib/runnables/tree_mirror/nodes/runnable_group.rb +23 -37
  109. data/plugins/runnables/lib/runnables/tree_mirror/nodes/runnable_type_group.rb +16 -18
  110. data/plugins/scm_svn/features/support/env.rb +0 -3
  111. data/plugins/snippets/features/snippets.feature +17 -2
  112. data/plugins/snippets/features/support/env.rb +0 -1
  113. data/plugins/snippets/lib/snippets/tab_handler.rb +51 -18
  114. data/plugins/swt/lib/swt/cucumber_patches.rb +13 -68
  115. data/plugins/swt/lib/swt/cucumber_runner.rb +2 -3
  116. data/plugins/syntax_check/README +6 -0
  117. data/plugins/syntax_check/lib/syntax_check.rb +16 -0
  118. data/plugins/syntax_check/lib/syntax_check/checker.rb +47 -0
  119. data/plugins/syntax_check/lib/syntax_check/error.rb +23 -0
  120. data/plugins/syntax_check/plugin.rb +7 -0
  121. data/plugins/tree_view_swt/lib/tree_view_swt.rb +6 -0
  122. data/plugins/web_bookmarks/Screenshot.png +0 -0
  123. data/plugins/web_bookmarks/lib/web_bookmarks.rb +42 -0
  124. data/plugins/web_bookmarks/lib/web_bookmarks/bookmark.rb +43 -0
  125. data/plugins/web_bookmarks/lib/web_bookmarks/browser_bar.rb +70 -0
  126. data/plugins/web_bookmarks/lib/web_bookmarks/commands.rb +111 -0
  127. data/plugins/web_bookmarks/lib/web_bookmarks/tree.rb +67 -0
  128. data/plugins/web_bookmarks/lib/web_bookmarks/view_controller.rb +22 -0
  129. data/plugins/web_bookmarks/plugin.rb +11 -0
  130. data/plugins/web_bookmarks/views/index.html.erb +5 -0
  131. metadata +60 -10
@@ -5,27 +5,31 @@ module Redcar
5
5
  def touch(new_file_path)
6
6
  FileUtils.touch(new_file_path)
7
7
  end
8
-
8
+
9
9
  def mkdir(new_dir_path)
10
10
  FileUtils.mkdir(new_dir_path)
11
11
  end
12
-
12
+
13
13
  def mv(path, new_path)
14
14
  FileUtils.mv(path, new_path)
15
+ new_path = File.join(new_path, File.basename(path)) unless File.file?(new_path)
16
+ Manager.update_tab_for_path(path,new_path)
15
17
  end
16
-
18
+
17
19
  def file?(path)
18
20
  File.file?(path)
19
21
  end
20
-
22
+
21
23
  def directory?(path)
22
- File.directory?(path)
24
+ # JRuby's File.directory? seems to have a problem with multi-byte strings
25
+ f = java.io.File.new(path.to_java)
26
+ f.directory?
23
27
  end
24
-
28
+
25
29
  def empty_directory?(path)
26
30
  Dir.glob("#{path}/*", File::FNM_DOTMATCH).length <= 2
27
31
  end
28
-
32
+
29
33
  def fetch_contents(path, force=false)
30
34
  Dir.glob("#{path}/*", File::FNM_DOTMATCH).map do |fn|
31
35
  is_dir = directory?(fn)
@@ -47,31 +51,32 @@ module Redcar
47
51
  def save(file, contents)
48
52
  File.open(file, "wb") {|f| f.print contents }
49
53
  end
50
-
54
+
51
55
  def mtime(file)
52
- File.stat(file).mtime
56
+ File.mtime(file)
53
57
  end
54
-
58
+
55
59
  def exists?(file)
56
60
  File.exists?(file)
57
61
  end
58
-
62
+
59
63
  def delete(file)
60
- FileUtils.rm_rf(file)
64
+ FileUtils.rm_rf(file) unless Trash.recycle(file)
65
+ Manager.update_tab_for_path(file)
61
66
  end
62
-
67
+
63
68
  def load_contents(file)
64
69
  File.open(file, 'rb') do |f|; f.read; end
65
70
  end
66
-
71
+
67
72
  def save_contents(file)
68
73
  File.open(file, "wb") {|f| f.print contents }
69
74
  end
70
-
75
+
71
76
  def refresh_operation(tree)
72
77
  yield
73
78
  end
74
79
  end
75
80
  end
76
81
  end
77
- end
82
+ end
@@ -4,14 +4,14 @@ module Redcar
4
4
  module Adapters
5
5
  class Remote
6
6
  class PathDoesNotExist < StandardError; end
7
-
7
+
8
8
  PROTOCOLS = {
9
9
  :ftp => RemoteProtocols::FTP,
10
10
  :sftp => RemoteProtocols::SFTP
11
11
  }
12
-
12
+
13
13
  attr_accessor :protocol, :host, :user, :password, :private_key_files
14
-
14
+
15
15
  def initialize(protocol, host, user, password, private_key_files)
16
16
  @protocol = protocol
17
17
  @host = host
@@ -20,7 +20,7 @@ module Redcar
20
20
  @private_key_files = private_key_files
21
21
  target
22
22
  end
23
-
23
+
24
24
  def target
25
25
  @target ||= PROTOCOLS[protocol].new(host, user, password, private_key_files)
26
26
  end
@@ -35,8 +35,9 @@ module Redcar
35
35
 
36
36
  def mv(path, new_path)
37
37
  target.mv(path, new_path)
38
+ Manager.update_tab_for_path(path,new_path)
38
39
  end
39
-
40
+
40
41
  def mtime(file)
41
42
  target.mtime(file)
42
43
  end
@@ -44,11 +45,11 @@ module Redcar
44
45
  def file?(path)
45
46
  target.file?(path)
46
47
  end
47
-
48
+
48
49
  def directory?(path)
49
50
  target.directory?(path)
50
51
  end
51
-
52
+
52
53
  def fetch_contents(path)
53
54
  target.fetch_contents(path)
54
55
  end
@@ -60,27 +61,28 @@ module Redcar
60
61
  def save(file, contents)
61
62
  target.save(file)
62
63
  end
63
-
64
+
64
65
  def stat(file)
65
66
  target.stat(file)
66
67
  end
67
-
68
+
68
69
  def delete(file)
69
70
  target.delete(file)
71
+ Manager.update_tab_for_path(file)
70
72
  end
71
73
 
72
74
  def exists?(path)
73
75
  target.exists?(path)
74
76
  end
75
-
77
+
76
78
  def load(file)
77
79
  target.load(file)
78
80
  end
79
-
81
+
80
82
  def save(file, contents)
81
83
  target.save(file, contents)
82
84
  end
83
-
85
+
84
86
  def refresh_operation(tree)
85
87
  visible_paths = tree.visible_nodes.map {|n| n.path}
86
88
  visible_dirs = visible_paths.map {|path| File.dirname(path) }.uniq
@@ -91,4 +93,4 @@ module Redcar
91
93
  end
92
94
  end
93
95
  end
94
- end
96
+ end
@@ -158,6 +158,7 @@ module Redcar
158
158
  else
159
159
  FileSaveAsCommand.new.run
160
160
  end
161
+ tab.update_for_file_changes
161
162
  end
162
163
  end
163
164
 
@@ -244,19 +245,22 @@ module Redcar
244
245
 
245
246
  class RevealInProjectCommand < ProjectCommand
246
247
  def execute
247
- tab = Redcar.app.focussed_window.focussed_notebook_tab
248
- return unless tab.is_a?(EditTab)
249
-
250
- path = tab.edit_view.document.mirror.path
251
- tree = project.tree
252
- current = tree.tree_mirror.top
253
- while current.any?
254
- ancestor_node = current.detect {|node| path =~ /^#{node.path}($|\/)/}
255
- tree.expand(ancestor_node)
256
- current = ancestor_node.children
248
+ if project and project.window.trees_visible?
249
+ tab = Redcar.app.focussed_window.focussed_notebook_tab
250
+ return unless tab.is_a?(EditTab) && tab.edit_view.document.mirror
251
+
252
+ path = tab.edit_view.document.mirror.path
253
+ tree = project.tree
254
+ current = tree.tree_mirror.top
255
+ while current.any?
256
+ ancestor_node = current.detect {|node| path =~ /^#{node.path}($|\/)/}
257
+ return unless ancestor_node
258
+ tree.expand(ancestor_node)
259
+ current = ancestor_node.children
260
+ end
261
+ tree.select(ancestor_node)
262
+ project.window.treebook.focus_tree(project.tree)
257
263
  end
258
- tree.select(ancestor_node)
259
- project.window.treebook.focus_tree(project.tree)
260
264
  end
261
265
  end
262
266
 
@@ -286,8 +290,11 @@ module Redcar
286
290
  ::Spoon.spawn(app, *options)
287
291
  else
288
292
  # TODO: This really needs proper escaping.
289
- options = options.map {|o| "\"#{o}\""}.join(' ')
290
- puts "Running: #{app} #{options}"
293
+ if options
294
+ options = options.map {|o| "\"#{o}\""}.join(' ')
295
+ else
296
+ options = ""
297
+ end
291
298
  Thread.new do
292
299
  system("#{app} #{options}")
293
300
  puts " Finished: #{app} #{options}"
@@ -303,7 +310,8 @@ module Redcar
303
310
  preferred = Manager.storage['preferred_file_browser']
304
311
  case Redcar.platform
305
312
  when :osx
306
- run_application('open', '-a', 'finder', path)
313
+ # Spoon doesn't seem to like `open`
314
+ system('open', '-a', 'Finder', path)
307
315
  when :windows
308
316
  run_application('explorer.exe', path.gsub("/","\\"))
309
317
  when :linux
@@ -335,7 +343,20 @@ module Redcar
335
343
  preferred = Manager.storage['preferred_command_line']
336
344
  case Redcar.platform
337
345
  when :osx
338
- run_application('open', path)
346
+ unless preferred
347
+ preferred = "Terminal"
348
+ Manager.storage['preferred_command_line'] = preferred
349
+ end
350
+ command = <<-BASH.gsub(/^\s{12}/, '')
351
+ osascript <<END
352
+ tell application "#{preferred}"
353
+ do script "cd \\\"#{path}\\\""
354
+ activate
355
+ end tell
356
+ END
357
+ BASH
358
+ # Spoon doesn't seem to work with `osascript`
359
+ system(command)
339
360
  when :windows
340
361
  run_application('start cmd.exe', '/kcd ' + path.gsub("/","\\"))
341
362
  when :linux
@@ -3,39 +3,39 @@ module Redcar
3
3
  class Project
4
4
  class DirController
5
5
  include Redcar::Tree::Controller
6
-
6
+
7
7
  def self.adapter(node, tree=nil)
8
8
  node ? node.adapter : tree.tree_mirror.adapter
9
9
  end
10
-
10
+
11
11
  def activated(tree, node)
12
12
  if node.leaf?
13
13
  FileOpenCommand.new(node.path, node.adapter).run
14
14
  end
15
15
  end
16
-
16
+
17
17
  def handle_error(tree, error)
18
18
  tree.close
19
19
  Application::Dialog.message_box(error.message, :type => :error)
20
20
  end
21
-
21
+
22
22
  class DragController
23
23
  include Redcar::Tree::Controller::DragController
24
-
24
+
25
25
  attr_reader :tree
26
-
26
+
27
27
  def initialize(tree)
28
28
  @tree = tree
29
29
  end
30
-
30
+
31
31
  def reorderable?
32
32
  false
33
33
  end
34
-
34
+
35
35
  def can_drop?(nodes, target, position)
36
36
  nodes.all? {|node| droppable?(node, target)}
37
37
  end
38
-
38
+
39
39
  def do_drop(nodes, target, position)
40
40
  paths = nodes.map {|node| node.path }
41
41
  non_nested_paths = remove_nested_paths(paths)
@@ -48,24 +48,24 @@ module Redcar
48
48
  end
49
49
  tree.refresh
50
50
  end
51
-
51
+
52
52
  private
53
-
53
+
54
54
  def droppable?(from_node, target_node)
55
55
  # you can always drop into the top level of the tree
56
56
  return true if target_node == nil
57
-
57
+
58
58
  # can't drop a file/dir onto itself
59
59
  return false if from_node.path == target_node.path
60
-
60
+
61
61
  # can't drop a directory into its children
62
62
  !child_of?(from_node.path, target_node.path)
63
63
  end
64
-
64
+
65
65
  def child_of?(path, possible_child_path)
66
66
  possible_child_path =~ /^#{Regexp.escape(path)}\//
67
67
  end
68
-
68
+
69
69
  # Removes paths which are children of higher level paths also being
70
70
  # dragged.
71
71
  def remove_nested_paths(paths)
@@ -79,14 +79,14 @@ module Redcar
79
79
  keep
80
80
  end
81
81
  end
82
-
82
+
83
83
  def drag_controller(tree)
84
84
  DragController.new(tree)
85
85
  end
86
-
86
+
87
87
  def right_click(tree, node)
88
88
  controller = self
89
-
89
+
90
90
  menu = Menu.new
91
91
  Redcar.plugin_manager.objects_implementing(:project_context_menus).each do |object|
92
92
  # a lot of plugins will only really care about the node that was clicked
@@ -101,15 +101,15 @@ module Redcar
101
101
  puts("Invalid project_context_menus hook detected in "+object.class.name)
102
102
  end
103
103
  end
104
-
104
+
105
105
  Application::Dialog.popup_menu(menu, :pointer)
106
106
  end
107
-
107
+
108
108
  def new_file(tree, node)
109
109
  enclosing_dir = node ? node.directory : tree.tree_mirror.path
110
110
  new_file_name = uniq_name(enclosing_dir, "New File")
111
111
  new_file_path = File.join(enclosing_dir, new_file_name)
112
-
112
+
113
113
  adapter = DirController.adapter(node, tree)
114
114
  adapter.touch(new_file_path)
115
115
  tree.refresh
@@ -117,7 +117,7 @@ module Redcar
117
117
  new_file_node = DirMirror::Node.cache[new_file_path]
118
118
  tree.edit(new_file_node)
119
119
  end
120
-
120
+
121
121
  def new_dir(tree, node)
122
122
  enclosing_dir = node ? node.directory : tree.tree_mirror.path
123
123
  new_dir_name = uniq_name(enclosing_dir, "New Directory")
@@ -129,7 +129,7 @@ module Redcar
129
129
  new_dir_node = DirMirror::Node.cache[new_dir_path]
130
130
  tree.edit(new_dir_node)
131
131
  end
132
-
132
+
133
133
  def rename(tree, node)
134
134
  nodes = tree.selection
135
135
  if nodes.length == 1
@@ -138,7 +138,7 @@ module Redcar
138
138
  bulk_rename(tree, nodes)
139
139
  end
140
140
  end
141
-
141
+
142
142
  def single_rename(tree, node)
143
143
  if node.text =~ /^(.*)\.[^\.]+$/
144
144
  tree.edit(node, 0, $1.length)
@@ -146,19 +146,19 @@ module Redcar
146
146
  tree.edit(node)
147
147
  end
148
148
  end
149
-
149
+
150
150
  def bulk_rename(tree, nodes)
151
151
  tab = Redcar.app.focussed_window.new_tab(HtmlTab)
152
152
  controller = BulkRenameController.new(tab, tree, nodes)
153
153
  tab.html_view.controller = controller
154
154
  tab.focus
155
155
  end
156
-
156
+
157
157
  class BulkRenameController
158
158
  include Redcar::HtmlController
159
-
159
+
160
160
  attr_reader :pairs, :match_pattern, :replace_pattern
161
-
161
+
162
162
  def initialize(tab, tree, nodes)
163
163
  @tab = tab
164
164
  @tree = tree
@@ -167,16 +167,16 @@ module Redcar
167
167
  @replace_pattern = ""
168
168
  @adapter = DirController.adapter(nodes.first, tree)
169
169
  end
170
-
170
+
171
171
  def title
172
172
  "Bulk Rename"
173
173
  end
174
-
174
+
175
175
  def index
176
176
  rhtml = ERB.new(File.read(File.join(File.dirname(__FILE__), "..", "..", "views", "bulk_rename.html.erb")))
177
177
  rhtml.result(binding)
178
178
  end
179
-
179
+
180
180
  def refresh(new_match_pattern, new_replace_pattern)
181
181
  begin
182
182
  @match_pattern = /#{new_match_pattern}/
@@ -198,29 +198,28 @@ module Redcar
198
198
  puts e.message
199
199
  puts e.backtrace
200
200
  end
201
-
201
+
202
202
  def submit(params)
203
203
  @pairs.each do |node, _|
204
204
  old_name = File.basename(node.path)
205
205
  new_name = transform_name(old_name)
206
206
  next if old_name == new_name
207
207
  new_path = File.join(File.dirname(node.path), new_name)
208
-
209
208
  @adapter.mv(node.path, new_path)
210
209
  end
211
210
  @tab.close
212
211
  @tree.refresh
213
212
  end
214
-
213
+
215
214
  private
216
-
215
+
217
216
  def transform_name(old_name)
218
217
  old_name.sub(match_pattern, replace_pattern)
219
218
  end
220
-
219
+
221
220
  def legal_path?(path)
222
221
  return true if File.exist?(path)
223
-
222
+
224
223
  begin
225
224
  FileUtils.touch(path)
226
225
  FileUtils.rm(path)
@@ -230,7 +229,7 @@ module Redcar
230
229
  end
231
230
  end
232
231
  end
233
-
232
+
234
233
  def delete(tree, _)
235
234
  nodes = tree.selection
236
235
  basenames = nodes.map {|node| File.basename(node.path) }
@@ -243,7 +242,7 @@ module Redcar
243
242
  tree.refresh
244
243
  end
245
244
  end
246
-
245
+
247
246
  def edited(tree, node, text)
248
247
  new_path = File.expand_path(File.join(File.dirname(node.path), text))
249
248
  return if node.path == new_path
@@ -254,9 +253,9 @@ module Redcar
254
253
  new_node = DirMirror::Node.create_from_path(adapter, {:fullname => new_path, :type => node.type})
255
254
  tree.select(new_node)
256
255
  end
257
-
256
+
258
257
  private
259
-
258
+
260
259
  def uniq_name(path, name)
261
260
  return name unless File.exist?(File.join(path, name))
262
261
  i = 1
@@ -270,4 +269,4 @@ module Redcar
270
269
  end
271
270
  end
272
271
 
273
-
272
+