markdown_exec 1.0.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/shared.rb ADDED
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ # encoding=utf-8
4
+
5
+ require 'shellwords'
6
+
7
+ public
8
+
9
+ # skip :reek:UtilityFunction
10
+ def value_for_cli(value)
11
+ case value.class.to_s
12
+ when 'String'
13
+ Shellwords.escape value
14
+ when 'FalseClass', 'TrueClass'
15
+ value ? '1' : '0'
16
+ else
17
+ Shellwords.escape value.to_s
18
+ end
19
+ end
data/lib/tap.rb ADDED
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ # encoding=utf-8
4
+
5
+ require 'json'
6
+ require 'yaml'
7
+
8
+ require_relative 'env'
9
+ include Env # rubocop:disable Style/MixinUsage
10
+
11
+ # add function for in-line tap
12
+ #
13
+ module Tap
14
+ $pdebug = env_bool 'MDE_DEBUG'
15
+
16
+ def tap_config(enable)
17
+ $pdebug = enable
18
+ end
19
+
20
+ def tap_inspect(format: nil, name: 'return')
21
+ return self unless $pdebug
22
+
23
+ cvt = {
24
+ json: :to_json,
25
+ string: :to_s,
26
+ yaml: :to_yaml,
27
+ else: :inspect
28
+ }
29
+ fn = cvt.fetch(format, cvt[:else])
30
+
31
+ puts "-> #{caller[0].scan(/in `?(\S+)'$/)[0][0]}()" \
32
+ " #{name}: #{method(fn).call}"
33
+
34
+ self
35
+ end
36
+ end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markdown_exec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fareed Stevenson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-27 00:00:00.000000000 Z
11
+ date: 2022-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: clipboard
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.3.6
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.3.6
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: open3
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -77,6 +91,7 @@ executables:
77
91
  extensions: []
78
92
  extra_rdoc_files: []
79
93
  files:
94
+ - ".reek"
80
95
  - ".rubocop.yml"
81
96
  - CHANGELOG.md
82
97
  - CODE_OF_CONDUCT.md
@@ -94,16 +109,13 @@ files:
94
109
  - bin/mde
95
110
  - bin/setup
96
111
  - bin/tab_completion.sh
97
- - fixtures/bash1.md
98
- - fixtures/bash2.md
99
- - fixtures/exclude1.md
100
- - fixtures/exclude2.md
101
- - fixtures/exec1.md
102
- - fixtures/heading1.md
103
- - fixtures/sample1.md
104
- - fixtures/title1.md
112
+ - bin/tab_completion.sh.erb
113
+ - lib/colorize.rb
114
+ - lib/env.rb
105
115
  - lib/markdown_exec.rb
106
116
  - lib/markdown_exec/version.rb
117
+ - lib/shared.rb
118
+ - lib/tap.rb
107
119
  homepage: https://rubygems.org/gems/markdown_exec
108
120
  licenses:
109
121
  - MIT
@@ -112,7 +124,14 @@ metadata:
112
124
  homepage_uri: https://rubygems.org/gems/markdown_exec
113
125
  rubygems_mfa_required: 'true'
114
126
  source_code_uri: https://github.com/fareedst/markdown_exec
115
- post_install_message:
127
+ post_install_message: |2+
128
+
129
+ To install tab completion:
130
+ - Append a command to load the completion script to your shell configuration file.
131
+ - This gem must be installed and executable for the command to be composed correctly.
132
+
133
+ echo "source $(mde --pwd)/bin/tab_completion.sh" >> ~/.bash_profile
134
+
116
135
  rdoc_options: []
117
136
  require_paths:
118
137
  - lib
@@ -132,3 +151,4 @@ signing_key:
132
151
  specification_version: 4
133
152
  summary: Interactively select and execute fenced code blocks in markdown files.
134
153
  test_files: []
154
+ ...
data/fixtures/bash1.md DELETED
@@ -1,12 +0,0 @@
1
- ``` :one
2
- a
3
- ```
4
- ```bash :two +one
5
- b
6
- ```
7
- ```bash :three +two +one
8
- c
9
- ```
10
- ```bash :four +three
11
- d
12
- ```
data/fixtures/bash2.md DELETED
@@ -1,15 +0,0 @@
1
- ``` :one
2
- a
3
- ```
4
- ``` :two +one
5
- b
6
- ```
7
- ``` :three +two
8
- c
9
- ```
10
- ``` :four
11
- d
12
- ```
13
- ``` :five +four +one
14
- e
15
- ```
data/fixtures/exclude1.md DELETED
@@ -1,6 +0,0 @@
1
- ``` :one
2
- a
3
- ```
4
- ```expect
5
- b
6
- ```
data/fixtures/exclude2.md DELETED
@@ -1,12 +0,0 @@
1
- ``` :one
2
- a
3
- ```
4
- ``` :(two)
5
- b
6
- ```
7
- ``` :three
8
- c
9
- ```
10
- ``` :()
11
- d
12
- ```
data/fixtures/exec1.md DELETED
@@ -1,8 +0,0 @@
1
- ```bash ls
2
- ls
3
- ```
4
-
5
- ```bash two-three
6
- echo "TWO"
7
- echo "THREE"
8
- ```
data/fixtures/heading1.md DELETED
@@ -1,19 +0,0 @@
1
- ``` :one
2
- a
3
- ```
4
- # h1
5
- ``` :two
6
- b
7
- ```
8
- ## h2
9
- ``` :three
10
- c
11
- ```
12
- ### h3
13
- ``` :four
14
- d
15
- ```
16
- ### h4
17
- ``` :five
18
- e
19
- ```
data/fixtures/sample1.md DELETED
@@ -1,9 +0,0 @@
1
- #
2
- ##
3
- ``` one
4
- a
5
- ```
6
-
7
- ```bash two
8
- b
9
- ```
data/fixtures/title1.md DELETED
@@ -1,6 +0,0 @@
1
- ```
2
- no name
3
- ```
4
- ``` :name1
5
- with name
6
- ```