wiselinks 0.7.3 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,104 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'closure-compiler'
4
- require 'coffeelint'
5
-
6
- require 'wiselinks/version'
7
-
8
- module Wiselinks
9
- class Builder
10
- include Rake::DSL if defined? Rake::DSL
11
-
12
- class << self
13
- attr_accessor :instance
14
-
15
- def install
16
- self.new.install
17
- end
18
- end
19
-
20
-
21
- def install
22
- # desc "Build #{self.name}-#{self.version} CoffeeScript sources."
23
- # task 'build' do
24
- # Rake::Task["coffee:lint"].invoke
25
- # Rake::Task["coffee:build"].invoke
26
- # end
27
-
28
- namespace :coffee do
29
- desc "Run CoffeeLint over #{self.name}-#{self.version} sources."
30
- task 'lint' do
31
- Coffeelint.lint_dir(self.sources) do |filename, lint_report|
32
- Coffeelint.display_test_results(filename, lint_report)
33
- end
34
- end
35
-
36
- desc "Build #{self.name}-#{self.version} CoffeeScript sources."
37
- task 'build' do
38
- system("rm ./build/*")
39
-
40
- system("echo '#{self.declaration}' > ./build/#{self.name_with_version}.js")
41
- system("coffee -o ./build -j temp.js -c #{self.coffee_sources.join(' ')}")
42
- system("cat ./build/temp.js >> ./build/#{self.name_with_version}.js")
43
-
44
- self.js_sources.each do |file|
45
- system("cat #{file} >> ./build/#{self.name_with_version}.js")
46
- end
47
-
48
- # Minimize
49
- #
50
- system("java -jar ./compiler.jar --charset UTF-8 --js ./build/#{self.name_with_version}.js --js_output_file=./build/#{self.name_with_version}.min.js")
51
-
52
- # Gzip
53
- #
54
- system("gzip -c ./build/#{self.name_with_version}.min.js > ./build/#{self.name_with_version}.min.js.gz")
55
-
56
- system("rm ./build/temp.js")
57
- end
58
- end
59
-
60
- end
61
-
62
- protected
63
-
64
- def sources
65
- File.expand_path('../../assets/javascripts', __FILE__)
66
- end
67
-
68
- def js_sources
69
- Dir.glob(File.join(self.sources, "**/*.js"))
70
- end
71
-
72
- def coffee_sources
73
- Dir.glob(File.join(self.sources, "**/*.js.coffee"))
74
- end
75
-
76
- def version
77
- self.specification.version
78
- end
79
-
80
- def declaration
81
- <<-EOS
82
- /**
83
- * #{self.name.capitalize}-#{self.version}
84
- * @copyright 2012-#{Date.today.year} #{self.specification.authors.join(', ')}
85
- * @preserve https://github.com/igor-alexandrov/wiselinks
86
- */
87
- EOS
88
- end
89
-
90
- def name
91
- self.specification.name
92
- end
93
-
94
- def name_with_version
95
- [self.name, self.version].join('-')
96
- end
97
-
98
- def specification
99
- @specification ||= Gem.loaded_specs['wiselinks']
100
- end
101
- end
102
- end
103
-
104
- Wiselinks::Builder.install