paperwork 0.3.4 → 0.3.5

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
  SHA256:
3
- metadata.gz: b2e693dd5bb169466f35243976c240df90b650c5a026b958fb2ad359362b97da
4
- data.tar.gz: 47d925596e691ea695051d32196b20d2f1f4af1bd4cbf52c828090c7904da41e
3
+ metadata.gz: f13203b1fabe9808e33e1cdaea4ba2c92d738daa94ffa1d22117af9057e76d6b
4
+ data.tar.gz: d4349a96f701e92591eabdc19abf1316b72ba88b876cd518ce9b58ea705aeecf
5
5
  SHA512:
6
- metadata.gz: 7743a376ef7a4cbacc04d71770622c4363a503a2396ec6135522b8fe266ecd774913c10af0c46bb561c68c454138daf90e71a8f1fcd2b15c1f554f08abc8f642
7
- data.tar.gz: 8d428a9773633ade5b13b79ed1f7d5e98cdd1f480b85a3370d22e36c48c5735155ac240c459c1f25816cf960c26708eaaf1220600021af838bdd7e8e9225df50
6
+ metadata.gz: '009b8503df60c1e652123084e5c51ec935e1daf996d7e7002b24f63a163a1fab9b5059d3e76b2c1f30d7489db70192dc157346a08f33d904d2fafd66ec4fe161'
7
+ data.tar.gz: 9cee87ec48e8587f19332f5fd5c5bb4b675199ffe5ec529582123a13c1b9dd46e0a3a7f4794f1347d36e3cfdb23986b17cdeb78951b4bb9970c984f747100392
data/Gemfile.lock CHANGED
@@ -1,7 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- paperwork (0.3.4)
4
+ paperwork (0.3.5)
5
+ listen (~> 3.4.1)
5
6
  rake (~> 12.3)
6
7
  redcarpet (~> 3.5.0)
7
8
  thor (~> 1.1.0)
@@ -13,11 +14,18 @@ GEM
13
14
  byebug (11.1.3)
14
15
  diff-lcs (1.4.4)
15
16
  docile (1.3.2)
17
+ ffi (1.14.2)
18
+ listen (3.4.1)
19
+ rb-fsevent (~> 0.10, >= 0.10.3)
20
+ rb-inotify (~> 0.9, >= 0.9.10)
16
21
  parallel (1.19.2)
17
22
  parser (2.7.1.4)
18
23
  ast (~> 2.4.1)
19
24
  rainbow (3.0.0)
20
25
  rake (12.3.3)
26
+ rb-fsevent (0.10.4)
27
+ rb-inotify (0.10.1)
28
+ ffi (~> 1.0)
21
29
  redcarpet (3.5.1)
22
30
  regexp_parser (1.7.1)
23
31
  rexml (3.2.4)
data/README.md CHANGED
@@ -9,6 +9,7 @@ title: paperwork
9
9
 
10
10
  Markdown is used throughout many software development projects because of its simple syntax. Though being simple markdown provides sufficient elements necessary to visualize most aspects of software. And it's integrated into many tools, like github, gitlab, Visual Studio Code,... most likely these are already part of nowadays development processes anyway.
11
11
 
12
+
12
13
  Most developers want to focus on code and progress and not on documentation. *paperwork* tries to keep most of the publishing topics of documentation away from them. One important goal with this is to keep the markdown document independent from the target media. So it is possible to write documentation as HTML pages that can be scrolled, printed,... as you would do with usual web sites. On the other hand, markdown could also be transformed to presentations. If you're reading this in a presentation, you're already looking at one example of such a transformation. If you don't, have a look at the [generated presentation](https://couchbelag.gitlab.io/paperwork). The source file for the presentation is the [regular `README.md` file of the project](https://gitlab.com/couchbelag/paperwork/-/blob/master/README.md).
13
14
 
14
15
 
