-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathRakefile
45 lines (38 loc) · 1 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
require 'jasmine'
require 'sprockets'
load 'jasmine/tasks/jasmine.rake'
# default
task :default => ["jasmine:ci"]
# settings
VERSION = "0.10.0"
ROOT = File.dirname(__FILE__)
SOURCE_DIR = "src"
BUILD_DIR = "lib"
SOURCE_JS = "application.js"
BUILD_JS = "neato-#{VERSION}.min.js"
# env
ENV['JASMINE_CONFIG_PATH'] = File.join(ROOT, "jasmine.yml")
# tasks
desc "Build library"
task :build do
# init environment
environment = Sprockets::Environment.new(ROOT)
environment.js_compressor = :uglify
environment.append_path SOURCE_DIR
# get asset content
asset = environment.find_asset(SOURCE_JS)
javascript_content = asset.to_s
# add copyright notice
javascript_content = %Q(/**
* Neato SDK Javascript
* https://github.com/NeatoRobotics/neato-sdk-js
*
* Copyright (c)2016 Neato Robotics, Inc.
* Author: Roberto Ostinelli
*
* Version: #{VERSION}
*/
) + javascript_content + "\n"
# write to file
File.open(File.join(ROOT, BUILD_DIR, BUILD_JS), 'w') { |file| file.write(javascript_content) }
end