forked from Shopify/shopify-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
100 lines (84 loc) · 2.51 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
require_relative "bin/load_shopify"
require "rake/testtask"
require "rubocop/rake_task"
require "bundler/gem_tasks"
Rake::TestTask.new do |t|
t.libs += %w(test)
t.test_files = FileList["test/**/*_test.rb"]
t.verbose = false
t.warning = false
end
RuboCop::RakeTask.new
task(default: [:test, :rubocop])
desc("Start up irb with cli loaded")
task :console do
exec("irb", "-r", "./bin/load_shopify.rb", "-r", "byebug")
end
namespace :rdoc do
repo = "https://github.com/Shopify/shopify-cli.wiki.git"
intermediate = "markdown_intermediate"
file_to_doc = [
"lib/shopify-cli/admin_api.rb",
"lib/shopify-cli/context.rb",
"lib/shopify-cli/db.rb",
"lib/shopify-cli/git.rb",
"lib/shopify-cli/heroku.rb",
"lib/shopify-cli/js_deps.rb",
"lib/shopify-cli/lazy_delegator.rb",
"lib/shopify-cli/method_object.rb",
"lib/shopify-cli/partners_api.rb",
"lib/shopify-cli/process_supervision.rb",
"lib/shopify-cli/project.rb",
"lib/shopify-cli/result.rb",
"lib/shopify-cli/transform_data_structure.rb",
"lib/shopify-cli/tunnel.rb",
]
task all: [:markdown, :wiki, :cleanup]
desc("Generate markdown files from rdoc comments")
task :markdown do
require "rdoc/rdoc"
require "docgen/markdown"
options = RDoc::Options.new
options.setup_generator("markdown")
options.op_dir = intermediate
options.files = file_to_doc
RDoc::RDoc.new.document(options)
end
desc("Copy markdown documentation to the wiki and commit them")
task :wiki do
require "tmpdir"
Dir.mktmpdir do |temp_dir|
system("git clone --depth=1 #{repo} #{temp_dir}")
FileUtils.cp(Dir[File.join(intermediate, "*.md")], temp_dir)
Dir.chdir(temp_dir) do
system("git add --all")
system('git commit -am "auto doc update"')
system("git push")
end
end
end
desc("Clean up any documentation related files")
task :cleanup do
FileUtils.rm_r(intermediate)
end
end
desc("Generate markdown documentation and update the wiki")
task(rdoc: "rdoc:all")
namespace :package do
require "shopify-cli/packager"
task all: [:debian, :rpm, :homebrew]
desc("Builds a Debian package of the CLI")
task :debian do
ShopifyCli::Packager.new.build_debian
end
desc("Builds an RPM package of the CLI")
task :rpm do
ShopifyCli::Packager.new.build_rpm
end
desc("Builds a Homebrew package of the CLI")
task :homebrew do
ShopifyCli::Packager.new.build_homebrew
end
end
desc("Builds all distribution packages of the CLI")
task(package: "package:all")