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.
- checksums.yaml +4 -4
- data/.reek +24 -0
- data/CHANGELOG.md +75 -11
- data/Gemfile +7 -5
- data/Gemfile.lock +19 -1
- data/README.md +25 -8
- data/Rakefile +56 -2
- data/bin/tab_completion.sh +131 -3
- data/bin/tab_completion.sh.erb +85 -0
- data/lib/colorize.rb +64 -0
- data/lib/env.rb +37 -0
- data/lib/markdown_exec/version.rb +3 -2
- data/lib/markdown_exec.rb +915 -368
- data/lib/shared.rb +19 -0
- data/lib/tap.rb +36 -0
- metadata +31 -11
- data/fixtures/bash1.md +0 -12
- data/fixtures/bash2.md +0 -15
- data/fixtures/exclude1.md +0 -6
- data/fixtures/exclude2.md +0 -12
- data/fixtures/exec1.md +0 -8
- data/fixtures/heading1.md +0 -19
- data/fixtures/sample1.md +0 -9
- data/fixtures/title1.md +0 -6
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.
|
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-
|
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
|
-
-
|
98
|
-
-
|
99
|
-
-
|
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
data/fixtures/bash2.md
DELETED
data/fixtures/exclude1.md
DELETED
data/fixtures/exclude2.md
DELETED
data/fixtures/exec1.md
DELETED
data/fixtures/heading1.md
DELETED
data/fixtures/sample1.md
DELETED