From 21388f21039cfe36737e1bfc2d91063fc998ec48 Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Wed, 21 Dec 2011 11:11:38 -0800 Subject: [PATCH] test 3rd party commands --- CHANGELOG.md | 1 + features/3rd_party_cli.feature | 5 +++++ fixtures/3rd-party-command/config.rb | 10 ++++++++++ 3 files changed, 16 insertions(+) create mode 100644 features/3rd_party_cli.feature create mode 100644 fixtures/3rd-party-command/config.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index cf8622b4..8d3acf5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ * Update to Redcarpet for Markdown (breaks Haml :markdown filter) * Return correct exit codes (0 for success, 1 for failure) from CLI * Yard code docs: http://rubydoc.info/github/tdreyno/middleman +* config.rb and extensions can add command-line commands 2.0.14 ==== diff --git a/features/3rd_party_cli.feature b/features/3rd_party_cli.feature new file mode 100644 index 00000000..297040b5 --- /dev/null +++ b/features/3rd_party_cli.feature @@ -0,0 +1,5 @@ +Feature: Allow config.rb and extensions to add CLI commands + Scenario: Test 3rd Party Command + Given a fixture app "3rd-party-command" + When I run `middleman hello` + Then the output should contain "Hello World" \ No newline at end of file diff --git a/fixtures/3rd-party-command/config.rb b/fixtures/3rd-party-command/config.rb new file mode 100644 index 00000000..edc0d327 --- /dev/null +++ b/fixtures/3rd-party-command/config.rb @@ -0,0 +1,10 @@ +class HelloWorld < Thor + default_task :say_hi + + desc "hello", "Say hello" + def say_hi + puts "Hello World" + end +end + +Middleman::CLI::Base.register(HelloWorld, :hello, "hello", "Say hello") \ No newline at end of file