redcar 0.3.4.3 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (196) hide show
  1. data/CHANGES +45 -0
  2. data/README.md +2 -1
  3. data/ROADMAP.md +0 -1
  4. data/Rakefile +10 -4
  5. data/bin/redcar +2 -2
  6. data/lib/openssl/build.properties +7 -0
  7. data/lib/plugin_manager/lib/plugin_manager.rb +10 -0
  8. data/lib/plugin_manager/lib/plugin_manager/plugin_definition.rb +1 -13
  9. data/lib/redcar.rb +12 -8
  10. data/lib/redcar/installer.rb +16 -15
  11. data/lib/redcar/ruby_extensions.rb +146 -1
  12. data/lib/redcar/runner.rb +16 -7
  13. data/lib/redcar/usage.rb +4 -7
  14. data/lib/redcar_quick_start.rb +5 -5
  15. data/lib/regex_replace.rb +0 -7
  16. data/plugins/application/features/step_definitions/command_steps.rb +5 -0
  17. data/plugins/application/features/step_definitions/dialog_steps.rb +5 -0
  18. data/plugins/application/features/step_definitions/filter_list_dialog_steps.rb +38 -0
  19. data/plugins/application/features/step_definitions/window_steps.rb +1 -1
  20. data/plugins/application/features/support/env.rb +44 -8
  21. data/plugins/application/lib/application.rb +32 -33
  22. data/plugins/application/lib/application/command.rb +32 -2
  23. data/plugins/application/lib/application/command/executor.rb +2 -12
  24. data/plugins/application/lib/application/dialog.rb +14 -14
  25. data/plugins/application/lib/application/event_spewer.rb +32 -0
  26. data/plugins/application/lib/application/menu.rb +5 -5
  27. data/plugins/application/lib/application/menu/builder.rb +5 -0
  28. data/plugins/application/lib/application/menu/lazy_menu.rb +24 -0
  29. data/plugins/application/lib/application/notebook.rb +4 -3
  30. data/plugins/application/lib/application/tab.rb +6 -2
  31. data/plugins/application/lib/application/window.rb +8 -4
  32. data/plugins/application/spec/application/menu/builder_spec.rb +17 -1
  33. data/plugins/application/spec/application/notebook_spec.rb +1 -1
  34. data/plugins/application_swt/build.xml +74 -0
  35. data/plugins/application_swt/lib/application_swt.rb +79 -0
  36. data/plugins/application_swt/lib/application_swt/cucumber_patches.rb +6 -1
  37. data/plugins/application_swt/lib/application_swt/dialog_adapter.rb +25 -17
  38. data/plugins/application_swt/lib/application_swt/dialogs/filter_list_dialog_controller.rb +50 -12
  39. data/plugins/application_swt/lib/application_swt/html_tab.rb +20 -0
  40. data/plugins/application_swt/lib/application_swt/menu.rb +26 -2
  41. data/plugins/application_swt/lib/application_swt/notebook.rb +10 -12
  42. data/plugins/application_swt/lib/application_swt/window.rb +11 -11
  43. data/plugins/application_swt/src/com/redcareditor/application_swt/CocoaUIEnhancer.java +313 -0
  44. data/plugins/auto_completer/lib/auto_completer.rb +74 -67
  45. data/plugins/auto_completer/lib/auto_completer/current_document_completion_source.rb +19 -0
  46. data/plugins/auto_completer/lib/auto_completer/document_controller.rb +2 -2
  47. data/plugins/auto_completer/lib/auto_completer/word_list.rb +8 -1
  48. data/plugins/auto_indenter/features/ruby_style_indentation.feature +24 -0
  49. data/plugins/auto_indenter/features/step_definitions/indentation_steps.rb +6 -0
  50. data/plugins/auto_indenter/features/support/env.rb +2 -0
  51. data/plugins/auto_indenter/lib/auto_indenter.rb +86 -0
  52. data/plugins/auto_indenter/lib/auto_indenter/analyzer.rb +91 -0
  53. data/plugins/auto_indenter/lib/auto_indenter/commands.rb +34 -0
  54. data/plugins/auto_indenter/lib/auto_indenter/document_controller.rb +67 -12
  55. data/plugins/auto_indenter/lib/auto_indenter/rules.rb +41 -0
  56. data/plugins/auto_indenter/spec/auto_indenter/analyzer_spec.rb +151 -0
  57. data/plugins/auto_indenter/spec/spec_helper.rb +5 -0
  58. data/plugins/auto_pairer/lib/auto_pairer.rb +1 -0
  59. data/plugins/auto_pairer/lib/auto_pairer/document_controller.rb +43 -42
  60. data/plugins/auto_pairer/lib/auto_pairer/pairs_for_scope.rb +1 -5
  61. data/plugins/core/lib/core.rb +12 -1
  62. data/plugins/core/lib/core/observable.rb +7 -7
  63. data/plugins/core/lib/core/persistent_cache.rb +14 -2
  64. data/plugins/core/lib/core/plugin.rb +7 -0
  65. data/plugins/core/lib/core/resource.rb +78 -0
  66. data/plugins/core/lib/core/task.rb +62 -0
  67. data/plugins/core/lib/core/task_queue.rb +72 -0
  68. data/plugins/core/spec/core/resource_spec.rb +124 -0
  69. data/plugins/core/spec/core/task_queue_spec.rb +202 -0
  70. data/plugins/core/spec/spec_helper.rb +23 -1
  71. data/plugins/declarations/TODO +3 -0
  72. data/plugins/declarations/lib/declarations.rb +144 -0
  73. data/plugins/declarations/lib/declarations/completion_source.rb +22 -0
  74. data/plugins/declarations/lib/declarations/file.rb +68 -0
  75. data/plugins/declarations/lib/declarations/parser.rb +94 -0
  76. data/plugins/declarations/lib/declarations/select_tag_dialog.rb +44 -0
  77. data/plugins/declarations/plugin.rb +7 -0
  78. data/plugins/declarations/spec/declarations/file_spec.rb +62 -0
  79. data/plugins/declarations/spec/fixtures/federalist.rb +15 -0
  80. data/plugins/declarations/spec/spec_helper.rb +4 -0
  81. data/plugins/edit_view/features/indentation_commands.feature +40 -0
  82. data/plugins/edit_view/features/line_delimiter.feature +40 -0
  83. data/plugins/edit_view/features/step_definitions/editing_steps.rb +16 -4
  84. data/plugins/edit_view/features/step_definitions/notebook_steps.rb +1 -1
  85. data/plugins/edit_view/features/step_definitions/tab_steps.rb +1 -1
  86. data/plugins/edit_view/features/step_definitions/window_steps.rb +5 -1
  87. data/plugins/edit_view/features/support/env.rb +3 -5
  88. data/plugins/edit_view/features/undo_and_redo.feature +21 -0
  89. data/plugins/edit_view/lib/edit_view.rb +57 -4
  90. data/plugins/edit_view/lib/edit_view/actions/arrow_keys.rb +19 -3
  91. data/plugins/edit_view/lib/edit_view/document.rb +46 -11
  92. data/plugins/edit_view/lib/edit_view/document/indentation.rb +35 -0
  93. data/plugins/edit_view/lib/edit_view/modified_tabs_checker.rb +35 -0
  94. data/plugins/edit_view/lib/edit_view/tab_settings.rb +13 -3
  95. data/plugins/edit_view/spec/edit_view/document/indentation_spec.rb +112 -0
  96. data/plugins/edit_view/spec/edit_view/document_spec.rb +22 -0
  97. data/plugins/edit_view/spec/spec_helper.rb +1 -0
  98. data/plugins/edit_view_swt/lib/edit_view_swt.rb +59 -7
  99. data/plugins/edit_view_swt/lib/edit_view_swt/document.rb +3 -3
  100. data/plugins/edit_view_swt/lib/edit_view_swt/word_movement.rb +2 -2
  101. data/plugins/edit_view_swt/vendor/java-mateview.rb +3 -2
  102. data/plugins/encryption/encryption.rb +13 -6
  103. data/plugins/execute_current_tab/lib/execute_current_tab.rb +25 -15
  104. data/plugins/html_view/assets/redcar.css +32 -1
  105. data/plugins/html_view/lib/html_view.rb +23 -3
  106. data/plugins/html_view/lib/html_view/html_tab.rb +4 -0
  107. data/plugins/my_plugin/lib/my_plugin.rb +4 -12
  108. data/plugins/plugin_manager_ui/lib/plugin_manager_ui.rb +1 -0
  109. data/plugins/plugin_manager_ui/views/index.html.erb +30 -37
  110. data/plugins/project/features/find_file.feature +75 -0
  111. data/plugins/project/features/open_and_save_files.feature +7 -7
  112. data/plugins/project/features/open_directory_tree.feature +11 -3
  113. data/plugins/project/features/refresh_directory_tree.feature +7 -1
  114. data/plugins/project/features/step_definitions/directory_steps.rb +11 -1
  115. data/plugins/project/features/step_definitions/file_steps.rb +10 -0
  116. data/plugins/project/features/support/env.rb +6 -1
  117. data/plugins/project/features/watch_for_modified_files.feature +79 -0
  118. data/plugins/project/lib/project.rb +72 -306
  119. data/plugins/project/lib/project/commands.rb +128 -0
  120. data/plugins/project/lib/project/dir_mirror.rb +5 -1
  121. data/plugins/project/lib/project/drb_service.rb +21 -31
  122. data/plugins/project/lib/project/file_list.rb +76 -0
  123. data/plugins/project/lib/project/file_mirror.rb +13 -1
  124. data/plugins/project/lib/project/find_file_dialog.rb +22 -52
  125. data/plugins/project/lib/project/manager.rb +210 -0
  126. data/plugins/project/lib/project/recent_directories.rb +16 -3
  127. data/plugins/project/plugin.rb +1 -1
  128. data/plugins/project/spec/fixtures/myproject/README +2 -0
  129. data/plugins/project/spec/fixtures/myproject/lib/foo_lib.rb +1 -0
  130. data/plugins/project/spec/fixtures/myproject/spec/foo_spec.rb +1 -0
  131. data/plugins/project/{features → spec}/fixtures/winter.txt +0 -0
  132. data/plugins/project/spec/project/dir_mirror_spec.rb +1 -12
  133. data/plugins/project/spec/project/file_list_spec.rb +140 -0
  134. data/plugins/project/spec/spec_helper.rb +20 -0
  135. data/plugins/redcar/plugin.rb +1 -0
  136. data/plugins/redcar/redcar.rb +254 -84
  137. data/plugins/redcar_debug/lib/redcar_debug.rb +58 -11
  138. data/plugins/redcar_debug/vendor/jruby-prof/README +46 -0
  139. data/plugins/redcar_debug/vendor/jruby-prof/Rakefile +36 -0
  140. data/plugins/redcar_debug/vendor/jruby-prof/build.xml +31 -0
  141. data/plugins/redcar_debug/vendor/jruby-prof/example/call_tree.html +22677 -0
  142. data/plugins/redcar_debug/vendor/jruby-prof/example/call_tree.txt +589 -0
  143. data/plugins/redcar_debug/vendor/jruby-prof/example/flat.txt +28 -0
  144. data/plugins/redcar_debug/vendor/jruby-prof/example/graph.html +1670 -0
  145. data/plugins/redcar_debug/vendor/jruby-prof/example/graph.txt +125 -0
  146. data/plugins/redcar_debug/vendor/jruby-prof/example/pidigits.rb +92 -0
  147. data/plugins/redcar_debug/vendor/jruby-prof/example/test.rb +28 -0
  148. data/plugins/redcar_debug/vendor/jruby-prof/example/test2.rb +29 -0
  149. data/plugins/redcar_debug/vendor/jruby-prof/example/test_exception.rb +28 -0
  150. data/plugins/redcar_debug/vendor/jruby-prof/example/test_overhead.rb +43 -0
  151. data/plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof.rb +66 -0
  152. data/plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/abstract_printer.rb +21 -0
  153. data/plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb +35 -0
  154. data/plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/graph_html_printer.rb +123 -0
  155. data/plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/graph_text_printer.rb +45 -0
  156. data/plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/invocation_set.rb +34 -0
  157. data/plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/method.rb +107 -0
  158. data/plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/profile_invocation.rb +43 -0
  159. data/plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/simple_tree_printer.rb +27 -0
  160. data/plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/tree_html_printer.rb +144 -0
  161. data/plugins/redcar_debug/vendor/jruby-prof/src/org/jruby/prof/Invocation.java +14 -0
  162. data/plugins/redcar_debug/vendor/jruby-prof/src/org/jruby/prof/JRubyProf.java +94 -0
  163. data/plugins/redcar_debug/vendor/jruby-prof/src/org/jruby/prof/ProfEventHook.java +49 -0
  164. data/plugins/redcar_debug/vendor/jruby-prof/templates/graph_row.html.erb +18 -0
  165. data/plugins/redcar_debug/vendor/jruby-prof/test/basic_test.rb +291 -0
  166. data/plugins/redcar_debug/views/history.html.erb +33 -0
  167. data/plugins/redcar_debug/views/index.html.erb +33 -0
  168. data/plugins/repl/lib/repl/internal_mirror.rb +3 -15
  169. data/plugins/repl/spec/repl/internal_mirror_spec.rb +2 -2
  170. data/plugins/snippets/lib/snippets.rb +0 -1
  171. data/plugins/snippets/lib/snippets/document_controller.rb +7 -1
  172. data/plugins/task_manager/lib/task_manager.rb +28 -0
  173. data/plugins/task_manager/plugin.rb +11 -0
  174. data/plugins/task_manager/views/index.html.erb +67 -0
  175. data/plugins/textmate/lib/textmate.rb +17 -21
  176. data/plugins/textmate/lib/textmate/plist.rb +1 -2
  177. data/plugins/textmate/lib/textmate/preference.rb +5 -1
  178. data/plugins/textmate/lib/textmate/snippet.rb +6 -1
  179. data/plugins/tree_view_swt/lib/tree_view_swt.rb +0 -6
  180. data/textmate/Bundles/Cucumber.tmbundle/Preferences/Comments.tmPreferences +1 -1
  181. data/textmate/Bundles/Cucumber.tmbundle/Preferences/next_Cucumber_Plain_Text_Feature_Completions.tmPreferences +30 -0
  182. data/textmate/Bundles/Cucumber.tmbundle/Preferences/next_Symbol_list___Scenario.tmPreferences +19 -0
  183. data/textmate/Bundles/Cucumber.tmbundle/Syntaxes/next_Cucumber_Plain_Text_Feature.tmLanguage +221 -0
  184. data/textmate/Bundles/Cucumber.tmbundle/Syntaxes/next_Cucumber_Steps.tmLanguage +424 -0
  185. data/textmate/Bundles/Cucumber.tmbundle/Syntaxes/plaintext_template.erb +19 -77
  186. data/textmate/Bundles/Cucumber.tmbundle/info.plist +1 -20
  187. data/textmate/Bundles/Perl.tmbundle/Syntaxes/Perl.plist +1 -1
  188. data/textmate/Themes/Emacs Strict.tmTheme +241 -0
  189. data/textmate/Themes/IR_White.tmTheme +792 -0
  190. data/textmate/Themes/Monokai.tmTheme +291 -0
  191. data/textmate/Themes/WhysPoignant.tmTheme +191 -0
  192. metadata +92 -7
  193. data/plugins/application/features/main_window.feature +0 -8
  194. data/plugins/project/lib/project/project_command.rb +0 -5
  195. data/textmate/Bundles/Cucumber.tmbundle/Snippets/Scenario.tmSnippet +0 -22
  196. data/textmate/Bundles/Cucumber.tmbundle/Snippets/Story.tmSnippet +0 -25
