redcar 0.11.0dev → 0.11
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +14 -1
- data/README.md +28 -8
- data/Rakefile +23 -18
- data/bin/redcar +9 -4
- data/lib/redcar.rb +42 -4
- data/lib/redcar/installer.rb +7 -2
- data/lib/redcar/logger.rb +64 -0
- data/lib/redcar/runner.rb +17 -8
- data/lib/redcar/usage.rb +2 -0
- data/plugins/application/features/step_definitions/tree_steps.rb +4 -4
- data/plugins/application/features/support/env.rb +6 -6
- data/plugins/application/lib/application.rb +31 -3
- data/plugins/application/lib/application/command.rb +6 -0
- data/plugins/application/lib/application/command/executor.rb +0 -1
- data/plugins/application/lib/application/commands/application_commands.rb +21 -0
- data/plugins/application/lib/application/commands/notebook_commands.rb +73 -0
- data/plugins/application/lib/application/commands/tab_commands.rb +105 -0
- data/plugins/application/lib/application/commands/treebook_commands.rb +117 -0
- data/plugins/application/lib/application/commands/window_commands.rb +68 -0
- data/plugins/{tree/lib → application/lib/application}/tree.rb +0 -4
- data/plugins/{tree/lib → application/lib/application}/tree/command.rb +0 -0
- data/plugins/{tree/lib → application/lib/application}/tree/controller.rb +0 -0
- data/plugins/{tree/lib → application/lib/application}/tree/mirror.rb +0 -0
- data/plugins/application/spec/application/keymap/builder_spec.rb +1 -1
- data/plugins/application/spec/application/menu/builder_spec.rb +2 -2
- data/plugins/application_swt/lib/application_swt.rb +4 -2
- data/plugins/application_swt/lib/swt/vtab_label.rb +6 -3
- data/plugins/auto_indenter/lib/auto_indenter/document_controller.rb +6 -3
- data/plugins/clojure/lib/clojure.rb +2 -2
- data/plugins/core/lib/core.rb +0 -4
- data/plugins/core/lib/core/gui.rb +2 -4
- data/plugins/core/lib/core/plugin/storage.rb +68 -21
- data/plugins/core/spec/core/base_storage_spec.rb +81 -0
- data/plugins/core/spec/core/shared_storage_spec.rb +49 -0
- data/plugins/core/spec/core/storage_spec.rb +13 -63
- data/plugins/declarations/lib/declarations.rb +3 -1
- data/plugins/document_search/features/replace.feature +29 -20
- data/plugins/document_search/lib/document_search/find_speedbar.rb +4 -1
- data/plugins/edit_view/features/indentation_commands.feature +6 -5
- data/plugins/edit_view/features/step_definitions/notebook_steps.rb +4 -4
- data/plugins/edit_view/features/step_definitions/tab_steps.rb +7 -7
- data/plugins/edit_view/features/step_definitions/window_steps.rb +2 -2
- data/plugins/edit_view/lib/edit_view.rb +15 -1
- data/plugins/edit_view/lib/edit_view/modified_tabs_checker.rb +7 -7
- data/plugins/edit_view_swt/lib/edit_view_swt.rb +7 -6
- data/plugins/execute_current_tab/lib/execute_current_tab.rb +1 -1
- data/plugins/groovy/lib/groovy.rb +3 -3
- data/plugins/groovy/lib/groovy/commands.rb +1 -1
- data/plugins/help/lib/help/view_controller.rb +5 -0
- data/plugins/help/views/index.html.erb +10 -1
- data/plugins/html_view/features/step_definitions/html_view_steps.rb +1 -1
- data/plugins/html_view/features/support/env.rb +0 -15
- data/plugins/html_view/lib/html_view.rb +3 -4
- data/plugins/html_view/lib/html_view/commands.rb +1 -1
- data/plugins/key_bindings/lib/key_bindings.rb +34 -0
- data/plugins/key_bindings/plugin.rb +8 -0
- data/plugins/{tree → key_bindings}/spec/spec_helper.rb +0 -0
- data/plugins/line_tools/features/lower_text.feature +3 -4
- data/plugins/line_tools/lib/line_tools.rb +6 -5
- data/plugins/mirah/lib/mirah.rb +2 -2
- data/plugins/pair_highlighter/lib/pair_highlighter/document_controller.rb +5 -3
- data/plugins/project/features/open_directory_tree.feature +1 -1
- data/plugins/project/features/step_definitions/file_steps.rb +5 -5
- data/plugins/project/features/step_definitions/find_file_steps.rb +2 -3
- data/plugins/project/features/support/env.rb +4 -0
- data/plugins/project/lib/project.rb +15 -9
- data/plugins/project/lib/project/commands.rb +46 -16
- data/plugins/project/lib/project/dir_controller.rb +1 -1
- data/plugins/project/lib/project/dir_mirror.rb +3 -2
- data/plugins/project/lib/project/drb_service.rb +3 -1
- data/plugins/project/lib/project/file_list.rb +99 -21
- data/plugins/project/lib/project/find_file_dialog.rb +8 -24
- data/plugins/project/lib/project/manager.rb +68 -12
- data/plugins/project/lib/project/project_tree_controller.rb +1 -1
- data/plugins/project/plugin.rb +1 -2
- data/plugins/project_search/features/word_search.feature +1 -1
- data/plugins/project_search/lib/project_search.rb +16 -6
- data/plugins/project_search/lib/project_search/commands.rb +15 -28
- data/plugins/project_search/lib/project_search/hit.rb +4 -0
- data/plugins/project_search/lib/project_search/lucene_index.rb +14 -4
- data/plugins/project_search/lib/project_search/views/_file.html.erb +11 -11
- data/plugins/project_search/lib/project_search/word_search.rb +22 -4
- data/plugins/project_search/spec/project_search/word_search_spec.rb +2 -2
- data/plugins/redcar/redcar.rb +140 -588
- data/plugins/repl/features/step_definitions/repl_steps.rb +3 -3
- data/plugins/repl/features/support/fake_repl.rb +1 -1
- data/plugins/ruby/lib/ruby.rb +4 -4
- data/plugins/runnables/features/fixtures/alternate.ruby +1 -0
- data/plugins/runnables/features/fixtures/line_app.rb +1 -0
- data/plugins/runnables/features/fixtures/name_app.rb +1 -0
- data/plugins/runnables/features/fixtures/params_app.rb +1 -0
- data/plugins/runnables/features/fixtures/runnable_app.rb +1 -0
- data/plugins/runnables/lib/runnables.rb +21 -0
- data/plugins/runnables/lib/runnables/command_output_controller.rb +14 -9
- data/plugins/runnables/lib/runnables/output_processor.rb +4 -4
- data/plugins/runnables/lib/runnables/running_process_checker.rb +6 -6
- data/plugins/runnables/plugin.rb +1 -2
- data/plugins/scm/lib/scm.rb +18 -18
- data/plugins/scm/lib/scm/commit_mirror.rb +2 -2
- data/plugins/scm/lib/scm/scm_changes_controller.rb +1 -1
- data/plugins/scm_hg/lib/scm_hg.rb +1 -1
- data/plugins/snippets/lib/snippets/document_controller.rb +46 -40
- data/plugins/swt/lib/swt.rb +2 -0
- data/plugins/test_runner/lib/test_runner.rb +1 -0
- data/plugins/test_runner/lib/test_runner/jasmine_test_runner.rb +15 -0
- data/plugins/test_runner/lib/test_runner/runnable_test_runner.rb +21 -5
- data/plugins/textmate/lib/textmate.rb +5 -1
- data/plugins/textmate/lib/textmate/preference.rb +4 -0
- data/plugins/textmate/lib/textmate/snippet.rb +0 -2
- data/plugins/textmate/lib/textmate/tree_mirror.rb +6 -5
- data/plugins/textmate/plugin.rb +1 -1
- data/plugins/textmate/vendor/redcar-bundles/Bundles/C.tmbundle/Syntaxes/C.plist +2 -2
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Clojure.tmbundle/info.plist +2 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Cucumber.tmbundle/Syntaxes/Cucumber_Plain_Text_Feature.tmLanguage +0 -4
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Cucumber.tmbundle/info.plist +2 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Mirah.tmbundle/info.plist +3 -1
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Palm-WebOS-Development.tmbundle/info.plist +2 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/RedcarRepl.tmbundle/info.plist +2 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/SQL.tmbundle/info.plist +2 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Scala.tmbundle/info.plist +2 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Smalltalk.tmbundle/Preferences/GNU_Smalltalk.tmPreferences +1 -1
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Smalltalk.tmbundle/Preferences/MIST_Smalltalk_Format.tmPreferences +1 -1
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Smalltalk.tmbundle/info.plist +2 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Vala.tmbundle/info.plist +4 -2
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Webrat.tmbundle/info.plist +2 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/YAML.tmbundle/Syntaxes/YAML.plist +1 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/groovy.tmbundle/info.plist +2 -0
- data/plugins/textmate/vendor/redcar-bundles/Themes/Twilight.tmTheme +0 -2
- data/plugins/todo_list/lib/todo_list.rb +3 -3
- data/plugins/todo_list/lib/todo_list/todo_controller.rb +1 -1
- data/plugins/web_bookmarks/features/step_definitions/web_steps.rb +1 -1
- data/plugins/web_bookmarks/lib/web_bookmarks.rb +11 -4
- data/plugins/web_bookmarks/lib/web_bookmarks/commands.rb +1 -1
- data/plugins/web_bookmarks/plugin.rb +1 -2
- metadata +29 -20
- data/plugins/core/lib/core/logger.rb +0 -28
- data/plugins/file_parser/lib/file_parser.rb +0 -125
- data/plugins/file_parser/plugin.rb +0 -7
- data/plugins/tree/plugin.rb +0 -9
data/CHANGES
CHANGED
@@ -3,14 +3,27 @@ Version 0.11 (TBA)
|
|
3
3
|
|
4
4
|
Enhancements:
|
5
5
|
|
6
|
+
* Project search backed by Lucene (Dan Lucraft)
|
6
7
|
* Fuzzy file finder now recognizes directories "a/c/repocontr" (Tim Felgentreff)
|
7
8
|
* Recent project fuzzy finder (Benedikt Müller)
|
8
9
|
* Improved DocumentSearch, with UI refinements, added Replace All commands (Tom Murray)
|
9
10
|
* Raise/lower region behaves better when you select multiple lines (Benedikt Müller)
|
10
|
-
*
|
11
|
+
* Which files are hidden in a project is now configurable (Konstantin Haase)
|
12
|
+
* Added logger at Redcar.log, goes to ~/.redcar/user.log (Dan Lucraft)
|
13
|
+
* Can hide files and directories from the project context menu (Benedikt Müller)
|
14
|
+
* Notification if Redcar doesn't have permission to save files (Benedikt Müller & Bill Siggelkow)
|
15
|
+
* Tweaked the load order to make the window appear faster during startup (Dan Lucraft)
|
16
|
+
* All the plugins use a single preference value to ignore files (Benedikt Müller & Daniel Lucraft)
|
17
|
+
* Can ignore directories (Benedikt Müller)
|
18
|
+
* User definable keybindings (Chris Nelson)
|
11
19
|
|
12
20
|
Bugfixes:
|
13
21
|
* Fixed Unicode problems in DocumentSearch (Tom Murray)
|
22
|
+
* You can now symlink bin/redcar (Konstantin Haase)
|
23
|
+
* Runnables are now terminated correctly when the tab is closed (Dan Lucraft)
|
24
|
+
* You are once again prompted when you close a window with running Runnables in (Dan Lucraft)
|
25
|
+
* Fix encoding issue that broke highlighting when there are multi-byte characters in a line (Dan Lucraft)
|
26
|
+
* Fixed project-dependent trees remaining open when project is closed (Delisa Mason)
|
14
27
|
|
15
28
|
Version 0.10 (17 January 2011)
|
16
29
|
==============================
|
data/README.md
CHANGED
@@ -1,15 +1,34 @@
|
|
1
1
|
{Redcar}
|
2
2
|
========
|
3
3
|
|
4
|
-
http://
|
4
|
+
[http://redcareditor.com/](http://redcareditor.com/)
|
5
5
|
|
6
6
|
## DESCRIPTION
|
7
7
|
|
8
|
-
A
|
8
|
+
A Ruby text editor.
|
9
|
+
|
10
|
+
* written in Ruby from the ground up
|
11
|
+
* runs on JRuby (a fast, compatible Ruby implementation)
|
12
|
+
* is cross-platform (Linux, Mac OS X, Windows)
|
13
|
+
* highly extensible
|
14
|
+
|
15
|
+
Some Redcar features:
|
16
|
+
|
17
|
+
* supports Textmate themes and snippets
|
18
|
+
* split screen mode
|
19
|
+
* syntax checking for many languages
|
20
|
+
* built in REPLs for Ruby, Groovy, Clojure and Mirah.
|
21
|
+
|
22
|
+
Some (current) limitations:
|
23
|
+
|
24
|
+
* Only supports UTF-8 file encodings (and therefore ASCII)
|
25
|
+
|
26
|
+
![alt text](http://redcareditor.com/images/redcar-4-thumb.png "Title")
|
27
|
+
![alt text](http://redcareditor.com/images/redcar-1-thumb.png "Title")
|
9
28
|
|
10
29
|
## INSTALLATION
|
11
30
|
|
12
|
-
You must have Java installed [1].
|
31
|
+
You must have Java installed [1]. Redcar is easiest to install as a gem. After installing the gem there is one further install step:
|
13
32
|
|
14
33
|
$ sudo gem install redcar
|
15
34
|
$ redcar install
|
@@ -49,7 +68,7 @@ To run:
|
|
49
68
|
|
50
69
|
$ ruby bin/redcar
|
51
70
|
|
52
|
-
|
71
|
+
### Updating a source build
|
53
72
|
|
54
73
|
If you are running a source version of Redcar and you have pulled changes from master, then you may have to update your repo:
|
55
74
|
|
@@ -60,15 +79,16 @@ If you are running a source version of Redcar and you have pulled changes from m
|
|
60
79
|
|
61
80
|
NB. Redcar features are known to work with Cucumber 0.9.2, and known NOT to work with Cucumber < 0.9
|
62
81
|
|
63
|
-
To run the tests you need JRuby installed. You also need rspec and cucumber installed as
|
82
|
+
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.
|
64
83
|
|
65
84
|
To run all specs and features:
|
66
85
|
|
86
|
+
$ jruby -S bundle install
|
67
87
|
$ jruby -S rake
|
68
88
|
|
69
89
|
NB. You must leave the test window focussed while the features run. Some of the tests will fail if the test process is in the background.
|
70
90
|
|
71
|
-
|
91
|
+
### Specs
|
72
92
|
|
73
93
|
On OSX:
|
74
94
|
|
@@ -79,7 +99,7 @@ On Linux:
|
|
79
99
|
$ jruby -S spec plugins/#{plugin_name}/spec/
|
80
100
|
|
81
101
|
|
82
|
-
|
102
|
+
### Features
|
83
103
|
|
84
104
|
On OSX:
|
85
105
|
|
@@ -91,5 +111,5 @@ On Linux:
|
|
91
111
|
|
92
112
|
## LICENSE
|
93
113
|
|
94
|
-
Redcar is copyright 2007-
|
114
|
+
Redcar is copyright 2007-2011 Daniel Lucraft and contributors.
|
95
115
|
It is licensed under the GPL2. See the included LICENSE file for details.
|
data/Rakefile
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
-
REDCAR_VERSION = "0.11
|
1
|
+
REDCAR_VERSION = "0.11" # also change in lib/redcar.rb!
|
2
2
|
require 'rubygems'
|
3
3
|
require 'fileutils'
|
4
|
+
|
5
|
+
# explitely use rspec < 2.0
|
6
|
+
gem 'rspec', '<2.0'
|
4
7
|
require 'spec/rake/spectask'
|
5
8
|
require 'cucumber/rake/task'
|
6
9
|
require "rake/gempackagetask"
|
@@ -29,7 +32,7 @@ begin
|
|
29
32
|
'plugins/*/lib/**/*.rb'
|
30
33
|
]
|
31
34
|
t.options = ['--markup', 'markdown']
|
32
|
-
end
|
35
|
+
end
|
33
36
|
rescue LoadError
|
34
37
|
end
|
35
38
|
|
@@ -126,9 +129,9 @@ task :specs do
|
|
126
129
|
files = Dir['plugins/*/spec/*/*_spec.rb'] + Dir['plugins/*/spec/*/*/*_spec.rb'] + Dir['plugins/*/spec/*/*/*/*_spec.rb']
|
127
130
|
case Config::CONFIG["host_os"]
|
128
131
|
when "darwin"
|
129
|
-
sh("jruby -J-XstartOnFirstThread -S spec -c #{files.join(" ")} && echo 'done'")
|
132
|
+
sh("jruby -J-XstartOnFirstThread -S bundle exec spec -c #{files.join(" ")} && echo 'done'")
|
130
133
|
else
|
131
|
-
sh("jruby -S spec -c #{files.join(" ")} && echo 'done'")
|
134
|
+
sh("jruby -S bundle exec spec -c #{files.join(" ")} && echo 'done'")
|
132
135
|
end
|
133
136
|
end
|
134
137
|
|
@@ -152,6 +155,8 @@ task :build do
|
|
152
155
|
cd "plugins/application_swt" do
|
153
156
|
sh "ant"
|
154
157
|
end
|
158
|
+
cp "plugins/edit_view_swt/vendor/java-mateview.jar", "#{ENV['HOME']}/.redcar/assets/java-mateview-#{REDCAR_VERSION}.jar"
|
159
|
+
cp "plugins/application_swt/lib/dist/application_swt.jar", "#{ENV['HOME']}/.redcar/assets/application_swt-#{REDCAR_VERSION}.jar"
|
155
160
|
end
|
156
161
|
|
157
162
|
def remove_gitignored_files(filelist)
|
@@ -167,16 +172,16 @@ def remove_matching_files(list, string)
|
|
167
172
|
end
|
168
173
|
|
169
174
|
def gem_manifest
|
170
|
-
r = %w(CHANGES LICENSE Rakefile README.md) +
|
171
|
-
Dir.glob("bin/redcar") +
|
172
|
-
Dir.glob("config/**/*") +
|
173
|
-
Dir.glob("share/**/*") +
|
174
|
-
remove_gitignored_files(Dir.glob("lib/**/*")) +
|
175
|
-
remove_matching_files(remove_gitignored_files(Dir.glob("plugins/**/*")), "redcar-bundles") +
|
176
|
-
Dir.glob("plugins/textmate/vendor/redcar-bundles/Bundles/*.tmbundle/Syntaxes/**/*") +
|
177
|
-
Dir.glob("plugins/textmate/vendor/redcar-bundles/Bundles/*.tmbundle/Preferences/**/*") +
|
178
|
-
Dir.glob("plugins/textmate/vendor/redcar-bundles/Bundles/*.tmbundle/Snippets/**/*") +
|
179
|
-
Dir.glob("plugins/textmate/vendor/redcar-bundles/Bundles/*.tmbundle/info.plist") +
|
175
|
+
r = %w(CHANGES LICENSE Rakefile README.md) +
|
176
|
+
Dir.glob("bin/redcar") +
|
177
|
+
Dir.glob("config/**/*") +
|
178
|
+
Dir.glob("share/**/*") +
|
179
|
+
remove_gitignored_files(Dir.glob("lib/**/*")) +
|
180
|
+
remove_matching_files(remove_gitignored_files(Dir.glob("plugins/**/*")), "redcar-bundles") +
|
181
|
+
Dir.glob("plugins/textmate/vendor/redcar-bundles/Bundles/*.tmbundle/Syntaxes/**/*") +
|
182
|
+
Dir.glob("plugins/textmate/vendor/redcar-bundles/Bundles/*.tmbundle/Preferences/**/*") +
|
183
|
+
Dir.glob("plugins/textmate/vendor/redcar-bundles/Bundles/*.tmbundle/Snippets/**/*") +
|
184
|
+
Dir.glob("plugins/textmate/vendor/redcar-bundles/Bundles/*.tmbundle/info.plist") +
|
180
185
|
Dir.glob("plugins/textmate/vendor/redcar-bundles/Themes/*.tmTheme")
|
181
186
|
remove_matching_files(r, "multi-byte")
|
182
187
|
end
|
@@ -236,7 +241,7 @@ task :run_ci do
|
|
236
241
|
a = "jruby -S spec #{filename} --backtrace"
|
237
242
|
puts a
|
238
243
|
system a
|
239
|
-
end
|
244
|
+
end
|
240
245
|
|
241
246
|
spec_filename = "#{filename[1]}_spec.rb"
|
242
247
|
spec = Dir["**/#{spec_filename}"]
|
@@ -292,13 +297,13 @@ namespace :redcar do
|
|
292
297
|
|
293
298
|
tasks = Rake::Task.tasks
|
294
299
|
runnables = []
|
295
|
-
ruby_bin = Config::CONFIG["bindir"] + "/ruby -r#{File.dirname(__FILE__)}/.redcar/runnables/sync_stdout.rb "
|
300
|
+
ruby_bin = Config::CONFIG["bindir"] + "/ruby -r#{File.dirname(__FILE__)}/.redcar/runnables/sync_stdout.rb "
|
296
301
|
tasks.each do |task|
|
297
302
|
name = task.name.gsub(":", "/")
|
298
303
|
command = ruby_bin + $0 + " " + task.name
|
299
304
|
runnables << {
|
300
305
|
"name" => name,
|
301
|
-
"command" => command,
|
306
|
+
"command" => command,
|
302
307
|
"description" => task.comment,
|
303
308
|
"type" => "task/ruby/rake"
|
304
309
|
}
|
@@ -308,7 +313,7 @@ namespace :redcar do
|
|
308
313
|
f.puts(JSON.pretty_generate(data))
|
309
314
|
end
|
310
315
|
File.open(".redcar/runnables/ruby.json", "w") do |f|
|
311
|
-
data = {"file_runners" =>
|
316
|
+
data = {"file_runners" =>
|
312
317
|
[
|
313
318
|
{
|
314
319
|
"regex" => ".*.rb$",
|
data/bin/redcar
CHANGED
@@ -1,9 +1,13 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
$KCODE='U' unless RUBY_VERSION > "1.9.0"
|
3
3
|
$redcar_process_start_time = Time.now
|
4
|
-
$VERBOSE =
|
4
|
+
$VERBOSE = ARGV.include? '--verbose'
|
5
|
+
|
6
|
+
file = __FILE__
|
7
|
+
file = File.readlink(file) while File.symlink?(file)
|
8
|
+
|
9
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', file)
|
5
10
|
|
6
|
-
$:.push(File.join(File.dirname(__FILE__), %w(.. lib)))
|
7
11
|
require "redcar_quick_start"
|
8
12
|
|
9
13
|
if ARGV.include? '--silent'
|
@@ -14,7 +18,7 @@ if ARGV.include? '--silent'
|
|
14
18
|
end
|
15
19
|
|
16
20
|
if ARGV.include? "install"
|
17
|
-
require
|
21
|
+
require 'redcar'
|
18
22
|
require 'redcar/installer'
|
19
23
|
require 'redcar/runner'
|
20
24
|
installer = Redcar::Installer.new
|
@@ -22,8 +26,9 @@ if ARGV.include? "install"
|
|
22
26
|
else
|
23
27
|
Redcar.read_stdin
|
24
28
|
exit if Redcar.try_to_load_via_drb
|
25
|
-
require
|
29
|
+
require 'redcar'
|
26
30
|
Redcar.environment = :user
|
31
|
+
Redcar.log.info("REDCAR #{Redcar::VERSION} start (start time was #{Redcar.process_start_time})")
|
27
32
|
Redcar.spin_up
|
28
33
|
Redcar.load_threaded
|
29
34
|
Redcar.show_splash
|
data/lib/redcar.rb
CHANGED
@@ -8,6 +8,7 @@ require 'redcar/usage'
|
|
8
8
|
require 'redcar/ruby_extensions'
|
9
9
|
require 'redcar/instance_exec'
|
10
10
|
require 'redcar/usage'
|
11
|
+
require 'redcar/logger'
|
11
12
|
require 'regex_replace'
|
12
13
|
|
13
14
|
require 'forwardable'
|
@@ -51,7 +52,7 @@ end
|
|
51
52
|
#
|
52
53
|
# and so on.
|
53
54
|
module Redcar
|
54
|
-
VERSION = '0.11
|
55
|
+
VERSION = '0.11' # also change in the Rakefile!
|
55
56
|
VERSION_MAJOR = 0
|
56
57
|
VERSION_MINOR = 11
|
57
58
|
VERSION_RELEASE = 0
|
@@ -105,15 +106,18 @@ module Redcar
|
|
105
106
|
$:.push File.expand_path(File.join(File.dirname(__FILE__), "plugin_manager", "lib"))
|
106
107
|
require 'plugin_manager'
|
107
108
|
|
108
|
-
$:.push File.expand_path(File.join(File.dirname(__FILE__), "json", "lib"))
|
109
|
-
require 'json'
|
110
|
-
|
111
109
|
$:.push File.expand_path(File.join(Redcar.asset_dir))
|
112
110
|
|
111
|
+
$:.push File.expand_path(File.join(File.dirname(__FILE__), "json", "lib"))
|
112
|
+
require 'json'
|
113
|
+
|
113
114
|
$:.push File.expand_path(File.join(File.dirname(__FILE__), "openssl", "lib"))
|
114
115
|
|
115
116
|
plugin_manager.load("swt")
|
116
117
|
end
|
118
|
+
|
119
|
+
def self.load_useful_libraries
|
120
|
+
end
|
117
121
|
|
118
122
|
def self.load_plugins
|
119
123
|
begin
|
@@ -231,6 +235,40 @@ module Redcar
|
|
231
235
|
return if Redcar.no_gui_mode?
|
232
236
|
@gui = gui
|
233
237
|
end
|
238
|
+
|
239
|
+
def self.log
|
240
|
+
@log ||= begin
|
241
|
+
targets = [log_file]
|
242
|
+
targets << STDOUT if show_log?
|
243
|
+
logger = Redcar::Logger.new(*targets)
|
244
|
+
logger.level = custom_log_level
|
245
|
+
at_exit { logger.close }
|
246
|
+
logger
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
250
|
+
def self.log_path
|
251
|
+
user_dir + "/#{environment}.log"
|
252
|
+
end
|
253
|
+
|
254
|
+
def self.log_file
|
255
|
+
File.open(log_path, "a")
|
256
|
+
end
|
257
|
+
|
258
|
+
def self.show_log?
|
259
|
+
ARGV.include?("--show-log")
|
260
|
+
end
|
261
|
+
|
262
|
+
def self.custom_log_level
|
263
|
+
ARGV.map {|a| a =~ /--log-level=(info|debug|warn|error)/; $1}.compact.first
|
264
|
+
end
|
265
|
+
|
266
|
+
def self.process_start_time
|
267
|
+
@process_start_time ||= begin
|
268
|
+
t = ARGV.map {|arg| arg =~ /--start-time=(\d+)$/; $1}.compact.first
|
269
|
+
t ? Time.at(t.to_i) : $redcar_process_start_time
|
270
|
+
end
|
271
|
+
end
|
234
272
|
end
|
235
273
|
|
236
274
|
usage = Redcar::Usage.new
|
data/lib/redcar/installer.rb
CHANGED
@@ -64,7 +64,8 @@ module Redcar
|
|
64
64
|
"http://mirrors.ibiblio.org/pub/mirrors/maven2/org/codehaus/groovy/groovy-all/1.7.4/groovy-all-1.7.4.jar" => "/groovy-all.jar",
|
65
65
|
"http://mirrors.ibiblio.org/pub/mirrors/maven2/org/tmatesoft/svnkit/svnkit/1.3.4/svnkit-1.3.4.jar" => "/svnkit.jar",
|
66
66
|
# "http://mirrors.ibiblio.org/pub/mirrors/maven2/rhino/js/1.7R2/js-1.7R2.jar" => "/js.jar",
|
67
|
-
"http://redcar.s3.amazonaws.com/deps/rhino-js-1.7R2.jar" => "/js.jar"
|
67
|
+
"http://redcar.s3.amazonaws.com/deps/rhino-js-1.7R2.jar" => "/js.jar",
|
68
|
+
"http://redcar.s3.amazonaws.com/lucene-core-2.9.1.jar" => "lucene/jars/lucene-core-2.9.1.jar"
|
68
69
|
},
|
69
70
|
:windows => {
|
70
71
|
"http://releases.mozilla.org/pub/mozilla.org/xulrunner/releases/#{xulrunner_version}/runtimes/xulrunner-#{xulrunner_version}.en-US.win32.zip" => "xulrunner-#{xulrunner_version}.en-US.win32.zip",
|
@@ -84,7 +85,11 @@ module Redcar
|
|
84
85
|
def fetch_asset(source, target)
|
85
86
|
relative_target = target || implicit_target(source)
|
86
87
|
absolute_target = File.join(Redcar.asset_dir, relative_target)
|
87
|
-
|
88
|
+
if File.exist?(absolute_target)
|
89
|
+
unless source =~ /dev\.jar/
|
90
|
+
return
|
91
|
+
end
|
92
|
+
end
|
88
93
|
download_file_to(source, absolute_target)
|
89
94
|
unzip_file(absolute_target) if absolute_target =~ /\.zip$/
|
90
95
|
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
|
2
|
+
module Redcar
|
3
|
+
class Logger
|
4
|
+
LEVELS = [:debug, :info, :warn, :error]
|
5
|
+
|
6
|
+
def initialize(*targets)
|
7
|
+
@targets = targets
|
8
|
+
end
|
9
|
+
|
10
|
+
def level
|
11
|
+
@level || :info
|
12
|
+
end
|
13
|
+
|
14
|
+
def level=(val)
|
15
|
+
@level = val ? val.to_sym : nil
|
16
|
+
end
|
17
|
+
|
18
|
+
def close
|
19
|
+
@targets.each {|target| target.close if target.is_a?(File)}
|
20
|
+
end
|
21
|
+
|
22
|
+
def log(msg_level, msg)
|
23
|
+
string = "#{msg_level.to_s.rjust(5, " ")} [#{Time.now.strftime("%x %X")}] #{msg}"
|
24
|
+
@targets.each do |target|
|
25
|
+
target.puts(string)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def should_log?(msg_level)
|
30
|
+
LEVELS.index(msg_level) >= LEVELS.index(level)
|
31
|
+
end
|
32
|
+
|
33
|
+
def error(msg=nil)
|
34
|
+
return unless should_log?(:error)
|
35
|
+
log(:error, (block_given? ? yield : msg))
|
36
|
+
end
|
37
|
+
|
38
|
+
def warn(msg=nil)
|
39
|
+
return unless should_log?(:warn)
|
40
|
+
log(:warn, (block_given? ? yield : msg))
|
41
|
+
end
|
42
|
+
|
43
|
+
def info(msg=nil)
|
44
|
+
return unless should_log?(:info)
|
45
|
+
log(:info, (block_given? ? yield : msg))
|
46
|
+
end
|
47
|
+
|
48
|
+
def debug(msg=nil)
|
49
|
+
return unless should_log?(:debug)
|
50
|
+
log(:debug, (block_given? ? yield : msg))
|
51
|
+
end
|
52
|
+
|
53
|
+
def benchmark(msg, msg_level=:debug)
|
54
|
+
s = Time.now
|
55
|
+
result = yield
|
56
|
+
if should_log?(msg_level)
|
57
|
+
log(msg_level, msg + " (#{Time.now - s}s)")
|
58
|
+
end
|
59
|
+
result
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
|
data/lib/redcar/runner.rb
CHANGED
@@ -60,20 +60,21 @@ module Redcar
|
|
60
60
|
|
61
61
|
# Windows XP updates
|
62
62
|
if [:windows].include?(Redcar.platform)
|
63
|
-
|
64
|
-
|
63
|
+
bin = "\"#{bin}\""
|
64
|
+
jruby_complete = "\"#{jruby_complete}\""
|
65
65
|
end
|
66
66
|
|
67
67
|
# unfortuanately, ruby doesn't support [a, *b, c]
|
68
68
|
command = ["java"]
|
69
69
|
command.push(*java_args)
|
70
70
|
command.push("-Xbootclasspath/a:#{jruby_complete}")
|
71
|
-
command.push("-Xmx320m", "-Xss1024k", "-Djruby.memory.max=320m", "-Djruby.stack.max=1024k", "org.jruby.Main")
|
71
|
+
command.push("-Dfile.encoding=UTF8", "-Xmx320m", "-Xss1024k", "-Djruby.memory.max=320m", "-Djruby.stack.max=1024k", "org.jruby.Main")
|
72
72
|
command.push "--debug" if debug_mode?
|
73
73
|
command.push(bin)
|
74
74
|
command.push(*cleaned_args)
|
75
75
|
command.push("--no-sub-jruby", "--ignore-stdin")
|
76
76
|
command.push(*args)
|
77
|
+
command.push "--start-time=#{$redcar_process_start_time.to_i}"
|
77
78
|
|
78
79
|
puts command.join(' ')
|
79
80
|
yield command
|
@@ -106,16 +107,24 @@ module Redcar
|
|
106
107
|
str.push "-Djruby.debug.loadService.timing=true"
|
107
108
|
end
|
108
109
|
|
109
|
-
str.push "-d32" if JvmOptionsProbe
|
110
|
-
str.push "-client" if JvmOptionsProbe
|
110
|
+
str.push "-d32" if JvmOptionsProbe.d32
|
111
|
+
str.push "-client" if JvmOptionsProbe.client
|
111
112
|
|
112
113
|
str
|
113
114
|
end
|
114
115
|
|
115
116
|
class JvmOptionsProbe
|
116
|
-
|
117
|
-
|
118
|
-
|
117
|
+
def self.redirect
|
118
|
+
@redirect ||= "> #{Redcar.null_device} 2>&1"
|
119
|
+
end
|
120
|
+
|
121
|
+
def self.d32
|
122
|
+
@d32 ||= system("java -d32 #{redirect}")
|
123
|
+
end
|
124
|
+
|
125
|
+
def self.client
|
126
|
+
@client ||= system("java -client #{redirect}")
|
127
|
+
end
|
119
128
|
end
|
120
129
|
end
|
121
130
|
end
|