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
data/CHANGES CHANGED
@@ -1,4 +1,49 @@
1
1
 
2
+ Version 0.3.5dev (1 May 2010)
3
+ =============================
4
+
5
+ Enhancements:
6
+
7
+ * Jump to declaration support for Ruby and Java
8
+ * Double click respects word boundaries
9
+ * Window title reflects project name
10
+ * Duplicate region command
11
+ * Switch tab with Alt-1, Alt-2 (or Cmd-1, Cmd-2 on OSX)
12
+ * Prompts to save modified tabs on tab, window or application close
13
+ * Snippet menus show tab trigger more nicely (linux/windows)
14
+ * Watches to changes to open files, and prompts to revert
15
+ * Project view sorts directories before files (by popular request!)
16
+ * Shows menu bar on OSX when there are no windows open
17
+ * Halve startup time from 0.3.4 (warm startup)
18
+ * Added background Task APIs.
19
+ * Task Manager
20
+ * Added ProjectRefresh Task API
21
+ * No longer dumps command errors to the console
22
+ * Command history tab
23
+ * Speed up opening of first file by lazy loading embedded grammars
24
+ * Sped up Ruby highlighting by 17x
25
+ * Doesn't die on long lines (gives up after 500 characters now)
26
+ * Added show/hide invisible characters menu option
27
+ * Smart indentation as you type (based on Textmate bundle rules)
28
+ * Add profiling commands to the Debug menu (uses jruby-prof)
29
+ * Lazy menus API
30
+ * Commands to profile Redcar with jruby-prof.
31
+
32
+ Fixes:
33
+
34
+ * Fix delete at end of line when using "\r\n" delimiter
35
+ * Increase and decrease indent commands respect soft tabs and tab width settings
36
+ * Directory tree sorts correctly
37
+ * Speed up opening a project (about 1s faster)
38
+
39
+ New contributors:
40
+
41
+ * Antono Vasiljev
42
+ * Sergey Potapov
43
+ * Kirill Nikitin
44
+ * Juozas Gaigalas
45
+ * Tim Felgentreff
46
+
2
47
  Version 0.3.4dev (7 Mar 2010)
3
48
  =============================
4
49
 
data/README.md CHANGED
@@ -13,7 +13,7 @@ A pure Ruby text editor running on JRuby.
13
13
 
14
14
  You must have Java installed.
15
15
 
16
- $ sudo gem install redcar --pre
16
+ $ sudo gem install redcar
17
17
  $ sudo redcar install
18
18
 
19
19
  NB the install will take a minute or so to complete as it has to download about
@@ -29,6 +29,7 @@ for a list of options.
29
29
 
30
30
  ## INSTALLING FROM SOURCE
31
31
 
32
+ If you want to contribute to Redcar, you can install it from the source code.
32
33
  Download from github, checkout the submodules and build JavaMateView. You will need Ant
33
34
  installed, and RSpec and Cucumber installed as JRuby gems.
34
35
 
data/ROADMAP.md CHANGED
@@ -11,7 +11,6 @@ Features still to port
11
11
  * Drag and drop of tabs
12
12
  * Packaged for one-click install on 3 platforms
13
13
  * Ruby on Rails/HTML/CSS/YAML bundle commands ported
14
- * Use Gecko as embedded browser widget on all 3 platforms
15
14
 
16
15
  Version 0.4.0
17
16
  -------------
data/Rakefile CHANGED
@@ -60,9 +60,12 @@ end
60
60
 
61
61
  desc "Build"
62
62
  task :build do
63
- sh("ant jar -f vendor/java-mateview/build.xml")
64
- cp("vendor/java-mateview/lib/java-mateview.rb", "plugins/edit_view_swt/vendor/")
65
- cp("vendor/java-mateview/release/java-mateview.jar", "plugins/edit_view_swt/vendor/")
63
+ sh "ant jar -f vendor/java-mateview/build.xml"
64
+ cp "vendor/java-mateview/lib/java-mateview.rb", "plugins/edit_view_swt/vendor/"
65
+ cp "vendor/java-mateview/release/java-mateview.jar", "plugins/edit_view_swt/vendor/"
66
+ cd "plugins/application_swt" do
67
+ sh "ant"
68
+ end
66
69
  end
67
70
 
68
71
  def remove_gitignored_files(filelist)
@@ -75,7 +78,7 @@ end
75
78
 
76
79
  spec = Gem::Specification.new do |s|
77
80
  s.name = "redcar"
78
- s.version = "0.3.4.3"
81
+ s.version = "0.3.5"
79
82
  s.summary = "A JRuby text editor."
