seed_formatter 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in seed_formatter.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require 'bundler/gem_tasks'
2
+
3
+ Rake::TestTask.new do |t|
4
+ t.libs << 'test'
5
+ end
6
+
7
+ desc "Run tests"
8
+ task :default => :test
@@ -0,0 +1,3 @@
1
+ module SeedFormatter
2
+ VERSION = "0.0.2"
3
+ end
@@ -0,0 +1,44 @@
1
+ require "seed_formatter/version"
2
+ require "colored"
3
+
4
+ module SeedFormatter
5
+ # Outputs a message with a set of given options
6
+ #
7
+ # @param [String] message: The message to format
8
+ # @param [Hash] options: A hash of options to apply to the string
9
+ # @option options [String] prefix: A prefix for the message. EG: "--> message"
10
+ # @option options [String] color: A Symbol representing the color from the Colored gem. See: Colored.colors
11
+ # @option options [String] suffix: A String suffix for the message. EG: "message !!!"
12
+ #
13
+ # @example Print out an error message
14
+ # SeedFormatter.output "Some error", {:prefix => "!!! ", :color => :red}
15
+ # # outputs "!!! Some error" in red text
16
+ def output message, options
17
+ puts "#{options[:prefix]}#{message}#{options[:suffix]}".send(options[:color])
18
+ end
19
+
20
+ # A preset formatter with overridable options
21
+ def message message, options = {}
22
+ options[:prefix] ||= "*** "
23
+ options[:color] ||= :white
24
+ output message, options
25
+ end
26
+
27
+ # A preset formatter with overridable options
28
+ def success message, options = {}
29
+ options[:prefix] ||= " + "
30
+ options[:color] ||= :green
31
+ output message, options
32
+ end
33
+
34
+ # A preset formatter with overridable options
35
+ def error message, options = {}
36
+ options[:prefix] ||= " - "
37
+ options[:color] ||= :red
38
+ output message, options
39
+ end
40
+
41
+ def spacer
42
+ puts ""
43
+ end
44
+ end
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "seed_formatter/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "seed_formatter"
7
+ s.version = SeedFormatter::VERSION
8
+ s.authors = ["Jordan Maguire"]
9
+ s.email = ["jmaguire@thefrontiergroup.com.au"]
10
+ s.homepage = "https://github.com/jordanmaguire/jordanmaguire.github.com"
11
+ s.summary = "summary"
12
+ s.description = "Easily format the output of your seeds and parse YAML files"
13
+
14
+ s.files = `git ls-files`.split("\n")
15
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
+ s.require_paths = ["lib"]
18
+
19
+ s.add_dependency 'colored'
20
+ end
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: seed_formatter
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 2
9
+ version: 0.0.2
10
+ platform: ruby
11
+ authors:
12
+ - Jordan Maguire
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2012-01-31 00:00:00 +08:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: colored
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ type: :runtime
31
+ version_requirements: *id001
32
+ description: Easily format the output of your seeds and parse YAML files
33
+ email:
34
+ - jmaguire@thefrontiergroup.com.au
35
+ executables: []
36
+
37
+ extensions: []
38
+
39
+ extra_rdoc_files: []
40
+
41
+ files:
42
+ - .gitignore
43
+ - Gemfile
44
+ - Rakefile
45
+ - lib/seed_formatter.rb
46
+ - lib/seed_formatter/version.rb
47
+ - seed_formatter.gemspec
48
+ has_rdoc: true
49
+ homepage: https://github.com/jordanmaguire/jordanmaguire.github.com
50
+ licenses: []
51
+
52
+ post_install_message:
53
+ rdoc_options: []
54
+
55
+ require_paths:
56
+ - lib
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ segments:
62
+ - 0
63
+ version: "0"
64
+ required_rubygems_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ segments:
69
+ - 0
70
+ version: "0"
71
+ requirements: []
72
+
73
+ rubyforge_project:
74
+ rubygems_version: 1.3.6
75
+ signing_key:
76
+ specification_version: 3
77
+ summary: summary
78
+ test_files: []
79
+