Skip to content

Instantly share code, notes, and snippets.

@RX14

RX14/repro.cr Secret

Created March 10, 2017 22:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RX14/2c84aa70d2f5cb7dfcd01a8853e8b70e to your computer and use it in GitHub Desktop.
Save RX14/2c84aa70d2f5cb7dfcd01a8853e8b70e to your computer and use it in GitHub Desktop.
require "secure_random"
require "file_utils"
require "json"
struct Foo
getter value : String
def initialize(@value)
end
end
def get_foo
cache = "/home/rx14/.cache/crane"
Foo.new(cache)
end
def ensure_crystal_sources
crystal_source_dir = File.join(get_foo.value, "git", "crystal")
FileUtils.mkdir_p(crystal_source_dir)
crystal_source_dir
end
def temp_crystal_checkout(revision)
base_clone_path = ensure_crystal_sources
temp_clone_path = File.join("/tmp", "crystal-checkout-#{SecureRandom.hex}")
begin
FileUtils.cp_r(base_clone_path, temp_clone_path)
yield temp_clone_path
ensure
FileUtils.rm_r(temp_clone_path)
end
end
temp_crystal_checkout("0.21.1") do |repository|
JSON.parse("")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment