computering 0.0.1 → 0.1.0
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 +39 -0
- data/bin/computering +11 -2
- data/computering.gemspec +3 -0
- data/example/preso.rb +7 -0
- data/lib/computering.rb +4 -0
- data/lib/computering/cmd.rb +2 -1
- data/lib/computering/dsl.rb +9 -1
- data/lib/computering/dsl/command.rb +20 -3
- data/lib/computering/dsl/headline.rb +8 -0
- data/lib/computering/dsl/link.rb +19 -0
- data/lib/computering/dsl/text.rb +8 -5
- data/lib/computering/version.rb +1 -1
- metadata +21 -5
- data/LICENSE.txt +0 -22
- data/example/preso_1.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9efa6d55cd4edf4da0ff1bf5c1ab415973b9cdc0
|
4
|
+
data.tar.gz: 3f125e492b6ca53f7e011a044488ff4a0d2d00da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 296528c1d1c84523f13a57366e38143a856db47ef4334bb2a900f3d3c7c7649ad268adc0897de24a7e36e285bd97fe2da8034e6196b0bf8bd1d5fc319d68c536
|
7
|
+
data.tar.gz: cb578a23be60309645c8dcf33e7b9438b90d4c07a978cc17af8bbcbabd00215e113b97d1dc1ba8c4140b8654a2c695519dd3d6cdbc1aa8b709e70966054556fa
|
data/README.md
CHANGED
@@ -2,6 +2,45 @@
|
|
2
2
|
|
3
3
|

