forked from copyhacker/diligent
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
296666d
commit eb11c21
Showing
3 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
Gemfile.lock | ||
*.gem | ||
*.rbc | ||
.ruby-version | ||
.bundle | ||
.config | ||
coverage | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |