terminal_markup 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
@@ -1,3 +1,2 @@
1
- M��k𬧳��D=���3@�FsD��K� M2`�����$Wȓl���u��.���#�V����"��7̄�e�2�D 0�
2
- Y(4)�
3
- /qb7�4�/�l�} ګT]l�3�̀Zg&����P0x
1
+ zEJ���1c=�� ����+�yTWk�g ۝�����4)�|>�%Ee N��P31ךF
2
+ ޾���Z�o��Z�b��5��9xq�ɶ�JB#�|R��eCѸXD0U���cl��>7��U^����5�X)"&��=�)~���Nd@��a\4�T�,����I ��݇���h�u,
@@ -1,3 +1,7 @@
1
+ === 0.0.2 2009-11-13
2
+
3
+ * added terminal_markup bin
4
+
1
5
  === 0.0.1 2009-11-13
2
6
 
3
7
  * 1 major enhancement:
@@ -1,6 +1,6 @@
1
1
  = TerminalMarkup
2
2
 
3
- * http://lemurheavy.com
3
+ * http://github.com/yickster/Terminal-Markup
4
4
 
5
5
  == DESCRIPTION:
6
6
 
@@ -11,6 +11,12 @@ Easy coloring/markup for terminal output
11
11
  "print this in red".in_red
12
12
  "print this on blue".on_blue
13
13
  "print this with underline".as_underline
14
+
15
+ class Dummy
16
+ def to_s; "hey" end
17
+ end
18
+
19
+ Dummy.new.in_red.on_blue
14
20
 
15
21
  == REQUIREMENTS:
16
22
 
@@ -18,13 +24,13 @@ none
18
24
 
19
25
  == INSTALL:
20
26
 
21
- sudo gem i terminal_markup
27
+ sudo gem i terminal_markup --source="http://gemcutter.org"
22
28
 
23
29
  == LICENSE:
24
30
 
25
31
  (The MIT License)
26
32
 
27
- Copyright (c) 2009 FIXME full name
33
+ Copyright (c) 2009 Nick Merwin
28
34
 
29
35
  Permission is hereby granted, free of charge, to any person obtaining
30
36
  a copy of this software and associated documentation files (the
@@ -19,8 +19,8 @@ Extra:
19
19
  =end
20
20
 
21
21
  module TerminalMarkup
22
- VERSION = "0.0.2"
23
- DATE = "11.13.09"
22
+ VERSION = "0.0.3"
23
+ DATE = "11.15.09"
24
24
  CREDITS = "TerminalMarkup v.#{VERSION}\n by Nick Merwin (http://lemurheavy.com) #{DATE}"
25
25
 
26
26
  FORMATTING = {
@@ -63,7 +63,9 @@ module TerminalMarkup
63
63
  module InstanceMethods
64
64
  TerminalMarkup::PREPOSITION_MAP.each do |markup, preposition|
65
65
  markup.each do |name, code|
66
- module_eval "def #{preposition}_#{name}; with_escape_code #{code} end"
66
+ define_method "#{preposition}_#{name}" do
67
+ with_escape_code code
68
+ end
67
69
  end
68
70
  end
69
71
 
@@ -74,8 +76,9 @@ module TerminalMarkup
74
76
 
75
77
  # for printing to console with escape codes intact
76
78
  def escape
77
- eval '"'+ gsub(/\"/,'\"') + '"'
79
+ eval '"'+ to_s.gsub(/\"/,'\"') + '"'
78
80
  end
81
+
79
82
  end
80
83
  end
81
84
 
@@ -1,3 +1,9 @@
1
1
  require 'stringio'
2
2
  require 'test/unit'
3
3
  require File.dirname(__FILE__) + '/../lib/terminal_markup'
4
+
5
+ class Dummy
6
+ def to_s
7
+ "asdf"
8
+ end
9
+ end
@@ -3,9 +3,27 @@ require File.dirname(__FILE__) + '/test_helper.rb'
3
3
  class TestTerminalMarkup < Test::Unit::TestCase
4
4
 
5
5
  def setup
6
+ @dummy = Dummy.new
7
+ end
8
+
9
+ def test_color
10
+ assert_equal "\\e[31masdf\\e[0m", "asdf".in_red
11
+ assert_equal "\\e[31masdf\\e[0m", @dummy.in_red
12
+ end
13
+
14
+ def test_formatting
15
+ assert_equal "\\e[4masdf\\e[0m", "asdf".as_underline
16
+ assert_equal "\\e[4masdf\\e[0m", @dummy.as_underline
17
+ end
18
+
19
+ def test_background_color
20
+ assert_equal "\\e[41masdf\\e[0m", "asdf".on_red
21
+ assert_equal "\\e[41masdf\\e[0m", @dummy.on_red
6
22
  end
7
23
 
8
- def test_truth
9
- assert true
24
+ def test_escape
25
+ assert_equal "asdf", "asdf".escape
26
+ assert_equal "\e[31masdf\e[0m", "asdf".in_red.escape
27
+ assert_equal "\e[31masdf\e[0m", @dummy.in_red.escape
10
28
  end
11
29
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: terminal_markup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Merwin
@@ -30,7 +30,7 @@ cert_chain:
30
30
  DrswbWvrKlA=
31
31
  -----END CERTIFICATE-----
32
32
 
33
- date: 2009-11-13 00:00:00 -08:00
33
+ date: 2009-11-15 00:00:00 -08:00
34
34
  default_executable:
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
metadata.gz.sig CHANGED
Binary file