crayon 1.0.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ ### 1.1.0 : 04/22/10
2
+
3
+ * Removed `puts` and `print` methods
4
+
5
+ ### 1.0.3 : 04/22/10
6
+
7
+ * Broke Crayon functionality out into separate modules
8
+ * Added CrayonString class to allow chaining methods
9
+
10
+ ### 1.0.2 : 04/21/10
11
+
12
+ * Removed last references to the `newline` and `io` methods.
13
+
1
14
  ### 1.0.1 : 04/21/10
2
15
 
3
16
  * Adds deprecation warnings for `puts` and `print`
data/README.md CHANGED
@@ -1,13 +1,9 @@
1
1
  # crayon
2
2
 
3
- ### current version : 1.0.3
3
+ ### current version : 1.1.0
4
4
 
5
5
  [http://github.com/mikowitz/crayon][github]
6
6
 
7
- ### version warnings
8
-
9
- * `puts` and `print` will be deprecated. `Crayon` will no longer contain an IO object, but will only return strings
10
-
11
7
  ## Description
12
8
 
13
9
  A simple, flexible gem that provides an open-ended API to print colored and styled output to the terminal.
@@ -39,18 +35,6 @@ The following are all methods that `Crayon` understands, and should give you an
39
35
  Crayon.bold("this will be bold")
40
36
  Crayon.underline_blue_on_yellow("this will be underlined blue text on a yellow background")
41
37
 
42
- ### `puts` and `print` deprecation warning
43
-
44
- As of version 1.0.2, `puts` and `print` no longer control adding a newline to the end of Crayon-ed text. The methods themselves will remain in the code base until version 1.1.0, but will issue deprecation warnings, and have no real effect on the code. Instead of a line of code looking like this:
45
-
46
- Crayon.print.red("red, ").blue("blue, ").puts.green("and green")
47
-
48
- you have a line of code like this:
49
-
50
- puts Crayon.red("red, ").blue("blue, ").green("and green")
51
-
52
- This change is mostly due to the fact that defining Crayon's IO object would make using Crayon inside of another project more complicated than it would need to be. Crayon now simply returns a formatted string.
53
-
54
38
  ### chaining
55
39
 
56
40
  You can also chain color calls without having to call `Crayon` multiple times
@@ -79,6 +63,14 @@ will look the same as
79
63
 
80
64
  Check out `test/proof.rb` and `~$ rake proof` if you don't believe me.
81
65
 
66
+ ## Return values
67
+
68
+ Crayon simply returns a formatted string
69
+
70
+ Color.red("red, ").blue("and blue") #=> "\e[31mred, \e[0m\e[34mand blue\e[0m"
71
+
72
+ So any call to `Crayon` must be `puts` or `print`-ed in order for the content to be displayed with the proper coloring.
73
+
82
74
  ## Copyright
83
75
 
84
76
  Copyright (c) 2010 Michael Berkowitz. See LICENSE for details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.3
1
+ 1.1.0
data/lib/crayon.rb CHANGED
@@ -19,16 +19,6 @@ module Crayon
19
19
  # @private
20
20
  TERMINATION_STRING = "\e[0m"
21
21
 
22
- def self.print
23
- Kernel::puts "Color.print is deprecated and will be removed in version 1.1.0."
24
- return Crayon
25
- end
26
-
27
- def self.puts
28
- Kernel::puts "Color.puts is deprecated and will be removed in version 1.1.0."
29
- return Crayon
30
- end
31
-
32
22
  def method_missing(method_name, string)
33
23
  nullify_variables
34
24
  @method_name = method_name
data/spec/crayon_spec.rb CHANGED
@@ -30,8 +30,13 @@ def test_prepare_string(expected_output, *args)
30
30
  end
31
31
 
32
32
  describe "Crayon" do
33
- it "chaining color calls should be allowed by returning a CrayonString from method_missing" do
34
- Crayon.red("OK").should be_a CrayonString
33
+ describe "chaining color calls" do
34
+ it "should be allowed by returning a CrayonString from method_missing" do
35
+ Crayon.red("OK").should be_a CrayonString
36
+ end
37
+ it "should return the full chained string" do
38
+ Crayon.red("OK").blue("OK").underline("OK").should == "\e[31mOK\e[0m\e[34mOK\e[0m\e[4mOK\e[0m"
39
+ end
35
40
  end
36
41
  describe "method_missing" do
37
42
  describe "should call :prepare string" do
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 1
7
+ - 1
7
8
  - 0
8
- - 3
9
- version: 1.0.3
9
+ version: 1.1.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Michael Berkowitz