@@ -57,9 +57,9 @@ module Redcar
57
57
  def replace(offset, length, text)
58
58
  @model.verify_text(offset, offset+length, text)
59
59
  jface_document.replace(offset, length, text)
60
- if length > text.length
61
- @swt_mate_document.mateText.redraw
62
- end
60
+ #if length > text.length
61
+ # @swt_mate_document.mateText.redraw
62
+ #end
63
63
  @model.modify_text
64
64
  end
65
65
 
@@ -9,7 +9,7 @@ module Redcar
9
9
  end
10
10
 
11
11
  def get_next_offset(e)
12
- if e.movement == Swt::SWT::MOVEMENT_WORD
12
+ if [Swt::SWT::MOVEMENT_WORD, Swt::SWT::MOVEMENT_WORD_END].include? e.movement
13
13
  e.newOffset = next_offset(e.offset, e.lineOffset, e.lineText)
14
14
  # SWT gets pissy without this:
15
15
  if e.newOffset == e.lineOffset + e.lineText.length + 1
@@ -36,7 +36,7 @@ module Redcar
36
36
  end
37
37
 
38
38
  def get_previous_offset(e)
39
- if e.movement == Swt::SWT::MOVEMENT_WORD
39
+ if [Swt::SWT::MOVEMENT_WORD, Swt::SWT::MOVEMENT_WORD_START].include? e.movement
40
40
  e.newOffset = previous_offset(e.offset, e.lineOffset, e.lineText)
