Remove Gemfile, Rakefile, Guardfile.
Showing
4 changed files
with
0 additions
and
92 deletions
Gemfile
deleted
100644 → 0
Gemfile.lock
deleted
100644 → 0
1 | GEM | ||
2 | remote: http://rubygems.org/ | ||
3 | specs: | ||
4 | closure-compiler (1.1.6) | ||
5 | coffee-script (2.2.0) | ||
6 | coffee-script-source | ||
7 | execjs | ||
8 | coffee-script-source (1.3.3) | ||
9 | execjs (1.4.0) | ||
10 | multi_json (~> 1.0) | ||
11 | ffi (1.0.11) | ||
12 | guard (1.0.2) | ||
13 | ffi (>= 0.5.0) | ||
14 | thor (~> 0.14.6) | ||
15 | guard-coffeescript (0.6.0) | ||
16 | coffee-script (>= 2.2.0) | ||
17 | guard (>= 0.8.3) | ||
18 | multi_json (1.3.6) | ||
19 | thor (0.14.6) | ||
20 | |||
21 | PLATFORMS | ||
22 | ruby | ||
23 | |||
24 | DEPENDENCIES | ||
25 | closure-compiler | ||
26 | coffee-script | ||
27 | guard | ||
28 | guard-coffeescript |
Guardfile
deleted
100644 → 0
Rakefile
deleted
100644 → 0
1 | require 'rubygems' | ||
2 | |||
3 | BUILD_DIRECTORY = 'lib' | ||
4 | SRC_DIRECTORY = 'src' | ||
5 | |||
6 | desc "build the toast-min.js files for distribution" | ||
7 | task :default => :clean do | ||
8 | FileUtils.mkdir_p(BUILD_DIRECTORY) | ||
9 | compile_js | ||
10 | end | ||
11 | |||
12 | task :build => :default | ||
13 | |||
14 | desc "removes the build directory" | ||
15 | task :clean do | ||
16 | print_action('Removing existing build directory') do | ||
17 | FileUtils.rm_rf(BUILD_DIRECTORY) | ||
18 | end | ||
19 | end | ||
20 | |||
21 | def compile_js() | ||
22 | require 'coffee-script' | ||
23 | require 'closure-compiler' | ||
24 | |||
25 | source = File.read(File.join(SRC_DIRECTORY, 'rivets.coffee')) | ||
26 | FileUtils.mkdir_p(BUILD_DIRECTORY) | ||
27 | output = File.join(BUILD_DIRECTORY, 'rivets.js') | ||
28 | minified_output = File.join(BUILD_DIRECTORY, 'rivets-min.js') | ||
29 | |||
30 | compiled = '' | ||
31 | print_action("Compiling CoffeeScript to '#{output}'") do | ||
32 | File.open(output, 'w+') do |file| | ||
33 | compiled = CoffeeScript.compile(source) | ||
34 | file.write(compiled) | ||
35 | end | ||
36 | end | ||
37 | |||
38 | print_action("Minifying Javascript to '#{minified_output}'") do | ||
39 | File.open(minified_output, 'w+') do |file| | ||
40 | file.write(Closure::Compiler.new.compress(compiled)) | ||
41 | end | ||
42 | end | ||
43 | end | ||
44 | |||
45 | def print_action(action, &block) | ||
46 | print "#{action}... " | ||
47 | STDOUT.flush | ||
48 | |||
49 | if block.call() | ||
50 | puts 'done' | ||
51 | else | ||
52 | puts 'failed' | ||
53 | end | ||
54 | end |
-
Please register or sign in to post a comment