80
83
  s.author = "Daniel Lucraft"
81
84
  s.email = "dan@fluentradical.com"
@@ -117,6 +120,9 @@ to complete the installation.
117
120
 
118
121
  (If you installed the gem with 'sudo', you will need to run 'sudo redcar install').
119
122
 
123
+ NB. This will download jars that Redcar needs to run from the internet. It will put
124
+ them only into the Redcar gem directory.
125
+
120
126
  ------------------------------------------------------------------------------------
121
127
 
122
128
  TEXT
data/bin/redcar CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  $VERBOSE = true if ARGV.find{|arg| arg == '--verbose'}
4
+ require File.join(File.dirname(__FILE__), %w(.. lib redcar_quick_start))
4
5
 
5
6
  if ARGV.first == "install"
6
7
  require File.join(File.dirname(__FILE__), %w(.. lib redcar))
@@ -13,12 +14,11 @@ elsif ARGV.first == '--associate_with_any_right_click'
13
14
  installer = Redcar::Installer.new
14
15
  installer.associate_with_any_right_click
15
16
  else
16
- require File.join(File.dirname(__FILE__), %w(.. lib redcar_quick_start))
17
17
  exit if Redcar.try_to_load_via_drb
18
18
  require File.join(File.dirname(__FILE__), %w(.. lib redcar))
19
19
  Redcar.spin_up
20
20
  Redcar.environment = :user
21
21
  Redcar.load
22
- Redcar::Top.start
22
+ Redcar::Top.start(ARGV)
23
23
  Redcar.pump
24
24
  end
@@ -0,0 +1,7 @@
1
+ version.target=1.5
2
+ version.source=1.5
3
+ jruby.home=/Users/danlucraft/Programs/jruby
4
+ jruby.jar=${jruby.home}/lib/jruby.jar
5
+ # set this to an alternate location to compile against a different jruby.jar
6
+ #jruby.jar=lib/jruby.jar
7
+
@@ -18,6 +18,14 @@ class PluginManager
18
18
  def plugins
19
19
  @unloaded_plugins + @loaded_plugins
20
20
  end
21
+
22
+ def plugin_objects
23
+ @loaded_plugins.map {|definition| definition.object}
24
+ end
25
+
26
+ def objects_implementing(method_name)
27
+ plugin_objects.select {|obj| obj.respond_to?(method_name) }
28
+ end
21
29
 
22
30
  def add_plugin_source(directory)
23
31
  definition_files = Dir[File.join(File.expand_path(directory), "*", "plugin.rb")]
@@ -40,6 +48,7 @@ class PluginManager
40
48
  end
41
49
 
42
50
  def load
51
+ start = Time.now
43
52
  previous_length = @unloaded_plugins.length + 1
44
53
  while previous_length > @unloaded_plugins.length
45
54
  previous_length = @unloaded_plugins.length
@@ -57,6 +66,7 @@ class PluginManager
57
66
  @unloaded_plugins.delete(plugin)
58
67
  end
59
68
  end
69
+ puts "[PluginManager] took #{Time.now - start}s to load plugins" if ENV["PLUGIN_DEBUG"]
60
70
  end
61
71
 
62
72
  private
@@ -21,15 +21,7 @@ class PluginManager
21
21
  end
22
22
 
23
23
  def load