41
41
  # SWT gets pissy without this:
42
42
  if e.newOffset == e.lineOffset - 1
@@ -6,6 +6,7 @@ module JavaMateView
6
6
  import com.redcareditor.mate.Grammar
7
7
  import com.redcareditor.mate.MateText
8
8
  import com.redcareditor.mate.Parser
9
+ import com.redcareditor.mate.ParserScheduler
9
10
  import com.redcareditor.mate.Pattern
10
11
  import com.redcareditor.mate.Scope
11
12
  import com.redcareditor.mate.ScopeMatcher
@@ -26,9 +27,9 @@ module JavaMateView
26
27
  end
27
28
 
28
29
  def delay_parsing
29
- parser.deactivate
30
+ parser.parserScheduler.deactivate
30
31
  yield
31
- parser.reactivate
32
+ parser.parserScheduler.reactivate
32
33
  end
33
34
  end
34
35
  end
@@ -1,7 +1,4 @@
1
1
 
2
- require 'openssl'
3
- require File.dirname(__FILE__) + "/jarmor-1.1"
4
- require File.dirname(__FILE__) + "/ezcrypto"
5
2
 
6
3
  module Encryption
7
4
  def self.menus
@@ -15,21 +12,31 @@ module Encryption
15
12
  end
16
13
  end
