asciiart 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/asciiart +1 -16
- data/lib/asciiart.rb +5 -5
- data/lib/asciiart/version.rb +1 -1
- metadata +7 -17
data/bin/asciiart
CHANGED
@@ -1,24 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'uri'
|
4
|
-
require 'tempfile'
|
5
|
-
require 'net/http'
|
6
2
|
require 'asciiart'
|
7
3
|
|
8
4
|
if ARGV[0].nil?
|
9
5
|
puts "Specify a path or URL to convert\n"
|
10
6
|
exit
|
11
|
-
end
|
12
|
-
|
13
|
-
if ARGV[0] =~ URI::regexp
|
14
|
-
temp_file = Tempfile.new(File.basename(ARGV[0]))
|
15
|
-
puts "\n...hold up, downloading...\n"
|
16
|
-
temp_file << Net::HTTP.get_response(URI.parse(ARGV[0])).body
|
17
|
-
temp_file.close
|
18
|
-
|
19
|
-
puts AsciiArt.new(temp_file.path).to_ascii_art
|
20
|
-
temp_file.delete
|
21
7
|
else
|
22
|
-
|
23
|
-
puts file_to_convert.to_ascii_art
|
8
|
+
puts AsciiArt.new(ARGV[0]).to_ascii_art
|
24
9
|
end
|
data/lib/asciiart.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
require "asciiart/version"
|
2
2
|
require 'RMagick'
|
3
|
+
require 'uri'
|
4
|
+
require 'open-uri'
|
3
5
|
|
4
6
|
class AsciiArt
|
5
7
|
|
6
|
-
attr_reader :file
|
7
8
|
attr_writer :image_chars
|
8
9
|
|
9
|
-
def initialize(path_to_file)
|
10
|
-
|
11
|
-
@data = file.read
|
12
|
-
|
10
|
+
def initialize(path_to_file)
|
11
|
+
# open-uri open will fallback to IO open
|
12
|
+
open(path_to_file) { |file| @data = file.read }
|
13
13
|
self
|
14
14
|
end
|
15
15
|
|
data/lib/asciiart/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asciiart
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-01-
|
13
|
+
date: 2013-01-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rmagick
|
17
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirement: &70275816255180 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,15 +22,10 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements:
|
26
|
-
none: false
|
27
|
-
requirements:
|
28
|
-
- - ! '>='
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
version: '0'
|
25
|
+
version_requirements: *70275816255180
|
31
26
|
- !ruby/object:Gem::Dependency
|
32
27
|
name: pry
|
33
|
-
requirement: !ruby/object:Gem::Requirement
|
28
|
+
requirement: &70275816254720 !ruby/object:Gem::Requirement
|
34
29
|
none: false
|
35
30
|
requirements:
|
36
31
|
- - ! '>='
|
@@ -38,12 +33,7 @@ dependencies:
|
|
38
33
|
version: '0'
|
39
34
|
type: :development
|
40
35
|
prerelease: false
|
41
|
-
version_requirements:
|
42
|
-
none: false
|
43
|
-
requirements:
|
44
|
-
- - ! '>='
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: '0'
|
36
|
+
version_requirements: *70275816254720
|
47
37
|
description:
|
48
38
|
email:
|
49
39
|
- stephen@eastmedia.com
|
@@ -81,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
71
|
version: '0'
|
82
72
|
requirements: []
|
83
73
|
rubyforge_project:
|
84
|
-
rubygems_version: 1.8.
|
74
|
+
rubygems_version: 1.8.10
|
85
75
|
signing_key:
|
86
76
|
specification_version: 3
|
87
77
|
summary: A command line tool to turn images into ASCII art
|