Class: Mirrorworks
- Inherits:
-
Object
- Object
- Mirrorworks
- Defined in:
- lib/mirrorworks.rb
Instance Method Summary collapse
-
#initialize ⇒ Mirrorworks
constructor
A new instance of Mirrorworks.
- #run(args) ⇒ Object
Constructor Details
#initialize ⇒ Mirrorworks
Returns a new instance of Mirrorworks.
11 12 13 14 15 |
# File 'lib/mirrorworks.rb', line 11 def initialize @help_msg = '' = {} @conf = {} end |
Instance Method Details
#run(args) ⇒ Object
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/mirrorworks.rb', line 128 def run(args) begin OptionParser.new do |opts| opts. = 'Usage: mirrorworks [options] <command> [reflections]' opts.on('-V', '--version', 'print version and exit') {version} opts.on('-h', '--help', 'print help and exit') {help} opts.on('-x', '--hard', 'delete extra files on transfer') do |x| [:x] = x end @help_msg = opts.to_s end.parse! args help if args.empty? command = args.shift parse_config unless command == 'install' case command when 'push' push args when 'pull' pull args when 'status' status args when 'list' list args when 'install' install else raise "No command '#{command}'" end rescue Exception => e puts e. unless e.is_a? SystemExit end end |