Sha256: f604d490d3ee3ee5c1e9d31ca35561e2335380fc3c763aa8c608f55853722303
Contents?: true
Size: 1.15 KB
Versions: 2
Compression:
Stored size: 1.15 KB
Contents
require 'erb' module Climine::Command class Config < Base CONFIG = "config.yml" TEMPLATE = <<-ERB url: <%= options[:url] %> apikey: <%= options[:key] %> ERB default_command :init desc "init ", "initialize config.yml" option :url, required: true, type: :string, aliases: '-u', banner: "RedmineURL", desc: "Your Redmine's URL" option :key, required: true, type: :string, aliases: '-k', banner: "API-Access-Key", desc: "Your API Access Key" def init open(CONFIG, 'w'){|file| file.write(ERB.new(TEMPLATE).result(binding)) } puts "create [ #{File.expand_path(CONFIG)} ]" end # def self.included base # base.class_eval do # desc "init ", "initialize config.yml" # option :url, required: true, type: :string, aliases: '-u', banner: "RedmineURL", desc: "Your Redmine's URL" # option :key, required: true, type: :string, aliases: '-k', banner: "API-Access-Key", desc: "Your API Access Key" # def init # open(CONFIG, 'w'){|file| file.write(ERB.new(TEMPLATE).result(binding)) } # puts "create [ #{File.expand_path(CONFIG)} ]" # end # end # end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
climine-0.0.2 | lib/climine/command/config.rb |
climine-0.0.1 | lib/climine/command/config.rb |