cloudhead-mutter 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.md +30 -17
- data/VERSION +1 -1
- data/lib/mutter/mutterer.rb +3 -2
- data/mutter.gemspec +2 -2
- metadata +3 -4
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -5,15 +5,14 @@ mutter
|
|
5
5
|
in color and
|
6
6
|
style
|
7
7
|
|
8
|
-
> mutter
|
9
|
-
> use it in your apps to have _gorgeous_ command-line output!
|
10
|
-
|
11
|
-
usage (command-line output)
|
12
|
-
---------------------------
|
8
|
+
> mutter takes the concepts of **separation of style & content** to the command-line!
|
13
9
|
|
10
|
+
synopsis
|
11
|
+
--------
|
12
|
+
|
14
13
|
require 'mutter'
|
15
|
-
|
16
|
-
mut = Mutter.new
|
14
|
+
|
15
|
+
mut = Mutter.new # creates a new 'Mutterer', who talks in command-line language
|
17
16
|
mut.say "hello _world_" # underlines 'world'
|
18
17
|
mut.say "hello world", :bold # bolds the whole string
|
19
18
|
mut.say "hello [world]", :cyan # inverts 'world', and colors the string cyan
|
@@ -45,9 +44,31 @@ customization
|
|
45
44
|
}
|
46
45
|
|
47
46
|
mut = Mutter.new(styles)
|
48
|
-
mut.say "warning,
|
49
|
-
mut.warning "warning,
|
47
|
+
mut.say "warning, the dogs have escaped!", :warning # These two are
|
48
|
+
mut.warning "warning, the dogs have escaped!" # equivalent
|
50
49
|
mut.say "gosh, we have an !!error!!"
|
50
|
+
|
51
|
+
### YAML
|
52
|
+
|
53
|
+
The previous example could have (and should really have) been written in a separate .yml file, like so:
|
54
|
+
|
55
|
+
warning:
|
56
|
+
match:
|
57
|
+
- '*!'
|
58
|
+
- '!*
|
59
|
+
style:
|
60
|
+
- yellow
|
61
|
+
- bold
|
62
|
+
|
63
|
+
error:
|
64
|
+
match: '!!'
|
65
|
+
style:
|
66
|
+
- red
|
67
|
+
- underline
|
68
|
+
|
69
|
+
and then loaded like this:
|
70
|
+
|
71
|
+
Mutter.new("styles.yml")
|
51
72
|
|
52
73
|
### quick styles
|
53
74
|
|
@@ -61,14 +82,6 @@ customization
|
|
61
82
|
mut << :bold << :underline # add :bold and :underline
|
62
83
|
mut.say "hello mutter." # bold and underlined
|
63
84
|
|
64
|
-
### YAML styles
|
65
|
-
|
66
|
-
mutter can also read styles from _YAML_ files, just give it the path, like so:
|
67
|
-
|
68
|
-
Mutter.new("styles.yml")
|
69
|
-
|
70
|
-
There's an example style in `spec/`
|
71
|
-
|
72
85
|
installation
|
73
86
|
------------
|
74
87
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.2
|
data/lib/mutter/mutterer.rb
CHANGED
@@ -58,7 +58,8 @@ module Mutter
|
|
58
58
|
# Output to @stream
|
59
59
|
#
|
60
60
|
def say msg, *styles
|
61
|
-
self.write process(msg, *styles) + "\n"
|
61
|
+
self.write (ENV['TERM'].include?('color') ? process(msg, *styles) : msg) + "\n"
|
62
|
+
return nil
|
62
63
|
end
|
63
64
|
|
64
65
|
alias :print say
|
@@ -78,7 +79,7 @@ module Mutter
|
|
78
79
|
self.class.stream.tap do |stream|
|
79
80
|
stream.write str
|
80
81
|
stream.flush
|
81
|
-
end
|
82
|
+
end; nil
|
82
83
|
end
|
83
84
|
|
84
85
|
#
|
data/mutter.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{mutter}
|
5
|
-
s.version = "0.3.
|
5
|
+
s.version = "0.3.2"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["cloudhead"]
|
9
|
-
s.date = %q{2009-
|
9
|
+
s.date = %q{2009-09-01}
|
10
10
|
s.email = %q{self@cloudhead.net}
|
11
11
|
s.extra_rdoc_files = [
|
12
12
|
"LICENSE",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudhead-mutter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- cloudhead
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-09-01 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -40,7 +40,6 @@ files:
|
|
40
40
|
- spec/style.yml
|
41
41
|
has_rdoc: false
|
42
42
|
homepage: http://github.com/cloudhead/mutter
|
43
|
-
licenses:
|
44
43
|
post_install_message:
|
45
44
|
rdoc_options:
|
46
45
|
- --charset=UTF-8
|
@@ -61,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
61
60
|
requirements: []
|
62
61
|
|
63
62
|
rubyforge_project:
|
64
|
-
rubygems_version: 1.
|
63
|
+
rubygems_version: 1.2.0
|
65
64
|
signing_key:
|
66
65
|
specification_version: 3
|
67
66
|
summary: ""
|