@@ -21,7 +22,6 @@ Well... you wouldn't, I agree. Nevertheless I've been into situations where I cr
21
22
  *paperwork* is not simply a renderer like *redcarpet* (which is actually used as renderer within *paperwork*). It provides *"markdown API"* to interface with different media formats. Of course, *paperwork* is not limited to presentations and/or books. Any media could be addressed. The idea simply is *reduce, reuse, recycle*, write documentation once and spread it across multiple channels.
22
23
 
23
24
 
24
-
25
25
  ## Installation & Usage
26
26
 
27
27
  ### In a ruby application
@@ -5,21 +5,24 @@ module Paperwork
5
5
  # task generators for building with middleman
6
6
  module Tasks
7
7
  require "rake"
8
+ require "listen"
8
9
 
9
10
  ##
10
11
  # main task generator for building the document
11
12
  #
12
13
  class Document < Paperwork::Tasks::Base # rubocop:disable Metrics/ClassLength
13
- attr_reader :dir
14
+ attr_reader :dir, :sources_map
14
15
 
15
16
  include Rake::DSL
16
17
 
17
18
  def initialize(name, sources, *dependencies)
18
19
  @dir = Paperwork::Tasks::Template.new(name).dir
19
20
 
21
+ @sources_map = {}
20
22
  sources.each do |src|
21
23
  dst = get_destination(File.join(self.dir, "source"), src)
22
24
  BuildFile.new(dst, src)
25
+ sources_map[src] = dst
23
26
  dependencies << dst
24
27
  end
25
28
 
@@ -116,22 +119,33 @@ module Paperwork
116
119
  else
117
120
  Process.spawn(cmd, out: :out, in: :in, err: :err)
118
121
  end
119
- puts
120
- puts "+---------------------------------------------------------------+"
121
- puts "| |"
122
- puts "| IMPORTANT: Edit documents in #{self.dir} for live reload! |"
123
- puts "| ---------- The documents there are hard links to your |"
124
- puts "| source files, so the changes will be there |"
125
- puts "| as well. |"
126
- puts "| |"
127
- puts "+---------------------------------------------------------------+"
128
- puts
129
- Process.waitall
130
122
  end
123
+
124
+ listen_to_sources
125
+
126
+ Process.waitall
131
127
  end
132
128
  end
133
129
  end
134
130
  end
131
+
132
+ def listen_to_sources
133
+ sources = {}
134
+ self.sources_map.each do |src, dst|
135
+ sources[File.absolute_path(src)] = dst
136
+ end
137
+
138
+ ignore_list = [/#{Paperwork::Config[:build_root]}/]
139
+ Listen.to(Dir.pwd, ignore: ignore_list) do |modified, added, removed|
140
+ (modified + added + removed).each do |src|
141
+ dst = sources[src]
142
+ unless dst.nil?
143
+ puts "## updating #{src}"
144
+ FileUtils.cp src, dst
145
+ end
146
+ end
147
+ end.start
148
+ end
135
149
  end
136
150
  end
137
151
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Paperwork
4
- VERSION = "0.3.4"
4
+ VERSION = "0.3.5"
5
5
  end
data/paperwork.gemspec CHANGED
@@ -33,6 +33,7 @@ Gem::Specification.new do |spec|
33
33
  spec.add_development_dependency "rubocop", "~> 0.87.1"
34
34
  spec.add_development_dependency "simplecov", "~> 0.18.5"
35
35
 
36
+ spec.add_runtime_dependency "listen", "~> 3.4.1"
36
37
  spec.add_runtime_dependency "rake", "~> 12.3"
37
38
  spec.add_runtime_dependency "redcarpet", "~> 3.5.0"
38
39
  spec.add_runtime_dependency "thor", "~> 1.1.0"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paperwork
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Schmid
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: 0.18.5
83
+ - !ruby/object:Gem::Dependency
84
+ name: listen
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 3.4.1
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 3.4.1
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: rake
85
99
  requirement: !ruby/object:Gem::Requirement