clerq 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.travis.yml +7 -0
  4. data/Gemfile +6 -0
  5. data/Gemfile.lock +24 -0
  6. data/README.md +269 -0
  7. data/Rakefile +10 -0
  8. data/TODO.md +3 -0
  9. data/bin/console +14 -0
  10. data/bin/setup +8 -0
  11. data/clerq.gemspec +44 -0
  12. data/exe/clerq +8 -0
  13. data/lib/assets/new/README.md.tt +75 -0
  14. data/lib/assets/new/clerq.thor.tt +15 -0
  15. data/lib/assets/new/clerq.yml.tt +4 -0
  16. data/lib/assets/new/content.md.tt +41 -0
  17. data/lib/assets/promo/README.md +40 -0
  18. data/lib/assets/promo/bin/Clerq SRS.docx +0 -0
  19. data/lib/assets/promo/bin/Clerq SRS.md +579 -0
  20. data/lib/assets/promo/bin/assets/promo_dark.png +0 -0
  21. data/lib/assets/promo/bin/assets/promo_light.png +0 -0
  22. data/lib/assets/promo/clerq.yml +3 -0
  23. data/lib/assets/promo/promo.thor +58 -0
  24. data/lib/assets/promo/src/clerq.md +82 -0
  25. data/lib/assets/promo/src/fr/cmp.node.md +14 -0
  26. data/lib/assets/promo/src/fr/cmp.repo.md +10 -0
  27. data/lib/assets/promo/src/fr/cmp.tt.md +20 -0
  28. data/lib/assets/promo/src/fr/cmp.writer.md +19 -0
  29. data/lib/assets/promo/src/fr/ent.md +32 -0
  30. data/lib/assets/promo/src/ui/cli/cli.bld.md +32 -0
  31. data/lib/assets/promo/src/ui/cli/cli.chk.md +17 -0
  32. data/lib/assets/promo/src/ui/cli/cli.hlp.md +14 -0
  33. data/lib/assets/promo/src/ui/cli/cli.new.md +20 -0
  34. data/lib/assets/promo/src/ui/cli/cli.opt.md +11 -0
  35. data/lib/assets/promo/src/ui/cli/cli.ver.md +4 -0
  36. data/lib/assets/promo/src/ui/ui.cli.md +8 -0
  37. data/lib/assets/promo/src/us/us.reader.md +8 -0
  38. data/lib/assets/promo/src/us/us.writer.md +79 -0
  39. data/lib/assets/tt/default.md.erb +64 -0
  40. data/lib/assets/tt/gitlab.md.erb +93 -0
  41. data/lib/assets/tt/pandoc.md.erb +88 -0
  42. data/lib/assets/tt/raw.md.erb +23 -0
  43. data/lib/clerq.rb +41 -0
  44. data/lib/clerq/cli.rb +129 -0
  45. data/lib/clerq/entities.rb +2 -0
  46. data/lib/clerq/entities/node.rb +135 -0
  47. data/lib/clerq/entities/template.rb +19 -0
  48. data/lib/clerq/gateways.rb +3 -0
  49. data/lib/clerq/gateways/gateway.rb +17 -0
  50. data/lib/clerq/gateways/in_files.rb +36 -0
  51. data/lib/clerq/gateways/in_memory.rb +35 -0
  52. data/lib/clerq/interactors.rb +5 -0
  53. data/lib/clerq/interactors/check_nodes.rb +81 -0
  54. data/lib/clerq/interactors/compile_nodes.rb +31 -0
  55. data/lib/clerq/interactors/create_node.rb +40 -0
  56. data/lib/clerq/interactors/interactor.rb +28 -0
  57. data/lib/clerq/interactors/join_nodes.rb +59 -0
  58. data/lib/clerq/interactors/query_nodes.rb +62 -0
  59. data/lib/clerq/properties.rb +21 -0
  60. data/lib/clerq/repositories.rb +5 -0
  61. data/lib/clerq/repositories/in_memory.rb +45 -0
  62. data/lib/clerq/repositories/node_reader.rb +107 -0
  63. data/lib/clerq/repositories/node_repository.rb +56 -0
  64. data/lib/clerq/repositories/repository.rb +11 -0
  65. data/lib/clerq/repositories/template_repository.rb +53 -0
  66. data/lib/clerq/settings.rb +56 -0
  67. data/lib/clerq/templater.rb +32 -0
  68. data/lib/clerq/version.rb +3 -0
  69. metadata +172 -0
