Class: Git::Flock::Flocker
- Inherits:
-
Object
- Object
- Git::Flock::Flocker
- Defined in:
- lib/git/flock.rb
Instance Attribute Summary collapse
-
#orgname ⇒ Object
readonly
Returns the value of attribute orgname.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
- #fail_args ⇒ Object
- #flockem ⇒ Object
-
#initialize(options) ⇒ Flocker
constructor
A new instance of Flocker.
- #repos ⇒ Object
Constructor Details
#initialize(options) ⇒ Flocker
Returns a new instance of Flocker.
15 16 17 18 |
# File 'lib/git/flock.rb', line 15 def initialize() @orgname = [:orgname] || fail_args @token = [:token] || fail_args end |
Instance Attribute Details
#orgname ⇒ Object (readonly)
Returns the value of attribute orgname.
20 21 22 |
# File 'lib/git/flock.rb', line 20 def orgname @orgname end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
20 21 22 |
# File 'lib/git/flock.rb', line 20 def token @token end |
Instance Method Details
#fail_args ⇒ Object
33 34 35 36 |
# File 'lib/git/flock.rb', line 33 def fail_args puts 'usage: git-flock org-name api-key' exit end |
#flockem ⇒ Object
22 23 24 25 26 27 |
# File 'lib/git/flock.rb', line 22 def flockem JSON.load(repos).each { |repo| `git clone #{repo['ssh_url']}` } rescue Exception => e puts e. fail_args end |
#repos ⇒ Object
29 30 31 |
# File 'lib/git/flock.rb', line 29 def repos `curl -u #{token}:x-oauth-basic -s https://api.github.com/orgs/#{orgname}/repos` end |