redcar 0.8.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (210) hide show
  1. data/CHANGES +41 -1
  2. data/README.md +1 -1
  3. data/Rakefile +5 -6
  4. data/lib/plugin_manager/lib/plugin_manager.rb +1 -2
  5. data/lib/redcar.rb +19 -14
  6. data/lib/redcar/installer.rb +21 -17
  7. data/lib/redcar/runner.rb +10 -7
  8. data/lib/redcar/usage.rb +1 -0
  9. data/lib/redcar_quick_start.rb +8 -12
  10. data/lib/regex_replace.rb +3 -3
  11. data/plugins/application/features/step_definitions/menu_steps.rb +10 -0
  12. data/plugins/application/features/step_definitions/speedbar_steps.rb +8 -2
  13. data/plugins/application/features/step_definitions/tree_steps.rb +48 -6
  14. data/plugins/application/features/step_definitions/window_steps.rb +9 -4
  15. data/plugins/application/features/support/env.rb +20 -1
  16. data/plugins/application/features/support/fake_event.rb +14 -0
  17. data/plugins/application/lib/application.rb +29 -12
  18. data/plugins/application/lib/application/dialogs/filter_list_dialog.rb +19 -0
  19. data/plugins/application/lib/application/speedbar.rb +23 -17
  20. data/plugins/application/lib/application/tab.rb +20 -15
  21. data/plugins/application/lib/application/treebook.rb +10 -7
  22. data/plugins/application/lib/application/window.rb +1 -1
  23. data/plugins/application/plugin.rb +1 -1
  24. data/plugins/application_swt/lib/application_swt/dialog_adapter.rb +4 -4
  25. data/plugins/application_swt/lib/application_swt/dialogs/filter_list_dialog_controller.rb +15 -4
  26. data/plugins/application_swt/lib/application_swt/icon.rb +3 -5
  27. data/plugins/application_swt/lib/application_swt/notebook/tab_drag_and_drop_listener.rb +4 -4
  28. data/plugins/application_swt/lib/application_swt/notebook/tab_transfer.rb +5 -5
  29. data/plugins/application_swt/lib/application_swt/speedbar.rb +34 -120
  30. data/plugins/application_swt/lib/application_swt/speedbar/button_item.rb +20 -0
  31. data/plugins/application_swt/lib/application_swt/speedbar/combo_item.rb +38 -0
  32. data/plugins/application_swt/lib/application_swt/speedbar/label_item.rb +15 -0
  33. data/plugins/application_swt/lib/application_swt/speedbar/slider_item.rb +32 -0
  34. data/plugins/application_swt/lib/application_swt/speedbar/text_box_item.rb +36 -0
  35. data/plugins/application_swt/lib/application_swt/speedbar/toggle_item.rb +29 -0
  36. data/plugins/application_swt/lib/application_swt/tab.rb +1 -3
  37. data/plugins/application_swt/lib/application_swt/toolbar.rb +19 -20
  38. data/plugins/application_swt/lib/application_swt/treebook.rb +24 -9
  39. data/plugins/application_swt/lib/application_swt/window.rb +110 -98
  40. data/plugins/application_swt/lib/swt/vtab_folder.rb +77 -32
  41. data/plugins/application_swt/lib/swt/vtab_item.rb +9 -0
  42. data/plugins/application_swt/lib/swt/vtab_label.rb +63 -23
  43. data/plugins/application_swt/plugin.rb +1 -1
  44. data/plugins/clipboard-viewer/lib/clipboard_viewer/clipboard_bar.rb +2 -2
  45. data/plugins/comment/features/line_comment.feature +116 -4
  46. data/plugins/comment/lib/comment.rb +18 -16
  47. data/plugins/connection_manager/lib/connection_manager/commands.rb +1 -1
  48. data/plugins/connection_manager/lib/connection_manager/private_key_store.rb +5 -3
  49. data/plugins/declarations/lib/declarations.rb +1 -1
  50. data/plugins/declarations/lib/declarations/parser.rb +68 -20
  51. data/plugins/document_search/features/replace.feature +18 -0
  52. data/plugins/document_search/lib/document_search.rb +37 -54
  53. data/plugins/document_search/lib/document_search/replace_all_command.rb +27 -0
  54. data/plugins/document_search/lib/document_search/replace_command.rb +38 -0
  55. data/plugins/document_search/lib/document_search/replace_next_command.rb +27 -0
  56. data/plugins/document_search/lib/document_search/search_and_replace.rb +17 -24
  57. data/plugins/edit_view/features/step_definitions/editing_steps.rb +4 -4
  58. data/plugins/edit_view/features/step_definitions/tab_steps.rb +9 -0
  59. data/plugins/edit_view/features/step_definitions/window_steps.rb +0 -12
  60. data/plugins/edit_view/lib/edit_view/document.rb +2 -0
  61. data/plugins/edit_view/lib/edit_view/document/command.rb +8 -8
  62. data/plugins/edit_view/lib/edit_view/edit_tab.rb +21 -7
  63. data/plugins/edit_view/lib/edit_view/select_font_dialog.rb +6 -0
  64. data/plugins/edit_view/lib/edit_view/select_theme_dialog.rb +6 -0
  65. data/plugins/edit_view_swt/lib/edit_view_swt.rb +92 -43
  66. data/plugins/edit_view_swt/lib/edit_view_swt/document.rb +17 -4
  67. data/plugins/find-in-project/lib/find_in_project.rb +1 -4
  68. data/plugins/find-in-project/lib/find_in_project/commands.rb +0 -14
  69. data/plugins/find-in-project/lib/find_in_project/controllers.rb +12 -0
  70. data/plugins/find-in-project/lib/find_in_project/views/index.html.erb +5 -0
  71. data/plugins/groovy/features/fixtures/test.groovy +0 -0
  72. data/plugins/groovy/features/step_definitions/groovy_steps.rb +27 -0
  73. data/plugins/groovy/features/support/env.rb +27 -0
  74. data/plugins/groovy/features/syntax_check_groovy.feature +72 -0
  75. data/plugins/groovy/lib/syntax_check/groovy.rb +76 -0
  76. data/plugins/groovy/plugin.rb +7 -0
  77. data/plugins/help/lib/help.rb +28 -4
  78. data/plugins/help/lib/help/help_tab.rb +11 -0
  79. data/plugins/help/lib/help/view_controller.rb +25 -0
  80. data/plugins/help/plugin.rb +2 -1
  81. data/plugins/{view_shortcuts → help}/views/default.css +0 -0
  82. data/plugins/{view_shortcuts → help}/views/index.html.erb +1 -1
  83. data/plugins/{view_shortcuts → help}/views/redcar_small_icon.png +0 -0
  84. data/plugins/html_view/features/browser_bar.feature +47 -0
  85. data/plugins/html_view/features/fixtures/other.html +1 -0
  86. data/plugins/html_view/features/fixtures/sample.html +1 -0
  87. data/plugins/html_view/features/step_definitions/html_view_steps.rb +45 -5
  88. data/plugins/html_view/features/support/env.rb +26 -0
  89. data/plugins/html_view/features/web_preview.feature +21 -0
  90. data/plugins/html_view/lib/html_controller.rb +5 -5
  91. data/plugins/html_view/lib/html_view.rb +62 -10
  92. data/plugins/{web_bookmarks/lib/web_bookmarks → html_view/lib/html_view}/browser_bar.rb +32 -20
  93. data/plugins/html_view/lib/html_view/commands.rb +64 -0
  94. data/plugins/{web_bookmarks/lib/web_bookmarks/view_controller.rb → html_view/lib/html_view/default_controller.rb} +7 -6
  95. data/plugins/html_view/lib/html_view/html_tab.rb +17 -6
  96. data/plugins/html_view/plugin.rb +3 -3
  97. data/plugins/{web_bookmarks → html_view}/views/index.html.erb +0 -0
  98. data/plugins/javascript/features/fixtures/test.js +0 -0
  99. data/plugins/javascript/features/support/env.rb +4 -0
  100. data/plugins/javascript/features/syntax_check_javascript.feature +27 -0
  101. data/plugins/javascript/lib/syntax_check/javascript.rb +52 -0
  102. data/plugins/javascript/plugin.rb +7 -0
  103. data/plugins/javascript/vendor/jslint.js +539 -0
  104. data/plugins/macros/lib/macros/commands.rb +3 -3
  105. data/plugins/open_default_app/lib/open_default_app.rb +29 -3
  106. data/plugins/open_default_app/plugin.rb +1 -1
  107. data/plugins/outline_view/features/outline_view.feature +79 -0
  108. data/plugins/outline_view/features/step_definitions/outline_steps.rb +45 -0
  109. data/plugins/outline_view/lib/outline_view.rb +1 -1
  110. data/plugins/outline_view/spec/fixtures/some_project/javascript.js +10 -0
  111. data/plugins/outline_view/spec/fixtures/some_project/nothing_to_see.rb +0 -0
  112. data/plugins/outline_view/spec/fixtures/some_project/one_lonely_class.rb +2 -0
  113. data/plugins/outline_view/spec/fixtures/some_project/similar_names.rb +18 -0
  114. data/plugins/outline_view/spec/fixtures/some_project/something_fancy.rb +736 -0
  115. data/plugins/outline_view/spec/fixtures/some_project/trailing_space.rb +5 -0
  116. data/plugins/outline_view_swt/lib/outline_view_swt.rb +17 -19
  117. data/plugins/pair_highlighter/lib/pair_highlighter/document_controller.rb +1 -4
  118. data/plugins/plugin_manager_ui/lib/plugin_manager_ui.rb +12 -3
  119. data/plugins/project/features/close_directory_tree.feature +27 -0
  120. data/plugins/project/features/highlight_focussed_tab.feature +45 -1
  121. data/plugins/project/features/open_and_save_files.feature +33 -0
  122. data/plugins/project/features/open_directory_tree.feature +37 -11
  123. data/plugins/project/features/step_definitions/directory_steps.rb +1 -1
  124. data/plugins/project/features/step_definitions/drb_steps.rb +40 -0
  125. data/plugins/project/features/support/env.rb +17 -0
  126. data/plugins/project/lib/project.rb +12 -2
  127. data/plugins/project/lib/project/commands.rb +101 -99
  128. data/plugins/project/lib/project/drb_service.rb +55 -65
  129. data/plugins/project/lib/project/manager.rb +29 -4
  130. data/plugins/project/lib/project/project_tree_controller.rb +24 -0
  131. data/plugins/project/lib/project/support/trash.rb +1 -0
  132. data/plugins/redcar/redcar.rb +100 -37
  133. data/plugins/redcar_debug/lib/redcar_debug.rb +3 -3
  134. data/plugins/repl/features/step_definitions/repl_steps.rb +3 -0
  135. data/plugins/repl/lib/repl.rb +4 -11
  136. data/plugins/repl/lib/repl/repl_tab.rb +26 -0
  137. data/plugins/ruby/features/fixtures/test.rb +0 -0
  138. data/plugins/ruby/features/support/env.rb +4 -0
  139. data/plugins/ruby/features/syntax_check_ruby.feature +25 -0
  140. data/plugins/runnables/features/command_tree.feature +28 -0
  141. data/plugins/runnables/lib/runnables.rb +1 -0
  142. data/plugins/runnables/lib/runnables/commands.rb +4 -4
  143. data/plugins/runnables/lib/runnables/output_processor.rb +5 -5
  144. data/plugins/runnables/lib/runnables/tree_mirror/tree_controller.rb +2 -7
  145. data/plugins/runnables/lib/runnables/tree_mirror/tree_mirror.rb +13 -8
  146. data/plugins/scm_git/lib/scm_git/change.rb +5 -5
  147. data/plugins/strip_trailing_spaces/features/fixtures/test.txt +3 -0
  148. data/plugins/strip_trailing_spaces/features/strip_trailing_spaces.feature +34 -0
  149. data/plugins/strip_trailing_spaces/lib/strip_trailing_spaces.rb +3 -38
  150. data/plugins/swt/lib/swt.rb +5 -13
  151. data/plugins/swt/lib/swt/full_swt.rb +15 -13
  152. data/plugins/syntax_check/features/step_definitions/syntax_check_steps.rb +7 -0
  153. data/plugins/syntax_check/lib/syntax_check.rb +21 -3
  154. data/plugins/syntax_check/lib/syntax_check/error.rb +4 -3
  155. data/plugins/task_manager/lib/task_manager.rb +1 -1
  156. data/plugins/textmate/vendor/redcar-bundles/Bundles/Ant.tmbundle/Preferences/Autocompletions.tmPreferences +345 -0
  157. data/plugins/textmate/vendor/redcar-bundles/Bundles/Ant.tmbundle/Preferences/Symbol List Target.tmPreferences +22 -0
  158. data/plugins/textmate/vendor/redcar-bundles/Bundles/Ant.tmbundle/Snippets/Doc Banner.tmSnippet +20 -0
  159. data/plugins/textmate/vendor/redcar-bundles/Bundles/Ant.tmbundle/Syntaxes/Ant.tmLanguage +247 -0
  160. data/plugins/textmate/vendor/redcar-bundles/Bundles/Ant.tmbundle/info.plist +55 -0
  161. data/plugins/textmate/vendor/redcar-bundles/Bundles/RedcarRepl.tmbundle/Syntaxes/GroovyRepl.plist +40 -0
  162. data/plugins/textmate/vendor/redcar-bundles/Bundles/RedcarRepl.tmbundle/info.plist +1 -1
  163. data/plugins/textmate/vendor/redcar-bundles/Bundles/Ruby Haml.tmbundle/Syntaxes/Ruby_Haml.tmLanguage +0 -1
  164. data/plugins/textmate/vendor/redcar-bundles/Bundles/Ruby Sass.tmbundle/Syntaxes/Ruby Sass.tmLanguage +626 -0
  165. data/plugins/textmate/vendor/redcar-bundles/Bundles/Ruby Sass.tmbundle/info.plist +16 -0
  166. data/plugins/todo_list/features/support/env.rb +8 -0
  167. data/plugins/todo_list/features/todo_list.feature +26 -0
  168. data/plugins/todo_list/lib/todo_list.rb +1 -0
  169. data/plugins/todo_list/lib/todo_list/file_parser.rb +23 -19
  170. data/plugins/todo_list/lib/todo_list/todo_controller.rb +60 -100
  171. data/plugins/todo_list/spec/fixtures/project/FIXME.file +3 -0
  172. data/plugins/todo_list/spec/fixtures/project/NOTE.ignored.file +1 -0
  173. data/plugins/todo_list/spec/fixtures/project/OPTIMIZE_colon.file +1 -0
  174. data/plugins/todo_list/spec/fixtures/project/XXX.ignored +1 -0
  175. data/plugins/todo_list/spec/fixtures/project/ignored_directory/TODO.file +2 -0
  176. data/plugins/todo_list/spec/fixtures/settings.rb +11 -0
  177. data/plugins/todo_list/spec/spec_helper.rb +6 -0
  178. data/plugins/todo_list/spec/todo_list/file_parser_spec.rb +35 -0
  179. data/plugins/tree/lib/tree.rb +1 -0
  180. data/plugins/tree/lib/tree/command.rb +5 -0
  181. data/plugins/web_bookmarks/features/bookmark.feature +37 -0
  182. data/plugins/web_bookmarks/features/fixtures/other.html +1 -0
  183. data/plugins/web_bookmarks/features/fixtures/sample.html +1 -0
  184. data/plugins/web_bookmarks/features/step_definitions/web_steps.rb +4 -0
  185. data/plugins/web_bookmarks/features/support/env.rb +26 -0
  186. data/plugins/web_bookmarks/lib/web_bookmarks.rb +0 -10
  187. data/plugins/web_bookmarks/lib/web_bookmarks/bookmark.rb +10 -1
  188. data/plugins/web_bookmarks/lib/web_bookmarks/commands.rb +1 -47
  189. data/plugins/web_bookmarks/lib/web_bookmarks/tree.rb +21 -14
  190. data/{plugins/application → share}/icons/close.png +0 -0
  191. data/{plugins/application → share}/icons/darwin-file.png +0 -0
  192. data/{plugins/application → share}/icons/darwin-folder.png +0 -0
  193. data/share/icons/open-source-flipped.png +0 -0
  194. data/{plugins/application/icons/redcar_icon_beta_dev.png → share/icons/redcar-icon-beta-dev.png} +0 -0
  195. data/{plugins/application/icons/redcar_icon_beta.png → share/icons/redcar-icon-beta.png} +0 -0
  196. data/{plugins/application → share}/icons/redcar-splash.png +0 -0
  197. metadata +90 -30
  198. data/lib/redcar/jvm_options_probe.rb +0 -33
  199. data/plugins/document_search/lib/document_search/replace.rb +0 -113
  200. data/plugins/document_search/lib/document_search/search.rb +0 -45
  201. data/plugins/outline_view_swt/lib/icons/alias.png +0 -0
  202. data/plugins/outline_view_swt/lib/icons/assignment.png +0 -0
  203. data/plugins/outline_view_swt/lib/icons/attribute.png +0 -0
  204. data/plugins/outline_view_swt/lib/icons/class.png +0 -0
  205. data/plugins/outline_view_swt/lib/icons/interface.png +0 -0
  206. data/plugins/outline_view_swt/lib/icons/method.png +0 -0
  207. data/plugins/strip_trailing_spaces/CHANGELOG +0 -12
  208. data/plugins/strip_trailing_spaces/README.md +0 -32
  209. data/plugins/view_shortcuts/lib/view_shortcuts.rb +0 -52
  210. data/plugins/view_shortcuts/plugin.rb +0 -11
