giraffes 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (9) hide show
  1. data/.document +5 -0
  2. data/Gemfile +12 -0
  3. data/Gemfile.lock +25 -0
  4. data/LICENSE.txt +20 -0
  5. data/README.rdoc +15 -0
  6. data/Rakefile +36 -0
  7. data/VERSION +1 -0
  8. data/bin/giraffe +88 -0
  9. metadata +191 -0
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source "http://rubygems.org"
2
+ gem "launchy"
3
+
4
+ # Add dependencies to develop your gem here.
5
+ # Include everything needed to run rake, tests, features, etc.
6
+ group :development do
7
+ gem "shoulda", ">= 0"
8
+ gem "bundler", "~> 1.0.0"
9
+ gem "jeweler", "~> 1.5.2"
10
+ gem "rcov", ">= 0"
11
+ gem "launchy"
12
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,25 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ configuration (1.2.0)
5
+ git (1.2.5)
6
+ jeweler (1.5.2)
7
+ bundler (~> 1.0.0)
8
+ git (>= 1.2.5)
9
+ rake
10
+ launchy (0.3.7)
11
+ configuration (>= 0.0.5)
12
+ rake (>= 0.8.1)
13
+ rake (0.8.7)
14
+ rcov (0.9.8)
15
+ shoulda (2.11.3)
16
+
17
+ PLATFORMS
18
+ ruby
19
+
20
+ DEPENDENCIES
21
+ bundler (~> 1.0.0)
22
+ jeweler (~> 1.5.2)
23
+ launchy
24
+ rcov
25
+ shoulda
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Michael Maloney
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,15 @@
1
+ = OMG GIRAFFE!
2
+
3
+ Installation
4
+ =============
5
+
6
+ (sudo) gem install giraffe
7
+
8
+ * On your command line, run `giraffe` to see a giraffe right in your prompt.
9
+ * If you'd like to see a REAL giraffe, run `giraffe -b` to see one!
10
+
11
+ == Copyright
12
+
13
+ Copyright (c) 2011 Michael Maloney. See LICENSE.txt for
14
+ further details.
15
+
data/Rakefile ADDED
@@ -0,0 +1,36 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'rake'
11
+
12
+ require 'jeweler'
13
+ Jeweler::Tasks.new do |gem|
14
+ gem.name = "giraffes"
15
+ gem.homepage = "http://github.com/mcmaloney/giraffe"
16
+ gem.license = "MIT"
17
+ gem.summary = "Shows you a giraffe: ASCII or image."
18
+ gem.description = "Shows you a giraffe right from your command line! Thanks to Bryan Woods and Kitty."
19
+ gem.email = "maloney.mc@gmail.com"
20
+ gem.authors = ["Michael Maloney"]
21
+ gem.executables << "giraffe"
22
+ gem.require_path = "bin"
23
+ gem.add_runtime_dependency 'launchy'
24
+ gem.add_development_dependency 'launchy'
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rake/rdoctask'
29
+ Rake::RDocTask.new do |rdoc|
30
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
31
+
32
+ rdoc.rdoc_dir = 'rdoc'
33
+ rdoc.title = "giraffe #{version}"
34
+ rdoc.rdoc_files.include('README*')
35
+ rdoc.rdoc_files.include('lib/**/*.rb')
36
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.2.0
data/bin/giraffe ADDED
@@ -0,0 +1,88 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'optparse'
5
+ require 'launchy'
6
+
7
+ class Giraffe
8
+ def coy_giraffe
9
+ coy_giraffe = <<-'OMG GIRAFFE'
10
+ /~~~~\ /~~~~\
11
+ \ / \ /
12
+ | |_____| |
13
+ /~ ~\
14
+ /~~~~~-_| /~~\ /~~~\ |_-~~~~~\
15
+ \ ==== /| | O| | ^ | |\ ==== /
16
+ ~-__-~ | |_---+--+----_| | ~-__-~
17
+ |/~ ~\|
18
+ / \
19
+ ( O O )
20
+ `\ ./`
21
+ ~-__________-~|
22
+ | |\__/| |
23
+ | |/~~\| |
24
+ | /~~~~~~~~~\ |
25
+ | | | |
26
+ | | | |
27
+ | | | |
28
+ | | | |
29
+
30
+ OMG GIRAFFE
31
+ end
32
+
33
+ # All of the ASCII giraffes.
34
+ def all_giraffes
35
+ methods.select { |m| m =~ /_giraffe$/ }
36
+ end
37
+
38
+ # Number of the image we want to show from the S3 bucket.
39
+ def self.random_pic_number
40
+ i = rand(11)
41
+ if i < 10
42
+ i = "00#{i.to_s}"
43
+ else
44
+ i = "0#{i.to_s}"
45
+ end
46
+ end
47
+
48
+ # Pick a random image from the giraffe_gem S3 bucket.
49
+ def self.random_img
50
+ "https://s3.amazonaws.com/giraffe_gem/#{random_pic_number}.jpg"
51
+ end
52
+
53
+ # A random ASCII giraffe.
54
+ def random_ascii
55
+ print send(all_giraffes[rand(all_giraffes.length)])
56
+ end
57
+ end
58
+
59
+ # By default, we only want to show 1 ASCII giraffe if a count is entered...
60
+ options = { :count => 1, :browser => false }
61
+
62
+ OptionParser.new do |opts|
63
+ opts.banner = "Usage #{__FILE__} [options]"
64
+ opts.on("-c N", "--count N", "How many giraffes do you want?") do |count|
65
+ options[:count] = count.to_i
66
+ end
67
+
68
+ # Show us a random giraffe image if we use the -b argument!
69
+ opts.on("-b", "--browser", "Show me a real giraffe.") do |browser|
70
+ options[:browser] = true
71
+ Launchy.open("#{Giraffe.random_img}")
72
+ end
73
+
74
+ opts.on_tail("-h", "--help", "Show this message") do
75
+ puts opts
76
+ exit
77
+ end
78
+ end.parse!
79
+
80
+
81
+ # OMG GIRAFFE!!
82
+ giraffe = Giraffe.new
83
+ unless options[:browser]
84
+ options[:count].times do
85
+ giraffe.random_ascii
86
+ end
87
+ end
88
+
metadata ADDED
@@ -0,0 +1,191 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: giraffes
3
+ version: !ruby/object:Gem::Version
4
+ hash: 23
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 2
9
+ - 0
10
+ version: 0.2.0
11
+ platform: ruby
12
+ authors:
13
+ - Michael Maloney
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-01-23 00:00:00 -05:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ type: :runtime
23
+ prerelease: false
24
+ name: launchy
25
+ version_requirements: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ hash: 3
31
+ segments:
32
+ - 0
33
+ version: "0"
34
+ requirement: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ type: :development
37
+ prerelease: false
38
+ name: shoulda
39
+ version_requirements: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ hash: 3
45
+ segments:
46
+ - 0
47
+ version: "0"
48
+ requirement: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ type: :development
51
+ prerelease: false
52
+ name: bundler
53
+ version_requirements: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ~>
57
+ - !ruby/object:Gem::Version
58
+ hash: 23
59
+ segments:
60
+ - 1
61
+ - 0
62
+ - 0
63
+ version: 1.0.0
64
+ requirement: *id003
65
+ - !ruby/object:Gem::Dependency
66
+ type: :development
67
+ prerelease: false
68
+ name: jeweler
69
+ version_requirements: &id004 !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ~>
73
+ - !ruby/object:Gem::Version
74
+ hash: 7
75
+ segments:
76
+ - 1
77
+ - 5
78
+ - 2
79
+ version: 1.5.2
80
+ requirement: *id004
81
+ - !ruby/object:Gem::Dependency
82
+ type: :development
83
+ prerelease: false
84
+ name: rcov
85
+ version_requirements: &id005 !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ hash: 3
91
+ segments:
92
+ - 0
93
+ version: "0"
94
+ requirement: *id005
95
+ - !ruby/object:Gem::Dependency
96
+ type: :development
97
+ prerelease: false
98
+ name: launchy
99
+ version_requirements: &id006 !ruby/object:Gem::Requirement
100
+ none: false
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ hash: 3
105
+ segments:
106
+ - 0
107
+ version: "0"
108
+ requirement: *id006
109
+ - !ruby/object:Gem::Dependency
110
+ type: :runtime
111
+ prerelease: false
112
+ name: launchy
113
+ version_requirements: &id007 !ruby/object:Gem::Requirement
114
+ none: false
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ hash: 3
119
+ segments:
120
+ - 0
121
+ version: "0"
122
+ requirement: *id007
123
+ - !ruby/object:Gem::Dependency
124
+ type: :development
125
+ prerelease: false
126
+ name: launchy
127
+ version_requirements: &id008 !ruby/object:Gem::Requirement
128
+ none: false
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ hash: 3
133
+ segments:
134
+ - 0
135
+ version: "0"
136
+ requirement: *id008
137
+ description: Shows you a giraffe right from your command line! Thanks to Bryan Woods and Kitty.
138
+ email: maloney.mc@gmail.com
139
+ executables:
140
+ - giraffe
141
+ - giraffe
142
+ extensions: []
143
+
144
+ extra_rdoc_files:
145
+ - LICENSE.txt
146
+ - README.rdoc
147
+ files:
148
+ - .document
149
+ - Gemfile
150
+ - Gemfile.lock
151
+ - LICENSE.txt
152
+ - README.rdoc
153
+ - Rakefile
154
+ - VERSION
155
+ - bin/giraffe
156
+ has_rdoc: true
157
+ homepage: http://github.com/mcmaloney/giraffe
158
+ licenses:
159
+ - MIT
160
+ post_install_message:
161
+ rdoc_options: []
162
+
163
+ require_paths:
164
+ - bin
165
+ required_ruby_version: !ruby/object:Gem::Requirement
166
+ none: false
167
+ requirements:
168
+ - - ">="
169
+ - !ruby/object:Gem::Version
170
+ hash: 3
171
+ segments:
172
+ - 0
173
+ version: "0"
174
+ required_rubygems_version: !ruby/object:Gem::Requirement
175
+ none: false
176
+ requirements:
177
+ - - ">="
178
+ - !ruby/object:Gem::Version
179
+ hash: 3
180
+ segments:
181
+ - 0
182
+ version: "0"
183
+ requirements: []
184
+
185
+ rubyforge_project:
186
+ rubygems_version: 1.3.7
187
+ signing_key:
188
+ specification_version: 3
189
+ summary: "Shows you a giraffe: ASCII or image."
190
+ test_files: []
191
+