diff --git a/README.markdown b/README.markdown index 264a180..f1210c0 100644 --- a/README.markdown +++ b/README.markdown @@ -1,36 +1,13 @@ -GemTemplate -=========== +Question +======== -A gem template for new projects. +Ask questions from Auto. -Requirements ------------- +Install +------- -
-sudo gem install stencil --source http://gemcutter.org -- -Setup the template ------------------- - -You only have to do this once. - -
-git clone git@github.com:winton/gem_template.git -cd gem_template -stencil -- -Setup a new project -------------------- - -Do this for every new project. +This plugin is automatically installed when you install the auto gem.
-mkdir my_project -git init -stencil gem_template -rake rename -- -The last command does a find-replace (gem\_template -> my\_project) on files and filenames. \ No newline at end of file +sudo gem install auto --source http://gemcutter.org + \ No newline at end of file diff --git a/bin/gem_template b/bin/gem_template deleted file mode 100644 index 2ab65da..0000000 --- a/bin/gem_template +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env ruby - -$:.push File.expand_path("#{File.dirname(__FILE__)}/../lib") -require 'gem_template' diff --git a/gemspec.rb b/gemspec.rb index 81dcfe2..ebeb210 100644 --- a/gemspec.rb +++ b/gemspec.rb @@ -1,12 +1,13 @@ -GEM_NAME = 'gem_template' +GEM_NAME = 'auto-question' GEM_FILES = FileList['**/*'] - FileList['coverage', 'coverage/**/*', 'pkg', 'pkg/**/*'] GEM_SPEC = Gem::Specification.new do |s| # == CONFIGURE == s.author = "Winton Welsh" s.email = "mail@wintoni.us" s.homepage = "http://github.com/winton/#{GEM_NAME}" - s.summary = "" + s.summary = "Ask questions from Auto" # == CONFIGURE == + s.add_dependency('auto', '=0.1.2') s.executables << GEM_NAME s.extra_rdoc_files = [ "README.markdown" ] s.files = GEM_FILES.to_a @@ -14,5 +15,5 @@ s.name = GEM_NAME s.platform = Gem::Platform::RUBY s.require_path = "lib" - s.version = "0.1.0" -end \ No newline at end of file + s.version = "0.0.1" +end diff --git a/lib/auto/question.rb b/lib/auto/question.rb new file mode 100644 index 0000000..eb0ac71 --- /dev/null +++ b/lib/auto/question.rb @@ -0,0 +1,70 @@ +module Auto + module Question + + def after_question(key=nil, value=nil, &block) + Questions.after_question(key, value, &block) + end + + def before_question(key=nil, value=nil, &block) + Questions.before_question(key, value, &block) + end + + def questions(hash={}, &block) + q = Questions + hash.each do |key, value| + q[key] = value + if before_question(key, value) + yield if block_given? + after_question(key, value) + end + end + q.questions + end + alias :question :questions + alias :q :questions + + class Questions + + cattr_accessor :questions + @@questions = {} + + class <