Sha256: 94a69da9a89b7c68351a0d5e6943f8a973305f64a39539e786aabbd46813036a
Contents?: true
Size: 1.08 KB
Versions: 3
Compression:
Stored size: 1.08 KB
Contents
#!/usr/bin/env ruby unless File.exist?(Dir.pwd + '/Gemfile') && /gem.*shopapp/.match?(File.read(Dir.pwd + '/Gemfile')) puts "You can only call shop macro from a shopapp root folder" return end deployment_targets = `rake shopapp:targets`.strip commands = %w(console rake tail bash run pulldb fetchdb restoredb help) if ARGV.count == 2 && ARGV[0] == 'help' && (commands.include? ARGV[1]) cmd = "rake shopapp:help cmd=#{ARGV[1]}" elsif ARGV.count <= 1 && ARGV[0] == 'restore' cmd = "rake shopapp:restore #{ARGV[1..-1].join ' '}" elsif ARGV.count < 2 || !(deployment_targets.split(', ').include? ARGV[0]) || !(commands.include? ARGV[1]) puts "Usage: shop [TARGET] COMMAND [parameters]" puts "Targets: #{deployment_targets}." puts "Commands: #{commands.join ', '}." puts "No target for restore and help, mandatory for all others." puts "For more info on specific command: shop help COMMAND." return else parameters = ARGV[2..-1].join ' ' parameters = %( "#{parameters}") if parameters.to_s.length > 0 cmd = "target=#{ARGV[0]} rake shopapp:#{ARGV[1]}#{parameters}" end exec cmd
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
shopapp-0.2.32 | bin/shop |
shopapp-0.2.31 | bin/shop |
shopapp-0.2.30 | bin/shop |