Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # For evergreen nested directory support
- # 1. Create a /config/evergreen.rb file and put these contents in it
- module Evergreen
- class Suite
- def specs
- Dir.glob(File.join(root, Evergreen.spec_dir, '**', '*_spec.{js,coffee,js.coffee}')).map do |path|
- Spec.new(self, path.gsub(File.join(root), ''))
- end
- end
- def templates
- Dir.glob(File.join(root, Evergreen.template_dir, '**', '*')).map do |path|
- Template.new(self, path.gsub(File.join(root), '')) unless File.directory?(path)
- end.compact
- end
- end
- end
- module Evergreen
- class Spec
- def initialize(suite, name)
- @suite = suite
- @name = name
- @name = "#{Evergreen.spec_dir}/#{name}" if !exist?
- end
- def name
- @name.gsub("/#{Evergreen.spec_dir}/", '')
- end
- def read
- require 'coffee-script'
- if full_path =~ /\.coffee$/
- CoffeeScript.compile File.read(full_path), :bare => true
- else
- File.read(full_path)
- end
- end
- end
- end
- module Evergreen
- class Template
- def name
- @name.gsub("/#{Evergreen.template_dir}/", '')
- end
- def full_path
- File.join(root, @name)
- end
- end
- end
Add Comment
Please, Sign In to add comment