awesome_print_colors 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
File without changes
File without changes
@@ -0,0 +1,20 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+
3
+ require 'awesome_print_colors'
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "awesome_print_colors"
7
+ s.version = AwesomePrintColors::VERSION
8
+ s.authors = ["Andrew Horsman"]
9
+ s.email = ["self@andrewhorsman.net"]
10
+ s.homepage = "http://github.com/basicxman/awesome_print_colors"
11
+
12
+ s.summary = "Core colour schemes for Michael Dvorkin's awesome_print"
13
+ s.description = "A collection of colour schemes for Michael Dvorkin's awesome_print. This codebase is used to separate cruft from the main awesome_print library."
14
+
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- spec/*`.split("\n")
17
+
18
+ s.add_dependency 'awesome_print'
19
+ s.add_development_dependency 'rspec'
20
+ end
@@ -0,0 +1,32 @@
1
+ module AwesomePrintColors
2
+ VERSION = "0.0.1"
3
+
4
+ class << self
5
+ attr_accessor :themes
6
+ end
7
+
8
+ self.themes = {
9
+ :test => {
10
+ :array => :white,
11
+ :bigdecimal => :blue,
12
+ :class => :yellow,
13
+ :date => :greenish,
14
+ :falseclass => :red,
15
+ :fixnum => :blue,
16
+ :float => :blue,
17
+ :hash => :pale,
18
+ :struct => :pale,
19
+ :nilclass => :red,
20
+ :string => :blue,
21
+ :symbol => :cyanish,
22
+ :time => :greenish,
23
+ :trueclass => :green,
24
+ :method => :purpleish,
25
+ :args => :pale,
26
+ :keyword => :cyan,
27
+ :variable => :cyanish
28
+ }
29
+ }
30
+ end
31
+
32
+ require 'awesome_print_colors/awesome_print'
@@ -0,0 +1,19 @@
1
+ module AwesomePrint
2
+
3
+ class Inspector
4
+
5
+ def merge_options!(options)
6
+ merge_options_without_themes!
7
+
8
+ theme = options[:theme]
9
+ unless AwesomePrintColors.themes.include? theme
10
+ return false
11
+ end
12
+
13
+ colors = AwesomePrintColors.themes[theme]
14
+ @options[:color].merge! colors
15
+ end
16
+
17
+ end
18
+
19
+ end
@@ -0,0 +1,4 @@
1
+ $:.unshift File.dirname(__FILE__)
2
+ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
3
+ require 'ap'
4
+ require 'awesome_print_colors'
@@ -0,0 +1,21 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "Theme" do
4
+
5
+ before(:all) do
6
+ @s = "Test"
7
+ end
8
+
9
+ it "should format without a theme" do
10
+ @s.ai.should == "\e[0;33m\"Test\"\e[0m"
11
+ end
12
+
13
+ it "should not format with a theme if an invalid theme is specified" do
14
+ @s.ai(:theme => :theme_failure).should == "\e[0;33m\"Test\"\e[0m"
15
+ end
16
+
17
+ it "should format with a valid theme" do
18
+ @s.ai(:theme => :test).should == "\e[1;34m\"Test\"\e[0m"
19
+ end
20
+
21
+ end
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: awesome_print_colors
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Andrew Horsman
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-06-02 00:00:00 -04:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: awesome_print
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: "0"
25
+ type: :runtime
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ prerelease: false
30
+ requirement: &id002 !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: "0"
36
+ type: :development
37
+ version_requirements: *id002
38
+ description: A collection of colour schemes for Michael Dvorkin's awesome_print. This codebase is used to separate cruft from the main awesome_print library.
39
+ email:
40
+ - self@andrewhorsman.net
41
+ executables: []
42
+
43
+ extensions: []
44
+
45
+ extra_rdoc_files: []
46
+
47
+ files:
48
+ - README.md
49
+ - Rakefile
50
+ - awesome_print_colors.gemspec
51
+ - lib/awesome_print_colors.rb
52
+ - lib/awesome_print_colors/awesome_print.rb
53
+ - spec/spec_helper.rb
54
+ - spec/theme_spec.rb
55
+ has_rdoc: true
56
+ homepage: http://github.com/basicxman/awesome_print_colors
57
+ licenses: []
58
+
59
+ post_install_message:
60
+ rdoc_options: []
61
+
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: "0"
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: "0"
76
+ requirements: []
77
+
78
+ rubyforge_project:
79
+ rubygems_version: 1.5.0
80
+ signing_key:
81
+ specification_version: 3
82
+ summary: Core colour schemes for Michael Dvorkin's awesome_print
83
+ test_files:
84
+ - spec/spec_helper.rb
85
+ - spec/theme_spec.rb