catscope 0.0.2 → 0.0.3
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.
- checksums.yaml +4 -4
- data/assets/js/app.js +19 -8
- data/lib/catscope/app.rb +2 -0
- data/lib/catscope/cli.rb +20 -0
- data/lib/catscope/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfc9e4bac2a2302d56f07924150a9fa805bd3bb5
|
4
|
+
data.tar.gz: 2982e7f3db031153ab3d59d885725b12e52343b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca8ec786784d78e16ec3d32674ca2198e808a0ed8f6db3206dcad443a331e13d8cb8424e2fb82a2a73013f6f837ab091043f75318992aafd84468433910815ed
|
7
|
+
data.tar.gz: 8d0fcd60aa7185c415ef43349085ca9a3e36f01c0995fdffbce3e267904609ba89dc894fe62bd16a0d7c0024447ccc106efe04b7465f1967b632d1b51986cb85
|
data/assets/js/app.js
CHANGED
@@ -4,6 +4,23 @@ $(document).foundation();
|
|
4
4
|
|
5
5
|
var io = new RocketIO().connect();
|
6
6
|
|
7
|
+
function __filelist_click_handler_builder(jq_child_ul) {
|
8
|
+
return function(e){
|
9
|
+
if (e.target.dataset.type == "dir") {
|
10
|
+
if (e.target.dataset.opened == "false") {
|
11
|
+
e.target.dataset.opened = "true";
|
12
|
+
filelist_expand_dir(e.target, $(e.target.nextSibling));
|
13
|
+
} else {
|
14
|
+
e.target.dataset.opened = "false";
|
15
|
+
jq_child_ul.empty();
|
16
|
+
}
|
17
|
+
} else {
|
18
|
+
// filelist_open_file(e.target.dataset.path);
|
19
|
+
wm.create(e.target.dataset.path);
|
20
|
+
}
|
21
|
+
};
|
22
|
+
}
|
23
|
+
|
7
24
|
function filelist_expand_dir(entryElem, container) {
|
8
25
|
$.getJSON("/api/lsdir/" + entryElem.dataset.path,
|
9
26
|
function(jsonData, status, jqxhr) {
|
@@ -16,16 +33,10 @@ function filelist_expand_dir(entryElem, container) {
|
|
16
33
|
"data-path": entry.path,
|
17
34
|
"data-type": entry.type,
|
18
35
|
"data-name": entry.name,
|
36
|
+
"data-opened": "false",
|
19
37
|
text: entry.name,
|
20
38
|
class: "js-filelist-" + entry.type,
|
21
|
-
click:
|
22
|
-
if (e.target.dataset.type == "dir") {
|
23
|
-
filelist_expand_dir(e.target, $(e.target.nextSibling));
|
24
|
-
} else {
|
25
|
-
// filelist_open_file(e.target.dataset.path);
|
26
|
-
wm.create(e.target.dataset.path);
|
27
|
-
}
|
28
|
-
}});
|
39
|
+
click: __filelist_click_handler_builder(child_ul)});
|
29
40
|
var save_link = $('<a>', {href: "/save/" + entry.path})
|
30
41
|
save_link.append($('<img>', {src: "/assets/img/disk.png"}));
|
31
42
|
|
data/lib/catscope/app.rb
CHANGED
data/lib/catscope/cli.rb
CHANGED
@@ -13,10 +13,30 @@ class CLI
|
|
13
13
|
|
14
14
|
def setup_parser()
|
15
15
|
@parser = OptionParser.new
|
16
|
+
|
17
|
+
@bind = '127.0.0.1'
|
18
|
+
@parser.on('-o', '--bind ADDRESS', "IP address to bind (default: #{@bind})") do |addr|
|
19
|
+
@bind = addr
|
20
|
+
end
|
21
|
+
|
22
|
+
@port = 4567
|
23
|
+
@parser.on('-p', '--port PORT', "Port to listen on (default: #{@port})") do |port|
|
24
|
+
@port = Integer(port)
|
25
|
+
end
|
26
|
+
|
27
|
+
@environment = "production"
|
28
|
+
@parser.on('-e', '--env ENV', "Rack environment (default: #{@environment})") do |env|
|
29
|
+
@environment = env
|
30
|
+
end
|
16
31
|
end
|
17
32
|
|
18
33
|
def run(argv)
|
19
34
|
@parser.parse!(argv)
|
35
|
+
|
36
|
+
App.set :environment, @environment
|
37
|
+
App.set :bind, @bind
|
38
|
+
App.set :port, @port
|
39
|
+
|
20
40
|
App.run!
|
21
41
|
true
|
22
42
|
end
|
data/lib/catscope/version.rb
CHANGED