This repository has been archived by the owner on May 4, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
/
Rakefile
78 lines (62 loc) · 2.35 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
require 'rake'
require './scripts/Settings'
require './scripts/Console'
require './scripts/Version'
require './scripts/Template'
# External args
VERSION = ENV['version'] || ''
# Version's tasks
namespace :version do
desc "Add new version"
task :add do
Console::display_box('Add new version')
if Version::check_version_syntax?(VERSION)
unless Version::check_version_exists?(VERSION)
Version::create_version(VERSION)
Console::display_done("Create new version: #{VERSION}")
Settings::add_version(VERSION)
Console::display_done("Update settings")
Template::create_template('Dockerfile', VERSION, {"version": VERSION})
Console::display_done("Add new version")
Template::create_template('Dockerfile', 'master')
Console::display_done("Update master")
Template::create_template('Makefile')
Console::display_done("Update make")
Template::create_template('README.md')
Console::display_done("Update documentation")
else
Console::display_error("This version '#{VERSION}' already exists.")
Console::display_info("Use another version than: " + Version::list_versions)
end
else
Console::display_error("Bad version: #{VERSION}")
Console::display_info("Please use a good version. (Eg: 1.0.0)")
end
end
desc "Remove version"
task :remove do
Console::display_box('Remove version')
if Version::check_version_syntax?(VERSION)
if Version::check_version_exists?(VERSION)
Version::remove_version(VERSION)
Console::display_done("Remove version: #{VERSION}")
Settings::remove_version(VERSION)
Console::display_done("Update settings")
Template::create_template('Dockerfile', 'master')
Console::display_done("Update master")
Template::create_template('Makefile')
Console::display_done("Update make")
Template::create_template('README.md')
Console::display_done("Update documentation")
else
Console::display_error("This version '#{VERSION}' does not exists.")
Console::display_info("Use a version in: " + Version::list_versions)
end
else
Console::display_error("Bad version: #{VERSION}")
Console::display_info("Please use a good version. (Eg: 1.0.0)")
end
end
end
# Default task
task :default => 'version:add'