-
Notifications
You must be signed in to change notification settings - Fork 2
/
Rakefile
60 lines (47 loc) · 1.43 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
# frozen_string_literal: true
require "bundler/gem_tasks"
require_relative "config/environment"
require "sinatra/activerecord/rake"
if PunyMonitor::App.development?
require "minitest/test_task"
Minitest::TestTask.create
require "rubocop/rake_task"
RuboCop::RakeTask.new
desc "Copy Chartkick assets to public/javascript"
task :assets do
require "fileutils"
chartkick_path = Gem.loaded_specs["chartkick"].full_gem_path
source_dir = File.join(chartkick_path, "vendor", "assets", "javascripts")
dest_dir = File.join(Dir.pwd, "public", "javascript")
FileUtils.cp_r(Dir[File.join(source_dir, "*")], dest_dir)
end
namespace :docker do
desc "Build Puny Monitor Docker image"
task :build do
sh "docker build -t hschne/puny-monitor:latest ."
end
desc "Push Puny Monitor Docker image"
task :push do
sh "docker push -a hschne/puny-monitor"
end
desc "Run Docker container"
task :run do
`docker run --rm \
-v=/:/host:ro,rslave -v=puny-data:/puny-monitor/db \
-e ROOT_PATH=/host \
-p 80:4567 \
hschne/puny-monitor:latest`
end
desc "Run Docker interactive shell"
task :shell do
`docker run --rm \
-v=/:/host:ro,rslave -v=puny-data:/puny-monitor/db \
-e ROOT_PATH=/host \
-p 80:4567 \
-it \
hschne/puny-monitor:latest \
/bin/bash`
end
end
task default: %i[test rubocop]
end