简体   繁体   中英

How to Package files using Ruby

I have three separate files, and I would like to have a script that would install the below files in the local folder

Package Items

https://gitlab.com/darkout/builder/-/raw/master/_data/do-hero-content.yml
https://gitlab.com/darkout/builder/-/raw/master/_includes/do-hero-content.html
https://gitlab.com/darkout/builder/-/raw/master/_sass/modules/do-hero-content.scss

Sample code example

install do-hero

Should install the above three files in the local in the following folders

expected output: to have the files in the local below folder

local > /_data/do-hero-content.yml

local > /_includes/do-hero-content.html

local > /_sass/modules/do-hero-content.scss

Could someone advise me what the best way to execute this is?

Thanks Shovan

You can write a ruby script called install that downloads these files (Calling curl or HTTPX ), then use FileUtils to copy them to the location you wanted:

#!/usr/bin/env ruby

if ARGV[0] == 'do-hero'
  # Write code to download these 3 files and copy to folders you want
end

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM