Skip to content

Commit

Permalink
Add test gems to extension and a gitignore. Closes #570
Browse files Browse the repository at this point in the history
  • Loading branch information
tdreyno committed Aug 21, 2012
1 parent f7fc041 commit 193f32b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 7 deletions.
1 change: 1 addition & 0 deletions middleman-core/features/cli_extension.feature
Expand Up @@ -11,3 +11,4 @@ Feature: Middleman New Extension CLI
| features/support/env.rb |
| lib/middleman_extension.rb |
| lib/my-extension-library.rb |
| .gitignore |
25 changes: 19 additions & 6 deletions middleman-core/lib/middleman-core/cli/extension.rb
Expand Up @@ -11,12 +11,19 @@ class Extension < Thor

# Required path for the new project to be generated
argument :name, :type => :string


# Template files are relative to this file
# @return [String]
def self.source_root
File.join(File.dirname(__FILE__), "..", "templates", "extension")
end

desc "extension [options]", "Create Middleman extension scaffold NAME"

# The extension task
# @param [String] name
def extension
generate_gitignore!
template "Rakefile", File.join(name, "Rakefile")
template "gemspec", File.join(name, "#{name}.gemspec")
template "Gemfile", File.join(name, "Gemfile")
Expand All @@ -26,11 +33,17 @@ def extension
empty_directory File.join(name, "fixtures")
end

# Template files are relative to this file
# @return [String]
def self.source_root
File.join(File.dirname(__FILE__), "..", "templates", "extension")
end
# Output a .gitignore file
class_option :git, :type => :boolean, :default => true

no_tasks {
# Write a .gitignore file for project
# @return [void]
def generate_gitignore!
return unless options[:git]
copy_file "gitignore", File.join(name, ".gitignore")
end
}

end
end
15 changes: 14 additions & 1 deletion middleman-core/lib/middleman-core/templates/extension/Gemfile
@@ -1,4 +1,17 @@
source :rubygems

# Specify your gem's dependencies in <%= name %>.gemspec
gemspec
gemspec

group :development do
gem "rake", "~> 0.9.2"
gem "rdoc", "~> 3.9"
gem "yard", "~> 0.8.0"
end

group :test do
gem "cucumber", "~> 1.2.0"
gem "fivemat"
gem "aruba", "~> 0.4.11"
gem "rspec", "~> 2.7"
end

2 comments on commit 193f32b

@tvaughan
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is missing the gitignore template, right? I ran middleman out of git and got this error message:

Could not find "gitignore" in any of your source paths. Your current source paths are: 
/home/tvaughan/.gem/ruby/1.9.1/gems/middleman-core-3.0.0/lib/middleman-core/cli/../templates/extension

@tdreyno
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git add fail

Please sign in to comment.