markdown_exec 1.1.1 → 1.2.0

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
  SHA256:
3
- metadata.gz: 0f8bb9f8a7a903a6b221ed8d04a5acb445e294be4c134202b9a71ba9e9f7c7ac
4
- data.tar.gz: d26a89ae33f1aeaac70b40f3e31b3090fb50c6eb48874eeba435ce89825123fc
3
+ metadata.gz: 160eb660362db62302a05b8b46398c6d85357c917ee55eeb89a8ce0f739eec8a
4
+ data.tar.gz: 706e575c290ec56d34ad58f06ca9e30127b2c0bdacf431a4c9e3f69bc30e80dc
5
5
  SHA512:
6
- metadata.gz: f177057c231ef950012abc922b6c3d9611e0b423df57cee07e6ac0e68864c18ce9b6a7cf640e165dbd8409d6ecefb199a3bb31643a7c5e31d5c241f17682545e
7
- data.tar.gz: 9fb1a5d4274d2443e1ed9680978cfb12c76b46416a3ba76483addd19b61238446dce86793a039cfede131bdd11a4436ae693640ad279add82e24415a544b7b53
6
+ metadata.gz: f540464a21a3ca2b654d89b3bc32f2172a3e610066bc64b9eae1bc29d99b8006ed3581998a50ae2327052c944656584375df55e64ffeeb77864ae05e45325e1c
7
+ data.tar.gz: a22c5ff757a2b5173725786bdbc399cae29f63eda891a0741149286391cb413abbcccd3799bd15ec769230ed44245b49664d434c77c12610bc2cfc138a9d3ddb
data/.reek ADDED
@@ -0,0 +1,24 @@
1
+ ---
2
+ detectors:
3
+ DataClump:
4
+ enabled: false
5
+ NilCheck:
6
+ enabled: false
7
+ TooManyStatements:
8
+ enabled: false
9
+ UtilityFunction:
10
+ public_methods_only: true
11
+ ControlParameter:
12
+ enabled: true
13
+ DuplicateMethodCall:
14
+ enabled: true
15
+ FeatureEnvy:
16
+ enabled: false # too strict
17
+ InstanceVariableAssumption:
18
+ enabled: true
19
+ IrresponsibleModule:
20
+ enabled: true
21
+ LongParameterList:
22
+ enabled: true
23
+ LongYieldList:
24
+ enabled: true
data/CHANGELOG.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Changelog
2
2
 
3
3
  ## [ToDo]
4
+ `reek lib/markdown_exec.rb --config .reek`
4
5
 
5
6
  - user settings
6
7
  - hidden w , w/o () in names
@@ -36,6 +37,21 @@
36
37
  - [ ] repeat to reload last doc and block
37
38
  - [ ] option to log blended, timeline; stdin, stdout, stderr; labels: prefix and blocks
38
39
  - [ ] ren logged_stdout_filename_prefix to saved_stdout_filename_prefix
40
+ - [ ] ignore '#' in fenced code blocks
41
+
42
+ ## [1.2.0] - 2022-06-11
43
+
44
+ ### Added
45
+
46
+ - Options
47
+ - Display document name in block selection menu
48
+ - Display headings (levels 1,2,3) in block selection menu
49
+ - Trap Ctrl-C (SIGTERM) while script is executing.
50
+ Completes MDE processes such as saving output and reporting results.
51
+
52
+ ### Changed
53
+
54
+ - Refactoring
39
55
 
40
56
  ## [1.1.1] - 2022-05-25
41
57
 
data/Gemfile CHANGED
@@ -6,8 +6,8 @@ gemspec
6
6
  gem 'clipboard'
7
7
  gem 'erb'
8
8
  gem 'minitest', '~> 5.0'
9
- gem 'mrdialog', '~> 1.0.3'
10
9
  gem 'rake', '~> 13.0'
10
+ gem 'reek'
11
11
  gem 'rubocop', '~> 1.21'
12
12
  gem 'rubocop-minitest', require: false
13
13
  gem 'rubocop-rake', require: false
data/Gemfile.lock CHANGED
@@ -1,9 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- markdown_exec (1.1.1)
4
+ markdown_exec (1.2.0)
5
5
  clipboard (~> 1.3.6)
6
- mrdialog (~> 1.0.3)
7
6
  open3 (~> 0.1.1)
8
7
  optparse (~> 0.1.1)
9
8
  tty-prompt (~> 0.23.1)
@@ -17,8 +16,8 @@ GEM
17
16
  clipboard (1.3.6)
18
17
  erb (2.2.3)
19
18
  cgi
19
+ kwalify (0.7.2)
20
20
  minitest (5.15.0)
21
- mrdialog (1.0.3)
22
21
  open3 (0.1.1)
23
22
  optparse (0.1.1)
24
23
  parallel (1.21.0)
@@ -28,6 +27,10 @@ GEM
28
27
  tty-color (~> 0.5)
29
28
  rainbow (3.1.1)
30
29
  rake (13.0.6)
30
+ reek (6.1.1)
31
+ kwalify (~> 0.7.0)
32
+ parser (~> 3.1.0)
33
+ rainbow (>= 2.0, < 4.0)
31
34
  regexp_parser (2.2.1)