@@ -0,0 +1,16 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>name</key>
6
+ <string>Ruby Sass</string>
7
+ <key>contactEmailRot13</key>
8
+ <string>obo@fcbexzbatre.pbz</string>
9
+ <key>contactName</key>
10
+ <string>Bob Aman</string>
11
+ <key>description</key>
12
+ <string>Template language for easily creating CSS; implemented in ruby.</string>
13
+ <key>uuid</key>
14
+ <string>176253C8-5D97-4C20-AA34-3BE8BC73FBC9</string>
15
+ </dict>
16
+ </plist>
@@ -0,0 +1,8 @@
1
+ require File.expand_path("../../../spec/fixtures/settings", __FILE__)
2
+
3
+ Before do
4
+ TodoListSpecHelper.set_fixture_settings
5
+ end
6
+
7
+ After do
8
+ end
@@ -0,0 +1,26 @@
1
+ Feature: Adding parameters to commands
2
+ As a user
3
+ I want to see what todo-items remain in my project
4
+
5
+ Background:
6
+ Given I will choose "plugins/todo_list/spec/fixtures/project" from the "open_directory" dialog
7
+ And I open a directory
8
+ When I open the "Todo List" from the "Project" menu
9
+ And I wait "2" seconds
10
+
11
+ Scenario: Opening the TODO list shows the todo items and their action texts without colons
12
+ Then the HTML tab should say "a course of action"
13
+ And the HTML tab should not say ": a course of action"
14
+
15
+ Scenario: Opening the TODO list shows the todo item's file names
16
+ Then the HTML tab should say "OPTIMIZE_colon.file"
17
+ And the HTML tab should say "FIXME.file"
18
+
19
+ Scenario: Opening the TODO list shows the todo item's line numbers
20
+ Then the HTML tab should say "OPTIMIZE_colon.file:1"
21
+ And the HTML tab should say "FIXME.file:3"
22
+
23
+ Scenario: Clicking a TODO item's file name should open it in an edit tab
24
+ When I click "FIXME.file" in the HTML tab
25
+ Then my active tab should be "FIXME.file"
26
+ And the contents should be "#\n#\n<c># FIXME note"
@@ -34,6 +34,7 @@ module Redcar
34
34
  controller = TodoController.new(project.home_dir)
