idobadge 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ec258931f1eba1eaa80da26bf09eb87c2a21c72f
4
+ data.tar.gz: d4d7f7c5fc2303e74d283950c5afbd55d5c5e6f4
5
+ SHA512:
6
+ metadata.gz: e15515feb767282a23360332d9355ed74c7e486df188177990705a32c1e69229d9f8d89319786a1201378c5c2d798fe9ad089d10ba4e52af2fdc86ebf173e332
7
+ data.tar.gz: 315e063b691885c5f17e662dfeb3394c0a1b529f41d50331cad0aab60f640f712c1ce863dc3252f036ae99ae33024f4c7c3b19b94c042c6e069e19c183cddb46
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.*
4
+ - 2.0.0
5
+ env:
6
+ global:
7
+ secure: E2dp6RCUHYfqkhh6kO1fRyhUbedbipDo41BtiMtgJP1ERXQol3en1yMwGFT+wPiLIv4CDTK/ORrsa6SX2csN4nOjTEUJtuWwNxQZRrrfDkEeLjYEM7dR2+wQEkv7PLP8wLxTDLND3r5rTtgS832wRHsysuUHOrkU9iSSAKH9oiw=
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in idobadge.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Seiei Higa
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,56 @@
1
+ # Idobadge
2
+
3
+ [![Build Status](https://travis-ci.org/hanachin/idobadge.svg?branch=master)](https://travis-ci.org/hanachin/idobadge)
4
+ [![Code Climate](https://codeclimate.com/github/hanachin/idobadge/badges/gpa.svg)](https://codeclimate.com/github/hanachin/idobadge)
5
+ [![Test Coverage](https://codeclimate.com/github/hanachin/idobadge/badges/coverage.svg)](https://codeclimate.com/github/hanachin/idobadge)
6
+ [![Dependency Status](https://gemnasium.com/hanachin/idobadge.svg)](https://gemnasium.com/hanachin/idobadge)
7
+
8
+ Text badges generator for idobata.io generic webhook.
9
+
10
+ ## Installation
11
+
12
+ Add this line to your application's Gemfile:
13
+
14
+ gem 'idobadge'
15
+
16
+ And then execute:
17
+
18
+ $ bundle
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install idobadge
23
+
24
+ ## Usage
25
+
26
+ ``` ruby
27
+ require 'idobadge'
28
+
29
+ Idobadge.success('success')
30
+ # => "<span class=\"label label-success\"><i class=\"fa fa-sun-o\"></i> <span class=\"label label-inverse\">success</span></span>"
31
+
32
+ Idobadge.warning('warning')
33
+ # => "<span class=\"label label-warning\"><i class=\"fa fa-umbrella\"></i> <span class=\"label label-inverse\">warning</span></span>"
34
+
35
+ Idobadge.important('important')
36
+ # => "<span class=\"label label-important\"><i class=\"fa fa-bomb\"></i> <span class=\"label label-inverse\">important</span></span>"
37
+
38
+ Idobadge.failure('failure')
39
+ # => "<span class=\"label label-important\"><i class=\"fa fa-bomb\"></i> <span class=\"label label-inverse\">failure</span></span>"
40
+
41
+ # customize icon
42
+ Idobadge.success('success', icon: 'thumbs-o-up')
43
+ # => "<span class=\"label label-success\"><i class=\"fa fa-thumbs-o-up\"></i> <span class=\"label label-inverse\">success</span></span>"
44
+
45
+ # no icon
46
+ Idobadge.success('success', icon: nil)
47
+ # => "<span class=\"label label-success\"><span class=\"label label-inverse\">success</span></span>"
48
+ ```
49
+
50
+ ## Contributing
51
+
52
+ 1. Fork it ( https://github.com/hanachin/idobadge/fork )
53
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
54
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
55
+ 4. Push to the branch (`git push origin my-new-feature`)
56
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,5 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ task default: :test
5
+ Rake::TestTask.new
data/idobadge.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'idobadge/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "idobadge"
8
+ spec.version = Idobadge::VERSION
9
+ spec.authors = ["Seiei Higa"]
10
+ spec.email = ["hanachin@gmail.com"]
11
+ spec.summary = %q{Text badges generator for idobata.io generic webhook.}
12
+ spec.homepage = ""
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.required_ruby_version = '>= 2.0'
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.6"
23
+ spec.add_development_dependency "codeclimate-test-reporter"
24
+ spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "minitest-power_assert"
26
+ end
@@ -0,0 +1,3 @@
1
+ module Idobadge
2
+ VERSION = "0.0.1"
3
+ end
data/lib/idobadge.rb ADDED
@@ -0,0 +1,16 @@
1
+ require "idobadge/version"
2
+
3
+ module Idobadge
4
+ {success: 'sun-o', warning: 'umbrella', important: 'bomb'}.each do |m, i|
5
+ define_method(m) do |text, icon: i|
6
+ "<span class=\"label label-#{__method__}\">" \
7
+ "#{icon && %|<i class="fa fa-#{icon}"></i> |}" \
8
+ "<span class=\"label label-inverse\">#{text}</span>" \
9
+ "</span>"
10
+ end
11
+ module_function m
12
+ end
13
+
14
+ alias :failure :important
15
+ module_function :failure
16
+ end
@@ -0,0 +1,2 @@
1
+ require "codeclimate-test-reporter"
2
+ CodeClimate::TestReporter.start
@@ -0,0 +1,29 @@
1
+ require 'minitest/autorun'
2
+ require 'minitest/power_assert'
3
+ require 'idobadge'
4
+
5
+ class TestIdobadge < MiniTest::Test
6
+ def test_success
7
+ assert { Idobadge.success('success') == '<span class="label label-success"><i class="fa fa-sun-o"></i> <span class="label label-inverse">success</span></span>' }
8
+ end
9
+
10
+ def test_warning
11
+ assert { Idobadge.warning('warning') == '<span class="label label-warning"><i class="fa fa-umbrella"></i> <span class="label label-inverse">warning</span></span>' }
12
+ end
13
+
14
+ def test_important
15
+ assert { Idobadge.important('important') == '<span class="label label-important"><i class="fa fa-bomb"></i> <span class="label label-inverse">important</span></span>' }
16
+ end
17
+
18
+ def test_failure
19
+ assert { Idobadge.failure('failure') == '<span class="label label-important"><i class="fa fa-bomb"></i> <span class="label label-inverse">failure</span></span>' }
20
+ end
21
+
22
+ def test_customize_icon
23
+ assert { Idobadge.success('success', icon: 'thumbs-o-up') == '<span class="label label-success"><i class="fa fa-thumbs-o-up"></i> <span class="label label-inverse">success</span></span>' }
24
+ end
25
+
26
+ def test_no_icon
27
+ assert { Idobadge.success('success', icon: nil) == '<span class="label label-success"><span class="label label-inverse">success</span></span>' }
28
+ end
29
+ end
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: idobadge
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Seiei Higa
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-08-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: codeclimate-test-reporter
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest-power_assert
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description:
70
+ email:
71
+ - hanachin@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".travis.yml"
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - idobadge.gemspec
83
+ - lib/idobadge.rb
84
+ - lib/idobadge/version.rb
85
+ - test/test_helper.rb
86
+ - test/test_idobadge.rb
87
+ homepage: ''
88
+ licenses:
89
+ - MIT
90
+ metadata: {}
91
+ post_install_message:
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '2.0'
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ requirements: []
106
+ rubyforge_project:
107
+ rubygems_version: 2.2.2
108
+ signing_key:
109
+ specification_version: 4
110
+ summary: Text badges generator for idobata.io generic webhook.
111
+ test_files:
112
+ - test/test_helper.rb
113
+ - test/test_idobadge.rb
114
+ has_rdoc: