Class: CuttingEdge::Repository
- Inherits:
-
Object
- Object
- CuttingEdge::Repository
- Defined in:
- lib/cutting_edge/repo.rb
Direct Known Subclasses
Constant Summary collapse
- DEPENDENCY_TYPES =
Which dependency types to accept (default only :runtime, excludes :development).
[:runtime]
- DEFAULT_LANG =
'ruby'
Instance Attribute Summary collapse
-
#auth_token ⇒ Object
readonly
Returns the value of attribute auth_token.
-
#contact_email ⇒ Object
readonly
Returns the value of attribute contact_email.
-
#dependency_types ⇒ Object
Returns the value of attribute dependency_types.
-
#lang ⇒ Object
readonly
Returns the value of attribute lang.
-
#locations ⇒ Object
readonly
Returns the value of attribute locations.
Class Method Summary collapse
Instance Method Summary collapse
- #hidden? ⇒ Boolean
- #hidden_token ⇒ Object
- #identifier ⇒ Object
-
#initialize(org:, name:, lang: nil, locations: nil, branch: nil, email: nil, auth_token: nil, hide: nil) ⇒ Repository
constructor
A new instance of Repository.
- #source ⇒ Object
- #url_for_file(file) ⇒ Object
- #url_for_project ⇒ Object
Constructor Details
#initialize(org:, name:, lang: nil, locations: nil, branch: nil, email: nil, auth_token: nil, hide: nil) ⇒ Repository
Returns a new instance of Repository.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/cutting_edge/repo.rb', line 91 def initialize(org:, name:, lang: nil, locations: nil, branch: nil, email: nil, auth_token: nil, hide: nil) @org = org @name = name @auth_token = auth_token @branch = branch || 'master' @hidden = hide @lang = lang || DEFAULT_LANG @contact_email = email @locations = {} (locations || get_lang(@lang).locations(name)).each do |loc| @locations[loc] = url_for_file(loc) end @dependency_types = DEPENDENCY_TYPES end |
Instance Attribute Details
#auth_token ⇒ Object (readonly)
Returns the value of attribute auth_token.
82 83 84 |
# File 'lib/cutting_edge/repo.rb', line 82 def auth_token @auth_token end |
#contact_email ⇒ Object (readonly)
Returns the value of attribute contact_email.
82 83 84 |
# File 'lib/cutting_edge/repo.rb', line 82 def contact_email @contact_email end |
#dependency_types ⇒ Object
Returns the value of attribute dependency_types.
83 84 85 |
# File 'lib/cutting_edge/repo.rb', line 83 def dependency_types @dependency_types end |
#lang ⇒ Object (readonly)
Returns the value of attribute lang.
82 83 84 |
# File 'lib/cutting_edge/repo.rb', line 82 def lang @lang end |
#locations ⇒ Object (readonly)
Returns the value of attribute locations.
82 83 84 |
# File 'lib/cutting_edge/repo.rb', line 82 def locations @locations end |
Class Method Details
.headers(auth_token) ⇒ Object
86 87 88 |
# File 'lib/cutting_edge/repo.rb', line 86 def headers(auth_token) {} end |
Instance Method Details
#hidden? ⇒ Boolean
110 111 112 |
# File 'lib/cutting_edge/repo.rb', line 110 def hidden? !!@hidden end |
#hidden_token ⇒ Object
106 107 108 |
# File 'lib/cutting_edge/repo.rb', line 106 def hidden_token @hidden end |
#identifier ⇒ Object
118 119 120 |
# File 'lib/cutting_edge/repo.rb', line 118 def identifier File.join(source, @org, @name) end |
#source ⇒ Object
114 115 116 |
# File 'lib/cutting_edge/repo.rb', line 114 def source '' end |
#url_for_file(file) ⇒ Object
126 127 128 |
# File 'lib/cutting_edge/repo.rb', line 126 def url_for_file(file) file end |
#url_for_project ⇒ Object
122 123 124 |
# File 'lib/cutting_edge/repo.rb', line 122 def url_for_project '' end |