35
35
  tab = win.new_tab(HtmlTab)
36
36
  tab.html_view.controller = controller
37
+ tab.icon = :document_list
37
38
  tab.focus
38
39
  end
39
40
  end
@@ -1,9 +1,11 @@
1
1
  module Redcar
2
2
  class TodoList
3
3
  class FileParser
4
+ TodoItem = Struct.new("TodoItem", :path, :line, :action)
4
5
 
5
6
  def initialize
6
- @tag_list = {}
7
+ @tag_list = Hash.new {|h,k| h[k] = [] }
8
+ @optional_colon = ":" if TodoList.storage['require_colon']
7
9
  end
8
10
 
9
11
  def parse_files(path)
@@ -13,19 +15,18 @@ module Redcar
13
15
  end
14
16
 
15
17
  def find_dirs(path)
16
- unless TodoList.storage['excluded_dirs'].to_a.include?(path.to_s)
17
- Dir["#{path.to_s}/*/"].map do |a|
18
- find_dirs(a)
19
- end
18
+ return unless File.directory? path
19
+ unless TodoList.storage['excluded_dirs'].include? File.basename(path)
20
+ Dir["#{path}/*"].each {|subdir| find_dirs(subdir) }
20
21
  find_files(path)
21
22
  end
22
23
  end