17
14
 
15
+ def self.lazy_load
16
+ $:.push File.expand_path(File.join(Redcar.root, "openssl", "lib"))
17
+ require 'openssl'
18
+
19
+ require File.dirname(__FILE__) + "/jarmor-1.1"
20
+ require File.dirname(__FILE__) + "/ezcrypto"
21
+ end
22
+
18
23
  class DecryptDocumentCommand < Redcar::EditTabCommand
19
24
  def execute
20
- result = Redcar::Application::Dialog.input(win, "Password", "Enter password")
25
+ Encryption.lazy_load
26
+ result = Redcar::Application::Dialog.input("Password", "Enter password")
21
27
  pw = result[:value]
22
28
  begin
23
29
  doc.text = EncryptionTools.dearmour_and_decrypt(doc.to_s, pw)
24
30
  rescue => e
25
- Redcar::Application::Dialog.message_box(win, "Couldn't decrypt!", :type => :error)
31
+ Redcar::Application::Dialog.message_box("Couldn't decrypt!", :type => :error)
26
32
  end
27
33
  end
28
34
  end
29
35
 
30
36
  class EncryptDocumentCommand < Redcar::EditTabCommand
31
37
  def execute
32
- result = Redcar::Application::Dialog.input(win, "Password", "Enter password")
38
+ Encryption.lazy_load
39
+ result = Redcar::Application::Dialog.input("Password", "Enter password")
33
40
  pw = result[:value]
