placegant 1.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 +7 -0
- data/.gitignore +7 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +23 -0
- data/README.md +41 -0
- data/Rakefile +11 -0
- data/VERSION +1 -0
- data/lib/placegant/helpers.rb +7 -0
- data/lib/placegant/placegant.rb +23 -0
- data/lib/placegant.rb +2 -0
- data/placegant.gemspec +20 -0
- data/test/placegant_helpers_test.rb +10 -0
- data/test/placegant_test.rb +20 -0
- metadata +55 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: dafdbfd7c32938853452e5c42128ff9ddc647b1c
|
4
|
+
data.tar.gz: 861e1f3031ec0cba0e00b32aef351cca700896a4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f60526e5a40c75bbcc0139f6a447512bb243196795af9fbe53943d363aad68cdee5b2b701e762234a45edf0d9a807ad4993f5d58d887d40e9536ef362bb8afa9
|
7
|
+
data.tar.gz: 197808975e2c5d838a746b615ac429db402624561e13491cd24a9f0c28ef7208bd0d969adf1e69021d108a5ecfc89f99495c8d8c8be16ecd3cfa542ea86f0a14
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
License
|
2
|
+
-------
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Copyright (c) 2015 Angie Green & the Bayou Binary Bitches
|
6
|
+
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
of this software and associated documentation files (the "Software"), to deal
|
9
|
+
in the Software without restriction, including without limitation the rights
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
12
|
+
furnished to do so, subject to the following conditions:
|
13
|
+
|
14
|
+
The above copyright notice and this permission notice shall be included in
|
15
|
+
all copies or substantial portions of the Software.
|
16
|
+
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
placeGant
|
2
|
+
===========
|
3
|
+
|
4
|
+
placegant is a small library for generating [placeGants](http://placeGant.me/).
|
5
|
+
|
6
|
+
Installing
|
7
|
+
----------
|
8
|
+
|
9
|
+
placegant is available on [RubyGems](http://rubygems.org/gems/placegant).
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
gem 'placegant'
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install placegant
|
22
|
+
|
23
|
+
Examples
|
24
|
+
--------
|
25
|
+
|
26
|
+
# Generate a 300x400 placeGant
|
27
|
+
PlaceGant.image(300, 400) => "http://placegant.me/pg/300/400"
|
28
|
+
|
29
|
+
Rails Helpers
|
30
|
+
-------------
|
31
|
+
|
32
|
+
# in Gemfile:
|
33
|
+
gem 'placegant'
|
34
|
+
|
35
|
+
# in app/helpers/application_helper.rb:
|
36
|
+
module ApplicationHelper
|
37
|
+
include PlaceGant::Helpers
|
38
|
+
end
|
39
|
+
|
40
|
+
# in your views:
|
41
|
+
<%= image_tag placegant(400, 500) %>
|
data/Rakefile
ADDED
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.1
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class PlaceGant
|
2
|
+
DEFAULT_WIDTH = 300
|
3
|
+
DEFAULT_HEIGHT = 300
|
4
|
+
|
5
|
+
# Returns the URL for a placeGant with
|
6
|
+
# the given width and height. If the width is given but the height
|
7
|
+
# is not, the image will be square.
|
8
|
+
#
|
9
|
+
# @param [Number] width the width of the placeGant
|
10
|
+
# @param [Number] height the height of the placeGant
|
11
|
+
def self.image(width = nil, height = nil)
|
12
|
+
if width.nil?
|
13
|
+
width = DEFAULT_WIDTH
|
14
|
+
height = DEFAULT_HEIGHT
|
15
|
+
elsif height.nil?
|
16
|
+
height = width
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class << self
|
21
|
+
alias_method :gant, :image
|
22
|
+
end
|
23
|
+
end
|
data/lib/placegant.rb
ADDED
data/placegant.gemspec
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "placegant"
|
6
|
+
s.version = File.read('VERSION').strip
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.authors = ["Angie Green"]
|
9
|
+
s.email = ["angie@angieraegreen.com"]
|
10
|
+
s.homepage = "https://github.com/AngieGreen/placegant"
|
11
|
+
s.summary = %q{A small library to generate placeGant images.}
|
12
|
+
s.description = %q{A small library to generate placeGant images.}
|
13
|
+
|
14
|
+
s.rubyforge_project = "placegant"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'placegant'
|
2
|
+
require 'test/unit'
|
3
|
+
|
4
|
+
class GantTest < Test::Unit::TestCase
|
5
|
+
def test_no_params
|
6
|
+
image = PlaceGant.image
|
7
|
+
assert_equal "http://placegant.me/pg/#{PlaceGant::DEFAULT_WIDTH}/#{PlaceGant::DEFAULT_HEIGHT}", image
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_width_height
|
11
|
+
image = PlaceGant.image(300, 200)
|
12
|
+
assert_equal "http://placegant.me/pg/300/200", image
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_image_alias
|
16
|
+
image = PlaceGant.gant(300, 200)
|
17
|
+
assert_equal "http://placegant.me/pg/300/200", image
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: placegant
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Angie Green
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-03-23 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A small library to generate placeGant images.
|
14
|
+
email:
|
15
|
+
- angie@angieraegreen.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- ".gitignore"
|
21
|
+
- Gemfile
|
22
|
+
- LICENSE.txt
|
23
|
+
- README.md
|
24
|
+
- Rakefile
|
25
|
+
- VERSION
|
26
|
+
- lib/placegant.rb
|
27
|
+
- lib/placegant/helpers.rb
|
28
|
+
- lib/placegant/placegant.rb
|
29
|
+
- placegant.gemspec
|
30
|
+
- test/placegant_helpers_test.rb
|
31
|
+
- test/placegant_test.rb
|
32
|
+
homepage: https://github.com/AngieGreen/placegant
|
33
|
+
licenses: []
|
34
|
+
metadata: {}
|
35
|
+
post_install_message:
|
36
|
+
rdoc_options: []
|
37
|
+
require_paths:
|
38
|
+
- lib
|
39
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
requirements: []
|
50
|
+
rubyforge_project: placegant
|
51
|
+
rubygems_version: 2.2.3
|
52
|
+
signing_key:
|
53
|
+
specification_version: 4
|
54
|
+
summary: A small library to generate placeGant images.
|
55
|
+
test_files: []
|