Class: Hubeye::Server::Strategies::AddRepo
- Inherits:
-
Object
- Object
- Hubeye::Server::Strategies::AddRepo
- Defined in:
- lib/hubeye/server/strategies/add_repo.rb
Constant Summary collapse
- STATES =
[:added, :replaced, :unchanged, :invalid].freeze
- ADDED =
"%{committer} => %{message}\n".freeze
- REPLACED =
"New commit on %s\n".freeze
- UNCHANGED =
"Repository %s hasn't changed\n".freeze
- INVALID =
"%s isn't a valid Github repository\n".freeze
Instance Method Summary collapse
-
#call ⇒ Object
Add the given space-separated Github repo(s) if they’re valid.
Instance Method Details
#call ⇒ Object
Add the given space-separated Github repo(s) if they’re valid
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/hubeye/server/strategies/add_repo.rb', line 15 def call repo_names_given = @matches[1].split @multiple_repos_given = repo_names_given.size > 1 @unique_repo_names = Set.new # hash of states associated with repository names. # Ex: {:added => ['luke-gru/hubeye'], :replaced => ['rails/rails'], ...} @states_with_repos = Hash[STATES.map {|s| [ s, [] ]}] repo_names_given.each do |name| full_name = server.full_repo_name(name) @unique_repo_names << full_name end add_repos gather_output socket.deliver @output end |