readmexec 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -4
- data/bin/readmexec +10 -4
- data/lib/readmexec/version.rb +1 -1
- data/test/readmexec_test.rb +5 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4de006be190a6f8a7d2579851165fe02e4b7f13
|
4
|
+
data.tar.gz: 7f6111fb8bc94d0aaa2ed4e0ce7fea4bfa06fb96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4535514c7bde53a83c5d0a2b0bdeb7784a41596dbccb782a693586c6e10a11028d28c845dfbd212b14bc334bdb987f3bdbc8d3cd5c8dbe375fe3b62eebdec11
|
7
|
+
data.tar.gz: 69cf43d3ad26e90d53845261402bae84ca0140efe5c170931409c8d0c4fe4706db8352b9bcad2058e7da1d88dd22745668aa4181e5d44e3d357b77cc860719a2
|
data/README.md
CHANGED
@@ -7,13 +7,21 @@ The idea here is to make README executable and verifiable since this is the only
|
|
7
7
|
## Example
|
8
8
|
|
9
9
|
```sh
|
10
|
-
|
10
|
+
gem install readmexec
|
11
11
|
```
|
12
12
|
|
13
|
-
|
13
|
+
Create a directory and grab README from github
|
14
14
|
|
15
15
|
```sh
|
16
|
-
|
16
|
+
mkdir -p readmexec
|
17
|
+
curl https://raw.githubusercontent.com/wojtekmach/readmexec/master/README.md > readmexec/README.md
|
17
18
|
```
|
18
19
|
|
19
|
-
Run
|
20
|
+
Run readmexec. By default it will just output commands it's going to execute:
|
21
|
+
|
22
|
+
```sh
|
23
|
+
cd readmexec
|
24
|
+
readmexec
|
25
|
+
```
|
26
|
+
|
27
|
+
Run `readmexec -e` to run commands instead of just printing them.
|
data/bin/readmexec
CHANGED
@@ -11,6 +11,10 @@ Block = Struct.new :type, :content do
|
|
11
11
|
content = buffer[1..-2].join("\n")
|
12
12
|
new(type, content)
|
13
13
|
end
|
14
|
+
|
15
|
+
def commands
|
16
|
+
content.split("\n").reject(&:empty?)
|
17
|
+
end
|
14
18
|
end
|
15
19
|
|
16
20
|
lines = File.readlines("README.md")
|
@@ -29,9 +33,11 @@ lines.each do |line|
|
|
29
33
|
end
|
30
34
|
|
31
35
|
blocks.each do |block|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
+
block.commands.each do |command|
|
37
|
+
if execute
|
38
|
+
puts `#{command}`
|
39
|
+
else
|
40
|
+
puts command
|
41
|
+
end
|
36
42
|
end
|
37
43
|
end
|
data/lib/readmexec/version.rb
CHANGED
data/test/readmexec_test.rb
CHANGED
@@ -5,8 +5,11 @@ describe "Readmexec" do
|
|
5
5
|
system "rm -rf readmexec"
|
6
6
|
|
7
7
|
`./bin/readmexec`.must_equal <<-end.gsub(/^\ {6}/, '')
|
8
|
-
|
9
|
-
|
8
|
+
gem install readmexec
|
9
|
+
mkdir -p readmexec
|
10
|
+
curl https://raw.githubusercontent.com/wojtekmach/readmexec/master/README.md > readmexec/README.md
|
11
|
+
cd readmexec
|
12
|
+
readmexec
|
10
13
|
end
|
11
14
|
end
|
12
15
|
end
|