Class: Calatrava::Kernel
- Inherits:
-
Object
- Object
- Calatrava::Kernel
- Includes:
- Rake::DSL
- Defined in:
- lib/calatrava/kernel.rb
Instance Method Summary collapse
- #coffee_files ⇒ Object
- #coffee_path ⇒ Object
- #features ⇒ Object
-
#initialize(root) ⇒ Kernel
constructor
A new instance of Kernel.
- #install_tasks ⇒ Object
- #node_path_for_features ⇒ Object
- #prepare_for_features ⇒ Object
Constructor Details
Instance Method Details
#coffee_files ⇒ Object
23 24 25 26 27 |
# File 'lib/calatrava/kernel.rb', line 23 def coffee_files Dir.chdir @path do Dir["kernel/app/*.coffee"] + Dir["kernel/plugins/*.coffee"] end end |
#coffee_path ⇒ Object
29 30 31 |
# File 'lib/calatrava/kernel.rb', line 29 def coffee_path (['app', 'app/plugins'] + features.collect { |m| "app/#{m[:name]}" }).join(':') end |
#features ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/calatrava/kernel.rb', line 12 def features Dir.chdir @path do Dir['kernel/app/*'].select { |n| File.directory? n }.collect do |n| { :name => File.basename(n), :coffee => Dir["#{n}/*.coffee"] } end end end |
#install_tasks ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/calatrava/kernel.rb', line 42 def install_tasks file '.node_updated' => 'package.json' do sh "npm install && touch .node_updated" end desc "Run jasmine test. If specs not given in argument, runs all test" task :spec => '.node_updated' do |t, args| cd "kernel" do ENV['NODE_PATH'] = "app:#{coffee_path}:spec:../assets/lib" sh "../node_modules/jasmine-node/bin/jasmine-node --coffee --test-dir spec" end end desc "Run cucumber.js features for kernel" task :features, [:file] => '.node_updated' do |t, args| prepare_for_features cd "kernel" do ENV['NODE_PATH'] = node_path_for_features features_to_be_run = args[:file] ? "#{kernel/features}/#{args[:file]}" : "features" sh "../node_modules/cucumber/bin/cucumber.js --tags @all,@kernel --tags ~@wip '#{features_to_be_run}'" end end namespace :features do task :wip => '.node_updated' do prepare_for_features cd "kernel" do ENV['NODE_PATH'] = node_path_for_features sh "../node_modules/cucumber/bin/cucumber.js --tags @wip --tags @kernel features" end end end end |
#node_path_for_features ⇒ Object
38 39 40 |
# File 'lib/calatrava/kernel.rb', line 38 def node_path_for_features "#{coffee_path}:features/support:../assets/lib:features/step_definitions:../features/testdata" end |
#prepare_for_features ⇒ Object
33 34 35 36 |
# File 'lib/calatrava/kernel.rb', line 33 def prepare_for_features sh "ln -sFfh kernel/features/step_definitions/ features/step_definitions" sh "ln -sFfh kernel/features/support/ features/support" end |