24
- required_files.each do |file|
25
- #fn = File.expand_path(file, definition_directory)
26
- #p file
27
- #p fn
28
- #if fn.match(/^#{Regexp.escape(definition_directory)}/)
29
- #p :delete
30
- $".delete(file)
31
- #end
32
- end
24
+ required_files.each {|file| $".delete(file) }
33
25
  load_file = File.expand_path(File.join(File.dirname(definition_file), file))
34
26
  $:.unshift(File.dirname(load_file))
35
27
  new_files = log_requires do
@@ -45,10 +37,6 @@ class PluginManager
45
37
  eval(object_string)
46
38
  end
47
39
 
48
- def definition_directory
49
- File.expand_path(File.dirname(@definition_file))
50
- end
51
-
52
40
  private
53
41
 
54
42
  def log_requires
data/lib/redcar.rb CHANGED
@@ -40,12 +40,14 @@ require 'yaml'
40
40
  #
41
41
  # and so on.
42
42
  module Redcar
43
- VERSION = '0.3.4'
43
+ VERSION = '0.3.5'
44
44
  VERSION_MAJOR = 0
45
45
  VERSION_MINOR = 3
46
- VERSION_RELEASE = 4
46
+ VERSION_RELEASE = 5
47
47
 
48
48
  ENVIRONMENTS = [:user, :debug, :test]
49
+
50
+ PROCESS_START_TIME = Time.now
49
51
 
50
52
  def self.environment=(env)
51
53
  unless ENVIRONMENTS.include?(env)
@@ -85,9 +87,6 @@ module Redcar
85
87
  $:.push File.expand_path(File.join(File.dirname(__FILE__), "plugin_manager", "lib"))
86
88
  require 'plugin_manager'
87
89
 
88
- $:.push File.expand_path(File.join(File.dirname(__FILE__), "openssl", "lib"))
89
- require 'openssl'
90
-
91
90
  plugin_manager.load
92
91
  if plugin_manager.unreadable_definitions.any?
93
92
  puts "Couldn't read definition files: "
@@ -130,14 +129,19 @@ module Redcar
130
129
  #
131
130
  # @return [String] expanded path
132
131
  def self.user_dir
132
+ dirname = {
133
+ :user => ".redcar",
134
+ :test => ".redcar_test",
135
+ :debug => ".redcar_debug"
136
+ }[Redcar.environment]
133
137
  if platform == :windows
134
138
  if ENV['USERPROFILE'].nil?
135
- userdir = "C:/My Documents/.redcar/"
139
+ userdir = "C:/My Documents/#{dirname}/"
136
140
  else
137
- userdir = File.join(ENV['USERPROFILE'], ".redcar")
141
+ userdir = File.join(ENV['USERPROFILE'], dirname)
138
142
  end
139
143
  else
140
- userdir = File.join(ENV['HOME'], ".redcar") unless ENV['HOME'].nil?
144
+ userdir = File.join(ENV['HOME'], dirname) unless ENV['HOME'].nil?
141
145
  end
142
146
  File.expand_path(userdir)
143
147
  end
@@ -77,7 +77,7 @@ module Redcar
77
77
  "/jruby/joni.jar"
78
78
  ]
79
79
 
80
- JRUBY << "http://jruby.kenai.com/downloads/1.4.0/jruby-complete-1.4.0.jar" unless RUBY_PLATFORM =~ /java/
80
+ JRUBY << "http://jruby.kenai.com/downloads/1.4.0/jruby-complete-1.4.0.jar"
81
81
 
82
82
  JOPENSSL = {
83
83
  "/jruby/bcmail-jdk14-139-#{Redcar::VERSION}.jar" => "lib/openssl/lib/bcmail-jdk14-139.jar",
@@ -86,7 +86,8 @@ module Redcar
86
86
  }
87
87
 
88
88
  REDCAR_JARS = {
89
- "/java-mateview-#{Redcar::VERSION}.jar" => "plugins/edit_view_swt/vendor/java-mateview.jar"
89
+ "/java-mateview-#{Redcar::VERSION}.jar" => "plugins/edit_view_swt/vendor/java-mateview.jar",
90
+ "/application-swt-#{Redcar::VERSION}.jar" => "plugins/application_swt/lib/dist/application_swt.jar"
90
91
  }
91
92
 
92
93
  XULRUNNER_URI = "http://releases.mozilla.org/pub/mozilla.org/xulrunner/releases/1.9.2/runtimes/xulrunner-1.9.2.en-US.win32.zip"
@@ -152,19 +153,19 @@ module Redcar
152
153
 
153
154
  # unzip a .zip file into the directory it is located
154
155
  def self.unzip_file(source)
155
- source = File.expand_path(source)
156
- Dir.chdir(File.dirname(source)) do
157
- Zip::ZipFile.open(source) do |zipfile|
158
- zipfile.entries.each do |entry|
159
- FileUtils.mkdir_p(File.dirname(entry.name))
160
- begin
161
- entry.extract
162
- rescue Zip::ZipDestinationFileExistsError
163
- end
164
- end
165
- end
166
- end
167
- end
156
+ source = File.expand_path(source)
157
+ Dir.chdir(File.dirname(source)) do
158
+ Zip::ZipFile.open(source) do |zipfile|
159
+ zipfile.entries.each do |entry|
160
+ FileUtils.mkdir_p(File.dirname(entry.name))
161
+ begin
162
+ entry.extract
163
+ rescue Zip::ZipDestinationFileExistsError
164
+ end
165
+ end
166
+ end
167
+ end
168
+ end
168
169
  end
169
170
  end
170
171
 
@@ -15,4 +15,149 @@ end
15
15
 
16
16
  def ARGV.option(name)
