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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 01edcab452f73170e54d3d90d8c9282f86e0decc
4
- data.tar.gz: 5586006cdf76b777216a441bf4d157691519d239
3
+ metadata.gz: e4de006be190a6f8a7d2579851165fe02e4b7f13
4
+ data.tar.gz: 7f6111fb8bc94d0aaa2ed4e0ce7fea4bfa06fb96
5
5
  SHA512:
6
- metadata.gz: d0ad1b29b8b543cdeb512d9efc431459f89a616ea3f140dc64ec6f4af3d5c62736c03182716a1d05e5c3f32106d8b0f9d796a37fcf9ca69518b7e7869830dd1a
7
- data.tar.gz: 3cefb1a52081e60150af716e01c148dd9b057a78212e40f211af73f81a45383e2bd4c7a5fe7e947c9334d41122e8aa490d648cb70622ac00b80ced37accf5537
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
- mkdir -p readmexec && cp README.md readmexec/
10
+ gem install readmexec
11
11
  ```
12
12
 
13
- and run readmexec. By default it will just output commands it's going to execute:
13
+ Create a directory and grab README from github
14
14
 
15
15
  ```sh
16
- cd readmexec && readmexec
16
+ mkdir -p readmexec
17
+ curl https://raw.githubusercontent.com/wojtekmach/readmexec/master/README.md > readmexec/README.md
17
18
  ```
18
19
 
19
- Run `readmexec -e` to run them.
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
- if execute
33
- puts `#{block.content}`
34
- else
35
- puts block.content
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
@@ -1,3 +1,3 @@
1
1
  module Readmexec
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -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
- mkdir -p readmexec && cp README.md readmexec/
9
- cd readmexec && readmexec
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: readmexec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wojtek Mach