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.
-
#private ⇒ Object
readonly
Returns the value of attribute private.
-
#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 18 19 |
# File 'lib/creategem/repository.rb', line 10 def initialize() @vendor = [:vendor] @private = [:private] @name = [:name] @user = [:user] @user_name = ::Git.global_config "user.name" @user_email = ::Git.global_config "user.email" @gem_server_url = [:gem_server_url] @private = [:private] 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 |
#private ⇒ Object (readonly)
Returns the value of attribute private.
8 9 10 |
# File 'lib/creategem/repository.rb', line 8 def private @private 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
25 26 27 |
# File 'lib/creategem/repository.rb', line 25 def bitbucket? vendor == :bitbucket end |
#github? ⇒ Boolean
21 22 23 |
# File 'lib/creategem/repository.rb', line 21 def github? vendor == :github end |
#origin ⇒ Object
42 43 44 |
# File 'lib/creategem/repository.rb', line 42 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
30 31 32 |
# File 'lib/creategem/repository.rb', line 30 def private? self.private end |
#public? ⇒ Boolean
34 35 36 |
# File 'lib/creategem/repository.rb', line 34 def public? !private? end |
#url ⇒ Object
38 39 40 |
# File 'lib/creategem/repository.rb', line 38 def url "https://#{REPOSITORIES[vendor]}/#{user}/#{name}" end |