lib/octofacts_updater/service/github.rb
# Commit a file to a location in the repository with the provided message. This will return true if there was
# an actual change, and false otherwise. This method does not actually do the commit, but rather it batches up
# all of the changes which must be realized later.
#
# path        - A String with the path at which to commit the file
# new_content - A String with the new contents
#
# Returns true (and updates @changes) if there was actually a change, false otherwise.
Commit a file to a location in the repository with the provided message. This will return true if there was
an actual change, and false otherwise. This method does not actually do the commit, but rather it batches up
all of the changes which must be realized later.

path        - A String with the path at which to commit the file
new_content - A String with the new contents

Returns true (and updates @changes) if there was actually a change, false otherwise.
Commit a file to a location in the repository with the provided message . This will return true if there was an actual change and false otherwise . This method does not actually do the commit but rather it batches up all of the changes which must be realized later . path - A String with the path at which to commit the file new_content - A String with the new contents Returns true ( and updates @changes ) if there was actually a change false otherwise .
def commit_data(path, new_content)
        ensure_branch_exists
        old_content = nil
        begin
          contents = octokit.contents(repository, path: path, ref: branch)
          old_content = Base64.decode64(contents.content)
        rescue Octokit::NotFound
          verbose("No old content found in #{repository.inspect} at #{path.inspect} in #{branch.inspect}")
        end
        if new_content == old_content
          verbose("Content of #{path} matches, no commit needed")
          return false
        else
          verbose("Content of #{path} does not match. A commit is needed.")
          verbose(Diffy::Diff.new(old_content, new_content))
        end
        @changes << Hash(
          path: path,
          mode: "100644",
          type: "blob",
          sha: octokit.create_blob(repository, new_content)
        )
        verbose("Batched update of #{path}")
        true
      end
def commit_data ( path , new_content ) ensure_branch_exists old_content = nil begin contents = octokit . contents ( repository , path : path , ref : branch ) old_content = Base64 . decode64 ( contents . content ) rescue Octokit :: NotFound verbose ( "No old content found in #{repository.inspect} at #{path.inspect} in #{branch.inspect}" ) end if new_content == old_content verbose ( "Content of #{path} matches, no commit needed" ) return false else verbose ( "Content of #{path} does not match. A commit is needed." ) verbose ( Diffy :: Diff . new ( old_content , new_content ) ) end @changes << Hash ( path : path , mode : "100644" , type : "blob" , sha : octokit . create_blob ( repository , new_content ) ) verbose ( "Batched update of #{path}" ) true end
Commit a file to a location in the repository with the provided message.
Commit a file to a location in the repository with the provided message .
# Fine, we will add below.
path
<not_specific>
new_content
<not_specific>