Class: Ossy::CLI::Github::UpdateFile

Inherits:
Commands::Core
  • Object
show all
Defined in:
lib/ossy/cli/github/update_file.rb

Instance Method Summary collapse

Instance Method Details

#call(repo:, file:, branch:) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/ossy/cli/github/update_file.rb', line 16

def call(repo:, file:, branch:)
  url = "https://raw.githubusercontent.com/#{repo}/#{branch}/shared/#{file}"

  content = open(url).read

  puts "Writing to #{file}"

  File.write("./#{file}", content)

  system "git commit #{file} -m 'Update #{file}'"
end