Class: Creategem::Repository
- Inherits:
-
Object
- Object
- Creategem::Repository
- Defined in:
- lib/creategem/repository.rb
Constant Summary collapse
- REPOSITORIES =
{ github: "github.com", bitbucket: "bitbucket.org" }
Instance Attribute Summary collapse
-
#gem_server_url ⇒ Object
readonly
Returns the value of attribute gem_server_url.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
-
#user_email ⇒ Object
readonly
Returns the value of attribute user_email.
-
#user_name ⇒ Object
readonly
Returns the value of attribute user_name.
-
#vendor ⇒ Object
readonly
Returns the value of attribute vendor.
Instance Method Summary collapse
- #bitbucket? ⇒ Boolean
- #github? ⇒ Boolean
-
#initialize(options) ⇒ Repository
constructor
A new instance of Repository.
- #origin ⇒ Object
-
#private? ⇒ Boolean
this could change later.
- #public? ⇒ Boolean
- #url ⇒ Object
Constructor Details
#initialize(options) ⇒ Repository
Returns a new instance of Repository.
10 11 12 13 14 15 16 17 |
# File 'lib/creategem/repository.rb', line 10 def initialize() @vendor = [:vendor] @name = [:name] @user = [:user] @user_name = ::Git.global_config "user.name" @user_email = ::Git.global_config "user.email" @gem_server_url = [:gem_server_url] end |
Instance Attribute Details
#gem_server_url ⇒ Object (readonly)
Returns the value of attribute gem_server_url.
8 9 10 |
# File 'lib/creategem/repository.rb', line 8 def gem_server_url @gem_server_url end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/creategem/repository.rb', line 8 def name @name end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
8 9 10 |
# File 'lib/creategem/repository.rb', line 8 def user @user end |
#user_email ⇒ Object (readonly)
Returns the value of attribute user_email.
8 9 10 |
# File 'lib/creategem/repository.rb', line 8 def user_email @user_email end |
#user_name ⇒ Object (readonly)
Returns the value of attribute user_name.
8 9 10 |
# File 'lib/creategem/repository.rb', line 8 def user_name @user_name end |
#vendor ⇒ Object (readonly)
Returns the value of attribute vendor.
8 9 10 |
# File 'lib/creategem/repository.rb', line 8 def vendor @vendor end |
Instance Method Details
#bitbucket? ⇒ Boolean
23 24 25 |
# File 'lib/creategem/repository.rb', line 23 def bitbucket? vendor == :bitbucket end |
#github? ⇒ Boolean
19 20 21 |
# File 'lib/creategem/repository.rb', line 19 def github? vendor == :github end |
#origin ⇒ Object
40 41 42 |
# File 'lib/creategem/repository.rb', line 40 def origin "git@#{REPOSITORIES[vendor]}:#{user}/#{name}.git" end |
#private? ⇒ Boolean
this could change later. For now all private repositories are on bitbucket and all private ones on github
28 29 30 |
# File 'lib/creategem/repository.rb', line 28 def private? bitbucket? end |
#public? ⇒ Boolean
32 33 34 |
# File 'lib/creategem/repository.rb', line 32 def public? !private? end |
#url ⇒ Object
36 37 38 |
# File 'lib/creategem/repository.rb', line 36 def url "https://#{REPOSITORIES[vendor]}/#{user}/#{name}" end |