coyote 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -2
- data/bin/coyote +0 -1
- data/config/coyote.yaml +21 -16
- data/coyote.gemspec +3 -3
- data/lib/coyote.rb +1 -1
- data/lib/coyote/builder.rb +21 -12
- data/lib/coyote/output.rb +11 -6
- metadata +3 -3
data/Rakefile
CHANGED
@@ -2,8 +2,8 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('coyote', '0.2.
|
6
|
-
p.description = "A command-line tool for combining and compressing JS files"
|
5
|
+
Echoe.new('coyote', '0.2.4') do |p|
|
6
|
+
p.description = "A flexible command-line tool for combining and compressing JS files"
|
7
7
|
p.summary = "Coyote is a command-line tool for combining and compressing JS files. It uses YAML for configuration and the Google Closure Compiler to compilation and compression."
|
8
8
|
p.url = "http://github.com/caseyohara/coyote"
|
9
9
|
p.author = "Casey O'Hara"
|
data/bin/coyote
CHANGED
data/config/coyote.yaml
CHANGED
@@ -1,17 +1,22 @@
|
|
1
|
-
# Example
|
1
|
+
# Example usages:
|
2
2
|
|
3
|
-
#
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
#
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
3
|
+
# Explicitly defining individual files to join
|
4
|
+
application:
|
5
|
+
compress: true
|
6
|
+
output: application.js
|
7
|
+
input:
|
8
|
+
- application/Application.Data.js
|
9
|
+
- application/Application.Controller.js
|
10
|
+
- application/Application.Interface.js
|
11
|
+
|
12
|
+
# Recursively searching and adding
|
13
|
+
application_classes:
|
14
|
+
compress: false
|
15
|
+
output: application.classes.js
|
16
|
+
input: application/**/*.class.js
|
17
|
+
|
18
|
+
# Adding by extension
|
19
|
+
jquery:
|
20
|
+
compress: true
|
21
|
+
output: jquery.plugins.js
|
22
|
+
input: jquery/plugins/*.js
|
data/coyote.gemspec
CHANGED
@@ -2,13 +2,13 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{coyote}
|
5
|
-
s.version = "0.2.
|
5
|
+
s.version = "0.2.4"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Casey O'Hara"]
|
9
|
-
s.date = %q{2011-
|
9
|
+
s.date = %q{2011-05-02}
|
10
10
|
s.default_executable = %q{coyote}
|
11
|
-
s.description = %q{A command-line tool for combining and compressing JS files}
|
11
|
+
s.description = %q{A flexible command-line tool for combining and compressing JS files}
|
12
12
|
s.email = %q{casey.ohara@imulus.com}
|
13
13
|
s.executables = ["coyote"]
|
14
14
|
s.extra_rdoc_files = ["bin/coyote", "lib/coyote.rb", "lib/coyote/builder.rb", "lib/coyote/generator.rb", "lib/coyote/output.rb"]
|
data/lib/coyote.rb
CHANGED
data/lib/coyote/builder.rb
CHANGED
@@ -5,21 +5,29 @@ module Coyote
|
|
5
5
|
|
6
6
|
def initialize(options)
|
7
7
|
@options = options
|
8
|
-
@config =
|
8
|
+
@config = get_config_or_screw_off
|
9
9
|
end
|
10
10
|
|
11
11
|
def build
|
12
|
-
if
|
13
|
-
@config.each do |
|
14
|
-
|
15
|
-
output_filename =
|
12
|
+
if config_defined?
|
13
|
+
@config.each do |key,value|
|
14
|
+
input = value['input']
|
15
|
+
output_filename = value['output']
|
16
16
|
output = Coyote::Output.new output_filename
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
if input.class == Array
|
19
|
+
input.each do |input|
|
20
|
+
Dir.glob(input).each do |file|
|
21
|
+
output.append file
|
22
|
+
end
|
23
|
+
end
|
24
|
+
elsif input.class == String
|
25
|
+
Dir.glob(input).each do |file|
|
26
|
+
output.append file
|
27
|
+
end
|
20
28
|
end
|
21
29
|
|
22
|
-
if
|
30
|
+
if value['compress'] || @options[:compress]
|
23
31
|
output.compress
|
24
32
|
end
|
25
33
|
|
@@ -31,12 +39,13 @@ module Coyote
|
|
31
39
|
end
|
32
40
|
|
33
41
|
|
34
|
-
def
|
42
|
+
def get_config_or_screw_off
|
35
43
|
if File.exists?(Coyote::CONFIG_FILENAME)
|
36
|
-
|
37
|
-
YAML.load(File.open(Coyote::CONFIG_FILENAME))
|
44
|
+
begin
|
45
|
+
return YAML.load(File.open(Coyote::CONFIG_FILENAME))
|
38
46
|
rescue ArgumentError => e
|
39
47
|
print "Could not parse YAML: #{e.message}\n".red
|
48
|
+
return false
|
40
49
|
end
|
41
50
|
else
|
42
51
|
print "Could not find a Coyote configuration file in this directory. Use 'coyote generate' to create one.\n".red
|
@@ -45,7 +54,7 @@ module Coyote
|
|
45
54
|
end
|
46
55
|
|
47
56
|
def config_defined?
|
48
|
-
@config.class == Hash && ! @config.empty?
|
57
|
+
@config && @config.class == Hash && ! @config.empty?
|
49
58
|
end
|
50
59
|
end
|
51
60
|
end
|
data/lib/coyote/output.rb
CHANGED
@@ -13,13 +13,17 @@ module Coyote
|
|
13
13
|
|
14
14
|
# open file, add contents to output
|
15
15
|
def append(filename)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
if File.exists?(filename)
|
17
|
+
@input_files.push(filename)
|
18
|
+
File.open(filename, 'r') do |file|
|
19
|
+
@input += "/***** #{filename} *****/\n"
|
20
|
+
@input += file.read
|
21
|
+
@input += "\n\n\n"
|
22
|
+
end
|
23
|
+
print "+ Added #{filename}\n"
|
24
|
+
else
|
25
|
+
print "! Error adding #{filename}\n"
|
21
26
|
end
|
22
|
-
print "+ Added #{filename}\n"
|
23
27
|
end
|
24
28
|
|
25
29
|
# save output to file
|
@@ -27,6 +31,7 @@ module Coyote
|
|
27
31
|
add_file_comments
|
28
32
|
@output_file.write(@input)
|
29
33
|
print "Saved to #{@output_filename} \n\n".green
|
34
|
+
@output_file.close
|
30
35
|
end
|
31
36
|
|
32
37
|
def add_file_comments
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: coyote
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.2.
|
5
|
+
version: 0.2.4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Casey O'Hara
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-05-02 00:00:00 -06:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -57,7 +57,7 @@ dependencies:
|
|
57
57
|
version: 1.0.5
|
58
58
|
type: :development
|
59
59
|
version_requirements: *id004
|
60
|
-
description: A command-line tool for combining and compressing JS files
|
60
|
+
description: A flexible command-line tool for combining and compressing JS files
|
61
61
|
email: casey.ohara@imulus.com
|
62
62
|
executables:
|
63
63
|
- coyote
|