lib/cli.rb in exercism-0.0.16 vs lib/cli.rb in exercism-0.0.17
- old
+ new
@@ -1,5 +1,6 @@
+require 'rubygems' if RUBY_VERSION <= "1.8.7"
require 'thor'
class Exercism
class CLI < Thor
@@ -11,11 +12,11 @@
end
map "-v" => "version", "--version" => "version"
desc "demo", "Fetch first assignment for each language from exercism.io"
- method_option :host, aliases: '-h', default: 'http://exercism.io', desc: 'the url of the exercism application'
+ method_option :host, :aliases => '-h', :default => 'http://exercism.io', :desc => 'the url of the exercism application'
def demo
require 'exercism'
guest = Object.new
def guest.key
@@ -26,37 +27,37 @@
assignments = exercism.demo
report(assignments)
end
desc "fetch", "Fetch current assignment from exercism.io"
- method_option :host, aliases: '-h', default: 'http://exercism.io', desc: 'the url of the exercism application'
+ method_option :host, :aliases => '-h', :default => 'http://exercism.io', :desc => 'the url of the exercism application'
def fetch
require 'exercism'
assignments = api.fetch
report(assignments)
end
desc "peek", "Fetch upcoming assignment from exercism.io"
- method_option :host, aliases: '-h', default: 'http://exercism.io', desc: 'the url of the exercism application'
+ method_option :host, :aliases => '-h', :default => 'http://exercism.io', :desc => 'the url of the exercism application'
def peek
require 'exercism'
assignments = api.peek
report(assignments)
end
desc "submit FILE", "Submit code to exercism.io on your current assignment"
- method_option :host, aliases: '-h', default: 'http://exercism.io', desc: 'the url of the exercism application'
+ method_option :host, :aliases => '-h', :default => 'http://exercism.io', :desc => 'the url of the exercism application'
def submit(file)
require 'exercism'
path = File.join(FileUtils.pwd, file)
begin
response = Exercism::Api.new(options[:host], Exercism.user).submit(file)
puts "Your assignment has been submitted."
url = submission_url(response.body, options[:host])
- puts "For feedback on your submission visit #{url}."
+ puts "For feedback on your submission visit #{url}"
rescue Exception => e
puts "There was an issue with your submission."
puts e.message
end
end