34
41
  doc.text = EncryptionTools.encrypt_and_armour(doc.to_s, pw)
35
42
  end
@@ -19,33 +19,43 @@ module Redcar
19
19
  }]
20
20
  end
21
21
 
22
- class Execute < Command
22
+ class Execute < EditTabCommand
23
23
 
24
24
  def execute
25
- doc = win.focussed_notebook_tab_document
26
- path = doc.path if doc
25
+ path = doc.path
27
26
  if path
28
- command = "ruby #{path} 2>&1"
29
- out = `#{command}`
30
- new_tab = Top::NewCommand.new.run
31
- new_tab.document.text = "***** generated output from #{command} ***\n" + out
32
- new_tab.title= 'exec output'
27
+ execute_file(path)
33
28
  else
34
- puts 'unable to execute--maybe you need to save it first, so it has a filename?'
29
+ path = File.join(Redcar.tmp_dir, "execute_file.rb")
30
+ File.open(path, "w") { |file| file.puts doc.to_s }
31
+ execute_file(path)
32
+ FileUtils.rm(path)
35
33
  end
36
34
  end
37
35
 
36
+ def execute_file(path)
37
+ command = "ruby \"#{path}\" 2>&1"
38
+ output = `#{command}`
39
+ new_tab = Top::NewCommand.new.run
40
+ title = "Output from #{command}"
41
+ new_tab.document.text = title + "\n" + "="*title.length + "\n\n" + output
42
+ new_tab.title = 'Output'
43
+ end
38
44
  end
39
45
 
40
- class EmbeddedExecute < Command
46
+ class EmbeddedExecute < EditTabCommand
41
47
 
42
48
  def execute
43
- doc = win.focussed_notebook_tab_document
44
- out = doc.get_all_text if doc
49
+ out = doc.get_all_text
45
50
  if out
46
- eval out, TOPLEVEL_BINDING, doc.path || doc.title || ''
47
- else
48
- puts 'unable to eval embedded'
51
+ begin
52
+ eval(out, TOPLEVEL_BINDING, doc.path || doc.title || '')
53
+ rescue Object => e
54
+ Application::Dialog.message_box(
55
+ "#{e.class}\n#{e.message}",
56
+ :type => :error )
57
+
58
+ end
49
59
  end
50
60
  end
51
61
 
@@ -9,4 +9,35 @@ td.plugin {
9
9
 
10
10
  td.links {
11
11
  text-align: right;
12
- }
12
+ }
13
+
14
+ body {
15
+ font-family: sans-serif;
16
+ }
17
+
18
+ h1, h2, h3, h4, h5 {
19
+ border-bottom: 1px solid black;
20
+ }
21
+
22
+ table {
23
+ border-collapse: collapse;
24
+ font-size: 0.8em;
25
+ }
26
+
27
+ th {
28
+ padding: 7px 12px;
29
+ border: 1px solid #bbb;
30
+ }
31
+
32
+ td {
33
+ padding: 7px 12px;
34
+ border: 1px solid #bbb;
35
+ }
36
+
37
+ tr.error {
38
+ background-color: #FCC;
39
+ }
40
+
41
+ tr.cancelled {
42
+ background-color: #EEE;
43
+ }
@@ -7,6 +7,7 @@ module Redcar
7
7
 
