redcar 0.12.1 → 0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +18 -0
- data/bin/redcar +1 -0
- data/lib/redcar.rb +4 -5
- data/lib/redcar/usage.rb +0 -1
- data/lib/redcar_quick_start.rb +3 -1
- data/plugins/application/lib/application.rb +1 -0
- data/plugins/application/lib/application/commands/treebook_commands.rb +11 -18
- data/plugins/application/lib/application/dialog.rb +1 -1
- data/plugins/application/lib/application/dialogs/filter_list_dialog.rb +13 -5
- data/plugins/application/lib/application/global_state.rb +21 -0
- data/plugins/application/lib/application/menu/item.rb +37 -11
- data/plugins/application/lib/application/notebook.rb +12 -0
- data/plugins/application/lib/application/tree/mirror.rb +0 -11
- data/plugins/application/lib/application/window.rb +32 -7
- data/plugins/application_swt/lib/application_swt.rb +1 -1
- data/plugins/application_swt/lib/application_swt/dialogs/filter_list_dialog_controller.rb +35 -10
- data/plugins/application_swt/lib/application_swt/icon.rb +1 -1
- data/plugins/application_swt/lib/application_swt/menu.rb +47 -15
- data/plugins/application_swt/lib/application_swt/notebook.rb +11 -2
- data/plugins/application_swt/lib/application_swt/window.rb +37 -34
- data/plugins/auto_indenter/lib/auto_indenter/analyzer.rb +1 -1
- data/plugins/auto_indenter/spec/auto_indenter/analyzer_spec.rb +9 -0
- data/plugins/declarations/lib/declarations.rb +31 -66
- data/plugins/declarations/lib/declarations/commands.rb +142 -0
- data/plugins/declarations/lib/declarations/file.rb +1 -1
- data/plugins/{outline_view → declarations}/spec/fixtures/some_project/javascript.js +0 -0
- data/plugins/{outline_view → declarations}/spec/fixtures/some_project/nothing_to_see.rb +0 -0
- data/plugins/{outline_view → declarations}/spec/fixtures/some_project/one_lonely_class.rb +0 -0
- data/plugins/{outline_view → declarations}/spec/fixtures/some_project/similar_names.rb +0 -0
- data/plugins/{outline_view → declarations}/spec/fixtures/some_project/something_fancy.rb +0 -0
- data/plugins/{outline_view → declarations}/spec/fixtures/some_project/trailing_space.rb +0 -0
- data/plugins/edit_view/lib/edit_view.rb +35 -2
- data/plugins/edit_view/lib/edit_view/commands/change_language_command.rb +31 -0
- data/plugins/edit_view/lib/edit_view/commands/language_settings_commands.rb +45 -0
- data/plugins/edit_view/lib/edit_view/document/command.rb +1 -1
- data/plugins/edit_view/lib/edit_view/edit_tab.rb +11 -13
- data/plugins/key_bindings/lib/key_bindings.rb +6 -2
- data/plugins/project/lib/project.rb +27 -32
- data/plugins/project/lib/project/commands.rb +3 -88
- data/plugins/project/lib/project/dir_controller.rb +12 -18
- data/plugins/project/lib/project/dir_mirror.rb +20 -25
- data/plugins/project/lib/project/file_mirror.rb +10 -10
- data/plugins/project/lib/project/find_file_dialog.rb +20 -18
- data/plugins/project/lib/project/find_recent_dialog.rb +6 -3
- data/plugins/project/lib/project/{adapters/local.rb → local_filesystem.rb} +35 -35
- data/plugins/project/lib/project/manager.rb +21 -75
- data/plugins/project/lib/project/sub_project.rb +3 -3
- data/plugins/project/plugin.rb +0 -1
- data/plugins/project_search/lib/project_search/lucene_refresh.rb +0 -1
- data/plugins/redcar/plugin.rb +2 -2
- data/plugins/redcar/redcar.rb +34 -42
- data/plugins/ruby/lib/ruby/syntax_checker.rb +27 -7
- data/plugins/scm/lib/scm.rb +1 -12
- data/plugins/sessions/lib/sessions.rb +22 -0
- data/plugins/sessions/lib/sessions/cursor_saver.rb +162 -0
- data/plugins/sessions/lib/sessions/loader.rb +99 -0
- data/plugins/sessions/lib/sessions/memory.rb +59 -0
- data/plugins/sessions/plugin.rb +8 -0
- data/plugins/strip_trailing_spaces/lib/strip_trailing_spaces.rb +2 -2
- data/plugins/syntax_check/lib/syntax_check.rb +2 -2
- data/plugins/tree_view_swt/lib/tree_view_swt.rb +1 -3
- data/redcar.gemspec +1 -1
- metadata +195 -291
- data/plugins/connection_manager/lib/connection_manager.rb +0 -57
- data/plugins/connection_manager/lib/connection_manager/commands.rb +0 -14
- data/plugins/connection_manager/lib/connection_manager/connection_store.rb +0 -87
- data/plugins/connection_manager/lib/connection_manager/controller.rb +0 -100
- data/plugins/connection_manager/lib/connection_manager/filter_dialog.rb +0 -38
- data/plugins/connection_manager/lib/connection_manager/private_key_store.rb +0 -93
- data/plugins/connection_manager/plugin.rb +0 -12
- data/plugins/connection_manager/views/index.html.erb +0 -284
- data/plugins/edit_view/lib/edit_view/info_speedbar.rb +0 -98
- data/plugins/outline_view/features/outline_view.feature +0 -79
- data/plugins/outline_view/features/project_outline.feature +0 -23
- data/plugins/outline_view/features/step_definitions/outline_steps.rb +0 -61
- data/plugins/outline_view/lib/outline_view.rb +0 -97
- data/plugins/outline_view/lib/outline_view/commands.rb +0 -19
- data/plugins/outline_view/plugin.rb +0 -10
- data/plugins/outline_view_swt/lib/outline_view_swt.rb +0 -79
- data/plugins/outline_view_swt/plugin.rb +0 -7
- data/plugins/project/lib/project/adapters/remote.rb +0 -96
- data/plugins/project/lib/project/adapters/remote_protocols/ftp.rb +0 -93
- data/plugins/project/lib/project/adapters/remote_protocols/protocol.rb +0 -94
- data/plugins/project/lib/project/adapters/remote_protocols/sftp.rb +0 -181
@@ -1,96 +0,0 @@
|
|
1
|
-
|
2
|
-
module Redcar
|
3
|
-
class Project
|
4
|
-
module Adapters
|
5
|
-
class Remote
|
6
|
-
class PathDoesNotExist < StandardError; end
|
7
|
-
|
8
|
-
PROTOCOLS = {
|
9
|
-
:ftp => RemoteProtocols::FTP,
|
10
|
-
:sftp => RemoteProtocols::SFTP
|
11
|
-
}
|
12
|
-
|
13
|
-
attr_accessor :protocol, :host, :user, :password, :private_key_files
|
14
|
-
|
15
|
-
def initialize(protocol, host, user, password, private_key_files)
|
16
|
-
@protocol = protocol
|
17
|
-
@host = host
|
18
|
-
@user = user
|
19
|
-
@password = password
|
20
|
-
@private_key_files = private_key_files
|
21
|
-
target
|
22
|
-
end
|
23
|
-
|
24
|
-
def target
|
25
|
-
@target ||= PROTOCOLS[protocol].new(host, user, password, private_key_files)
|
26
|
-
end
|
27
|
-
|
28
|
-
def touch(file)
|
29
|
-
target.touch(file)
|
30
|
-
end
|
31
|
-
|
32
|
-
def mkdir(new_dir_path)
|
33
|
-
target.mkdir(new_dir_path)
|
34
|
-
end
|
35
|
-
|
36
|
-
def mv(path, new_path)
|
37
|
-
target.mv(path, new_path)
|
38
|
-
Manager.update_tab_for_path(path,new_path)
|
39
|
-
end
|
40
|
-
|
41
|
-
def mtime(file)
|
42
|
-
target.mtime(file)
|
43
|
-
end
|
44
|
-
|
45
|
-
def file?(path)
|
46
|
-
target.file?(path)
|
47
|
-
end
|
48
|
-
|
49
|
-
def directory?(path)
|
50
|
-
target.directory?(path)
|
51
|
-
end
|
52
|
-
|
53
|
-
def fetch_contents(path)
|
54
|
-
target.fetch_contents(path)
|
55
|
-
end
|
56
|
-
|
57
|
-
def load(file)
|
58
|
-
target.load(file)
|
59
|
-
end
|
60
|
-
|
61
|
-
def save(file, contents)
|
62
|
-
target.save(file)
|
63
|
-
end
|
64
|
-
|
65
|
-
def stat(file)
|
66
|
-
target.stat(file)
|
67
|
-
end
|
68
|
-
|
69
|
-
def delete(file)
|
70
|
-
target.delete(file)
|
71
|
-
Manager.update_tab_for_path(file)
|
72
|
-
end
|
73
|
-
|
74
|
-
def exists?(path)
|
75
|
-
target.exists?(path)
|
76
|
-
end
|
77
|
-
|
78
|
-
def load(file)
|
79
|
-
target.load(file)
|
80
|
-
end
|
81
|
-
|
82
|
-
def save(file, contents)
|
83
|
-
target.save(file, contents)
|
84
|
-
end
|
85
|
-
|
86
|
-
def refresh_operation(tree)
|
87
|
-
visible_paths = tree.visible_nodes.map {|n| n.path}
|
88
|
-
visible_dirs = visible_paths.map {|path| File.dirname(path) }.uniq
|
89
|
-
target.with_cached_directories(visible_dirs) do
|
90
|
-
yield
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
@@ -1,93 +0,0 @@
|
|
1
|
-
|
2
|
-
module Redcar
|
3
|
-
class Project
|
4
|
-
module Adapters
|
5
|
-
module RemoteProtocols
|
6
|
-
class FTP < Protocol
|
7
|
-
class << self
|
8
|
-
def handle_error(e, host, user)
|
9
|
-
return "Authentication failed for user #{user} in ftp://#{host}" if e.is_a?(Net::FTPPermError)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def connection
|
14
|
-
require 'net/ftp'
|
15
|
-
gem "net-ftp-list"
|
16
|
-
require 'net/ftp/list'
|
17
|
-
@connection ||= Net::FTP.open(host, user, password)
|
18
|
-
end
|
19
|
-
|
20
|
-
def touch(file)
|
21
|
-
local_path, local_file = split_paths(file)
|
22
|
-
|
23
|
-
FileUtils.mkdir_p local_path
|
24
|
-
FileUtils.touch local_file
|
25
|
-
|
26
|
-
upload local_file, file
|
27
|
-
end
|
28
|
-
|
29
|
-
def mkdir(new_dir_path)
|
30
|
-
exec :mkdir, new_dir_path
|
31
|
-
end
|
32
|
-
|
33
|
-
def mv(path, new_path)
|
34
|
-
target = "#{new_path}/#{File.basename(path)}"
|
35
|
-
exec :rename, path, target
|
36
|
-
end
|
37
|
-
|
38
|
-
def mtime(file)
|
39
|
-
if e = entry(file)
|
40
|
-
e[:mtime]
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def download(remote, local)
|
45
|
-
exec :get, remote, local
|
46
|
-
end
|
47
|
-
|
48
|
-
def upload(local, remote)
|
49
|
-
exec :put, local, remote
|
50
|
-
end
|
51
|
-
|
52
|
-
def dir_listing(path)
|
53
|
-
contents = []
|
54
|
-
exec(:list, path) do |e|
|
55
|
-
entry = Net::FTP::List.parse(e)
|
56
|
-
name = entry.basename
|
57
|
-
type = "unknown"
|
58
|
-
type = "file" if entry.file?
|
59
|
-
type = "dir" if entry.dir?
|
60
|
-
|
61
|
-
unless ['.', '..'].include?(name)
|
62
|
-
contents << { :fullname => "#{path}/#{name}", :name => "#{name}", :type => type, :mtime => entry.mtime }
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
contents
|
67
|
-
end
|
68
|
-
|
69
|
-
def is_folder(path)
|
70
|
-
exec(:chdir, path)
|
71
|
-
exec(:pwd) == path
|
72
|
-
end
|
73
|
-
|
74
|
-
def with_cached_directories
|
75
|
-
yield
|
76
|
-
end
|
77
|
-
|
78
|
-
private
|
79
|
-
|
80
|
-
def exec(method, *args, &block)
|
81
|
-
begin
|
82
|
-
Redcar.timeout(10) do
|
83
|
-
connection.send(method, *args, &block)
|
84
|
-
end
|
85
|
-
rescue Redcar::TimeoutError
|
86
|
-
raise "#{host} connection timed out"
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
@@ -1,94 +0,0 @@
|
|
1
|
-
|
2
|
-
module Redcar
|
3
|
-
class Project
|
4
|
-
module Adapters
|
5
|
-
module RemoteProtocols
|
6
|
-
class Protocol
|
7
|
-
attr_accessor :host, :user, :password, :private_key_files
|
8
|
-
|
9
|
-
def initialize(host, user, password, private_key_files)
|
10
|
-
@host = host
|
11
|
-
@user = user
|
12
|
-
@password = password
|
13
|
-
@cache = {}
|
14
|
-
@private_key_files = private_key_files
|
15
|
-
connection
|
16
|
-
end
|
17
|
-
|
18
|
-
def exists?(path)
|
19
|
-
!!entry(path)
|
20
|
-
end
|
21
|
-
|
22
|
-
def directory?(path)
|
23
|
-
return false unless entry = entry(path)
|
24
|
-
entry[:type] == :dir
|
25
|
-
end
|
26
|
-
|
27
|
-
def file?(path)
|
28
|
-
return false unless entry = entry(path)
|
29
|
-
entry[:type] == :file
|
30
|
-
end
|
31
|
-
|
32
|
-
def fetch_contents(path)
|
33
|
-
fetch(path)
|
34
|
-
end
|
35
|
-
|
36
|
-
def load(file)
|
37
|
-
local_path, local_file = split_paths(file)
|
38
|
-
|
39
|
-
FileUtils.mkdir_p local_path
|
40
|
-
download file, local_file
|
41
|
-
File.open(local_file, 'rb') do |f|; f.read; end
|
42
|
-
end
|
43
|
-
|
44
|
-
def save(file, contents)
|
45
|
-
local_path, local_file = split_paths(file)
|
46
|
-
|
47
|
-
ret = File.open(local_file, "wb") {|f| f.print contents }
|
48
|
-
upload local_file, file
|
49
|
-
|
50
|
-
ret
|
51
|
-
end
|
52
|
-
|
53
|
-
private
|
54
|
-
|
55
|
-
def cache(path)
|
56
|
-
@cache[path]
|
57
|
-
end
|
58
|
-
|
59
|
-
def check_folder(path)
|
60
|
-
parent = File.dirname(path)
|
61
|
-
if contents = cache(parent)
|
62
|
-
result = contents.find { |f| f[:fullname] == path }
|
63
|
-
return false unless result
|
64
|
-
result[:type] == :dir
|
65
|
-
else
|
66
|
-
is_folder(path)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
def split_paths(file)
|
71
|
-
base_temp = '/tmp'
|
72
|
-
file_name = File.basename(file)
|
73
|
-
path = File.dirname(file)
|
74
|
-
|
75
|
-
local_path = "#{base_temp}/#{host}#{path}"
|
76
|
-
local_file = "#{local_path}/#{file_name}"
|
77
|
-
|
78
|
-
[local_path, local_file]
|
79
|
-
end
|
80
|
-
|
81
|
-
def entry(file)
|
82
|
-
path = File.dirname(file)
|
83
|
-
contents = fetch(path)
|
84
|
-
contents.detect { |f| f[:fullname] == file }
|
85
|
-
end
|
86
|
-
|
87
|
-
def fetch(path)
|
88
|
-
dir_listing(path)
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
@@ -1,181 +0,0 @@
|
|
1
|
-
|
2
|
-
module Redcar
|
3
|
-
class Project
|
4
|
-
module Adapters
|
5
|
-
module RemoteProtocols
|
6
|
-
class SFTP < Protocol
|
7
|
-
class << self
|
8
|
-
def handle_error(e, host, user)
|
9
|
-
return "Authentication failed for user #{user} in sftp://#{host}" if e.is_a?(Net::SSH::AuthenticationFailed)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def connection
|
14
|
-
gem "net-ssh"
|
15
|
-
gem "net-sftp"
|
16
|
-
require 'net/ssh'
|
17
|
-
require 'net/sftp'
|
18
|
-
Redcar.timeout(10) do
|
19
|
-
@connection ||= Net::SSH.start(host, user, :password => password, :keys => private_key_files)
|
20
|
-
end
|
21
|
-
rescue OpenSSL::PKey::DSAError => error
|
22
|
-
puts "*** Warning, DSA keys not supported."
|
23
|
-
# Error with DSA key. Throw us back to a password input. Think this is because jopenssl bugs
|
24
|
-
# out on valid dsa keys.
|
25
|
-
raise Net::SSH::AuthenticationFailed, "DSA key-based authentication failed."
|
26
|
-
rescue Redcar::TimeoutError
|
27
|
-
raise "connection to #{host} timed out"
|
28
|
-
end
|
29
|
-
|
30
|
-
def touch(file)
|
31
|
-
exec "touch \"#{escape(file)}\""
|
32
|
-
end
|
33
|
-
|
34
|
-
def mkdir(new_dir_path)
|
35
|
-
exec "mkdir -p \"#{escape(new_dir_path)}\""
|
36
|
-
end
|
37
|
-
|
38
|
-
def mv(path, new_path)
|
39
|
-
exec "mv \"#{escape(path)}\" \"#{escape(new_path)}\""
|
40
|
-
end
|
41
|
-
|
42
|
-
def mtime(file)
|
43
|
-
sftp_exec(:stat!, file).mtime
|
44
|
-
end
|
45
|
-
|
46
|
-
def download(remote, local)
|
47
|
-
sftp_exec(:download!, remote, local)
|
48
|
-
end
|
49
|
-
|
50
|
-
def upload(local, remote)
|
51
|
-
sftp_exec(:upload!, local, remote)
|
52
|
-
end
|
53
|
-
|
54
|
-
def delete(file)
|
55
|
-
sftp_exec(:remove, file)
|
56
|
-
end
|
57
|
-
|
58
|
-
def use_cache?
|
59
|
-
@use_cache
|
60
|
-
end
|
61
|
-
|
62
|
-
def dir_listing(path)
|
63
|
-
if use_cache?
|
64
|
-
if @cached_dirs[path]
|
65
|
-
return @cached_dirs[path]
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
return [] unless result = retrieve_dir_listing(path)
|
70
|
-
process_dir_listing_response(result)
|
71
|
-
end
|
72
|
-
|
73
|
-
def retrieve_dir_listing(path)
|
74
|
-
raise Adapters::Remote::PathDoesNotExist, "Path #{path} does not exist" unless check_folder(path)
|
75
|
-
|
76
|
-
exec %Q(
|
77
|
-
for file in #{path}/*; do
|
78
|
-
test -f "$file" && echo "file|na|$file"
|
79
|
-
test -d "$file" && test $(find $file -maxdepth 1 | wc -l) -eq 1 && echo "dir|0|$file"
|
80
|
-
test -d "$file" && test $(find $file -maxdepth 1 | wc -l) -gt 1 && echo "dir|1|$file"
|
81
|
-
done
|
82
|
-
)
|
83
|
-
end
|
84
|
-
|
85
|
-
def process_dir_listing_response(response)
|
86
|
-
contents = []
|
87
|
-
response.each do |line|
|
88
|
-
next unless line.include?('|')
|
89
|
-
type, empty_flag, name = line.chomp.split('|')
|
90
|
-
unless ['.', '..'].include?(name)
|
91
|
-
hash = { :fullname => name, :name => File.basename(name), :type => type.to_sym }
|
92
|
-
if type == "dir"
|
93
|
-
hash[:empty] = (empty_flag == "0")
|
94
|
-
end
|
95
|
-
contents << hash
|
96
|
-
end
|
97
|
-
end
|
98
|
-
contents
|
99
|
-
end
|
100
|
-
|
101
|
-
def exists?(path)
|
102
|
-
is_file(path) or is_folder(path)
|
103
|
-
end
|
104
|
-
|
105
|
-
def is_folder(path)
|
106
|
-
result = exec(%Q(
|
107
|
-
test -d "#{path}" && echo y
|
108
|
-
))
|
109
|
-
|
110
|
-
result =~ /^y/ ? true : false
|
111
|
-
end
|
112
|
-
|
113
|
-
def is_file(path)
|
114
|
-
result = exec(%Q(
|
115
|
-
test -f "#{path}" && echo y
|
116
|
-
))
|
117
|
-
|
118
|
-
result =~ /^y/ ? true : false
|
119
|
-
end
|
120
|
-
|
121
|
-
def with_cached_directories(dirs)
|
122
|
-
@cached_dirs = list_dirs(dirs)
|
123
|
-
@use_cache = true
|
124
|
-
yield
|
125
|
-
ensure
|
126
|
-
@use_cache = false
|
127
|
-
end
|
128
|
-
|
129
|
-
def list_dirs(dirs)
|
130
|
-
cmd = ""
|
131
|
-
dirs.each do |dir|
|
132
|
-
cmd << <<-SH
|
133
|
-
for file in #{dir}/*; do
|
134
|
-
test -f "$file" && echo "file|na|$file"
|
135
|
-
test -d "$file" && test $(find "$file" -maxdepth 1 | wc -l) -eq 1 && echo "dir|0|$file"
|
136
|
-
test -d "$file" && test $(find "$file" -maxdepth 1 | wc -l) -gt 1 && echo "dir|1|$file"
|
137
|
-
done
|
138
|
-
SH
|
139
|
-
end
|
140
|
-
response = exec(cmd)
|
141
|
-
listings = process_dir_listing_response(response)
|
142
|
-
hash = {}
|
143
|
-
listings.each do |listing|
|
144
|
-
(hash[File.dirname(listing[:fullname])] ||= []) << listing
|
145
|
-
end
|
146
|
-
hash
|
147
|
-
end
|
148
|
-
|
149
|
-
private
|
150
|
-
|
151
|
-
def escape(path)
|
152
|
-
path.gsub("\\", "\\\\").gsub("\"", "\\\"")
|
153
|
-
end
|
154
|
-
|
155
|
-
def exec(what)
|
156
|
-
puts "exec: #{what.inspect}"
|
157
|
-
begin
|
158
|
-
Redcar.timeout(10) do
|
159
|
-
connection.exec!(what)
|
160
|
-
end
|
161
|
-
rescue Redcar::TimeoutError => e
|
162
|
-
connection.shutdown!
|
163
|
-
raise "#{host} connection timed out"
|
164
|
-
end
|
165
|
-
end
|
166
|
-
|
167
|
-
def sftp_exec(method, *args)
|
168
|
-
begin
|
169
|
-
Redcar.timeout(10) do
|
170
|
-
connection.sftp.send(method, *args)
|
171
|
-
end
|
172
|
-
rescue Redcar::TimeoutError
|
173
|
-
connection.shutdown!
|
174
|
-
raise "#{host} connection timed out"
|
175
|
-
end
|
176
|
-
end
|
177
|
-
end
|
178
|
-
end
|
179
|
-
end
|
180
|
-
end
|
181
|
-
end
|