@@ -0,0 +1,3 @@
1
+ ---
2
+ document: Clerq SRS
3
+ template: default.md.erb
@@ -0,0 +1,58 @@
1
+ require 'clerq'
2
+ require 'thor'
3
+
4
+ class Promo < Thor
5
+ include Thor::Actions
6
+ namespace :promo
7
+
8
+ desc "publish", "Publish document"
9
+ def publish
10
+ doc = Clerq.settings.document
11
+ tmp = '.publish.md'
12
+ `clerq build -t pandoc.md.erb -o #{tmp}`
13
+ Dir.chdir(Clerq.settings.bin) do
14
+ `pandoc -s --toc #{tmp} -o "#{doc}.docx"`
15
+ File.delete(tmp)
16
+ end
17
+ end
18
+
19
+ desc "toc", "Print TOC"
20
+ def toc
21
+ node = Clerq::Interactors::JoinNodes.()
22
+ puts "% #{node.title}"
23
+ node.to_a.drop(1).each do |n|
24
+ puts "#{' ' * (n.nesting_level - 1)}[#{n.id}] #{n.title}"
25
+ end
26
+ end
27
+
28
+ desc "mm", "Create meeting minutes"
29
+ def mm
30
+ minutes = "meeting minutes #{Time.new.strftime('%Y-%m-%d')}.md"
31
+ content = "% #{minutes.capitalize}\n\n" + MINUTES_TEMPLATE
32
+ Dir.mkdir('mm') unless Dir.exist?('mm')
33
+ File.write("mm/#{minutes}", content)
34
+ say "'mm/#{minutes}' created!"
35
+ end
36
+
37
+ MINUTES_TEMPLATE = <<~EOF
38
+ # Attendants
39
+
40
+ 1.
41
+ 2.
42
+ 3.
43
+
44
+ # Questions
45
+
46
+ 1.
47
+ 2.
48
+ 3.
49
+
50
+ # Resolutions
51
+
52
+ 1.
53
+ 2.
54
+ 3.
55
+ EOF
56
+
57
+
58
+ end
@@ -0,0 +1,82 @@
1
+ # 1 Introduction
2
+ {{skip_meta: true}}
3
+
4
+ ## 1.1 Purpose
5
+ {{skip_meta: true}}
6
+
7
+ The purpose of this document is to provide a demo project "Clerq Promo SRS" for all perspective Clerq users to introduce the system by example and provide a sandbox for experiments for the existing users.
8
+
9
+ The other purpose (rather technical) is to have repository that provides all possible combinations of markup inside (links, ids, macros, etc.) to exercise in writing documents templates.
10
+
11
+ ## 1.2 Scope
12
+ {{skip_meta: true}}
13
+
14
+ This software system will be a command-line interface (CLI) that provides a set of tools related to requirements management tasks. The system will also provide the requirements repository structure and the format of the requirements sources.
15
+
16
+ The system does not provide any graphical user interface. Assumed that users create and write requirements through any available text editor application, and manage requirements repository structure through any available file manager application.
17
+
18
+ Any features related to restricting access to the requirements repository or to the functions of the system are out of scope. Assumed that each project repository is under control of an SCM tool (Git, Subversion, etc.) and the SCM is in charge of user's access to the SCM artifacts.
19
+
20
+ ## 1.3 Definitions, acronyms, and abbreviations
21
+ {{skip_meta: true}}
22
+
23
+ CLI
24
+
25
+ : Command-line interface
26
+
27
+ VCS
28
+
29
+ : Version control system
30
+
31
+ SCM
32
+
33
+ : Software configuration management
34
+
35
+ User story
36
+
37
+ : User stories at [www.agilealliance.org](https://www.agilealliance.org/glossary/user-stories)
38
+
39
+ OS
40
+
41
+ : Operations System
42
+
43
+ [//]: # (to use the extension `--from markdown+definition_lists`)
44
+
45
+ ## 1.4 References
46
+ {{skip_meta: true}}
47
+
48
+ 1. [Markdown Guide](https://www.markdownguide.org/)
49
+ 2. [Pandoc User’s Guide](https://pandoc.org/MANUAL.html)
50
+ 3. [Git Documentation](https://git-scm.com/doc)
51
+
52
+ ## 1.5 Overview
53
+ {{skip_meta: true}}
54
+
55
+ The remaining sections of this document provide user requirements and functional requirements of the system.
56
+
57
+ The next chapter [[us]] introduces the system from User Stories' point of view and establishes the context for the functional requirements. The chapter is organized by user roles.
58
+
59
+ The following chapter [[fr]] describes detailed requirements for functions and user interfaces that are based on user stories from the previous chapter. The chapter is structured around system components and is written primarily for developers and quality assurance specialists.
60
+
61
+ # [us] 2 User stories
62
+ {{skip_meta: true; order_index: .reader .writer}}
63
+
64
+ # [fr] 3 Functional requirements
65
+ {{skip_meta: true}}
66
+
67
+ ## [cmp] Components
68
+ {{order_index: .node .repo}}
69
+
70
+ The system shall provide the following components:
71
+
72
+ {{@@list}}
73
+
74
+ ## [ent] Entities
75
+ {{order_index: .node .tt}}
76
+
77
+ ## [ui] User Interface
78
+
79
+ # Appendix
80
+ {{skip_meta: true}}
81
+
82
+ ![Clerq in Atom](assets/promo_light.png)
@@ -0,0 +1,14 @@
1
+ # [.node] Node
2
+ {{parent: cmp}}
3
+
4
+ The system shall provide the `Node` component that represents one single node of a document. The component shall provide the following function:
5
+
6
+ {{@@list}}
7
+
8
+ ## [.read] Read node from markup text
9
+
10
+ The system shall provide the ability to read node from lightweight markup language (markdown) to [[ent.node]].
11
+
12
+ ## [.write] Write node to markup text
13
+
14
+ The system shall provide the ability to write node from [[ent.node]] to lightweight markup language (markdown).
@@ -0,0 +1,10 @@
1
+ # [.repo] Repository
2
+ {{parent: cmp}}
3
+
4
+ ## [.read] Read repository
5
+
6
+ The system shall provide the function to read repository from separate files and folders and combine it to [[ent.node]] under root document node.
7
+
8
+ ## [.query] Query repository
9
+
10
+ The system shall provide the function to query repository by providing a query string
@@ -0,0 +1,20 @@
1
+ # [.tt] Templates manager
2
+ {{parent: cmp}}
3
+
4
+ The system shall provide `Template manager` component. The component shall provide the following functions:
5
+
6
+ {{@@list}}
7
+
8
+ ## [.find] Find template
9
+
10
+ The system shall provide function `find` for templates
11
+
12
+ __Input__
13
+
14
+ Parameter | Type | Required | Description
15
+ --------- | ------ | -------- | -----------
16
+ id | String | Yes | Template identifier
17
+
18
+ __Output__
19
+
20
+ Template body (see [[ent.tt]]) by provided template `id` parameter.
@@ -0,0 +1,19 @@
1
+ # [.writer] Writer
2
+ {{parent: cmp}}
3
+
4
+ The system shall provide the `Writer component`. The component shall provide functions of writing requirements repository to markup text.
5
+
6
+ ## [.write] Write function
7
+
8
+ The `Writer` component shall provide the function `write`.
9
+
10
+ __Input__
11
+
12
+ Parameter | Type | Required | Description
13
+ --------- | ---- | -------- | -----------
14
+ node | Node | Yes | see [[ent.node]]
15
+ template | Template | Yes | se [[ent.tt]]
16
+
17
+ __Output__
18
+
19
+ Text presentation of `node` parameter according to `template` parameter
@@ -0,0 +1,32 @@
1
+ # [.node] Node entity
2
+ {{parent: ent}}
3
+
4
+ The system shall provide `Node` entity that provide the following attributes:
5
+
6
+ Attribute | Type | Required | Default | Description
7
+ --------- | ------ | -------- | ------- | -----------
8
+ id | String | Yes | "" | Node identifier
9
+ title | String | Yes | "" | Node title
10
+ meta | Hash | Yes | {} | Node metadata
11
+ body | String | Yes | "" | Node body
12
+ items | Array<Node> | Yes | [] | Array of child nodes
13
+
14
+ ## System node options
15
+
16
+ The system through node metadata shall provide the following system options:
17
+
18
+ Option | Example | Description
19
+ ----------- | ------- | -----------
20
+ parent | parent: fr | specifies the node parent
21
+ skip_meta | skip_meta: true | force the system to skip printing metadata
22
+ order_index | order_index: .1 .2 | force the system to use specified order for child nodes
23
+
24
+ # [.tt] Template entity
25
+ {{parent: ent}}
26
+
27
+ The system shall provide `Template` entity that provide the following attributes:
28
+
29
+ Attribute | Type | Required | Default | Description
30
+ --------- | ------ | -------- | ------- | -----------
31
+ id | String | Yes | "" | Template identifier
32
+ body | String | Yes | "" | Template body
@@ -0,0 +1,32 @@
1
+ # [.bld] Building project
2
+ {{parent: cli}}
3
+
4
+ The system shall provide command `clerq build`. When the user requests the command the system shall combine all requirements in the project repository and build the output document according to input parameters.
5
+
6
+ ## [.par] Input parameters
7
+
8
+ The command shall provide the following input parameters:
9
+
10
+ * `-o/--output`, string, optional, represent name for the output document;
11
+ * `-t/--template TEMPLATE`, string, optional, represent a template for building the document;
12
+ * `-q/--query QUERY`, string, optional, represent query string for requirements.
13
+
14
+ ##
15
+
16
+ When `-o/--output` parameter is not provided, the system shall use the default file name from settings of the project.
17
+
18
+ ##
19
+
20
+ When `-o/--output` parameter is provided, the system shall save the generated document under the provided name.
21
+
22
+ ##
23
+
24
+ When `-t/--template` parameter is not provided, the system shall use the default template from settings of the project.
25
+
26
+ ##
27
+
28
+ When `-t/--template` parameter is provided, the system shall check that the provided template exists and use it for document generation.
29
+
30
+ ##
31
+
32
+ When `-q/--query` parameter is provided, the system shall check if the provided query is correct query string and select requirements for building the document according to the query.
@@ -0,0 +1,17 @@
1
+ # [.chk] Checking project
2
+ {{parent: cli}}
3
+
4
+ The system shall provide command `clerq check`. When the user requests the command the system shall check the clerq repository for errors.
5
+
6
+ ##
7
+
8
+ When any errors have found during checking, the system shall print the errors grouped by error type. The following errors type shall be checked:
9
+
10
+ * Non-unique identifiers;
11
+ * Unknown/wrong parents;
12
+ * Unknown/Wrong links;
13
+ * Wrong order_index attribute.
14
+
15
+ ##
16
+
17
+ When errors have not found, the system shall print the message `No errors found. Everything is fine.`
@@ -0,0 +1,14 @@
1
+ # [.hlp] Help
2
+ {{parent: cli}}
3
+
4
+ The system shall provide command `clerq help`. When the user requests the command, the system shall print the list of all clerq CLI commands with a short description of each command.
5
+
6
+ ## [.par] Input parameters
7
+
8
+ The command shall provide the following input parameters:
9
+
10
+ * `COMMAND`, string, optional, represent name for the command.
11
+
12
+ ##
13
+
14
+ When the `COMMAND` parameter is provided, the system shall print the detailed description of the command with all supported parameters and options.
@@ -0,0 +1,20 @@
1
+ # [.new] Creating new project
2
+ {{parent: cli}}
3
+
4
+ The system shall provide command `clerq new`. When the user requests the command the system shall create a new clerq project according to input parameters.
5
+
6
+ {{@@skip TODO what is the project?}}
7
+
8
+ ## [.par] Input parameters
9
+
10
+ The command shall provide the following input parameters:
11
+
12
+ * `PROJECT`, string, required, represent the name of the new project.
13
+
14
+ ##
15
+
16
+ When parameter `PROJECT` not provided, the system shall stop the command execution and print the error message `Parameter "PROJECT" required!`.
17
+
18
+ ##
19
+
20
+ When parameter `PROJECT` provided and a directory called according to the parameter value exists, the system shall stop the command execution and print the error message `Directory "PROJECT" exists!`.
@@ -0,0 +1,11 @@
1
+ # [.opt] Project settings
2
+ {{parent: cli}}
3
+
4
+ The system shall provide settings file for clerq project. It should be placed under root clerq project directory and called `clerq.yml`.
5
+
6
+ Clerq project setting file shall provide the following options:
7
+
8
+ * `document`, string, required, represent file name of output document by default;
9
+ * `template`, string, required, represent template of output document by default;
10
+ * `title`, string, required, represent title of the output document;
11
+ * `author`, string, optional, represent optional document author.
@@ -0,0 +1,4 @@
1
+ # [.ver] Getting version
2
+ {{parent: cli}}
3
+
4
+ The system shall provide command `clerq --version`. When the user requests the command the system shall print its version.
@@ -0,0 +1,8 @@
1
+ # [cli] CLI
2
+ {{parent: ui; order_index: .opt .ver .hlp .new .chk .bld}}
3
+
4
+ The following requirements assumed that all CLI commands have to be called in a directory that contains a certain clerq project.
5
+
6
+ The system shall provide the following CLI commands:
7
+
8
+ {{@@list}}
@@ -0,0 +1,8 @@
1
+ # [.reader] Reader
2
+ {{parent: us}}
3
+
4
+ A requirements reader uses requirements in his day to day work as an input for other project activities or participates in the requirements review process.
5
+
6
+ ## Chose a presentation format
7
+
8
+ As a reader, I want to get requirements in a particular document format (PDF, Html, MS Word, OpenDocument, etc.), so that I can use my usual tools to work with the document.
@@ -0,0 +1,79 @@
1
+ # [.writer] Writer
2
+ {{parent: us}}
3
+
4
+ A requirements writer / author / developer / analyst
5
+
6
+ ## README, HOW-TO
7
+
8
+ As a requirements analyst who visits the project promo page, I want to get some introduction to the project and its features, so that I understand how close it meets my needs.
9
+
10
+ {{@@skip it just requires that the project should have README.md}}
11
+
12
+ ## Write in plain text files
13
+
14
+ As a requirements writer, I want to develop and store requirements in plain text, so that my readers and I would not need to install any specialized software to work with requirements.
15
+
16
+ ## Using of lightweight markup language
17
+
18
+ As a requirements writer, when I work on the requirements text, I want to use a lightweight markup language (LML), so that it still plain text and, at the same time, I have basic formatting capabilities of style and structure of a text, lists, and tables.
19
+
20
+ ## Set of separate files
21
+
22
+ As a requirements writer, when I develop requirements, I want to structure the entire set of requirements as a set of separate files and folders, so that I have a high degree of agility but some drawbacks also ...
23
+
24
+ * I can write different complex topics in different files and folders;
25
+ * I can share the same repository with other authors without problems like the necessity to work with the same file simultaneously more that one person:
26
+
27
+ {{@@skip just curious if the user stories format really suited there for ... these rather features and benefits or quality properties than stories}}
28
+
29
+ ## Requirements subordination and order
30
+
31
+ As a drawback for the previous story when I have requirements in separated files, I need an ability to specify requirements subordination and output order through separated files, so that I can combine all requirements into the consistent repository.
32
+
33
+ ## Supporting Metadata
34
+
35
+ As a requirements writer, when I develop requirements, I want to mark requirements text by some metadata (source, author, dependencies, etc.), so that I can use the metadata for tagging, searching, selection, referring, etc.
36
+
37
+ ## Supporting Links
38
+
39
+ As a requirements writer, when I develop requirements, I want to link those with each other through simple references, so that I refer from one requirement to others.
40
+
41
+ ## Requirements templates
42
+
43
+ As a requirements writer, when I develop requirements, I want to create and use requirements templates, so that I simplify my work, improve productivity and provide basic writing style.
44
+
45
+ ## Checking repository
46
+ {{topic: true}}
47
+
48
+ As a requirements writer, I want to check requirements repository for different possible errors, so that I fix the errors and have consistent repository.
49
+
50
+ Manual files writing and writing in separate files especially can cause the following errors:
51
+
52
+ * Errors in structure of a requirements file;
53
+ * Errors in linking or ordering requirements;
54
+ * References that not exist in the repository;
55
+ * Duplicates of requirements identifiers.
56
+
57
+ ## Querying requirements
58
+
59
+ As a requirements writer, at any time, I want to query requirements (based on its attributes such "id", "title", "body", and metadata), so that I can have different subsets of requirements based on my needs.
60
+
61
+ ## Combining into documents
62
+
63
+ As a requirements writer, at any time, I want to combine requirements to a single consistent requirements specification, so that I can have requirements draft and releases.
64
+
65
+ ## Providing unique identifiers
66
+
67
+ As a requirements writer, I want to have automatically created unique identifiers for the requirements where it omitted, so that I will always have unique identifiers for all requirements.
68
+
69
+ ## Document templates
70
+
71
+ As a requirement writer, I want the system support ability to chose different templates for documents, so that I can have templates for different purposes (drafts and releases) and even software products (GitHub Markdown, Gitlab Markdown, Pandoc Markdown to convert to docx, odt, or pdf.)
72
+
73
+ ## Create own document template
74
+
75
+ As a requirements writer, I want to have ability to create my own templates or modify existing templates, so than I can do template tuning for my needs.
76
+
77
+ ## Script automation
78
+
79
+ As a requirements analyst, I want have ability to automate my working tasks related to requirements, so that I can write scripts related to publishing, reviewing or deriving other artifacts based on the requirements (backlog, estimation sheet, traceability matrix, etc.).