23
24
 
24
25
  def find_files(path)
25
26
  TodoList.storage['included_suffixes'].each do |suffix|
26
- files = File.join(path.to_s, "*#{suffix}")
27
+ files = File.join(path, "*#{suffix}")
27
28
  Dir.glob(files).each do |file_path|
28
- unless TodoList.storage['excluded_files'].to_a.include?(File.basename(file_path))
29
+ unless TodoList.storage['excluded_files'].include?(File.basename(file_path))
29
30
  find_tags(file_path)
30
31
  end
31
32
  end
@@ -33,20 +34,23 @@ module Redcar
33
34
  end
34
35
 
35
36
  def find_tags(file_path)
36
- TodoList.storage['tags'].each do |tag|
37
- if TodoList.storage['require_colon']
38
- tag += ":"
37
+ tags = TodoList.storage['tags']
38
+ File.open(file_path) do |file|
39
+ file.readlines.each_with_index do |line, idx|
40
+ included_tags = tags.select {|tag| line.include? "#{tag}#{@optional_colon}" }
41
+ create_tag_items(included_tags, file_path, line, idx)
39
42
  end
40
- file = File.new(file_path,"r")
41
- i = 1
42
- while(line = file.gets)
43
- if(line.include?(tag))
44
- action = line[line.index(tag.to_s)+tag.length,line.length]
45
- @tag_list[tag+file_path.to_s+":#{i}"] = action
46
- end
47
- i +=1
43
+ end
44
+ end
45
+
46
+ def create_tag_items(included_tags, file, line, idx)
47
+ included_tags.each do |tag|
48
+ action = line[(line.index(tag) + tag.length)..-1]
49
+ @tag_list[tag] << TodoItem.new.tap do |t|
50
+ t.path = file
51
+ t.line = idx
52
+ t.action = (action.chars.first == ":" ? action[1..-1] : action).strip
48
53
  end
