Module: AllGems
- Defined in:
- lib/allgems.rb,
lib/allgems/App.rb,
lib/allgems/Runner.rb,
lib/allgems/Specer.rb,
lib/allgems/Indexer.rb,
lib/allgems/GemWorker.rb,
lib/allgems/ViewHelpers.rb,
lib/allgems/IndexBuilder.rb
Defined Under Namespace
Modules: ViewHelpers Classes: App, GemWorker, IndexBuilder, Indexer, Runner, Specer
Class Attribute Summary collapse
-
.allgems ⇒ Object
Returns the value of attribute allgems.
-
.data_directory ⇒ Object
Returns the value of attribute data_directory.
-
.db ⇒ Object
Returns the value of attribute db.
-
.logger ⇒ Object
Returns the value of attribute logger.
Class Method Summary collapse
- .defaulterize ⇒ Object
-
.doc_format ⇒ Object
Format for documentation.
-
.doc_format=(f) ⇒ Object
- f
-
format Sets format for documentation.
-
.hanna_hack ⇒ Object
Path to hanna hack.
-
.initialize_db(db) ⇒ Object
db: Sequel::Database Run any migrations needed NOTE: Call before using the database.
-
.newest_gem ⇒ Object
Newest gem based on release date.
-
.public_directory ⇒ Object
Location of public directory.
-
.total_gems ⇒ Object
Total number of unique gem names installed.
-
.total_installs ⇒ Object
Total number of actual gems installed.
Class Attribute Details
.allgems ⇒ Object
Returns the value of attribute allgems.
4 5 6 |
# File 'lib/allgems.rb', line 4 def allgems @allgems end |
.data_directory ⇒ Object
Returns the value of attribute data_directory.
4 5 6 |
# File 'lib/allgems.rb', line 4 def data_directory @data_directory end |
.db ⇒ Object
Returns the value of attribute db.
4 5 6 |
# File 'lib/allgems.rb', line 4 def db @db end |
.logger ⇒ Object
Returns the value of attribute logger.
4 5 6 |
# File 'lib/allgems.rb', line 4 def logger @logger end |
Class Method Details
.defaulterize ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/allgems.rb', line 5 def defaulterize @data_directory = nil @doc_format = ['rdoc'] @logger = Logger.new(nil) @db = nil @tg = nil @ti = nil @allgems = true @refresh = Time.now.to_i + 3600 end |
.doc_format ⇒ Object
Format for documentation
24 25 26 |
# File 'lib/allgems.rb', line 24 def doc_format @doc_format end |
.doc_format=(f) ⇒ Object
- f
-
format
Sets format for documentation. Should be one of: hanna, rdoc, sdoc
29 30 31 32 33 34 35 36 |
# File 'lib/allgems.rb', line 29 def doc_format=(f) @doc_format = [] f.split(',').each do |type| type = type.to_sym raise ArgumentError.new("Valid types: hanna, sdoc, rdoc") unless [:hanna,:sdoc,:rdoc].include?(type) @doc_format << type end end |
.hanna_hack ⇒ Object
Path to hanna hack
65 66 67 |
# File 'lib/allgems.rb', line 65 def hanna_hack File.("#{__FILE__}/../allgems/hanna_hack.rb") end |
.initialize_db(db) ⇒ Object
db: Sequel::Database Run any migrations needed NOTE: Call before using the database
18 19 20 21 22 |
# File 'lib/allgems.rb', line 18 def initialize_db(db) self.db = db require 'sequel/extensions/migration' Sequel::Migrator.apply(db, "#{File.(__FILE__).gsub(/\/[^\/]+$/, '')}/allgems/migrations") end |
.newest_gem ⇒ Object
Newest gem based on release date
60 61 62 63 |
# File 'lib/allgems.rb', line 60 def newest_gem g = AllGems.db[:versions].join(:gems, :id => :gem_id).order(:release.desc).limit(1).select(:name, :release).first {:name => g[:name], :release => g[:release]} end |
.public_directory ⇒ Object
Location of public directory
38 39 40 |
# File 'lib/allgems.rb', line 38 def public_directory File.("#{__FILE__}/../../public") end |
.total_gems ⇒ Object
Total number of unique gem names installed
42 43 44 45 46 47 48 49 |
# File 'lib/allgems.rb', line 42 def total_gems return 0 if self.db.nil? if(@tg.nil? || Time.now.to_i > @refresh) @tg = self.db[:gems].count @refresh = Time.now.to_i + 3600 end @tg end |
.total_installs ⇒ Object
Total number of actual gems installed
51 52 53 54 55 56 57 58 |
# File 'lib/allgems.rb', line 51 def total_installs return 0 if self.db.nil? if(@ti.nil? || Time.now.to_i > @refresh) @ti = self.db[:versions].count @refresh = Time.now.to_i + 3600 end @ti end |