-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
82 lines (69 loc) · 2.02 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
require "./support/helpers.rb"
namespace :app do
task :install do
@app = get_app
run_install @app
end
task :run do
@app = get_app
@keys = get_keys
# Check if we have all input
@frontend_key = @keys["frontend_key"] or raise "No frontend key set in keys.yml"
@push_key = @keys["push_key"] or raise "No push key set in keys.yml"
@revision = ENV["revision"]
if @revision.nil?
@revision = demo_revision
puts "No revision set in env; using demo revision #{@revision.inspect}"
end
# Use uris from keys.yml, or the default production ones
@uri = @keys["uri"] || "https://appsignal-endpoint.net/collect"
@sourcemap_uri = @keys["sourcemaps_uri"] || "https://appsignal.com/api/sourcemaps"
puts "Writing appsignal.js"
write_appsignal_config(
@app,
@frontend_key,
@revision,
@uri
)
# Make production build
run_build @app
# Upload the sourcemaps
upload_sourcemaps(@app, @sourcemap_uri, @revision, @push_key)
# Run the webserver
Thread.new do
run_webserver(@app)
end
# Open page in the browser
run_command "open http://localhost:5001"
# Stay alive
loop do
sleep 1
end
end
end
desc "Link local checkout of the javascript packages"
task :link do
puts "Linking integrations"
run_link
end
desc "Unlink local checkout of the javascript packages"
task :unlink do
puts "Unlinking integrations"
run_unlink
end
desc "Update the readme using the template"
task :update_readme do
puts "Updating readme"
@apps = all_apps
File.write "README.md", render_erb("support/templates/README.md.erb", binding)
end
desc "Clean build, node_modules and lock files"
task :clean do
all_apps.each do |app|
config = app_config(app)
run_command "cd frameworks/#{app} && rm -rf #{config.fetch(:build_dir)}"
run_command "cd frameworks/#{app} && rm -rf node_modules"
run_command "cd frameworks/#{app} && rm -rf package-lock.json"
run_command "cd frameworks/#{app} && rm -rf yarn.lock"
end
end