codewalk 0.0.1

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.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/bin/codewalk +9 -0
  3. data/lib/codewalk.rb +33 -0
  4. metadata +46 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e6cb420482139cc4eefaf46d43cba96e399a3d11
4
+ data.tar.gz: b87c2a47d680248474eccfd30a26166b17e7bca0
5
+ SHA512:
6
+ metadata.gz: 1a0cddc57c4dfe36d75a0c812458326c31058ff53d7514a74a58006bd0e189f3de41d32793ee205ec6ac3d997d6925671b31caf945f683a16d5e39c41c06b11c
7
+ data.tar.gz: 09505dd8ad61c01e63dd9e3f9709999271755e4b6cc888dde33f05544b449755009b5e2c7e47a7c254bf22331fae869e45cd691d9f568e2c30307b5343c64eb8
data/bin/codewalk ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'codewalk'
4
+
5
+ command = ARGV.join(" ")
6
+
7
+ codewalk = Codewalk.new.run(command)
8
+
9
+ print codewalk.output()
data/lib/codewalk.rb ADDED
@@ -0,0 +1,33 @@
1
+ class Codewalk
2
+
3
+ DELIMITER = /\nEXAMPLE [0-9]*\n/
4
+
5
+ def parse(output_raw)
6
+ raw_chunks = output_raw.split(DELIMITER)
7
+ raw_chunks.shift() # remove empty first element
8
+ @chunks = raw_chunks.collect do |chunk|
9
+ # remove starting and trailing newline from each chunk
10
+ chunk[-1] = ""
11
+ chunk[0] = ""
12
+ chunk
13
+ end
14
+
15
+ self
16
+ end
17
+
18
+ def [](index)
19
+ @chunks[index]
20
+ end
21
+
22
+ def output()
23
+ @chunks[-1]
24
+ end
25
+
26
+ def run(command)
27
+ output_raw = `#{command}`
28
+ parse(output_raw)
29
+
30
+ self
31
+ end
32
+
33
+ end
metadata ADDED
@@ -0,0 +1,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: codewalk
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Max Cantor
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-15 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A quick script for making code-alongs clearer.
14
+ email:
15
+ - max@maxcantor.net
16
+ executables:
17
+ - codewalk
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - bin/codewalk
22
+ - lib/codewalk.rb
23
+ homepage:
24
+ licenses: []
25
+ metadata: {}
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubyforge_project:
42
+ rubygems_version: 2.2.0
43
+ signing_key:
44
+ specification_version: 4
45
+ summary: A quick script for making code-alongs clearer.
46
+ test_files: []