Sha256: 3a010dc2591f4fbca638ad562ef3c84efb24270a740209713af35bb6f35ab3e1
Contents?: true
Size: 1.62 KB
Versions: 3
Compression:
Stored size: 1.62 KB
Contents
#!/usr/bin/env ruby require "eskort" require "octokit" require 'pry' # TODO: # should move to cli options UPDATE_GEMS_COUNT = 1 DEFAULT_LABELS = [] REPOSITORY_NAME = ENV['REPOSITORY_NAME'] BASE_BRANCH = 'master' GIT_USER_EMAIL = ENV['GIT_USER_EMAIL'] GIT_USER_NAME = ENV['GIT_USER_NAME'] def checkout_and_update_gem(branch_name, active_spec) command = Eskort::Bundler::Command.new command.git_config_global(email: GIT_USER_EMAIL, name: GIT_USER_NAME) command.git_checkout(branch_name) command.bundle_update(active_spec.name) command.git_commit(active_spec.name, active_spec.version.to_s) command.git_push(branch_name) end def branch_name(active_spec) "#{active_spec.name}-#{Time.now.to_i}#{Time.now.usec}" end def create_pull_request(branch_name, current_spec, active_spec) client = Octokit::Client.new(access_token: ENV['GITHUB_ACCESS_TOKEN']) client.create_pull_request( REPOSITORY_NAME, BASE_BRANCH, branch_name, title(active_spec.name, current_spec.version.to_s, active_spec.version.to_s), body(active_spec.name, current_spec.version.to_s, active_spec.version.to_s), { labels: DEFAULT_LABELS }, ) end def title(spec_name, from_version, to_version) "Auto Update: #{spec_name} #{from_version} -> #{to_version}" end def body(spec_name, from_version, to_version) "Auto Update: #{spec_name} #{from_version} -> #{to_version}" end outdated_gems = Eskort::Bundler::Outdated.new.list outdated_gems.sample(UPDATE_GEMS_COUNT).each do |og| branch_name = branch_name(og.active_spec) checkout_and_update_gem(branch_name, og.active_spec) create_pull_request(branch_name, og.current_spec, og.active_spec) end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
eskort-0.0.4 | bin/eskort |
eskort-0.0.3 | bin/eskort |
eskort-0.0.2 | bin/eskort |