Class: CuttingEdge::Repository

Inherits:
Object
  • Object
show all
Defined in:
lib/cutting_edge/repo.rb

Direct Known Subclasses

GithubRepository

Constant Summary collapse

DEPENDENCY_TYPES =

Which dependency types to accept (default only :runtime, excludes :development).

[:runtime]
DEFAULT_LANG =
'ruby'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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_tokenObject (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_emailObject (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_typesObject

Returns the value of attribute dependency_types.



83
84
85
# File 'lib/cutting_edge/repo.rb', line 83

def dependency_types
  @dependency_types
end

#langObject (readonly)

Returns the value of attribute lang.



82
83
84
# File 'lib/cutting_edge/repo.rb', line 82

def lang
  @lang
end

#locationsObject (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

Returns:

  • (Boolean)


110
111
112
# File 'lib/cutting_edge/repo.rb', line 110

def hidden?
  !!@hidden
end

#hidden_tokenObject



106
107
108
# File 'lib/cutting_edge/repo.rb', line 106

def hidden_token
  @hidden
end

#identifierObject



118
119
120
# File 'lib/cutting_edge/repo.rb', line 118

def identifier
  File.join(source, @org, @name)
end

#sourceObject



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_projectObject



122
123
124
# File 'lib/cutting_edge/repo.rb', line 122

def url_for_project
  ''
end