-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathRakefile
74 lines (56 loc) · 1.79 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
task default: "help"
desc "Bantuan"
task :help do
puts <<HELP
Semua proses ini ditangani oleh rake, berikut daftar lengkapnya:
#{%x[rake -T]}
Contoh:
$ rake test:yaml
Panduan dasar untuk jekyll:
Untuk build sumber kode:
$ jekyll build
Untuk melihat hasil build:
$ jekyll serve
Panduan lengkap untuk jekyll:
###########################################################################################
#{%x[jekyll -h]}
###########################################################################################
HELP
end
namespace :test do
desc "Uji file YAML"
task :yaml do
require "yaml"
list_yaml = Dir["./**/*.yml"]
list_yaml.each do |file|
begin
puts "Checking : #{file}"
YAML.load_file(file)
rescue Exception
puts "Failed to read #{file}: #{$!}"
end
end
end
end
namespace :list do
desc "Generate semua Startup atau Perusahaan pengguna Ruby dan Rails di Indonesia"
task :companies_id_ruby do
require "open-uri"
require "yaml"
unless File.exist?(Dir.pwd + "/_data")
FileUtils.mkdir_p Dir.pwd + "/_data"
end
File.open(Dir.pwd + "/_data/companies_id_ruby.yml", "wb") {|file|
file.write open("https://raw.githubusercontent.com/id-ruby/id-ruby/master/_data/companies.yml").read
}
unless File.exist?(Dir.pwd + "/assets/showcase/companies_id_ruby/images")
FileUtils.mkdir_p Dir.pwd + "/assets/showcase/companies_id_ruby/images"
end
companies_id_ruby = YAML.load_file(Dir.pwd + "/_data/companies_id_ruby.yml")
companies_id_ruby.each {|company|
File.open(Dir.pwd + "/assets/showcase/companies_id_ruby/#{company['image_url']}", "wb") {|file|
file.write open("https://raw.githubusercontent.com/id-ruby/id-ruby/master/#{company['image_url']}").read
}
}
end
end