Skip to content

Commit

Permalink
Git add derp
Browse files Browse the repository at this point in the history
  • Loading branch information
copyhacker committed Apr 17, 2014
1 parent 296666d commit eb11c21
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Gemfile.lock
*.gem
*.rbc
.ruby-version
.bundle
.config
coverage
Expand Down
29 changes: 29 additions & 0 deletions lib/diligent/list.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module Diligent
class List

attr_accessor :specs

class << self
def load
self.new.as_hash
end
end

def initialize
# TODO Optionally point at a different path?
@specs = Bundler.load.specs
end

def as_hash
@specs.inject({}) do |hash, spec|
hash[spec.name] = {
'version' => spec.version.to_s,
'author' => spec.author,
'description' => spec.description
}

hash
end
end
end
end
11 changes: 11 additions & 0 deletions spec/diligent/list_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require 'spec_helper'

describe Diligent::List do
context '.load' do
before { @list = Diligent::List.load }

it 'should be a list of gems used' do
expect(@list['awesome_print']['author']).to eq('Michael Dvorkin')
end
end
end

0 comments on commit eb11c21

Please sign in to comment.