Sha256: 11c59de8991f549ca4a6c39dff78fabd20df7c226a9382e84a8cc800ea410c35
Contents?: true
Size: 1.69 KB
Versions: 1
Compression:
Stored size: 1.69 KB
Contents
#!/usr/bin/env ruby # encoding: utf-8 # follow symlink base = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__ libdir = File.expand_path(File.join(File.dirname(base), "..", "lib")) # because of system installation, there is bin/../lib, but not bin/../lib/pupu if File.directory?(File.join(libdir, "pupu")) $:.unshift(libdir) unless $:.include?(libdir) end require "pupu/cli" # helpers def usage <<-HELP === Usage === pupu install [pupu] pupu uninstall [pupu] pupu update [pupu|all] pupu list pupu check pupu search [pattern] pupu create [name] --media-root=media HELP end # main loop begin case ARGV.shift when "install" Pupu::CLI.new(ARGV).install when "uninstall", "remove" Pupu::CLI.new(ARGV).uninstall when "update" Pupu::CLI.new(ARGV).update when "list" # list all pupus Pupu::CLI.new(ARGV).list when "check" # check setup & if you are in the right directory Pupu::CLI.new(ARGV).check || abort("File config/pupu.rb doesn't exist or can't be loaded") when "search" Pupu::CLI.new(ARGV).search(ARGV.first) when "create" begin require "simple-templater" rescue LoadError abort "You have to install simple-templater first!" end path = File.expand_path(File.join(File.dirname(base), "..", "stubs", "pupu")) generator = SimpleTemplater::GeneratorSet.new(:pupu, path) begin generator.run(ARGV) rescue SimpleTemplater::TargetAlreadyExist => exception abort exception.message rescue Interrupt exit rescue Exception => exception abort "Exception #{exception.inspect} occured during running generator #{generator.inspect}\n#{exception.backtrace.join("\n")}" end else abort usage end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pupu-0.0.4.pre | bin/pupu |