17
17
  ARGV.map {|arg| arg =~/--#{name}=(.*)$/; $1}.compact.first
18
- end
18
+ end
19
+
20
+ module AndAnd
21
+
22
+ # This module is included in Object, so each of these methods are added
23
+ # to Object when you require 'andand'. Each method is an *adverb*: they are
24
+ # intended to be enchained with another method, such as receiver.adverb.method
25
+ #
26
+ # The purpose of an adverb is to modify what the primary method returns.
27
+ #
28
+ # Adverbs also take blocks or procs, passing the receiver as an argument to the
29
+ # block or proc. They retain the same semantics with a block or proc as they
30
+ # do with a method. This behaviour weakly resembles a monad.
31
+ module ObjectGoodies
32
+
33
+ # Returns nil if its receiver is nil, regardless of whether nil actually handles the
34
+ # actual method ot what it might return.
35
+ #
36
+ # 'foo'.andand.size => 3
37
+ # nil.andand.size => nil
38
+ # 'foo'.andand { |s| s << 'bar' } => 'foobar'
39
+ # nil.andand { |s| s << 'bar' } => nil
40
+ def andand (p = nil)
41
+ if self
42
+ if block_given?
43
+ yield(self)
44
+ elsif p
45
+ p.to_proc.call(self)
46
+ else
47
+ self
48
+ end
49
+ else
50
+ if block_given? or p
51
+ self
52
+ else
53
+ MockReturningMe.new(self)
54
+ end
55
+ end
56
+ end
57
+
58
+ # Invokes the method and returns the receiver if nothing is raised. Therefore,
59
+ # the purpose of calling the method is strictly for side effects. In the block
60
+ # form, it resembles #tap from Ruby 1.9, and is useful for debugging. It also
61
+ # resembles #returning from Rails, with slightly different syntax.
62
+ #
63
+ # Object.new.me do |o|
64
+ # def o.foo
65
+ # 'foo'
66
+ # end
67
+ # end
68
+ # => your new object
69
+ #
70
+ # In the method form, it is handy for chaining methods that don't ordinarily
71
+ # return the receiver:
72
+ #
73
+ # [1, 2, 3, 4, 5].me.pop.reverse
74
+ # => [4, 3, 2, 1]
75
+ def me (p = nil)
76
+ if block_given?
77
+ yield(self)
78
+ self
79
+ elsif p
80
+ p.to_proc.call(self)
81
+ self
82
+ else
83
+ ProxyReturningMe.new(self)
84
+ end
85
+ end
86
+
87
+ unless Object.instance_methods.include?('tap')
88
+ alias :tap :me
89
+ end
90
+
91
+ # Does not invoke the method or block and returns the receiver.
92
+ # Useful for comemnting stuff out, especially if you are using #me for
93
+ # debugging purposes: change the .me to .dont and the semantics of your
94
+ # program are unchanged.
95
+ #
96
+ # [1, 2, 3, 4, 5].me { |x| p x }
97
+ # => prints and returns the array
98
+ # [1, 2, 3, 4, 5].dont { |x| p x }
99
+ # => returns the array without printing it
100
+ def dont (p = nil)
101
+ if block_given?
102
+ self
103
+ elsif p
104
+ self
105
+ else
106
+ MockReturningMe.new(self)
107
+ end
108
+ end
109
+
110
+ end
111
+
112
+ end
113
+
114
+ class Object
115
+ include AndAnd::ObjectGoodies
116
+ end
117
+
118
+ unless Module.constants.map { |c| c.to_s }.include?('BlankSlate')
119
+ if Module.constants.map { |c| c.to_s }.include?('BasicObject')
120
+ module AndAnd
121
+ class BlankSlate < BasicObject
122
+ end
123
+ end
124
+ else
125
+ module AndAnd
126
+ class BlankSlate
127
+ def self.wipe
128
+ instance_methods.reject { |m| m =~ /^__/ }.each { |m| undef_method m }
129
+ end
130
+ def initialize
131
+ BlankSlate.wipe
132
+ end
133
+ end
134
+ end
135
+ end
136
+ end
137
+
138
+ module AndAnd
139
+ # A proxy that returns its target without invoking the method you
140
+ # invoke. Useful for nil.andand and #dont
141
+ class MockReturningMe < BlankSlate
142
+ def initialize(me)
143
+ super()
144
+ @me = me
145
+ end
146
+ def method_missing(*args)
147
+ @me
148
+ end
149
+ end
150
+
151
+ # A proxy that returns its target after invoking the method you
152
+ # invoke. Useful for #me
153
+ class ProxyReturningMe < BlankSlate
154
+ def initialize(me)
155
+ super()
156
+ @me = me
157
+ end
158
+ def method_missing(sym, *args, &block)
159
+ @me.__send__(sym, *args, &block)
160
+ @me
161
+ end
162
+ end
163
+ end