49
- file.close
50
54
  end
51
55
  end
52
56
  end
@@ -11,120 +11,80 @@ module Redcar
11
11
  "Todo List"
12
12
  end
13
13
 
14
- def debug
15
- false
16
- end
17
-
18
14
  # Open a text file in a new edit tab
19
- def open_file(path)
20
- path = path.to_s
21
- #check for line number
22
- idx = path.rindex(":")
23
- line = 1
24
- unless idx.nil?
25
- # line number found
26
- line = path[idx+1,path.length]
27
- # convert path to actual file path
28
- path = path[0,idx]
29
- end
30
- if File.exists?(path)
31
- puts "Opening #{path} in new tab" if debug
15
+ def open_file(options)
16
+ path = options.keys.first
17
+ line = options.values.first.first.to_i
18
+ if File.exists? path
32
19
  Project::FileOpenCommand.new(path).run
33
- tab = Redcar.app.focussed_notebook_tab
34
- #check if line is a number
35
- if numeric?(line)
36
- line = line.to_i - 1
37
- if line >= 0
38
- document = tab.edit_view.document
39
- if line <= document.line_count.to_i
40
- puts "scrolling to line number: #{line}" if debug
41
- offset = document.offset_at_line(line)
42
- document.cursor_offset = offset
43
- document.scroll_to_line(line)
44
- end
45
- end
20
+ tab = Redcar.app.focussed_notebook_tab
21
+ document = tab.edit_view.document
22
+ if line <= document.line_count
23
+ offset = document.offset_at_line(line)
24
+ document.cursor_offset = offset
25
+ document.scroll_to_line(line)
46
26
  end
