readmexec 0.0.2 → 0.0.3
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 +4 -4
- data/README.md +3 -1
- data/VERSION +1 -0
- data/bin/readmexec +18 -12
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed4263c9fd56dfd1d46106f720d2f9115218dbc9
|
4
|
+
data.tar.gz: ca5eaf76b3bfeaee683759ecbb294afcb52332b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f02d21bc3937c95f14d76d56facebb8fefc4a2ffea7c9c8ca2bce77002fa1034714ca6a36648f01a579f61bcd1fe3f3a2fffc2d3315da6e588d00a466abf437
|
7
|
+
data.tar.gz: 6f739fcadd0e29b8618890c45b8a7b0de7f2e5ffafae6009050ea9872a66cf26cd07327466fc0e08d66cee74e3edf8e99918954165208e74223e746a0f6795d5
|
data/README.md
CHANGED
@@ -2,7 +2,9 @@
|
|
2
2
|
|
3
3
|
Readmexec grabs commands from your README and runs them.
|
4
4
|
|
5
|
-
The idea
|
5
|
+
The idea is to make README executable and verifiable since this is the only way to make sure it stays up to date. You can ensure that by using readmexec locally or on CI and verify that build instructions are still working.
|
6
|
+
|
7
|
+
|
6
8
|
|
7
9
|
## Example
|
8
10
|
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.3
|
data/bin/readmexec
CHANGED
@@ -3,8 +3,6 @@
|
|
3
3
|
BEGIN_REGEX = /\A```(.*)/
|
4
4
|
END_REGEX = /\A```$/
|
5
5
|
|
6
|
-
execute = ARGV[0] == "-e"
|
7
|
-
|
8
6
|
Block = Struct.new :type, :content do
|
9
7
|
def self.for(buffer)
|
10
8
|
type = buffer.first.match(BEGIN_REGEX)[1]
|
@@ -17,24 +15,32 @@ Block = Struct.new :type, :content do
|
|
17
15
|
end
|
18
16
|
end
|
19
17
|
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
def code_blocks(lines)
|
19
|
+
blocks = []
|
20
|
+
buffer = []
|
23
21
|
|
24
|
-
lines.each do |line|
|
25
|
-
|
26
|
-
|
27
|
-
|
22
|
+
lines.each do |line|
|
23
|
+
if line =~ BEGIN_REGEX .. line =~ END_REGEX
|
24
|
+
buffer << line
|
25
|
+
end
|
28
26
|
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
if line =~ END_REGEX
|
28
|
+
blocks << Block.for(buffer)
|
29
|
+
buffer = []
|
30
|
+
end
|
32
31
|
end
|
32
|
+
blocks
|
33
33
|
end
|
34
34
|
|
35
|
+
execute = ARGV[0] == "-e"
|
36
|
+
|
37
|
+
lines = File.readlines("README.md")
|
38
|
+
blocks = code_blocks(lines)
|
39
|
+
|
35
40
|
blocks.each do |block|
|
36
41
|
block.commands.each do |command|
|
37
42
|
if execute
|
43
|
+
$stderr.puts "Running: #{command}"
|
38
44
|
puts `#{command}`
|
39
45
|
else
|
40
46
|
puts command
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: readmexec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wojtek Mach
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -51,6 +51,7 @@ files:
|
|
51
51
|
- LICENSE.txt
|
52
52
|
- README.md
|
53
53
|
- Rakefile
|
54
|
+
- VERSION
|
54
55
|
- bin/readmexec
|
55
56
|
- lib/readmexec.rb
|
56
57
|
- lib/readmexec/version.rb
|