Skip to content

Commit

Permalink
First cut
Browse files Browse the repository at this point in the history
  • Loading branch information
hemanth committed May 24, 2012
0 parents commit 9787083
Show file tree
Hide file tree
Showing 8 changed files with 1,686 additions and 0 deletions.
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GNU AFFERO GENERAL PUBLIC LICENSE
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Visit the site [hackersays-gem](http://hemanth.github.com/hackersays-gem)
8 changes: 8 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require 'rake/testtask'

Rake::TestTask.new do |t|
t.libs << 'test'
end

desc "Run tests"
task :default => :test
4 changes: 4 additions & 0 deletions bin/hackersays
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env ruby
require 'hackersays'
puts Hacker.said()

29 changes: 29 additions & 0 deletions hackersays.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Gem::Specification.new do |s|
s.name = "hackersays"
s.version = "1.0.0"
s.default_executable = "hackersays"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Hemanth.HM"]
s.date = %q{2012-05-20}
s.description = %q{The best lines from hackers around the world!}
s.email = %q{hemanth.hm@gmail.com}
s.files = ["Rakefile", "lib/hackersays.rb", "bin/hackersays","lib/.said"]
s.test_files = Dir.glob('test/*.rb')
s.homepage = %q{http://rubygems.org/gems/gita}
s.require_paths = ["lib"]
s.rubygems_version = %q{1.6.2}
s.summary = %q{Hackersays!}
s.bindir = 'bin'
s.executables = 'hackersays'

if s.respond_to? :specification_version then
s.specification_version = 3

if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
else
end
else
end
end

1,621 changes: 1,621 additions & 0 deletions lib/.said

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions lib/hackersays.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env ruby
require 'yaml'
require 'open-uri'
class Hacker
def self.said
@quotes = []
hackers_said = File.dirname(__FILE__) + "/.said"
@quotes = YAML::load(open(hackers_said).read)
quote = @quotes[rand(@quotes.length)]
said = quote[:c]
who = quote[:a] || "Some hacker"
"#{said} ~ #{who}".gsub(/\n/,"")
end
end
8 changes: 8 additions & 0 deletions test/test_hackersays.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require 'test/unit'
require 'hackersays'

class HackerTest < Test::Unit::TestCase
def test_hacker_said
assert_not_nil Hacker.said()
end
end

0 comments on commit 9787083

Please sign in to comment.