activeoutline 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 169ed2516e2bd7778600622d84abf2978c26ca8c
4
- data.tar.gz: 7c198bb2931f528a4c17ad9ade4cf7c5c227a45e
3
+ metadata.gz: e4c71e812b7643c45a917e68ffc678fb4b2f62de
4
+ data.tar.gz: 645ac70e8f804928df692c0f523016917b08be03
5
5
  SHA512:
6
- metadata.gz: ea1ab80c3071d36fd7c825ddf646c48833e43efc1036882ce5c39cacb8f9b21a08dc2013b1f806f4134a19c7506513959533a296205ff8ab64d296561ff64806
7
- data.tar.gz: 90dca6027415ed30a2cc56d4f978771bdfccd8d2fa5304aa71b61a7abde4b51656e4caceb91ac029e2cb8ae12bc209ba6da2eef6a7f7fb4c32ca5e470d52e0bf
6
+ metadata.gz: 5d86a0b7f9d2476ea459f8199b51aa700c21aa97422349536f783bf3095485439839e385b7bd7a6417b71718f9607acc605b5918bc7e47dffd933d6e5f7307b9
7
+ data.tar.gz: 868444b88117e4630e5efda3469f5381bbdbc662c1dfa3af31e4d4911bb6a051fd6d124a75ae9ffddb54f8294763b9cdccb36271801bcccf982f55bcd407f1d8
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -12,9 +12,9 @@ class ActiveOutline
12
12
 
13
13
  class LinkReader
14
14
 
15
- def initialize(filepath, debug: false)
15
+ def initialize(filepath, debug: false, default_url: nil)
16
16
 
17
- @filepath, @debug = filepath, debug
17
+ @filepath, @debug, @default_url = filepath, debug, default_url
18
18
  read filepath
19
19
 
20
20
  end
@@ -39,10 +39,31 @@ class ActiveOutline
39
39
  s, _ = RXFHelper.read(filepath)
40
40
  puts 's ' + s.inspect if @debug
41
41
 
42
- @links = PolyrexLinks.new.import(s)
42
+ s2 = if @default_url then
43
+
44
+ # set a default url for entries which don't have one
45
+ s.lines.map do |x|
46
+ x =~ /:\/\// ? x : x.chomp + ' ' + @default_url \
47
+ + URI.encode(x.strip) + "\n"
48
+ end.join
49
+
50
+ else
51
+ s
52
+ end
53
+
54
+ if @debug then
55
+ puts 's2: ' + s2.inspect
56
+ puts 's: ' + s.inspect
57
+ end
58
+
59
+ if s2 != s and RXFHelper.writeable?(filepath) then
60
+ RXFHelper.write filepath, s2
61
+ end
62
+
63
+ @links = PolyrexLinks.new.import(s2)
43
64
  @ftx = FileTreeXML.new(s.lines.map {|x| x[/^ *\S+/]}.join("\n"),
44
65
  debug: @debug)
45
- end
66
+ end
46
67
 
47
68
  def reload()
48
69
  read @filepath
@@ -52,19 +73,18 @@ class ActiveOutline
52
73
  end
53
74
 
54
75
  def initialize(filepath='outline.txt', host: 'localhost',
55
- port: '60700', debug: false)
56
-
57
- @host, @port = host, port
76
+ port: '60700', debug: false, default_url: nil)
58
77
 
59
- @lr = LinkReader.new(filepath, debug: debug)
78
+ @filepath, @host, @port, @debug = filepath, host, port, debug
79
+ @default_url = default_url
60
80
 
61
81
  end
62
82
 
63
83
  def start()
64
84
 
65
- DRb.start_service "druby://#{@host}:#{@port}", @lr
85
+ lr = LinkReader.new(@filepath, debug: @debug, default_url: @default_url)
86
+ DRb.start_service "druby://#{@host}:#{@port}", lr
66
87
  DRb.thread.join
67
88
 
68
89
  end
69
90
  end
70
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeoutline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -33,7 +33,7 @@ cert_chain:
33
33
  date: 2018-03-17 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
- name: file_tree
36
+ name: filetree_xml
37
37
  requirement: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
metadata.gz.sig CHANGED
@@ -1 +1 @@
1
- t��� U�^��Qjk'"�� kbSGq//MP��ψ��`
1
+ "�tͯ�j��Ⱥeo�ݔ��톍�}8���=���$���`4j��_y]�{��`,��r��'���Ej�򏭫���fk �V �~=�.����ʮ��>��<M���4�������r½�Ojy�/W�?q\��oW)�&�IUi���ma���������|�{�Bns~̍�x�d/�X0V�=Ǚ3�6ɑ���`q�t.��!~ŷ�`c�Ӛ�e<߅8�v�-z�g(7���_°|���IX�+�� ͋� 6