Class: MSpec::Opal::RakeTask
- Includes:
- Rake::DSL
- Defined in:
- opal/lib/mspec/opal/rake_task.rb
Instance Method Summary collapse
-
#initialize(name, &task_block) ⇒ RakeTask
constructor
A new instance of RakeTask.
Constructor Details
#initialize(name, &task_block) ⇒ RakeTask
Returns a new instance of RakeTask
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'opal/lib/mspec/opal/rake_task.rb', line 15 def initialize(name, &task_block) namespace name do desc 'Run MSpec::Opal code examples' unless ::Rake.application.last_comment task :default do puts 'Starting MSpec Runner...' runner = Runner.new(&task_block) runner.run end desc 'Build specs to build/specs.js and build/specs.min.js' task :build do require 'opal/util' path = './build/specs.js' min_path = './build/specs.min.js' Environment.new.build_specs(path) min = ::Opal::Util.uglify File.read(path) File.open(min_path, 'w') { |f| f << min_path } end end task name => "#{name}:default" end |