8
8
  def initialize(html_tab)
9
9
  @html_tab = html_tab
10
+ @html_tab.add_listener(:controller_action, &method(:controller_action))
10
11
  end
11
12
 
12
13
  def controller=(new_controller)
@@ -14,9 +15,28 @@ module Redcar
14
15
  @html_tab.title = controller.title
15
16
  func = RubyFunc.new(@html_tab.controller.browser, "rubyCall")
16
17
  func.controller = @controller
17
- text = controller.index + setup_javascript_listeners
18
- # puts text
19
- @html_tab.controller.browser.set_text(text)
18
+ controller_action("index")
19
+ end
20
+
21
+ def controller_action(action_name, path=nil)
22
+ action_method_arity = controller.method(action_name).arity
23
+ begin
24
+ text = if action_method_arity == 0
25
+ controller.send(action_name)
26
+ elsif action_method_arity == 1
27
+ controller.send(action_name, path)
28
+ end
29
+ rescue => e
30
+ text = <<-HTML
31
+ Sorry, there was an error.<br />
32
+ #{e.message}
33
+ HTML
34
+ end
35
+ @html_tab.controller.browser.set_text(text + setup_javascript_listeners)
36
+ end
37
+
38
+ def contents=(source)
39
+ @html_tab.controller.browser.set_text(source)
20
40
  end
21
41
 
22
42
  private
@@ -12,5 +12,9 @@ module Redcar
12
12
  def create_html_view
13
13
  @html_view = HtmlView.new(self)
14
14
  end
15
+
16
+ def controller_action(action, path)
17
+ notify_listeners(:controller_action, action, path)
18
+ end
15
19
  end
16
20
  end
@@ -20,7 +20,7 @@ module Redcar
20
20
  # Example command: showing a dialog box.
21
21
  class HelloWorldCommand < Redcar::Command
22
22
  def execute
23
- Application::Dialog.message_box(win, "Hello World!")
23
+ Application::Dialog.message_box("Hello World!")
24
24
  end
25
25
  end
26
26
 
@@ -28,19 +28,11 @@ module Redcar
28
28
  # and open this file.
29
29
  class EditMyPluginCommand < Redcar::Command
30
30
  def execute
31
- # Create a new window
32
- new_window = Redcar.app.new_window
33
-
34
- # Create a new Tree. Tree's have mirrors for displaying data and controllers
35
- # for reacting to events.
36
- tree = Tree.new(Project::DirMirror.new(File.join(Redcar.root, "plugins", "my_plugin")),
37
- Project::DirController.new)
38
-
39
- # Open the tree in the new window.
40
- Project.open_tree(new_window, tree)
31
+ # Open the project in a new window
32
+ Project::Manager.open_project_for_path("plugins/my_plugin")
41
33
 
42
34
  # Create a new edittab
43
- tab = new_window.new_tab(Redcar::EditTab)
35
+ tab = Redcar.app.focussed_window.new_tab(Redcar::EditTab)
44
36
 
45
37
  # A FileMirror's job is to wrap up the file in an interface that the Document understands.
46
38
  mirror = Project::FileMirror.new(File.join(Redcar.root, "plugins", "my_plugin", "lib", "my_plugin.rb"))
@@ -40,6 +40,7 @@ module Redcar
40
40
  def plugin_table(plugins)
41
41
  str = "<table>\n"
42
42
  highlight = true
43
+ plugins = plugins.sort_by {|pl| pl.name.downcase }
43
44
  plugins.each do |plugin|
44
45
  name = plugin.is_a?(PluginManager::PluginDefinition) ? plugin.name : plugin
45
46
  str << "<tr class=\"#{highlight ? "grey" : ""}\">"
