[英]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/_data/do-hero-content.yml
https://gitlab.com/darkout/builder/-/raw/master/_includes/do-hero-content.html 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 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本地 > /_data/do-hero-content.yml
local > /_includes/do-hero-content.html本地 > /_includes/do-hero-content.html
local > /_sass/modules/do-hero-content.scss本地 > /_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:你可以写一个Ruby脚本调用
install
该下载这些文件(调用卷曲或HTTPX ),然后使用文件实用程序将它们复制到你想要的位置:
#!/usr/bin/env ruby
if ARGV[0] == 'do-hero'
# Write code to download these 3 files and copy to folders you want
end
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.