47
- tab.focus
48
27
  end
28
+ tab.focus
49
29
  false
50
30
  end
51
31
 
52
- def numeric?(object)
53
- true if Integer(object) rescue false
54
- end
55
-
56
- def parse_path(path,tag)
57
- idx = tag.length
58
- if TodoList.storage['require_colon']
59
- idx += 1
60
- end
61
- path = path[idx,path.length]
62
- display_path = path[@path.length+1,path.length]
63
- case Redcar.platform
64
- when :osx, :linux
65
- display_path = display_path.gsub("//","/")
66
- when :windows
67
- display_path = display_path.gsub("//","\\")
68
- end
69
- puts "Final path: #{path}" if debug
70
- puts "Path for display: #{display_path}" if debug
71
- [path, display_path]
72
- end
73
-
74
32
  def populate_list
75
33
  @thread = Thread.new do
76
34
  sleep 1
77
- execute(<<-JAVASCRIPT)
78
- $("#status").html("Searching...");
79
- $("#tags").html(" ");
80
- JAVASCRIPT
81
- s = Time.now
82
- @tag_list = TodoList::FileParser.new.parse_files(@path) || {}
83
- i = 0
84
- total = @tag_list.to_a.length.to_i - 1
35
+ execute(open_page)
36
+ @tag_list = TodoList::FileParser.new.parse_files(@path)
37
+
85
38
  TodoList.storage['tags'].each do |tag|
