trackler 2.1.0.47 → 2.1.0.48

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: abacbba140846c7009970e81e498b44890347f87
4
- data.tar.gz: 5e654ab7a1f5089d53b4b3b43769045ad5670417
3
+ metadata.gz: d041252955c6c56c8018a5504e9e7062006f8b53
4
+ data.tar.gz: 7692edb8a74dc2636d1233774a7ccff2882e35ff
5
5
  SHA512:
6
- metadata.gz: 8e4ffd2d17ebe5674921d9aa886e492a749f6abd2d50c5d2918ec0188c8f4bf6144adb85391400fedfcb8424ad7e9edf374ff06da2ce5acb4c15d2251532e6cb
7
- data.tar.gz: 0647a113a9dc3e90ba82beacb0c8b6696ea20c01d7f38234ace4513230b2ae711034e18d6ea555b2af2c712470e34f3d321f18852006095755455fa2805c0462
6
+ metadata.gz: 5b8744b83b20e0983d1248537a8237a2a5660ddf8ea28561b28c4bd85db6eb39914fc26482b5d1dce8ffb6902a462e6d6b5d35fbfc40f174f1deabb8e40fe8dd
7
+ data.tar.gz: 4929da04a0244fbe9c0bb8474cddc85944d382fb1da4369c693f5362844733f185bf606fe403b91ad00a08a739286ebc5ab446014f239d9a94ca35106b6bd98a
@@ -1,75 +1,77 @@
1
- class DocFile
2
- DEFAULT_IMAGE_PATH = "/docs/img"
3
-
4
- def self.find(basename:, track_dir:)
5
- dir = File.join(track_dir, "docs")
6
-
7
- [
8
- MarkdownFile.new(basename: basename, docs_dir: dir),
9
- OrgmodeFile.new(basename: basename, docs_dir: dir),
10
- ].detect(&:exist?) || NullFile.new(basename: basename, docs_dir: dir)
11
- end
12
-
13
- attr_reader :basename, :dir
14
- def initialize(basename:, docs_dir:)
15
- @basename = basename
16
- @dir = docs_dir
1
+ module Trackler
2
+ class DocFile
3
+ DEFAULT_IMAGE_PATH = "/docs/img"
4
+
5
+ def self.find(basename:, track_dir:)
6
+ dir = File.join(track_dir, "docs")
7
+
8
+ [
9
+ MarkdownFile.new(basename: basename, docs_dir: dir),
10
+ OrgmodeFile.new(basename: basename, docs_dir: dir),
11
+ ].detect(&:exist?) || NullDocFile.new(basename: basename, docs_dir: dir)
12
+ end
13
+
14
+ attr_reader :basename, :dir
15
+ def initialize(basename:, docs_dir:)
16
+ @basename = basename
17
+ @dir = docs_dir
18
+ end
19
+
20
+ def render(image_path: DEFAULT_IMAGE_PATH)
21
+ body.gsub(img_src, img_dst(image_path))
22
+ end
23
+
24
+ def name
25
+ "%s.%s" % [basename, extension]
26
+ end
27
+
28
+ def extension
29
+ "md"
30
+ end
31
+
32
+ def exist?
33
+ File.exist?(path)
34
+ end
35
+
36
+ private
37
+
38
+ def body
39
+ File.read(path)
40
+ end
41
+
42
+ def path
43
+ File.join(dir, name)
44
+ end
45
+
46
+ def img_src
47
+ Regexp.new("]\\(%s" % DEFAULT_IMAGE_PATH)
48
+ end
49
+
50
+ def img_dst(image_path)
51
+ "](%s" % image_path.gsub(Regexp.new("/$"), "")
52
+ end
17
53
  end
18
54
 
19
- def render(image_path: DEFAULT_IMAGE_PATH)
20
- body.gsub(img_src, img_dst(image_path))
21
- end
22
-
23
- def name
24
- "%s.%s" % [basename, extension]
25
- end
55
+ class OrgmodeFile < DocFile
56
+ def body
57
+ Orgmode::Parser.new(File.read(path)).to_markdown
58
+ end
26
59
 
27
- def extension
28
- "md"
60
+ def extension
61
+ "org"
62
+ end
29
63
  end
30
64
 
31
- def exist?
32
- File.exist?(path)
65
+ class MarkdownFile < DocFile
33
66
  end
34
67
 
35
- private
36
-
37
- def body
38
- File.read(path)
39
- end
40
-
41
- def path
42
- File.join(dir, name)
43
- end
44
-
45
- def img_src
46
- Regexp.new("]\\(%s" % DEFAULT_IMAGE_PATH)
47
- end
48
-
49
- def img_dst(image_path)
50
- "](%s" % image_path.gsub(Regexp.new("/$"), "")
51
- end
52
- end
53
-
54
- class OrgmodeFile < DocFile
55
- def body
56
- Orgmode::Parser.new(File.read(path)).to_markdown
57
- end
58
-
59
- def extension
60
- "org"
61
- end
62
- end
63
-
64
- class MarkdownFile < DocFile
65
- end
66
-
67
- class NullFile < DocFile
68
- def render(image_path:"")
69
- ""
70
- end
68
+ class NullDocFile < DocFile
69
+ def render(image_path:"")
70
+ ""
71
+ end
71
72
 
72
- def exist?
73
- false
73
+ def exist?
74
+ false
75
+ end
74
76
  end
75
77
  end
@@ -1,3 +1,3 @@
1
1
  module Trackler
2
- VERSION = "2.1.0.47"
2
+ VERSION = "2.1.0.48"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trackler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0.47
4
+ version: 2.1.0.48
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katrina Owen