Sha256: aa6ad7e61ff3a423c13b9b28614f3ea44703891bd63914d6e57c2b7942d107d2
Contents?: true
Size: 1.42 KB
Versions: 2
Compression:
Stored size: 1.42 KB
Contents
# # To be refactored... # module Assetify LINE = CLI.new class << self # # Text Interface # def check_param params, string unless string.include? params[0] puts "Did you mean #{string}?" exit 0 end end # Fuzzy find files def find_assets(params = nil) return Asset.all unless params Asset.filter params end # # CLI Master case/switch! # # Destructive: # i -> install # u -> update # x -> clean ? todo # # Safe: # c -> check # w -> web # def work_on params case params.first when /^i/, nil check_param params, "install" if params[0] find_assets(params[1]).map(&:install!) when /^u/ check_param params, "update" find_assets(params[1]).map { |a| a.install! :force } when /^c/ check_param params, "check" find_assets(params[1]).map { |a| a.check! } when /^w/ check_param params, "web" GUI.boot! else puts "Dunno how to #{params.join}." end end # # Divider bar # def bar puts "-" * TSIZE end def work!(params) start = Time.now Assetfile.find print "Assetify - #{Asset.all.size} assets" print " | #{params[1..-1].join(' . ')}" if params[1] puts " |" bar work_on params bar puts "Done in #{Time.now - start}s" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
assetify-2.0.1 | lib/assetify/cli.rb |
assetify-2.0.0 | lib/assetify/cli.rb |