Sha256: e964fd726d66f4d307c72f59ccb185183251ef76494184cdec0bcf3d601419da

Contents?: true

Size: 777 Bytes

Versions: 7

Compression:

Stored size: 777 Bytes

Contents

module RoboPigeon::GitLab
  class Commit
    attr_accessor :files, :branch, :message, :author_name, :author_email
    def initialize
      self.files = []
      self.author_name = ENV['GITLAB_USER_NAME']
      self.author_email = ENV['GITLAB_USER_EMAIL']
      self.branch = RoboPigeon::GitLab::Client.branch
    end

    def add_file(file, content=nil, method='update')
      content ||= File.read(file)
      files.push(action: method, file_path: file, content: content)
    end

    def client
      RoboPigeon::GitLab::Client.client
    end

    def commit!
      client.create_commit(
        RoboPigeon::GitLab::Client.project,
        branch,
        message,
        files,
        author_name: author_name,
        author_email: author_email
      )
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
robopigeon-0.5.1 lib/robopigeon/gitlab/commit.rb
robopigeon-0.5.0 lib/robopigeon/gitlab/commit.rb
robopigeon-0.4.0 lib/robopigeon/gitlab/commit.rb
robopigeon-0.3.2 lib/robopigeon/gitlab/commit.rb
robopigeon-0.3.1 lib/robopigeon/gitlab/commit.rb
robopigeon-0.3.0 lib/robopigeon/gitlab/commit.rb
robopigeon-0.2.0 lib/robopigeon/gitlab/commit.rb