From a68604a1f76827fb3b4b3fcbedd8a1eacc818005 Mon Sep 17 00:00:00 2001 From: bootstraponline <code@bootstraponline.com> Date: Mon, 4 Aug 2014 18:41:46 -0400 Subject: [PATCH] Fix delegators --- README.md | 2 +- lib/appium_thor/commands/commands.rb | 7 ++++--- lib/appium_thor/config.rb | 12 +++++++++++- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b049acd..b29655b 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ end --:|:-- gem_name | must be provided github_owner | `appium` -github_name | gem_name +github_name | `#{gem_name}` version_file | `lib/#{gem_name}/version.rb` docs_block | no docs are generated diff --git a/lib/appium_thor/commands/commands.rb b/lib/appium_thor/commands/commands.rb index 4da0a5a..543cfb4 100644 --- a/lib/appium_thor/commands/commands.rb +++ b/lib/appium_thor/commands/commands.rb @@ -2,9 +2,10 @@ class Default < Thor desc 'info', 'prints config info for this gem' def info - puts " gem_name: #{gem_name}\n" + - " github_name: #{github_name}\n" + - "version_file: #{version_file}" + puts " gem_name: #{gem_name}\n" + + " github_name: #{github_name}\n" + + " github_owner: #{github_owner}\n" + " version_file: #{version_file}" end desc 'bumpx', 'Bump the x version number, set y & z to zero, update the date.' diff --git a/lib/appium_thor/config.rb b/lib/appium_thor/config.rb index 7062ac2..85e20a2 100644 --- a/lib/appium_thor/config.rb +++ b/lib/appium_thor/config.rb @@ -26,7 +26,17 @@ def docs_block &block @docs_block = block end - %w[gem_name github_name github_owner version_file].each do |option| + # Returns all options as symbols. Required for defining delegators in init.rb + def options + string_options + [:docs_block] + end + + # the subset of options that operate on strings + def string_options + %w[gem_name github_name github_owner version_file].map(&:to_sym) + end + + string_options.each do |option| class_eval %Q( def #{option} string=nil return @#{option} if @#{option}