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
data/CHANGES CHANGED
@@ -1,3 +1,45 @@
1
+ Version 0.8 (26 October 2010)
2
+ =============================
3
+
4
+ Enhancements:
5
+
6
+ * Alternate Runnables File Runner command and shortcut (Delisa Mason)
7
+ * File runners now have access to line number and file names (Delisa Mason)
8
+ * Projects can have 'subproject' windows which share config files like Runnables (Delisa Mason)
9
+ * Symlinks to other directories are searched recursively (Tim Felgentreff)
10
+ * Redcar can be started without opening a window (for boot-time startup) (Tim Felgentreff)
11
+ * The Mac OS X app bundle comes with assets bundled (Tim Felgentreff)
12
+ * The Runnables tree now nests runnables depending on slashes in the type definition (Tim Felgentreff)
13
+ * Deleting or moving a file updates the tab title and file correctly. (Delisa Mason)
14
+ * Paired characters are not inserted if it looks like you are closing a pair (Dan Lucraft)
15
+ * Syntax checking for Ruby upon save (Tim Felgentreff)
16
+ * Deleting a file from the project tree will move it to the trash, if the OS permits (Tim Felgentreff)
17
+ * Help Menu options for submitting bugs and viewing the users' guide (Delisa Mason)
18
+ * Toggle line and selection commenting (Delisa Mason)
19
+ * Clipboard History Viewer and Paster (Delisa Mason)
20
+ * Web Preview files and Bookmarks (Delisa Mason)
21
+ * -w commandline switch to block the prompt when piping into or opening files on an existing Redcar instance (Tim Felgentreff)
22
+ * 'Open Default App' project context menu item for opening any type of file (Jeremy Wentworth)
23
+ * Changing to another tab reveals the associated file in the project tree (Johannes Wollert)
24
+ * Trees can be hidden or revealed by a keyboard shortcut (Delisa Mason)
25
+ * Fullscreen mode! (Matt Scharley)
26
+
27
+ Bugfixes:
28
+
29
+ * Snippet completion works even when preceded by other characters (Delisa Mason)
30
+ * New files now open in the project window which is the closest ancestor (Delisa Mason)
31
+ * Search-and-replace now operates on the user-selected text as well, not only after it (Tim Felgentreff)
32
+ * Word back/forward movement is not confused by multi-byte characters. (Dan Lucraft)
33
+ * Can load files with multi-byte characters and see them in the tree (Dan Lucraft)
34
+ * Open in command line now works correctly with Terminal.app (Delisa Mason, Mat Schaffer)
35
+ * Search-and-replace won't loop forever over a document anymore if it still finds the search string (Tim Felgentreff)
36
+ * Goto line command works again (Dan Lucraft)
37
+ * Run tab commands are now project-aware (Delisa Mason)
38
+
39
+ New APIs:
40
+ * after_save can be implemented by plugins to run code after an edit view was saved (Tim Felgentreff)
41
+ * before_web_refresh can be implemented by plugins to run code before a HtmlTab is refreshed (Delisa Mason)
42
+
1
43
  Version 0.7 (4 October 2010)
2
44
  ============================
3
45
 
data/README.md CHANGED
@@ -9,12 +9,14 @@ A pure Ruby text editor running on JRuby.
9
9
 
10
10
  ## INSTALLATION
11
11
 
12
- You must have Java installed. You will also need to run these commands for each user on your computer that needs access to Redcar.
12
+ You must have Java installed [1]. You will also need to run these commands for each user on your computer that needs access to Redcar.
13
13
 
14
14
  $ sudo gem install redcar
15
15
  $ redcar install
16
16
 
17
- NB the install will take a minute or so to complete as it has to download about 15MB of jar files.
17
+ The install will take a minute or so to complete as it has to download about 15MB of jar files.
18
+
19
+ [1] Sun Java or OpenJDK work. Gcj is known not to work.
18
20
 
19
21
  ## USAGE
20
22
 
@@ -56,7 +58,7 @@ If you are running a source version of Redcar and you have pulled changes from m
56
58
 
57
59
  ## TESTS
58
60
 
59
- NB. Redcar features won't run with Cucumber 0.9.0 yet. They are known to work with 0.8.5.
61
+ NB. Redcar features are known to work with Cucumber 0.8.5, and known NOT to work with Cucumber >= 0.9
60
62
 
61
63
  To run the tests you need JRuby installed. You also need rspec and cucumber installed as Jruby gems. See jruby.org for this, or install with rvm.
62
64
 
