Class: Gitomator::Context
- Inherits:
-
BaseContext
- Object
- BaseContext
- Gitomator::Context
- Defined in:
- lib/gitomator/context.rb
Constant Summary collapse
- DEFAULT_CONFIG =
{ 'git' => { 'provider' => 'shell'}, 'hosting' => { 'provider' => 'local'} }
Class Method Summary collapse
-
.from_file(config_file) ⇒ Object
Convenience function to create Context instances from configuration files.
Instance Method Summary collapse
- #create_github_hosting_service(config) ⇒ Object
- #create_github_tagging_service(config) ⇒ Object
- #create_local_hosting_service(config) ⇒ Object
- #create_shell_git_service(_) ⇒ Object
- #create_travis_ci_service(config) ⇒ Object
- #create_travis_pro_ci_service(config) ⇒ Object
-
#initialize(config = {}) ⇒ Context
constructor
A new instance of Context.
Methods inherited from BaseContext
Constructor Details
#initialize(config = {}) ⇒ Context
Returns a new instance of Context.
69 70 71 |
# File 'lib/gitomator/context.rb', line 69 def initialize(config={}) super(DEFAULT_CONFIG.merge(config)) end |
Class Method Details
.from_file(config_file) ⇒ Object
Convenience function to create Context instances from configuration files.
57 58 59 |
# File 'lib/gitomator/context.rb', line 57 def self.from_file(config_file) return new(Gitomator::Util.load_config(config_file)) end |
Instance Method Details
#create_github_hosting_service(config) ⇒ Object
99 100 101 102 103 104 105 |
# File 'lib/gitomator/context.rb', line 99 def create_github_hosting_service(config) require 'gitomator/service/hosting' require 'gitomator/github/hosting_provider' return Gitomator::Service::Hosting.new ( Gitomator::GitHub::HostingProvider.from_config(config)) end |
#create_github_tagging_service(config) ⇒ Object
121 122 123 124 125 126 127 |
# File 'lib/gitomator/context.rb', line 121 def create_github_tagging_service(config) require 'gitomator/service/tagging' require 'gitomator/github/tagging_provider' return Gitomator::Service::Tagging.new ( Gitomator::GitHub::TaggingProvider.from_config(config)) end |
#create_local_hosting_service(config) ⇒ Object
74 75 76 77 78 79 80 81 82 83 |
# File 'lib/gitomator/context.rb', line 74 def create_local_hosting_service(config) require 'gitomator/service/hosting' require 'gitomator/service_provider/hosting_local' require 'tmpdir' dir = config['dir'] || Dir.mktmpdir('Gitomator_') return Gitomator::Service::Hosting.new ( Gitomator::ServiceProvider::HostingLocal.new(git, dir) ) end |
#create_shell_git_service(_) ⇒ Object
86 87 88 89 90 |
# File 'lib/gitomator/context.rb', line 86 def create_shell_git_service(_) require 'gitomator/service/git' require 'gitomator/service_provider/git_shell' Gitomator::Service::Git.new(Gitomator::ServiceProvider::GitShell.new()) end |
#create_travis_ci_service(config) ⇒ Object
108 109 110 111 112 113 114 |
# File 'lib/gitomator/context.rb', line 108 def create_travis_ci_service(config) require 'gitomator/service/ci' require 'gitomator/travis/ci_provider' return Gitomator::Service::CI.new( Gitomator::Travis::CIProvider.from_config(config)) end |
#create_travis_pro_ci_service(config) ⇒ Object
116 117 118 |
# File 'lib/gitomator/context.rb', line 116 def create_travis_pro_ci_service(config) create_travis_ci_service(config) end |