32
35
  rexml (3.2.5)
33
36
  rubocop (1.26.0)
@@ -70,8 +73,8 @@ DEPENDENCIES
70
73
  erb
71
74
  markdown_exec!
72
75
  minitest (~> 5.0)
73
- mrdialog (~> 1.0.3)
74
76
  rake (~> 13.0)
77
+ reek
75
78
  rubocop (~> 1.21)
76
79
  rubocop-minitest
77
80
  rubocop-rake
data/README.md CHANGED
@@ -203,6 +203,10 @@ export ACTIVITY=asleep
203
203
  echo "$TIME -> $ACTIVITY"
204
204
  ```
205
205
 
206
+ ``` :sleep
207
+ sleep 10
208
+ ```
209
+
206
210
  # License
207
211
 
208
212
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile CHANGED
@@ -5,8 +5,6 @@ require 'rake/testtask'
5
5
  require 'erb'
6
6
  require 'yaml'
7
7
 
8
- require_relative 'lib/shared'
9
-
10
8
  Rake::TestTask.new(:test) do |task|
11
9
  task.libs << 'test'
12
10
  task.libs << 'lib'
@@ -15,6 +13,11 @@ end
15
13
 
16
14
  require 'rubocop/rake_task'
17
15
 
16
+ require_relative 'lib/shared'
17
+ require_relative 'lib/tap'
18
+
19
+ include Tap # rubocop:disable Style/MixinUsage
20
+
18
21
  RuboCop::RakeTask.new do |task|
19
22
  task.requires << 'rubocop-minitest'
20
23
  end
@@ -26,12 +29,13 @@ end
26
29
 
27
30
  require_relative 'lib/markdown_exec/version'
28
31
 
29
- task default: %i[test rubocop rubocopminitest]
32
+ task default: %i[test reek rubocop rubocopminitest]
30
33
 
31
34
  # task :default => :build
32
35
 
33
36
  desc 'gem build'
34
37
  task :build do
38
+ Rake::Task['update_tab_completion'].execute
35
39
  system "gem build #{MarkdownExec::GEM_NAME}.gemspec"
36
40
  end
37
41
 
@@ -55,13 +59,29 @@ task :clean do
55
59
  system 'rm *.gem'
56
60
  end
57
61
 
62
+ desc 'reek'
63
+ task :reek do
64
+ `reek --config .reek .`
65
+ end
66
+
58
67
  private
59
68
 
60
69
  BF = 'bin'
61
70
 
71
+ # format for use in array in bash script
72
+ # `opts=<%= mde_tab_completions %>`
73
+ #
74
+ def words_list(words)
75
+ words.map do |word|
76
+ %("#{word}")
77
+ end.join ' '
78
+ end
79
+
80
+ # write tab_completion.sh with erb
81
+ #
62
82
  def update_tab_completion(target)
63
83
  words = `#{File.join BF, MarkdownExec::BIN_NAME} --tab-completions`.split("\n")
64
- mde_tab_completions = '(' + (words.map { |s| "\"#{s}\"" }).join(' ') + ')'
84
+ mde_tab_completions = "(#{words_list(words)})"
65
85
  mde_help = `#{File.join BF, MarkdownExec::BIN_NAME} --help`.split("\n")
66
86
  menu_export_yaml = `#{File.join BF, MarkdownExec::BIN_NAME} --menu-export`
67
87
 
@@ -13,7 +13,7 @@ __filedirs_all()
13
13
  }
14
14
 
15
15
  _mde_echo_version() {
16
- echo "1.1.1"
16
+ echo "1.2.0"
17
17
  }
18
18
 
19
19
  _mde() {
@@ -42,6 +42,10 @@ _mde() {
42
42
 
43
43
  --logged-stdout-filename-prefix) COMPREPLY="mde"; return 0 ;;
44
44
 
45
+ --menu-blocks-with-docname) COMPREPLY="0"; return 0 ;;
46
+
47
+ --menu-blocks-with-headings) COMPREPLY="0"; return 0 ;;
48
+
45
49
  --output-execution-summary) COMPREPLY="0"; return 0 ;;
46
50
 
47
51
  --output-script) COMPREPLY="0"; return 0 ;;