@@ -1,40 +1,33 @@
1
- <br />
2
- <br />
3
- <div class="container">
4
- <div class="span-8">
5
- <% jquery_path = File.expand_path(File.join(Redcar.root, %w(plugins html_view assets jquery-1.4.min.js))) %>
6
- <script type="text/javascript" src="file://<%= jquery_path %>"></script>
7
- <% blueprint_dir = File.expand_path(File.join(Redcar.root, %w(plugins html_view assets blueprint))) %>
8
- <% redcar_css = File.expand_path(File.join(Redcar.root, %w(plugins html_view assets redcar.css))) %>
9
- <link rel="stylesheet" href="file://<%= blueprint_dir %>/screen.css" type="text/css" media="screen, projection">
10
- <link rel="stylesheet" href="file://<%= blueprint_dir %>/print.css" type="text/css" media="print">
11
- <link rel="stylesheet" href="file://<%= redcar_css %>" type="text/css" media="screen">
12
-
13
- <h3>Loaded Plugins</h3>
14
- <%= plugin_table(Redcar.plugin_manager.loaded_plugins) %>
15
-
16
- <h3>Unloaded Plugins</h3>
17
- <%= plugin_table(Redcar.plugin_manager.unloaded_plugins) %>
18
-
19
- <h3>Unreadable definitions</h3>
20
- <%= plugin_table(Redcar.plugin_manager.unreadable_definitions) %>
21
-
22
- <h3>Plugins with Errors</h3>
23
- <%= plugin_table(Redcar.plugin_manager.plugins_with_errors) %>
24
-
25
- <script language="javascript">
26
- $("a").click(function(e) {
27
- e.preventDefault();
28
- var pluginName = $(this).parent().parent().find(".plugin-name").text();
29
- try {
30
- Controller.reloadPlugin(pluginName);
31
- } catch(e) {
32
- alert(e.message);
33
- }
34
- });
35
- </script>
36
- </div>
37
- </div>
1
+ <h3>Plugin Manager</h3>
2
+
3
+ <% jquery_path = File.expand_path(File.join(Redcar.root, %w(plugins html_view assets jquery-1.4.min.js))) %>
4
+ <script type="text/javascript" src="file://<%= jquery_path %>"></script>
5
+ <% redcar_css = File.expand_path(File.join(Redcar.root, %w(plugins html_view assets redcar.css))) %>
6
+ <link rel="stylesheet" href="file://<%= redcar_css %>" type="text/css" media="screen">
7
+
8
+ <h4>Loaded Plugins</h4>
9
+ <%= plugin_table(Redcar.plugin_manager.loaded_plugins) %>
10
+
11
+ <h4>Unloaded Plugins</h4>
12
+ <%= plugin_table(Redcar.plugin_manager.unloaded_plugins) %>
13
+
14
+ <h4>Unreadable definitions</h4>
15
+ <%= plugin_table(Redcar.plugin_manager.unreadable_definitions) %>
16
+
17
+ <h4>Plugins with Errors</h4>
18
+ <%= plugin_table(Redcar.plugin_manager.plugins_with_errors) %>
19
+
20
+ <script language="javascript">
21
+ $("a").click(function(e) {
22
+ e.preventDefault();
23
+ var pluginName = $(this).parent().parent().find(".plugin-name").text();
24
+ try {
25
+ Controller.reloadPlugin(pluginName);
26
+ } catch(e) {
27
+ alert(e.message);
28
+ }
29
+ });
30
+ </script>
38
31
 
39
32
 
40
33
  <script type="text/javascript">