|
4
4
|
|
5
|
+
# Usage
|
6
|
+
|
7
|
+
Installing the gem:
|
8
|
+
|
9
|
+
```
|
10
|
+
gem install computering
|
11
|
+
```
|
12
|
+
|
13
|
+
or via Bundler
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
#Gemfile
|
17
|
+
gem "computering"
|
18
|
+
```
|
19
|
+
|
20
|
+
create a presentation file
|
21
|
+
|
22
|
+
```
|
23
|
+
echo "
|
24
|
+
headline 'computering'
|
25
|
+
paragraph 'is super easy'
|
26
|
+
command 'echo to use'
|
27
|
+
link 'see yourself', 'https://github.com/phoet/computering'
|
28
|
+
" > preso.rb
|
29
|
+
```
|
30
|
+
|
31
|
+
and run it with the `computering` command:
|
32
|
+
|
33
|
+
```
|
34
|
+
computering preso.rb
|
35
|
+
```
|
36
|
+
|
37
|
+
# TODO
|
38
|
+
|
39
|
+
* syntax-check
|
40
|
+
* dry-mode
|
41
|
+
* config speed
|
42
|
+
* add styling
|
43
|
+
|
5
44
|
# License
|
6
45
|
|
7
46
|
"THE (extended) BEER-WARE LICENSE" (Revision 42.0815): [phoet](mailto:ps@nofail.de) contributed to this project.
|
data/bin/computering
CHANGED
@@ -4,5 +4,14 @@ $LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
require "Computering"
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
abort "USAGE: computering file [file ...]" if ARGV.empty?
|
8
|
+
|
9
|
+
begin
|
10
|
+
puts "", "Start typing or exit with Ctrl+C", ""
|
11
|
+
ARGV.each do |cmd|
|
12
|
+
cmd = Computering::Cmd.new ARGV[0]
|
13
|
+
cmd.execute
|
14
|
+
end
|
15
|
+
rescue Computering::Cmd::Exit
|
16
|
+
puts "", "KTHXBYE!"
|
17
|
+
end
|
data/computering.gemspec
CHANGED
@@ -8,6 +8,7 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Computering::VERSION
|
9
9
|
spec.authors = ["Peter Schröder"]
|
10
10
|
spec.email = ["phoetmail@googlemail.com"]
|
11
|
+
spec.license = %q{THE (extended) BEER-WARE LICENSE}
|
11
12
|
spec.summary = spec.description = %q{pretends you could type really fast}
|
12
13
|
spec.homepage = "https://github.com/phoet/computering"
|
13
14
|
|
@@ -16,6 +17,8 @@ Gem::Specification.new do |spec|
|
|
16
17
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
17
18
|
spec.require_paths = ["lib"]
|
18
19
|
|
20
|
+
spec.add_dependency "rainbow", "> 1.0"
|
21
|
+
|
19
22
|
spec.add_development_dependency "bundler", "~> 1.3"
|
20
23
|
spec.add_development_dependency "rspec"
|
21
24
|
spec.add_development_dependency "rake"
|
data/example/preso.rb
ADDED
data/lib/computering.rb
CHANGED
data/lib/computering/cmd.rb
CHANGED
@@ -21,7 +21,7 @@ module Computering
|
|
21
21
|
def execute
|
22
22
|
items.each do |item|
|
23
23
|
if item.blank?
|
24
|
-
@stdout.puts
|
24
|
+
@stdout.puts
|
25
25
|
else
|
26
26
|
readchars item
|
27
27
|
end
|
@@ -35,6 +35,7 @@ module Computering
|
|
35
35
|
raise Exit if char.ord == CONTROL_C
|
36
36
|
if char.ord == ENTER
|
37
37
|
@stdout.puts item[i..-1]
|
38
|
+
item.execute
|
38
39
|
@stdout.puts item.buffer
|
39
40
|
break
|
40
41
|
else
|
data/lib/computering/dsl.rb
CHANGED
@@ -1,11 +1,19 @@
|
|
1
1
|
module Computering
|
2
2
|
module Dsl
|
3
|
+
def headline(text)
|
4
|
+
self.items += Headline.from_text(text)
|
5
|
+
end
|
6
|
+
|
3
7
|
def paragraph(text)
|
4
8
|
self.items += Text.from_text(text)
|
5
9
|
end
|
6
10
|
|
7
11
|
def command(text)
|
8
|
-
self.items
|
12
|
+
self.items += Command.from_text(text)
|
13
|
+
end
|
14
|
+
|
15
|
+
def link(text, link)
|
16
|
+
self.items += Link.from_text(text, link)
|
9
17
|
end
|
10
18
|
|
11
19
|
protected
|
@@ -1,8 +1,25 @@
|
|
1
|
+
require "bundler"
|
2
|
+
|
1
3
|
module Computering::Dsl
|
2
4
|
class Command < Text
|
3
|
-
def
|
4
|
-
|
5
|
-
|
5
|
+
def initialize(cmd)
|
6
|
+
@text = " #{'⌘'.color(:green)} #{cmd.color(:black).background(:cyan)}"
|
7
|
+
@buffer = ""
|
8
|
+
@cmd = cmd
|
9
|
+
end
|
10
|
+
|
11
|
+
def execute
|
12
|
+
output = ""
|
13
|
+
Bundler.with_clean_env do
|
14
|
+
output = `#{@cmd}`
|
15
|
+
end
|
16
|
+
@buffer = "\n#{output}\n"
|
17
|
+
rescue
|
18
|
+
puts $!
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.from_text(cmd)
|
22
|
+
Array(self.new cmd)
|
6
23
|
end
|
7
24
|
end
|
8
25
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Computering::Dsl
|
2
|
+
class Link < Text
|
3
|
+
def initialize(text, link)
|
4
|
+
@text = " #{'☞'.color(:green)} #{text}"
|
5
|
+
@link = link
|
6
|
+
@buffer = ''
|
7
|
+
end
|
8
|
+
|
9
|
+
def execute
|
10
|
+
`open '#{@link}'`
|
11
|
+
rescue
|
12
|
+
puts $!
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.from_text(text, link)
|
16
|
+
Array(self.new text, link)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/computering/dsl/text.rb
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
module Computering::Dsl
|
2
2
|
class Text
|
3
|
-
def initialize(
|
4
|
-
@
|
5
|
-
@buffer =
|
3
|
+
def initialize(text)
|
4
|
+
@text = text
|
5
|
+
@buffer = ""
|
6
6
|
end
|
7
7
|
|
8
8
|
def [](index)
|
9
|
-
@
|
9
|
+
@text[index]
|
10
|
+
end
|
11
|
+
|
12
|
+
def execute
|
10
13
|
end
|
11
14
|
|
12
15
|
def buffer
|
@@ -14,7 +17,7 @@ module Computering::Dsl
|
|
14
17
|
end
|
15
18
|
|
16
19
|
def blank?
|
17
|
-
@
|
20
|
+
@text.nil? || @text.strip == ""
|
18
21
|
end
|
19
22
|
|
20
23
|
def self.from_text(text)
|
data/lib/computering/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: computering
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Schröder
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-07-
|
11
|
+
date: 2013-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rainbow
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>'
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>'
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: bundler
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -63,22 +77,24 @@ files:
|
|
63
77
|
- .gitignore
|
64
78
|
- .rspec
|
65
79
|
- Gemfile
|
66
|
-
- LICENSE.txt
|
67
80
|
- README.md
|
68
81
|
- Rakefile
|
69
82
|
- bin/computering
|
70
83
|
- computering.gemspec
|
71
|
-
- example/
|
84
|
+
- example/preso.rb
|
72
85
|
- lib/computering.rb
|
73
86
|
- lib/computering/cmd.rb
|
74
87
|
- lib/computering/dsl.rb
|
75
88
|
- lib/computering/dsl/command.rb
|
89
|
+
- lib/computering/dsl/headline.rb
|
90
|
+
- lib/computering/dsl/link.rb
|
76
91
|
- lib/computering/dsl/text.rb
|
77
92
|
- lib/computering/version.rb
|
78
93
|
- spec/computering/dsl/text_spec.rb
|
79
94
|
- spec/spec_helper.rb
|
80
95
|
homepage: https://github.com/phoet/computering
|
81
|
-
licenses:
|
96
|
+
licenses:
|
97
|
+
- THE (extended) BEER-WARE LICENSE
|
82
98
|
metadata: {}
|
83
99
|
post_install_message:
|
84
100
|
rdoc_options: []
|
data/LICENSE.txt
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2013 Peter Schröder
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|