jitterbug 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -1,19 +1,50 @@
1
1
  # Jitterbug: A just-in-time image creator for pretty text headers
2
2
 
3
- Jitterbug provides on-demand text header images using the font of your choice. On its first request, Jitterbug creates the requested header graphic. Then, and on subsequent requests, it returns an html image tag pointing to the header graphic file.
3
+ Jitterbug provides on-demand text header images using the font of your choice. On the first request, Jitterbug creates the requested header graphic and returns its image tag. On subsequent requests it returns the image tag of the already-created graphic.
4
+
5
+ ## Usage
6
+
7
+ Pass the `jitterbug` helper a string to convert into a header graphic. Optionally pass in any other parameters that differ from the defaults.
8
+
9
+ <%= jitterbug 'Default' %>
10
+ <%= jitterbug('Forty Two', :size => 42) %>
11
+ <%= jitterbug(t('whole_enchilada'), :background => '#fff', :color => 'green', :font => 'Yummy.otf', :font_dir => '/fonts/', :format => 'gif', :img_path => '/images/headers/', :size => 64, :width => 240) %>
12
+
13
+ ## Dependencies
14
+
15
+ Jitterbug uses `Imagemagick` to build the header images. It needs to be installed on your development and production machines, as do any fonts that you're using.
4
16
 
5
17
  ## Quick Links
6
18
 
7
- * http://github.com/flyingsaucer/jitterbug
19
+ * [github.com/flyingsaucer/jitterbug](http://github.com/flyingsaucer/jitterbug)
20
+ * [imagemagick.org](http://www.imagemagick.org/script/index.php)
8
21
 
9
- ## Installing
22
+ ## Installation
10
23
 
11
- # Install the gem:
12
24
  sudo gem install jitterbug
13
-
14
- ## Using in an existing project
15
25
 
26
+ In your `config/environment.rb` file:
27
+
28
+ Rails::Initializer.run do |config|
29
+ config.gem "jitterbug", :source => 'http://gemcutter.org/'
30
+ end
31
+
32
+ ## Configuration
33
+
34
+ Define your global configuration in `config/jitterbug.yml`. The following sample contains Jitterbug's built in defaults. Note that the asterisk default for the font causes Jitterbug to use the first font that it finds in the font_dir folder.
16
35
 
36
+ development: &defaults
37
+ background: transparent
38
+ color: white
39
+ font: *
40
+ font_dir: /lib/fonts/
41
+ format: png
42
+ img_path: /content/jitterbug/
43
+ size: 14
17
44
 
18
- ### Default configs
45
+ test:
46
+ <<: *defaults
47
+ img_path: /tmp/jitterbug/
19
48
 
49
+ production:
50
+ <<: *defaults
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.3.0
data/jitterbug.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{jitterbug}
8
- s.version = "0.2.0"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Chris Sessions", "Seth Engelhard"]
data/lib/jitterbug.rb CHANGED
@@ -19,9 +19,9 @@ module Jitterbug
19
19
  -font #{Jitterbug::Fonts.find(options[:font_dir], options[:font])} \
20
20
  -pointsize #{options[:size]} -blur 0x.3 #{caption} #{path}`
21
21
  end
22
- image_tag "/#{options[:img_path]}/#{hash}.#{options[:format]}".gsub('//', '/'),
23
- :class => (['jitterbug'] << options[:class]).compact.join(' '),
24
- :alt => label
22
+ img_src = "/#{options[:img_path]}/#{hash}.#{options[:format]}".gsub('//', '/')
23
+ img_class = (['jitterbug'] << options[:class]).compact.join(' ')
24
+ %Q{<img src="#{img_src}" class="#{img_class}" alt="#{label}" />}
25
25
  end
26
26
 
27
27
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jitterbug
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Sessions