data/Rakefile CHANGED
@@ -1,10 +1,11 @@
1
- REDCAR_VERSION = "0.7" # also change in lib/redcar.rb!
1
+ REDCAR_VERSION = "0.8" # also change in lib/redcar.rb!
2
2
  require 'rubygems'
3
3
  require 'fileutils'
4
4
  require 'spec/rake/spectask'
5
5
  require 'cucumber/rake/task'
6
6
  require "rake/gempackagetask"
7
7
  require "rake/rdoctask"
8
+ Dir[File.expand_path("../tasks/*.rake", __FILE__)].each { |f| load f }
8
9
 
9
10
  if RUBY_PLATFORM =~ /mswin|mingw/
10
11
  begin
@@ -41,7 +42,12 @@ task :release_docs do
41
42
  end
42
43
 
43
44
  ### CI
44
- task :ci => [:specs_ci, :cucumber_ci]
45
+ COVERAGE_DATA = "coverage.data"
46
+ task :ci do
47
+ FileUtils.rm COVERAGE_DATA if File.exist?(COVERAGE_DATA)
48
+ Rake::Task["specs_ci"].invoke
49
+ Rake::Task["cucumber_ci"].invoke
50
+ end
45
51
 
46
52
  def find_ci_reporter(filename)
47
53
  jruby_gem_path = %x[jruby -rubygems -e "p Gem.path.first"].gsub("\n", "").gsub('"', "")
@@ -49,18 +55,27 @@ def find_ci_reporter(filename)
49
55
  result || raise("Could not find ci_reporter gem in #{jruby_gem_path}")
50
56
  end
51
57
 
