lib/robopigeon/gitlab/dsl.rb in robopigeon-0.1.0 vs lib/robopigeon/gitlab/dsl.rb in robopigeon-0.2.0
- old
+ new
@@ -1,13 +1,8 @@
require 'gitlab'
module RoboPigeon::Dsl
- class GitLabRoot
- def self.run(&block)
- gitlab = RoboPigeon::Dsl::GitLabRoot.new
- gitlab.instance_eval(&block)
- end
-
+ class GitLabRoot < RoboPigeon::Dsl::Base
RoboPigeon::Documentarian.add_command(
'enabled',
block: ['gitlab'],
params: [
{ name: 'enabled', type: 'boolean', desc: 'should it run gitlab commands', example: 'false', default: 'true' }
@@ -79,11 +74,10 @@
end
end
class GitLab < GitLabRoot
attr_accessor :merge_request
- include RoboPigeon::Dsl::Helpers
def self.run(&block)
if RoboPigeon::GitLab::Client.enabled
gitlab = RoboPigeon::Dsl::GitLab.new
gitlab.instance_eval(&block)
@@ -167,8 +161,18 @@
block: %w[job gitlab],
desc: 'merge the recently created merge request'
)
def merge_merge_request
merge_request.merge!
+ end
+
+ RoboPigeon::Documentarian.add_block(
+ 'commit',
+ helpers: true,
+ block: %w[job gitlab],
+ desc: 'Create a commit on a branch'
+ )
+ def commit(&block)
+ RoboPigeon::GitLab::Commit.run(&block)
end
end
end