redcar 0.7 → 0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +42 -0
- data/README.md +5 -3
- data/Rakefile +39 -81
- data/bin/redcar +1 -1
- data/lib/redcar.rb +9 -6
- data/lib/redcar/installer.rb +1 -1
- data/lib/redcar/ruby_extensions.rb +19 -0
- data/lib/redcar/runner.rb +1 -1
- data/lib/redcar/usage.rb +3 -0
- data/lib/redcar_quick_start.rb +11 -11
- data/plugins/application/features/step_definitions/tree_steps.rb +22 -5
- data/plugins/application/features/step_definitions/window_steps.rb +9 -1
- data/plugins/application/features/support/env.rb +5 -2
- data/plugins/application/lib/application.rb +51 -46
- data/plugins/application/lib/application/window.rb +60 -30
- data/plugins/application_swt/lib/application_swt.rb +16 -16
- data/plugins/application_swt/lib/application_swt/window.rb +35 -7
- data/plugins/auto_completer/features/support/env.rb +0 -2
- data/plugins/auto_indenter/features/support/env.rb +0 -1
- data/plugins/auto_pairer/features/auto_pairer.feature +50 -45
- data/plugins/auto_pairer/features/support/env.rb +0 -1
- data/plugins/auto_pairer/lib/auto_pairer/document_controller.rb +11 -6
- data/plugins/clipboard-viewer/Screenshot.png +0 -0
- data/plugins/clipboard-viewer/lib/clipboard_viewer.rb +50 -0
- data/plugins/clipboard-viewer/lib/clipboard_viewer/browser_controller.rb +27 -0
- data/plugins/clipboard-viewer/lib/clipboard_viewer/clipboard_bar.rb +67 -0
- data/plugins/clipboard-viewer/plugin.rb +9 -0
- data/plugins/clipboard-viewer/views/clipboard.html.erb +15 -0
- data/plugins/clipboard-viewer/views/default.css +43 -0
- data/plugins/clipboard-viewer/views/redcar_small_icon.png +0 -0
- data/plugins/comment/features/line_comment.feature +137 -0
- data/plugins/comment/features/selection_comment.feature +21 -0
- data/plugins/comment/features/step_definitions/comment_steps.rb +7 -0
- data/plugins/comment/lib/comment.rb +266 -0
- data/plugins/comment/plugin.rb +7 -0
- data/plugins/comment/vendor/comment_lib.json +47 -0
- data/plugins/declarations/lib/declarations.rb +1 -1
- data/plugins/document_search/features/replace.feature +10 -2
- data/plugins/document_search/features/support/env.rb +0 -1
- data/plugins/document_search/lib/document_search.rb +4 -1
- data/plugins/document_search/lib/document_search/replace.rb +11 -3
- data/plugins/document_search/lib/document_search/search_and_replace.rb +5 -2
- data/plugins/edit_view/features/case_change.feature +9 -9
- data/plugins/edit_view/features/cursor_navigation.feature +36 -0
- data/plugins/edit_view/features/step_definitions/editing_steps.rb +63 -8
- data/plugins/edit_view/features/step_definitions/notebook_steps.rb +2 -0
- data/plugins/edit_view/features/step_definitions/tab_steps.rb +8 -5
- data/plugins/edit_view/features/support/env.rb +8 -2
- data/plugins/edit_view/lib/edit_view.rb +16 -1
- data/plugins/edit_view/lib/edit_view/actions/cmd_enter.rb +11 -0
- data/plugins/edit_view/lib/edit_view/document.rb +27 -10
- data/plugins/edit_view/lib/edit_view/edit_tab.rb +17 -4
- data/plugins/edit_view/spec/edit_view/document_spec.rb +3 -0
- data/plugins/edit_view_swt/lib/edit_view_swt.rb +42 -3
- data/plugins/edit_view_swt/lib/edit_view_swt/word_movement.rb +17 -15
- data/plugins/help/lib/help.rb +40 -0
- data/plugins/help/plugin.rb +8 -0
- data/plugins/html_view/features/step_definitions/html_view_steps.rb +6 -4
- data/plugins/line_tools/features/support/env.rb +0 -1
- data/plugins/macros/features/step_definitions/macro_steps.rb +0 -55
- data/plugins/macros/features/support/env.rb +0 -2
- data/plugins/open_default_app/lib/open_default_app.rb +35 -0
- data/plugins/open_default_app/plugin.rb +8 -0
- data/plugins/open_default_app/screenshot.png +0 -0
- data/plugins/plugin_manager_ui/lib/plugin_manager_ui.rb +17 -3
- data/plugins/project/features/find_file.feature +3 -2
- data/plugins/project/features/highlight_focussed_tab.feature +8 -0
- data/plugins/project/features/move_and_rename_files.feature +25 -0
- data/plugins/project/features/open_and_save_files.feature +10 -1
- data/plugins/project/features/open_directory_tree.feature +32 -2
- data/plugins/project/features/step_definitions/directory_steps.rb +17 -0
- data/plugins/project/features/step_definitions/project_tree_steps.rb +3 -0
- data/plugins/project/features/sub_project.feature +14 -0
- data/plugins/project/features/support/env.rb +22 -3
- data/plugins/project/features/watch_for_modified_files.feature +32 -9
- data/plugins/project/lib/project.rb +53 -21
- data/plugins/project/lib/project/adapters/local.rb +21 -16
- data/plugins/project/lib/project/adapters/remote.rb +15 -13
- data/plugins/project/lib/project/commands.rb +37 -16
- data/plugins/project/lib/project/dir_controller.rb +41 -42
- data/plugins/project/lib/project/drb_service.rb +35 -21
- data/plugins/project/lib/project/file_list.rb +7 -1
- data/plugins/project/lib/project/manager.rb +28 -3
- data/plugins/project/lib/project/sub_project.rb +17 -0
- data/plugins/project/lib/project/support/recycle.js +2 -0
- data/plugins/project/lib/project/support/trash.rb +72 -0
- 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
- 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
- data/plugins/project/spec/project/file_list_spec.rb +4 -0
- data/plugins/redcar/features/goto_line_command.feature +20 -0
- data/plugins/redcar/redcar.rb +107 -47
- data/plugins/repl/lib/repl.rb +20 -20
- data/plugins/repl/lib/repl/clojure_mirror.rb +50 -58
- data/plugins/repl/lib/repl/groovy_mirror.rb +22 -41
- data/plugins/repl/lib/repl/repl_mirror.rb +85 -14
- data/plugins/repl/lib/repl/ruby_mirror.rb +12 -39
- data/plugins/repl/spec/repl/groovy_mirror_spec.rb +1 -1
- data/plugins/repl/spec/repl/ruby_mirror_spec.rb +12 -12
- data/plugins/ruby/README +6 -0
- data/plugins/ruby/lib/syntax_check/ruby.rb +28 -0
- data/plugins/ruby/plugin.rb +7 -0
- data/plugins/runnables/features/command_tree.feature +9 -0
- data/plugins/runnables/features/file_runner_input.feature +20 -0
- data/plugins/runnables/features/run_alternate_command.feature +14 -0
- data/plugins/runnables/features/support/env.rb +42 -5
- data/plugins/runnables/lib/runnables.rb +67 -21
- data/plugins/runnables/lib/runnables/commands.rb +35 -18
- data/plugins/runnables/lib/runnables/tree_mirror/nodes/runnable_group.rb +23 -37
- data/plugins/runnables/lib/runnables/tree_mirror/nodes/runnable_type_group.rb +16 -18
- data/plugins/scm_svn/features/support/env.rb +0 -3
- data/plugins/snippets/features/snippets.feature +17 -2
- data/plugins/snippets/features/support/env.rb +0 -1
- data/plugins/snippets/lib/snippets/tab_handler.rb +51 -18
- data/plugins/swt/lib/swt/cucumber_patches.rb +13 -68
- data/plugins/swt/lib/swt/cucumber_runner.rb +2 -3
- data/plugins/syntax_check/README +6 -0
- data/plugins/syntax_check/lib/syntax_check.rb +16 -0
- data/plugins/syntax_check/lib/syntax_check/checker.rb +47 -0
- data/plugins/syntax_check/lib/syntax_check/error.rb +23 -0
- data/plugins/syntax_check/plugin.rb +7 -0
- data/plugins/tree_view_swt/lib/tree_view_swt.rb +6 -0
- data/plugins/web_bookmarks/Screenshot.png +0 -0
- data/plugins/web_bookmarks/lib/web_bookmarks.rb +42 -0
- data/plugins/web_bookmarks/lib/web_bookmarks/bookmark.rb +43 -0
- data/plugins/web_bookmarks/lib/web_bookmarks/browser_bar.rb +70 -0
- data/plugins/web_bookmarks/lib/web_bookmarks/commands.rb +111 -0
- data/plugins/web_bookmarks/lib/web_bookmarks/tree.rb +67 -0
- data/plugins/web_bookmarks/lib/web_bookmarks/view_controller.rb +22 -0
- data/plugins/web_bookmarks/plugin.rb +11 -0
- data/plugins/web_bookmarks/views/index.html.erb +5 -0
- metadata +60 -10
@@ -0,0 +1,23 @@
|
|
1
|
+
module Redcar
|
2
|
+
module SyntaxCheck
|
3
|
+
class Error
|
4
|
+
Type = "syntax.error.type"
|
5
|
+
Icon = "compile-error"
|
6
|
+
Color = [255, 32, 32]
|
7
|
+
|
8
|
+
attr_accessor :line, :message, :doc
|
9
|
+
|
10
|
+
def initialize(doc, line, message)
|
11
|
+
@doc = doc
|
12
|
+
@line = line
|
13
|
+
@message = message
|
14
|
+
end
|
15
|
+
|
16
|
+
def annotate
|
17
|
+
edit_view = doc.edit_view
|
18
|
+
edit_view.add_annotation_type(Type, Icon, Color)
|
19
|
+
edit_view.add_annotation(Type, line, message, 0, doc.get_line(line).length)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -401,6 +401,8 @@ module Redcar
|
|
401
401
|
def get_elements(tree_mirror)
|
402
402
|
tree_mirror.top.to_java
|
403
403
|
rescue => e
|
404
|
+
puts e.message
|
405
|
+
puts e.backtrace
|
404
406
|
@tree_view_swt.handle_mirror_error(e)
|
405
407
|
end
|
406
408
|
|
@@ -412,12 +414,16 @@ module Redcar
|
|
412
414
|
children.any? if children
|
413
415
|
end
|
414
416
|
rescue => e
|
417
|
+
puts e.message
|
418
|
+
puts e.backtrace
|
415
419
|
@tree_view_swt.handle_mirror_error(e)
|
416
420
|
end
|
417
421
|
|
418
422
|
def get_children(tree_node)
|
419
423
|
tree_node.children.to_java
|
420
424
|
rescue => e
|
425
|
+
puts e.message
|
426
|
+
puts e.backtrace
|
421
427
|
@tree_view_swt.handle_mirror_error(e)
|
422
428
|
end
|
423
429
|
|
Binary file
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'web_bookmarks/commands'
|
2
|
+
require 'web_bookmarks/bookmark'
|
3
|
+
require 'web_bookmarks/browser_bar'
|
4
|
+
require 'web_bookmarks/tree'
|
5
|
+
require 'web_bookmarks/view_controller'
|
6
|
+
|
7
|
+
module Redcar
|
8
|
+
class WebBookmarks
|
9
|
+
TREE_TITLE = "Web Bookmarks"
|
10
|
+
BOOKMARKS_FILE = "web_bookmarks.json"
|
11
|
+
|
12
|
+
def self.storage
|
13
|
+
@storage ||= begin
|
14
|
+
storage = Plugin::Storage.new('web_bookmarks')
|
15
|
+
storage.set_default('show_browser_bar_on_start', true)
|
16
|
+
storage
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.menus
|
21
|
+
Redcar::Menu::Builder.build do
|
22
|
+
sub_menu "File" do
|
23
|
+
item "Web Preview", :command => WebBookmarks::FileWebPreview, :priority => 8
|
24
|
+
end
|
25
|
+
sub_menu "Edit" do
|
26
|
+
sub_menu "Document Navigation" do
|
27
|
+
item "Open Browser Bar", :command => WebBookmarks::OpenBrowserBar, :priority => 5
|
28
|
+
end
|
29
|
+
end
|
30
|
+
sub_menu "Project" do
|
31
|
+
item "Web Bookmarks", :command => WebBookmarks::ShowTree, :priority => 40
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.toolbars
|
37
|
+
Redcar::ToolBar::Builder.build do
|
38
|
+
item "Web Bookmarks", :command => WebBookmarks::ShowTree, :icon => File.join(Redcar::ICONS_DIRECTORY, "globe.png"), :barname => :project
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
|
2
|
+
module Redcar
|
3
|
+
class WebBookmarks
|
4
|
+
class Bookmark
|
5
|
+
include Redcar::Tree::Mirror::NodeMirror
|
6
|
+
attr_reader :url
|
7
|
+
|
8
|
+
def initialize(name,url)
|
9
|
+
@name = name
|
10
|
+
@url = url
|
11
|
+
@children = []
|
12
|
+
end
|
13
|
+
|
14
|
+
def leaf?
|
15
|
+
children.length < 1
|
16
|
+
end
|
17
|
+
|
18
|
+
def add(bookmark)
|
19
|
+
@children << bookmark
|
20
|
+
end
|
21
|
+
|
22
|
+
def text
|
23
|
+
@name
|
24
|
+
end
|
25
|
+
|
26
|
+
def icon
|
27
|
+
if leaf?
|
28
|
+
if @url =~ /^file/
|
29
|
+
File.join(Redcar::ICONS_DIRECTORY, "document-globe.png")
|
30
|
+
else
|
31
|
+
File.join(Redcar::ICONS_DIRECTORY, "globe.png")
|
32
|
+
end
|
33
|
+
else
|
34
|
+
File.join(Redcar::ICONS_DIRECTORY, "book-bookmark.png")
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def children
|
39
|
+
@children
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
|
2
|
+
module Redcar
|
3
|
+
class WebBookmarks
|
4
|
+
class BrowserBar < Redcar::Speedbar
|
5
|
+
|
6
|
+
def html_tab
|
7
|
+
tab = Redcar.app.focussed_window.focussed_notebook_tab
|
8
|
+
tab if tab.is_a?(Redcar::HtmlTab)
|
9
|
+
end
|
10
|
+
|
11
|
+
button :back, "<", "Ctrl+Left" do
|
12
|
+
html_tab.controller.browser.back if html_tab
|
13
|
+
end
|
14
|
+
|
15
|
+
button :forward, ">", "Ctrl+Right" do
|
16
|
+
html_tab.controller.browser.forward if html_tab
|
17
|
+
end
|
18
|
+
|
19
|
+
button :stop, "Stop", nil do
|
20
|
+
html_tab.controller.browser.stop if html_tab
|
21
|
+
end
|
22
|
+
|
23
|
+
button :refresh, "Refresh", "F5" do
|
24
|
+
if tab = html_tab
|
25
|
+
url = tab.controller.browser.url.to_s
|
26
|
+
Redcar.plugin_manager.objects_implementing(:before_web_refresh).each do |obj|
|
27
|
+
obj.before_web_refresh(path)
|
28
|
+
end
|
29
|
+
tab.controller.browser.refresh
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
button :source, "Source", nil do
|
34
|
+
tab = Redcar.app.focussed_window.new_tab(Redcar::EditTab)
|
35
|
+
url = html_tab.controller.browser.url.to_s
|
36
|
+
if url =~ /^file:\/\//
|
37
|
+
file_path = url[7,url.length]
|
38
|
+
mirror = Project::FileMirror.new(file_path)
|
39
|
+
tab.edit_view.document.mirror = mirror
|
40
|
+
else
|
41
|
+
tab.edit_view.document.text = html_tab.controller.browser.text
|
42
|
+
tab.title = "Page Source"
|
43
|
+
end
|
44
|
+
tab.edit_view.grammar = "HTML"
|
45
|
+
tab.edit_view.reset_undo
|
46
|
+
tab.focus
|
47
|
+
end
|
48
|
+
|
49
|
+
button :add, "+", nil do
|
50
|
+
if tab = html_tab and
|
51
|
+
url = tab.controller.browser.url.to_s
|
52
|
+
WebBookmarks::AddBookmark.new(url).run
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
label :url_label, "New URL:"
|
57
|
+
textbox :new_url
|
58
|
+
|
59
|
+
button :go_to_url, "Go!", "Return" do
|
60
|
+
@tab = html_tab
|
61
|
+
if @tab
|
62
|
+
unless new_url.value == ""
|
63
|
+
@tab.title=new_url.value
|
64
|
+
@tab.controller.go_to_location(new_url.value)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
|
2
|
+
require 'java'
|
3
|
+
|
4
|
+
module Redcar
|
5
|
+
class WebBookmarks
|
6
|
+
|
7
|
+
# Open a HtmlTab for displaying web content
|
8
|
+
class DisplayWebContent < Redcar::Command
|
9
|
+
def initialize(name,url,display_bar=true)
|
10
|
+
@name = name
|
11
|
+
@url = url
|
12
|
+
@display_bar = display_bar
|
13
|
+
end
|
14
|
+
|
15
|
+
def execute
|
16
|
+
win = Redcar.app.focussed_window
|
17
|
+
controller = ViewController.new(@name,@url)
|
18
|
+
tab = win.new_tab(HtmlTab)
|
19
|
+
tab.html_view.controller = controller
|
20
|
+
tab.focus
|
21
|
+
if @display_bar or
|
22
|
+
WebBookmarks.storage['show_browser_bar_on_start']
|
23
|
+
WebBookmarks::OpenBrowserBar.new.run
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
class FileWebPreview < Redcar::EditTabCommand
|
29
|
+
def execute
|
30
|
+
mirror = doc.mirror
|
31
|
+
if mirror and path = mirror.path and File.exists?(path)
|
32
|
+
name = "Preview: " +File.basename(path)
|
33
|
+
else
|
34
|
+
name = "Preview: (untitled)"
|
35
|
+
preview = java.io.File.createTempFile("preview","html")
|
36
|
+
preview.deleteOnExit
|
37
|
+
path = preview.getAbsolutePath
|
38
|
+
File.open(path,'w') {|f| f.puts(doc.get_all_text)}
|
39
|
+
end
|
40
|
+
url = "file://" + path
|
41
|
+
DisplayWebContent.new(name,url).run
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
class ShowTree < Redcar::Command
|
46
|
+
sensitize :open_project
|
47
|
+
def execute
|
48
|
+
if tree = win.treebook.trees.detect {|tree| tree.tree_mirror.title == TREE_TITLE }
|
49
|
+
tree.refresh
|
50
|
+
win.treebook.focus_tree(tree)
|
51
|
+
else
|
52
|
+
project = Project::Manager.in_window(win)
|
53
|
+
tree = Tree.new(
|
54
|
+
TreeMirror.new(project),
|
55
|
+
TreeController.new(project)
|
56
|
+
)
|
57
|
+
win.treebook.add_tree(tree)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
class OpenBrowserBar < Redcar::Command
|
63
|
+
def execute
|
64
|
+
window = Redcar.app.focussed_window
|
65
|
+
speedbar = Redcar::WebBookmarks::BrowserBar.new
|
66
|
+
window.open_speedbar(speedbar)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
class AddBookmark < Redcar::ProjectCommand
|
71
|
+
def initialize(url)
|
72
|
+
@protocol = url.split("://")[0]
|
73
|
+
@url = url.split("://")[1]
|
74
|
+
end
|
75
|
+
|
76
|
+
def execute
|
77
|
+
@path = project.config_files(BOOKMARKS_FILE).detect { |pj|
|
78
|
+
not pj.include?(Redcar.user_dir)
|
79
|
+
}
|
80
|
+
if @path
|
81
|
+
json = File.read(@path)
|
82
|
+
else
|
83
|
+
@path = project.path + "/.redcar/#{BOOKMARKS_FILE}"
|
84
|
+
json = JSON.generate({"bookmarks"=>[]})
|
85
|
+
end
|
86
|
+
bookmarks = JSON(json)["bookmarks"]
|
87
|
+
if name = fill_field("Name")
|
88
|
+
group = fill_field("Group")
|
89
|
+
bookmark = {
|
90
|
+
"name" => name,
|
91
|
+
"url" => @url,
|
92
|
+
"protocol" => @protocol
|
93
|
+
}
|
94
|
+
bookmark["group"] = group unless group.nil? or group == ""
|
95
|
+
bookmarks << bookmark
|
96
|
+
File.open(@path,'w') do |f|
|
97
|
+
f.puts JSON.pretty_generate({"bookmarks"=>bookmarks})
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def fill_field(name)
|
103
|
+
title = "Add New Bookmark"
|
104
|
+
msg = "Choose a #{name} for this Bookmark"
|
105
|
+
out = Redcar::Application::Dialog.input(title,msg)
|
106
|
+
return if out[:button] == :cancel
|
107
|
+
name = out[:value]
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
|
2
|
+
module Redcar
|
3
|
+
class WebBookmarks
|
4
|
+
class TreeController
|
5
|
+
include Redcar::Tree::Controller
|
6
|
+
|
7
|
+
def initialize(project)
|
8
|
+
@project = project
|
9
|
+
end
|
10
|
+
|
11
|
+
def activated(tree, node)
|
12
|
+
DisplayWebContent.new(node.text,node.url).run
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class TreeMirror
|
17
|
+
include Redcar::Tree::Mirror
|
18
|
+
|
19
|
+
def initialize(project)
|
20
|
+
@project = project
|
21
|
+
end
|
22
|
+
|
23
|
+
def bookmarks_files_paths
|
24
|
+
@project.config_files(BOOKMARKS_FILE)
|
25
|
+
end
|
26
|
+
|
27
|
+
def parse_url(url)
|
28
|
+
url.gsub("__PROJECT_PATH__",@project.path)
|
29
|
+
end
|
30
|
+
|
31
|
+
def title; TREE_TITLE; end
|
32
|
+
|
33
|
+
def top; load; end
|
34
|
+
|
35
|
+
def load
|
36
|
+
bookmarks = []
|
37
|
+
spares = []
|
38
|
+
groups = {}
|
39
|
+
bookmarks_files_paths.each do |path|
|
40
|
+
json = File.read(path)
|
41
|
+
bookmarks += JSON(json)["bookmarks"]
|
42
|
+
end
|
43
|
+
|
44
|
+
if bookmarks.any?
|
45
|
+
bookmarks.sort_by {|b| b["name"]}.map do |b|
|
46
|
+
prefix = b["protocol"] || "http"
|
47
|
+
url = prefix + "://" + parse_url(b["url"])
|
48
|
+
if b["group"].nil?
|
49
|
+
spares << Bookmark.new(b["name"],url)
|
50
|
+
else
|
51
|
+
if groups[b["group"]]
|
52
|
+
group = groups[b["group"]]
|
53
|
+
else
|
54
|
+
group = Bookmark.new(b["group"],nil)
|
55
|
+
groups[group.text] = group
|
56
|
+
end
|
57
|
+
group.add(Bookmark.new(b["name"],url))
|
58
|
+
end
|
59
|
+
end
|
60
|
+
spares.sort_by {|s| s.text} + groups.sort_by {|k,g| k}.map {|k,g| g}
|
61
|
+
else
|
62
|
+
[]
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
module Redcar
|
3
|
+
class WebBookmarks
|
4
|
+
class ViewController
|
5
|
+
include HtmlController
|
6
|
+
|
7
|
+
def initialize(title,url)
|
8
|
+
@title = title
|
9
|
+
@url = url
|
10
|
+
end
|
11
|
+
|
12
|
+
def title
|
13
|
+
@title
|
14
|
+
end
|
15
|
+
|
16
|
+
def index
|
17
|
+
rhtml = ERB.new(File.read(File.join(File.dirname(__FILE__), "..","..", "views", "index.html.erb")))
|
18
|
+
rhtml.result(binding)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|