@@ -76,7 +80,7 @@ _mde() {
76
80
  # present matching option names
77
81
  #
78
82
  if [[ ${cur} == -* ]] ; then
79
- opts=("--list-blocks" "--list-default-env" "--list-default-yaml" "--list-docs" "--list-recent-output" "--list-recent-scripts" "--pwd" "--run-last-script" "--select-recent-output" "--select-recent-script" "--menu-export" "--tab-completions" "--help" "--version" "--exit" "--config" "--debug" "--display-level" "--block-name" "--filename" "--list-count" "--logged-stdout-filename-prefix" "--output-execution-summary" "--output-script" "--output-stdout" "--path" "--save-executed-script" "--save-execution-output" "--saved-script-chmod" "--saved-script-filename-prefix" "--saved-script-folder" "--saved-script-glob" "--saved-stdout-folder" "--saved-stdout-glob" "--user-must-approve")
83
+ opts=("--list-blocks" "--list-default-env" "--list-default-yaml" "--list-docs" "--list-recent-output" "--list-recent-scripts" "--pwd" "--run-last-script" "--select-recent-output" "--select-recent-script" "--menu-export" "--tab-completions" "--help" "--version" "--exit" "--config" "--debug" "--display-level" "--block-name" "--filename" "--list-count" "--logged-stdout-filename-prefix" "--menu-blocks-with-docname" "--menu-blocks-with-headings" "--output-execution-summary" "--output-script" "--output-stdout" "--path" "--save-executed-script" "--save-execution-output" "--saved-script-chmod" "--saved-script-filename-prefix" "--saved-script-folder" "--saved-script-glob" "--saved-stdout-folder" "--saved-stdout-glob" "--user-must-approve")
80
84
  COMPREPLY=( $(compgen -W "$(printf "'%s' " "${opts[@]}")" -- "${cur}") )
81
85
 
82
86
  return 0
@@ -103,6 +107,10 @@ _mde() {
103
107
 
104
108
  --logged-stdout-filename-prefix) COMPREPLY=".PREFIX."; return 0 ;;
105
109
 
110
+ --menu-blocks-with-docname) COMPREPLY=".BOOL."; return 0 ;;
111
+
112
+ --menu-blocks-with-headings) COMPREPLY=".BOOL."; return 0 ;;
113
+
106
114
  --output-execution-summary) COMPREPLY=".BOOL."; return 0 ;;
107
115
 
108
116
  --output-script) COMPREPLY=".BOOL."; return 0 ;;
@@ -140,4 +148,4 @@ _mde() {
140
148
 
141
149
  complete -o filenames -o nospace -F _mde mde
142
150
  # _mde_echo_version
143
- # echo "Updated: 2022-05-26 01:40:10 UTC"
151
+ # echo "Updated: 2022-06-12 20:31:36 UTC"
data/lib/colorize.rb ADDED
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ # encoding=utf-8
4
+
5
+ # │0 │ to restore default │
6
+ # │ │ color │
7
+ # ├───┼───────────────────────┤
8
+ # │ │ │
9
+ # │1 │ for brighter colors │
10
+ # ├───┼───────────────────────┤
11
+ # │ │ │
12
+ # │4 │ for underlined text │
13
+ # ├───┼───────────────────────┤
14
+ # │ │ │
15
+ # │5 │ for flashing text
16
+ class String
17
+ def black
18
+ "\033[30m#{self}\033[0m"
19
+ end
20
+
21
+ def red
22
+ "\033[31m#{self}\033[0m"
23
+ end
24
+
25
+ def bred
26
+ "\033[1;31m#{self}\033[0m"
27
+ end
28
+
29
+ def green
30
+ "\033[32m#{self}\033[0m"
31
+ end
32
+
33
+ def bgreen
34
+ "\033[1;32m#{self}\033[0m"
35
+ end
36
+
37
+ def yellow
38
+ "\033[33m#{self}\033[0m"
39
+ end
40
+
41
+ def byellow
42
+ "\033[1;33m#{self}\033[0m"
43
+ end
44
+
45
+ def blue
46
+ "\033[34m#{self}\033[0m"
47
+ end
48
+
49
+ def magenta
50
+ "\033[35m#{self}\033[0m"
51
+ end
52
+
53
+ def cyan
54
+ "\033[36m#{self}\033[0m"
55
+ end
56
+
57
+ def white
58
+ "\033[37m#{self}\033[0m"
59
+ end
60
+
61
+ def bwhite
62
+ "\033[1;37m#{self}\033[0m"
63
+ end
64
+ end
data/lib/env.rb ADDED
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ # encoding=utf-8
4
+
5
+ # utility functions to read environment variables
6
+ #
7
+ module Env
8
+ # :reek:BooleanParameter
9
+ # :reek:DataClump
10
+ # :reek:NilCheck
11
+ # :reek:UtilityFunction
12
+ def env_bool(name, default: false)
13
+ return default if name.nil? || (val = ENV[name]).nil?
14
+ return false if val.empty? || val == '0'
15
+
16
+ true
17
+ end
18
+
19
+ # skip :reek:DataClump
20
+ # skip :reek:NilCheck
21
+ # skip :reek:UtilityFunction
22
+ def env_int(name, default: 0)
23
+ return default if name.nil? || (val = ENV[name]).nil?
24
+ return default if val.empty?
25
+
26
+ val.to_i
27
+ end
28
+
29
+ # skip :reek:DataClump
30
+ # skip :reek:NilCheck
31
+ # skip :reek:UtilityFunction
32
+ def env_str(name, default: '')
33
+ return default if name.nil? || (val = ENV[name]).nil?
34
+
35
+ val || default
36
+ end
37
+ end
@@ -5,5 +5,5 @@ module MarkdownExec
5
5
  APP_NAME = 'MDE'
6
6
  BIN_NAME = 'mde'
7
7
  GEM_NAME = 'markdown_exec'
8
- VERSION = '1.1.1'
8
+ VERSION = '1.2.0'
9
9
  end