branding 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 98c7c50a74686570bba45b496c478e1e3e34dbcc
4
- data.tar.gz: 631b8ac04bd4f9aea66443e4c5224535bc32025d
3
+ metadata.gz: 84f12d04e4345b16255303cead54dd8dc0fc861b
4
+ data.tar.gz: 0e29efd611b2ab5c9f16459a6312321b376566c2
5
5
  SHA512:
6
- metadata.gz: 575a40f1e189d2ceee0614e12e4773e8c73c4c90c46ca39cad7a3fcc781190f0a65ae59cdfaa23f69bb4483958c883cca484de3c70cbddcc3953d5b009fc3fad
7
- data.tar.gz: 8526484d7c9776793bed44e8de82efb7f56f30c02c40dc4c963f01beb58733dc899c3edca79d5ba193bbfd279a3f54a39390f9e015df8dc5b7948eae3d929bfa
6
+ metadata.gz: 8e1fb915ef2b0cdb5c7fa4b03056c3462112866c79ac02caa33e6fe43aaf18bb032c91514c03700c2bf80fc4ab5c4d851b50fd0066d729c5e1c6a75a036cb9fb
7
+ data.tar.gz: 29d28dbacb70e62f3337250ca181f959c4a5286d9c3a7eab08407d8f583af8333f7b597a59ffc34a3ce97673fb862542ed0f332359e4f7fe24b38651596578bd
data/README.md CHANGED
@@ -1,12 +1,14 @@
1
1
  # Branding
2
2
 
3
- Proud of your code? Add some bling to your terminal.
3
+ Proud of your code? Add some _bling_ to your terminal.
4
+
5
+ [![asciicast](https://asciinema.org/a/9gk8mur6c5gmff67to3y1l1a1.png)](https://asciinema.org/a/9gk8mur6c5gmff67to3y1l1a1)
4
6
 
5
7
  ## Perks
6
8
 
7
9
  * No dependencies!
8
10
  * Pure Ruby PNG decoding in < 200 LoC
9
- * Hi-Res mode for 2x pixel density!
11
+ * Hi-Res mode for 4x pixel density!
10
12
  * Hi-Color mode for 720 colors!!
11
13
  * Loads of fun!
12
14
 
@@ -20,15 +22,37 @@ Branding will detect your Rails application's favicon. It adds a small
20
22
  initializer in development and testing environments that draws the favicon with
21
23
  ANSI control characters whenever you run tests, a rake task or boot the console.
22
24
 
25
+ ### Hi-Res mode
26
+
27
+ `hires` mode is a technique where we can 4x the "pixel" density of the
28
+ terminal. This is accomplished by using the half-height unicode characters.
29
+
30
+ Some terminal fonts do not render these characters very well and there are some artifacts.
31
+
32
+ So far, `Inconsolata` has yield the best results.
33
+
23
34
  ## Installation
24
35
 
25
36
  Add this line to your application's Gemfile:
26
37
 
27
- gem 'branding'
38
+ ```ruby
39
+ gem 'branding'
40
+ ```
28
41
 
29
42
  ## Usage
30
43
 
31
- Continue your normal workflow.
44
+ If you're adding branding to your Rails project, there is no more
45
+ configuration. To test how images look in the terminal:
46
+
47
+ ```shell
48
+ branding logo-72x72.png
49
+ ```
50
+
51
+ To test out **hires mode**, try:
52
+
53
+ ```shell
54
+ branding -p hires logo-144x144.png
55
+ ```
32
56
 
33
57
  ## Contributing
34
58
 
@@ -1,3 +1,5 @@
1
+ require 'zlib'
2
+
1
3
  module Branding
2
4
  ##
3
5
  # This is a simple PNG decoder, inspired and adapted from ChunkyPNG
@@ -7,10 +7,12 @@ module Branding
7
7
  rows, cols = Canvas.terminal_size
8
8
  ideal_width = cols / 6
9
9
 
10
- logo = Branding::Logo.new(Branding::Railtie.best_icon(ideal_width))
11
- logo.algo = :hires
12
- logo.print
13
- print "\n"
10
+ if icon_path = Branding::Railtie.best_icon(ideal_width)
11
+ logo = Branding::Logo.new(icon_path)
12
+ logo.algo = :hires
13
+ logo.print
14
+ print "\n"
15
+ end
14
16
  rescue
15
17
  # We don't want to do anything if this causes an exception. Your time
16
18
  # is too valuable to be dealing with busted amusement gems.
@@ -27,6 +29,7 @@ module Branding
27
29
  end
28
30
 
29
31
  if paths.empty?
32
+ nil
30
33
  else
31
34
  paths.first
32
35
  end
@@ -1,3 +1,3 @@
1
1
  module Branding
2
- VERSION = "0.0.2"
2
+ VERSION = '0.0.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: branding
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Natchev