lib/codestatus.rb in codestatus-0.1.0 vs lib/codestatus.rb in codestatus-0.1.1
- old
+ new
@@ -1,27 +1,23 @@
require "codestatus/version"
require "codestatus/build_status"
+require "codestatus/cli"
require "codestatus/repository_resolver"
require "codestatus/repository_resolver/user_defined_resolver"
require "codestatus/repository_resolver/rubygems_resolver"
+require "codestatus/repository_resolver/npm_resolver"
require "codestatus/package_repository"
require "codestatus/package_repository/github_repository"
module Codestatus
- def self.status(slug = ARGV.first)
- slug = 'rubygems/apartment' unless slug
- package_registry, package_name = slug.split('/')
+ def self.status(registry:, package:)
+ resolver = RepositoryResolver.new(registry: registry, package: package)
- resolver = RepositoryResolver.new(registry: package_registry, package: package_name)
-
package_repository = resolver.repository
+
if package_repository
- status = package_repository.status
- success = (status == BuildStatus::SUCCESS)
+ package_repository.status
else
- status = 'Repository not found'
- success = 1
+ BuildStatus.new(sha: nil, status: nil)
end
- puts status
- exit success ? 0 : 1
end
end