samples/helloworld/hello_world.rb in rubikon-0.4.1 vs samples/helloworld/hello_world.rb in rubikon-0.5.0

- old
+ new

@@ -13,15 +13,20 @@ end # A relatively simple Hello World application using Rubikon class HelloWorld < Rubikon::Application::Base + set :config_file, 'helloworld.ini' + set :config_format, :ini + # Greet the whole world per default flag :more option :name, [:who] option :names, -1 default 'Simple hello world' do + p config + debug 'Starting to greet the world...' if given? :name greet parameters[:name].who elsif given? :names names.args.each do |name| @@ -36,17 +41,18 @@ # Interactive mode # # Ask the user for his name and greet him command :interactive, 'Greet interactively' do name = input 'Please enter your name' - greet name + call :'__default', '--name', name end # Show a progress bar while iterating through a loop + flag :brackets command :progress, 'Display a progress bar' do put 'Watch my progress while I greet the world: ' x = 1000000 - progress_bar(:char => '+', :maximum => x, :size => 30) do |progress| + progress_bar(:char => '+', :maximum => x, :size => 30, :brackets => brackets.given?, :bracket_filler => '-') do |progress| x.times do progress.+ end end end