58
+ def rcov_run(cmd, opts)
59
+ cmd = %{rcov --aggregate #{COVERAGE_DATA} -x "features/,spec/,vendor/,openssl/,yaml/,json/,yaml,gems,file:,(eval),(__FORWARDABLE__)" #{cmd} -- #{opts}}
60
+ jruby_run(cmd)
61
+ end
62
+
63
+ def jruby_run(cmd)
64
+ opts = "-J-XstartOnFirstThread" if Config::CONFIG["host_os"] =~ /darwin/
65
+ sh("jruby --debug #{opts} -S #{cmd} && echo 'done'")
66
+ end
67
+
52
68
  task :specs_ci do
53
- rspec_loader = find_ci_reporter "rspec_loader"
69
+ rspec_loader = find_ci_reporter "rspec_loader"
54
70
  files = Dir['plugins/*/spec/*/*_spec.rb'] + Dir['plugins/*/spec/*/*/*_spec.rb'] + Dir['plugins/*/spec/*/*/*/*_spec.rb']
55
- opts = "-J-XstartOnFirstThread" if Config::CONFIG["host_os"] =~ /darwin/
56
- opts = "#{opts} -S spec --require #{rspec_loader} --format CI::Reporter::RSpec -c #{files.join(" ")}"
57
- sh("jruby #{opts} && echo 'done'")
71
+ rspec_opts = "--require #{rspec_loader} --format CI::Reporter::RSpec -c #{files.join(" ")}"
72
+ rcov_run('"$GEM_HOME"/bin/spec', rspec_opts)
58
73
  end
59
74
 
60
- task :cucumber_ci do
61
- opts = "-J-XstartOnFirstThread" if Config::CONFIG["host_os"] =~ /darwin/
62
- opts = "#{opts} bin/cucumber -f progress -f junit --out features/reports/ plugins/*/features"
63
- sh("jruby #{opts} && echo 'done'")
75
+ task :cucumber_ci do
76
+ reports_folder = "features/reports"
77
+ FileUtils.rm_rf reports_folder if File.exist? reports_folder
78
+ rcov_run("bin/cucumber", "-f progress -f junit --out #{reports_folder} plugins/*/features")
64
79
  end
65
80
 
66
81
  ### TESTS
@@ -80,11 +95,13 @@ end
80
95
 
81
96
  desc "Run features"
82
97
  task :cucumber do
83
- case Config::CONFIG["host_os"]
84
- when "darwin"
85
- sh("jruby -J-XstartOnFirstThread bin/cucumber -cf progress plugins/*/features && echo 'done'")
86
- else
87
- sh("jruby bin/cucumber -cf progress plugins/*/features && echo 'done'")
98
+ cmd = "jruby "
99
+ if Config::CONFIG["host_os"] == "darwin"
100
+ cmd += "-J-XstartOnFirstThread "
101
+ end
102
+ cmd += "bin/cucumber -cf progress"
103
+ Dir["plugins/*/features"].each do |f|
104
+ sh("#{cmd} #{f} && echo 'done'")
88
105
  end
89
106
  end
90
107
 
@@ -112,7 +129,7 @@ def remove_matching_files(list, string)
112
129
  list.reject {|entry| entry.include?(string)}
113
130
  end
114
131
 
115
- spec = Gem::Specification.new do |s|
132
+ Spec = spec = Gem::Specification.new do |s|
116
133
  s.name = "redcar"
117
134
  s.version = REDCAR_VERSION
118
135
  s.summary = "A JRuby text editor."
@@ -149,19 +166,19 @@ spec = Gem::Specification.new do |s|
149
166
 
150
167
  s.post_install_message = <<TEXT
151
168
 
152
- ------------------------------------------------------------------------------------
169
+ -------------------------------------------------------------------------------
153
170
 
154
171
  Please now run:
155
172
 
156
173
  $ redcar install
157
174
 
158
- to complete the installation. (NB do NOT use sudo. In previous versions, sudo was
159
- required for this step, but now it should be run as the user.)
175
+ to complete the installation. (NB. do NOT use sudo. In previous versions,
176
+ sudo was required for this step, but now it should be run as the user.)
160
177
 
161
- NB. This will download jars that Redcar needs to run from the internet. It will put
162
- them into ~/.redcar/assets.
178
+ NB. This will download jars that Redcar needs to run from the internet.
179
+ It will put them into ~/.redcar/assets.
163
180
 
164
- ------------------------------------------------------------------------------------
181
+ -------------------------------------------------------------------------------
165
182
 
166
183
  TEXT
167
184
  end
@@ -170,65 +187,6 @@ Rake::GemPackageTask.new(spec) do |pkg|
170
187
  pkg.gem_spec = spec
171
188
  end
172
189
 
173
- desc "Build a MacOS X App bundle"
174
- task :app_bundle => :build do
175
- require 'erb'
176
-
177
- redcar_icon = "redcar_icon_beta.png"
178
-
179
- bundle_contents = File.join("pkg", "Redcar.app", "Contents")
180
- FileUtils.rm_rf bundle_contents if File.exist? bundle_contents
181
- macos_dir = File.join(bundle_contents, "MacOS")
182
- resources_dir = File.join(bundle_contents, "Resources")
183
- FileUtils.mkdir_p macos_dir
184
- FileUtils.mkdir_p resources_dir
185
-
186
- info_plist_template = ERB.new <<-PLIST
187
- <?xml version="1.0" encoding="UTF-8"?>
188
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
189
- <plist version="1.0">
190
- <dict>
191
- <key>CFBundleExecutable</key>
192
- <string>redcar</string>
193
- <key>CFBundleIconFile</key>
194
- <string><%= redcar_icon %></string>
195
- <key>CFBundleIdentifier</key>
196
- <string>com.redcareditor.Redcar</string>
197
- <key>CFBundleInfoDictionaryVersion</key>
198
- <string>6.0</string>
199
- <key>CFBundlePackageType</key>
200
- <string>APPL</string>
201
- <key>CFBundleSignature</key>
202
- <string>????</string>
203
- <key>CFBundleVersion</key>
204
- <string><%= spec.version %></string>
205
- <key>LSMinimumSystemVersion</key>
206
- <string>10.5</string>
207
- </dict>
208
- </plist>
209
- PLIST
210
- File.open(File.join(bundle_contents, "Info.plist"), "w") do |f|
211
- f << info_plist_template.result(binding)
212
- end
213
-
214
- File.open(File.join(macos_dir, "redcar"), "w") do |f|
215
- f << '#!/bin/sh
216
- DIR=$(cd "$(dirname "$0")"; pwd)
217
- REDCAR=$(cd "$(dirname "${DIR}/../Resources/bin/redcar")"; pwd)
218
- $REDCAR/redcar install
219
- $REDCAR/redcar --ignore-stdin $@'
220
- end
221
- File.chmod 0777, File.join(macos_dir, "redcar")
222
-
223
- spec.files.each do |f|
224
- FileUtils.mkdir_p File.join(resources_dir, File.dirname(f))
225
- FileUtils.cp_r f, File.join(resources_dir, f), :remove_destination => true
226
- end
227
-
228
- FileUtils.cp_r File.join(resources_dir, "plugins", "application", "icons", redcar_icon),
229
- resources_dir, :remove_destination => true
230
- end
231
-
232
190
  desc 'Run a watchr continuous integration daemon for the specs'
233
191
  task :run_ci do
234
192
  require 'watchr'
data/bin/redcar CHANGED
@@ -13,7 +13,7 @@ if ARGV.include? '--silent'
13
13
  STDERR.reopen STDOUT
14
14
  end
15
15
 
16
- if ARGV.first == "install"
16
+ if ARGV.include? "install"
17
17
  require File.expand_path(File.join(File.dirname(__FILE__), %w(.. lib redcar)))
18
18
  require 'redcar/installer'
19
19
  require 'redcar/runner'
data/lib/redcar.rb CHANGED
@@ -51,9 +51,9 @@ end
51
51
  #
52
52
  # and so on.
53
53
  module Redcar
54
- VERSION = '0.7' # also change in the Rakefile!
54
+ VERSION = '0.8' # also change in the Rakefile!
55
55
  VERSION_MAJOR = 0
56
- VERSION_MINOR = 7
56
+ VERSION_MINOR = 8
57
57
  VERSION_RELEASE = 0
58
58
 
59
59
  ENVIRONMENTS = [:user, :debug, :test]
@@ -201,14 +201,17 @@ module Redcar
201
201
  #
202
202
  # @return [String] expanded path
203
203
  def self.home_dir
204
- if platform == :windows
204
+ @userdir ||= if arg = ARGV.detect {|v| v.start_with? "--home-dir=" }
205
+ arg =~ /\-\-home\-dir=(.*)/
206
+ File.expand_path($1)
207
+ elsif platform == :windows
205
208
  if ENV['USERPROFILE'].nil?
206
- userdir = "C:/My Documents/"
209
+ "C:/My Documents/"
207
210
  else
208
- userdir = ENV['USERPROFILE']
211
+ ENV['USERPROFILE']
209
212
  end
210
213
  else
211
- userdir = ENV['HOME'] unless ENV['HOME'].nil?
214
+ ENV['HOME'] unless ENV['HOME'].nil?
212
215
  end
213
216
  end
214
217
 
@@ -38,7 +38,7 @@ module Redcar
38
38
 
39
39
  def assets_by_platform
40
40
  { :all => {
41
- "http://jruby.org.s3.amazonaws.com/downloads/1.5.2/jruby-complete-1.5.2.jar" => "/jruby-complete-1.5.2.jar",
41
+ "http://jruby.org.s3.amazonaws.com/downloads/1.5.3/jruby-complete-1.5.3.jar" => "/jruby-complete-1.5.3.jar",
42
42
  "http://redcar.s3.amazonaws.com/jface/org.eclipse.core.commands.jar" => nil,
43
43
  "http://redcar.s3.amazonaws.com/jface/org.eclipse.core.runtime_3.5.0.v20090525.jar" => nil,
44
44
  "http://redcar.s3.amazonaws.com/jface/org.eclipse.equinox.common.jar" => nil,
@@ -20,6 +20,25 @@ class String
20
20
  downcase
21
21
  end
22
22
 
23
+ def chars
24
+ r = split(//)
25
+ def r.to_s
26
+ join("")
27
+ end
28
+ r
29
+ end
30
+
31
+ def byte_offset_to_char_offset(byte_offset)
32
+ self[0...byte_offset].chars.length
33
+ end
34
+
35
+ def char_offset_to_byte_offset(char_offset)
36
+ self.chars[0...char_offset].to_s.length
37
+ end
38
+
39
+ def to_java
40
+ java.lang.String.new(to_java_bytes, "UTF8")
41
+ end
23
42
  end
24
43
 
25
44
  class Object
data/lib/redcar/runner.rb CHANGED
@@ -51,7 +51,7 @@ module Redcar
51
51
  # our vendored jarred one (useful for gems).
52
52
  def construct_command(args="")
53
53
  bin = File.expand_path(File.join(File.dirname(__FILE__), %w{.. .. bin redcar}))
54
- jruby_complete = File.expand_path(File.join(Redcar.asset_dir, "jruby-complete-1.5.2.jar"))
54
+ jruby_complete = File.expand_path(File.join(Redcar.asset_dir, "jruby-complete-1.5.3.jar"))
55
55
  unless File.exist?(jruby_complete)
56
56
  puts "\nCan't find jruby jar at #{jruby_complete}, did you run 'redcar install' ?"
57
57
  exit 1
data/lib/redcar/usage.rb CHANGED
@@ -24,6 +24,9 @@ module Redcar
24
24
  puts "--untitled-file=PATH Open the given file as an untitled tab."
25
25
  puts " --ignore-stdin Ignore stdin."
26
26
  puts " --fork Detach from the console."
27
+ puts " --no-window Don't force opening a window on Redcar startup"
28
+ puts " --home-dir=PATH Use the specified directory as Redcar home directory"
29
+ puts " -w Open the specified files and wait until they are closed"
27
30
  #puts "To associate with right click in windows explorer:"
28
31
  #puts
29
32
  #puts " C:> redcar --associate_with_any_right_click"
@@ -40,19 +40,19 @@ module Redcar
40
40
 
41
41
  if ARGV.any?
42
42
  ARGV.each do |arg|
43
- if File.file?(arg) or File.directory?(arg)
44
- if drb.open_item_drb(File.expand_path(arg)) != 'ok'
45
- return
46
- end
47
- end
48
43
  if arg =~ /--untitled-file=(.*)/
49
- path = $1
50
- if File.file?(path)
51
- if drb.open_item_untitled(File.expand_path(path)) != 'ok'
52
- return
53
- end
54
- end
44
+ path = $1 if File.file?($1)
45
+ untitled = true
46
+ elsif File.file?(arg) or File.directory?(arg)
47
+ path = File.expand_path(arg)
48
+ end
49
+ next unless path
50
+ if ARGV.include? "-w" and File.file?(path)
51
+ drb_answer = drb.open_file_and_wait(path, untitled)
52
+ else
53
+ drb_answer = drb.open_item_drb(path, untitled)
55
54
  end
55
+ return unless drb_answer == 'ok'
56
56
  end
57
57
  else
58
58
  return unless drb.open_item_drb('just_bring_to_front')
@@ -1,11 +1,15 @@
1
1
 
2
2
  When /^I expand the tree row "([^\"]*)"$/ do |row|
3
- item = top_tree.items.detect {|item| item.getText == row }
3
+ item = visible_tree_items(top_tree).detect {|item| item.getText == row }
4
4
  viewer = focussed_tree.controller.viewer
5
5
  node = viewer.getViewerRowFromItem(item).getElement
6
6
  viewer.expandToLevel(node, 1)
7
7
  end
8
8
 
9
+ When /^I toggle tree visibility$/ do
10
+ Redcar::Top::ToggleTreesCommand.new.run
11
+ end
12
+
9
13
  Then /^I should (not )?see "([^\"]*)" in the tree$/ do |negate, rows|
10
14
  item_names = visible_tree_items(top_tree).map(&:get_text)
11
15
  rows.split(',').map(&:strip).each do |row|
@@ -17,10 +21,14 @@ Then /^I should (not )?see "([^\"]*)" in the tree$/ do |negate, rows|
17
21
  end
18
22
  end
19
23
 
20
- Then /^the tree width should be the default$/ do
24
+ Then /^the tree width should be (0|the default)$/ do |w|
21
25
  width = Redcar.app.focussed_window.treebook.controller.tab_folder.bounds.width
22
- default = Redcar::ApplicationSWT::Window::TREEBOOK_WIDTH + Redcar::ApplicationSWT::Window::SASH_WIDTH - 5
23
- raise "The tree width was #{width}, expected #{default}" unless width == default
26
+ if w == 0
27
+ width.should == 0
28
+ else
29
+ default = Redcar::ApplicationSWT::Window::TREEBOOK_WIDTH + Redcar::ApplicationSWT::Window::SASH_WIDTH - 5
30
+ raise "The tree width was #{width}, expected #{default}" unless width == default
31
+ end
24
32
  end
25
33
 
26
34
  When /^I activate the "([^"]*)" node in the tree$/ do |node_text|
@@ -30,6 +38,15 @@ When /^I activate the "([^"]*)" node in the tree$/ do |node_text|
30
38
  node = find_node_with_text(mirror.top, node_text)
31
39
 
32
40
  node.should_not be_nil
33
-
41
+
34
42
  controller.activated(model, node)
43
+ end
44
+
45
+ When /^I rename the "([^"]*)" node in the tree$/ do |node_text|
46
+ controller = focussed_tree.tree_controller
47
+ mirror = focussed_tree.tree_mirror
48
+ node = find_node_with_text(mirror.top, node_text)
49
+
50
+ node.should_not be_nil
51
+ controller.single_rename(focussed_tree, node)
35
52
  end
@@ -1,4 +1,12 @@
1
1
 
2
2
  Then /^the window should have title "([^\"]*)"$/ do |expected_title|
3
3
  active_shell.get_text.should == expected_title
4
- end
4
+ end
5
+
6
+ When /^I manually widen the treebook (only a few pixels|to show the sash)$/ do |w|
7
+ if w =~ /^only/
8
+ focussed_window.controller.send(:set_sash_widths, Redcar::ApplicationSWT::Window::SASH_WIDTH-1)
9
+ else
10
+ focussed_window.controller.send(:set_sash_widths, Redcar::ApplicationSWT::Window::SASH_WIDTH)
11
+ end
12
+ end