lib/xolti.rb in xolti-0.1.0 vs lib/xolti.rb in xolti-0.1.1
- old
+ new
@@ -22,10 +22,11 @@
require_relative "core"
require_relative "config"
require_relative "file_finder"
require_relative "resources"
+require_relative "version"
Signal.trap("INT") do
puts "\nCancelling..."
exit 1
end
@@ -115,10 +116,29 @@
puts "Correct header."
end
end
end
+ map ["--version", "-v"] => :__print_version
+
+ desc "--version, -v", "Print version of xolti"
+ def __print_version()
+ puts XoltiVersion.get
+ end
+
+ map ["--license", "-l"] => :__print_license
+
+ desc "--license, -l", "Print licensing information of xolti"
+ def __print_license()
+ puts "Xolti version #{XoltiVersion.get}, Copyright (C) 2016 RĂ©mi Even"
+ puts "Xolti comes with ABSOLUTELY NO WARRANTY."
+ puts "This is free software, and you are welcome to redistribute it"
+ puts "under the terms of the GPLv3."
+ puts "The complete license can be found at \"https://www.gnu.org/licenses/gpl.txt\"."
+ puts "The source code of xolti can be found at \"https://github.com/RemiEven/xolti\"."
+ end
+
no_commands {
def ask_for_name(config)
default_name = Pathname.getwd.basename.to_s
print "name (#{default_name}): "
typed_name = STDIN.gets.chomp
@@ -129,10 +149,17 @@
print "author: "
typed_author = STDIN.gets.chomp
config["project_info"]["author"] = typed_author
end
+ def ask_for_license(config)
+ default_license = "GPL3.0"
+ print "license (#{default_license}): "
+ typed_license = STDIN.gets.chomp
+ config["license"] = (typed_license == "") ? default_license : typed_license
+ end
+
def load_config()
begin
return XoltiConfig.load_config
rescue Exception => e
yield e if block_given?
@@ -146,8 +173,9 @@
return puts "Xolti is already initialiazed" if config != nil
puts "Initiating xolti project"
config = {"project_info" => {}}
self.ask_for_name(config)
self.ask_for_author(config)
+ self.ask_for_license(config)
File.write("xolti.yml", config.to_yaml)
end
end