86
- table_id = "#{tag}_table"
87
- html=<<-HTML
88
- <br/>
89
- <table id="#{table_id}" width="100%">
90
- <tr>
91
- <th bgcolor="#ffffcc" colspan="2">#{tag}</th>
92
- </tr>
93
- </table>
94
- HTML
95
- execute(<<-JAVASCRIPT)
96
- $("#tags").append(#{html.inspect});
97
- JAVASCRIPT
98
- @tag_list.each do |path,action|
99
- if path[0,tag.length] == tag
100
- puts "#{i} of #{total}" if debug
101
- path, display_path = parse_path(path,tag)
102
- html=<<-HTML
103
- <tr>
104
- <td bgcolor="#ccffcc" width="40%"><a class="action">#{action}</a></td>
105
- <td bgcolor="#dddddd"><a class="file_path" href="controller/open_file?#{path}">#{display_path}</a></td>
106
- </tr>
107
- HTML
108
- percentage = 100
109
- if total > 0
110
- percentage = ((i.to_f/total.to_f)*100).to_i
111
- end
112
- execute(<<-JAVASCRIPT)
113
- $("#status").html("Populating... #{percentage}%");
114
- $("##{table_id}").append(#{html.inspect});
115
- JAVASCRIPT
116
- break if i.to_i == total.to_i
117
- i+= 1
118
- end
39
+ execute(%{ $("#tags").append(#{html_table_for(tag).inspect}); })
40
+ end
41
+ @tag_list.each_pair do |tag, todo_items|
42
+ todo_items.each do |item|
43
+ execute(%{ $("##{table_id(tag)}").append(#{html_tr_for(item).inspect}); })
119
44
  end
120
45
  end
121
- execute(<<-JAVASCRIPT)
122
- $("#status").remove();
123
- $("#final_status").html("Search completed in #{Time.now - s} seconds");
124
- $("#refresh").html("Refresh List");
125
- JAVASCRIPT
46
+ execute(finalize_page)
126
47
  end
127
- @thread = nil
48
+ end
49
+
50
+ def html_table_for(tag)
51
+ <<-HTML
52
+ <br/>
53
+ <table id="#{table_id(tag)}" width="100%">
54
+ <tr>
55
+ <th bgcolor="#ffffcc" colspan="2">#{tag}</th>
56
+ </tr>
57
+ </table>
58
+ HTML
59
+ end
60
+
61
+ def html_tr_for(item)
62
+ display_path = item.path[@path.length..-1]
63
+ <<-HTML
64
+ <tr>
65
+ <td bgcolor="#ccffcc" width="40%"><a class="action">#{item.action}</a></td>
66
+ <td bgcolor="#dddddd"><a class="file_path" href="controller/open_file?#{item.path}=#{item.line}">#{display_path}:#{item.line+1}</a></td>
67
+ </tr>
68
+ HTML
69
+ end
70
+
71
+ def table_id(tag)
72
+ "#{tag}_table"
73
+ end
74
+
75
+ def open_page
76
+ <<-JAVASCRIPT
77
+ $("#status").html("Searching...");
78
+ $("#tags").html(" ");
79
+ JAVASCRIPT
80
+ end
81
+
82
+ def finalize_page
83
+ <<-JAVASCRIPT
84
+ $("#status").remove();
85
+ $("#final_status").html("Search complete.");
86
+ $("#refresh").html("Refresh List");
87
+ JAVASCRIPT
128
88
  end
129
89
 
130
90
  def index
@@ -0,0 +1,3 @@
1
+ #
2
+ #
3
+ # FIXME note
@@ -0,0 +1 @@
1
+ # OPTIMIZE: a course of action
@@ -0,0 +1,2 @@
1
+ # TODO: This should be ignored, with
2
+ # TODO and without colon
@@ -0,0 +1,11 @@
1
+ module TodoListSpecHelper
2
+ Fixtures = File.expand_path("../project", __FILE__)
3
+
4
+ def self.set_fixture_settings
5
+ Redcar::TodoList.storage['tags'] = ["FIXME", "OPTIMIZE", "NOTE", "TODO"]
6
+ Redcar::TodoList.storage['excluded_files'] = ["NOTE.ignored.file"]
7
+ Redcar::TodoList.storage['require_colon'] = false
8
+ Redcar::TodoList.storage['excluded_dirs'] = ["ignored_directory"]
9
+ Redcar::TodoList.storage['included_suffixes'] = [".file"]
10
+ end
11
+ end
@@ -0,0 +1,6 @@
1
+ $:.push File.expand_path('../../../../lib', __FILE__)
2
+ require File.expand_path("../fixtures/settings", __FILE__)
3
+
4
+ require 'redcar'
5
+ Redcar.environment = :test
6
+ Redcar.load_unthreaded
@@ -0,0 +1,35 @@
1
+ require File.expand_path("../../spec_helper", __FILE__)
2
+
3
+ describe Redcar::TodoList::FileParser do
4
+ before do
5
+ TodoListSpecHelper.set_fixture_settings
6
+ @parser = Redcar::TodoList::FileParser.new
7
+ @tags = @parser.parse_files(TodoListSpecHelper::Fixtures)
8
+ end
9
+
10
+ it "should find tags that are in the tag list" do
11
+ @tags.keys.should include "FIXME"
12
+ @tags.keys.should include "OPTIMIZE"
13
+ end
14
+
15
+ it "should find only colon'ed tags if that requirement is set in the settings" do
16
+ Redcar::TodoList.storage['require_colon'] = true
17
+ @parser = Redcar::TodoList::FileParser.new
18
+ tags = @parser.parse_files(TodoListSpecHelper::Fixtures)
19
+ tags.keys.should include "OPTIMIZE"
20
+ tags.keys.should_not include "FIXME"
21
+ Redcar::TodoList.storage['require_colon'] = false
22
+ end
23
+
24
+ it "should not search files without included suffixes" do
25
+ @tags.keys.should_not include "XXX"
26
+ end
27
+
28
+ it "should not search excluded files" do
29
+ @tags.keys.should_not include "NOTE"
30
+ end
31
+
32
+ it "should ignore files in excluded dirs" do
33
+ @tags.keys.should_not include "TODO"
34
+ end
35
+ end
@@ -1,5 +1,6 @@
1
1
 
2
2
  require 'tree/controller'
3
+ require 'tree/command'
3
4
  require 'tree/mirror'
4
5
 
5
6
  module Redcar
@@ -0,0 +1,5 @@
1
+ module Redcar
2
+ class TreeCommand < Redcar::Command
3
+ sensitize :open_trees
4
+ end
5
+ end
@@ -0,0 +1,37 @@
1
+ Feature: Showing and opening bookmarks in a tree
2
+
3
+ Background:
4
+ When I will choose "plugins/web_bookmarks/features/fixtures" from the "open_directory" dialog
5
+ And I open a directory
6
+
7
+ Scenario: Show grouped bookmarks from .redcar/web_bookmarks.json in the project
8
+ When I open the web bookmarks tree
9
+ Then I should see "Online" in the tree
10
+ And I should see "Sample" in the tree
11
+ And I should not see "Other" in the tree
12
+
13
+ Scenario: Show individual bookmarks in groups
14
+ When I open the web bookmarks tree
15
+ And I expand the tree row "Online"
16
+ Then I should see "Google" in the tree
17
+ And I should see "Github" in the tree
18
+
19
+ Scenario: Opening a bookmark from the tree
20
+ When I open the web bookmarks tree
21
+ And I activate the "Sample" node in the tree
22
+ Then my active tab should be "Sample"
23
+ And the HTML tab should say "Hello!!"
24
+
25
+ Scenario: Closing the project via icon closes the bookmarks tree
26
+ When I open the web bookmarks tree
27
+ And I click the project tree tab
28
+ And I click the close button
29
+ Then the tree width should be the minimum size
30
+ And there should not be a tree titled "Web Bookmarks"
31
+
32
+ Scenario: Closing the project via menu item closes the bookmarks tree
33
+ When I open the web bookmarks tree
34
+ And I click the project tree tab
35
+ And I close the tree
36
+ Then the tree width should be the minimum size
37
+ And there should not be a tree titled "Web Bookmarks"
@@ -0,0 +1 @@
1
+ <html><b>Is today Tuesday?</b></html>