catscope 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a04352dbd5d2bc81dbceed21903c1bd5e0096e5c
4
- data.tar.gz: 01e87cf27af948d71f8a440e03785c90959934dc
3
+ metadata.gz: bfc9e4bac2a2302d56f07924150a9fa805bd3bb5
4
+ data.tar.gz: 2982e7f3db031153ab3d59d885725b12e52343b0
5
5
  SHA512:
6
- metadata.gz: 3b1b3b97e558c044a43feab5d1f2f9e453352dd8b4c3119fd526e23ce7ee520ad21d6799acb5aa7a0a97290b4f29b6c9d853e58c978f291f02c312b624fc973c
7
- data.tar.gz: 05dd7cf692a3331a8a23d7a7533106c303385505bc5b9572f60b108eda72b7265b04c33ffca3c9c1e0137e4b02984a9a5ac07f4c04d11955a4ad4db94154f600
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: function(e){
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
@@ -192,6 +192,8 @@ class App < Sinatra::Base
192
192
 
193
193
  entry
194
194
  end
195
+ end.sort_by do |entry|
196
+ entry[:name]
195
197
  end
196
198
 
197
199
  entries.to_json
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
@@ -1,3 +1,3 @@
1
1
  module Catscope
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: catscope
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuto Hayamizu