@@ -0,0 +1,75 @@
1
+ Feature: Find file
2
+
3
+ Background:
4
+ Given I will choose "plugins/project/spec/fixtures/myproject" from the "open_directory" dialog
5
+ When I open a directory
6
+
7
+ Scenario: No files initially and with nothing typed
8
+ When I run the command Redcar::Project::FindFileCommand
9
+ Then there should be a filter dialog open
10
+ And the filter dialog should have no entries
11
+
12
+ Scenario: No matching files
13
+ When I run the command Redcar::Project::FindFileCommand
14
+ And I set the filter to "xxx"
15
+ And I wait "0.4" seconds
16
+ Then the filter dialog should have 0 entries
17
+
18
+ Scenario: One matching file
19
+ When I run the command Redcar::Project::FindFileCommand
20
+ And I set the filter to "foo_spec"
21
+ And I wait "0.4" seconds
22
+ Then the filter dialog should have 1 entry
23
+ And I should see "foo_spec.rb (myproject/spec)" at 0 the filter dialog
24
+
25
+ Scenario: Two matching files
26
+ When I run the command Redcar::Project::FindFileCommand
27
+ And I set the filter to "foo"
28
+ And I wait "0.4" seconds
29
+ Then the filter dialog should have 2 entries
30
+ And I should see "foo_lib.rb (myproject/lib)" at 0 the filter dialog
31
+ And I should see "foo_spec.rb (myproject/spec)" at 1 the filter dialog
32
+
33
+ Scenario: One matching file with arbitrary letters
34
+ When I run the command Redcar::Project::FindFileCommand
35
+ And I set the filter to "fsc"
36
+ And I wait "0.4" seconds
37
+ Then the filter dialog should have 1 entry
38
+ And I should see "foo_spec.rb (myproject/spec)" at 0 the filter dialog
39
+
40
+ Scenario: Open a file
41
+ When I run the command Redcar::Project::FindFileCommand
42
+ And I set the filter to "fsc"
43
+ And I wait "0.4" seconds
44
+ And I select in the filter dialog
45
+ Then there should be no filter dialog open
46
+ And I should see "foo spec" in the edit tab
47
+
48
+ Scenario: Open a file then see the file in the initial list
49
+ When I run the command Redcar::Project::FindFileCommand
50
+ And I set the filter to "fsc"
51
+ And I wait "0.4" seconds
52
+ And I select in the filter dialog
53
+ And I run the command Redcar::Project::FindFileCommand
54
+ Then the filter dialog should have 1 entry
55
+ And I should see "foo_spec.rb (myproject/spec)" at 0 the filter dialog
56
+
57
+ Scenario: Open two files then see the files in the initial list
58
+ When I have opened "plugins/project/spec/fixtures/myproject/spec/foo_spec.rb"
59
+ And I have opened "plugins/project/spec/fixtures/myproject/lib/foo_lib.rb"
60
+ And I run the command Redcar::Project::FindFileCommand
61
+ Then the filter dialog should have 2 entries
62
+ And I should see "foo_spec.rb (myproject/spec)" at 0 the filter dialog
63
+ And I should see "foo_lib.rb (myproject/lib)" at 1 the filter dialog
64
+
65
+ Scenario: Open three files then see the files in the initial list
66
+ When I have opened "plugins/project/spec/fixtures/myproject/spec/foo_spec.rb"
67
+ And I have opened "plugins/project/spec/fixtures/myproject/lib/foo_lib.rb"
68
+ And I have opened "plugins/project/spec/fixtures/myproject/README"
69
+ And I run the command Redcar::Project::FindFileCommand
70
+ Then the filter dialog should have 3 entries
71
+ And I should see "foo_lib.rb (myproject/lib)" at 0 the filter dialog
72
+ And I should see "foo_spec.rb (myproject/spec)" at 1 the filter dialog
73
+ And I should see "README (fixtures/myproject)" at 2 the filter dialog
74
+
75
+
@@ -1,13 +1,13 @@
1
1
  Feature: Open and save files
2
2
 
3
3
  Scenario: Open a file
4
- Given I will choose "plugins/project/features/fixtures/winter.txt" from the "open_file" dialog
4
+ Given I will choose "plugins/project/spec/fixtures/winter.txt" from the "open_file" dialog
5
5
  When I open a file
6
6
  Then there should be one edit tab
7
7
  And I should see "Wintersmith" in the edit tab
8
8
 
9
9
  Scenario: Opening an already open file focusses the edit tab
10
- Given I will choose "plugins/project/features/fixtures/winter.txt" from the "open_file" dialog
10
+ Given I will choose "plugins/project/spec/fixtures/winter.txt" from the "open_file" dialog
11
11
  When I open a file
12
12
  And I open a new edit tab
13
13
  And I replace the contents with "Jenny Green Eyes"
@@ -16,16 +16,16 @@ Feature: Open and save files
16
16
  And I should see "Wintersmith" in the edit tab
17
17
 
18
18
  Scenario: Save a file
19
- Given I have opened "plugins/project/features/fixtures/winter.txt"
19
+ Given I have opened "plugins/project/spec/fixtures/winter.txt"
20
20
  When I replace the contents with "Hi!"
21
21
  And I save the tab
22
- Then the file "plugins/project/features/fixtures/winter.txt" should contain "Hi!"
22
+ Then the file "plugins/project/spec/fixtures/winter.txt" should contain "Hi!"
23
23
  And I should see "Hi!" in the edit tab
24
24
 
25
25
  Scenario: Save a file As
26
- Given I have opened "plugins/project/features/fixtures/winter.txt"
27
- And I will choose "plugins/project/features/fixtures/winter2.txt" from the "save_file" dialog
26
+ Given I have opened "plugins/project/spec/fixtures/winter.txt"
27
+ And I will choose "plugins/project/spec/fixtures/winter2.txt" from the "save_file" dialog
28
28
  And I save the tab as
29
- Then the file "plugins/project/features/fixtures/winter2.txt" should contain "Wintersmith"
29
+ Then the file "plugins/project/spec/fixtures/winter2.txt" should contain "Wintersmith"
30
30
  And I should see "Wintersmith" in the edit tab
31
31