bin/ziyafy in derailed-ziya-2.1.0 vs bin/ziyafy in derailed-ziya-2.1.1
- old
+ new
@@ -10,40 +10,41 @@
class Ziyafy
# Copy necessary ZiYa components to a ruby web application
def initialize( argv=ARGV )
option_parser = default_option_parser
option_parser.parse!(argv)
+ puts 'You must specify at least one off --charts, --gauges or --maps' unless options.charts or options.gauges or options.maps
copy_artifacts
end
# copies ziya artifacts to public app directory
def copy_artifacts
%w[charts gauges maps].each do |s|
if options.send( s )
dest_dir = File.join( options.public_dir )
src_dir = File.expand_path( File.join( File.dirname(__FILE__), %w[.. resources], s ) )
- puts "Installing ZiYa artifacts in `#{dest_dir}"
- FileUtils.cp_r( src_dir, dest_dir )
+ puts "Installing ZiYa `#{s} artifacts in `#{dest_dir}"
+ ::FileUtils.cp_r( src_dir, dest_dir )
end
end
end
# access the options
def options #:nodoc:
- if not @options then
+ unless @options
@options = OpenStruct.new
# Unless specified copy artifacts to the public directory
- @options.public_dir = File.join( Dir.pwd, %w[public] )
+ @options.public_dir = ::File.join( Dir.pwd, %w[public] )
@options.charts = false
@options.gauges = false
@options.maps = false
end
- return @options
+ @options
end
# sets up cmd line args
def default_option_parser #:nodoc:
- OptionParser.new do |op|
+ ::OptionParser.new do |op|
op.separator ""
op.separator "ziyafy options:"
op.on( "-c", "--charts", "Copy ZiYa charts artifacts only" ) do |dir|
options.charts = true
\ No newline at end of file