coyote 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +17 -2
- data/bin/coyote +1 -1
- data/coyote.gemspec +8 -2
- data/lib/coyote.rb +1 -1
- data/lib/coyote/config_reader.rb +4 -3
- data/lib/coyote/generator.rb +13 -12
- data/lib/coyote/notification.rb +41 -19
- data/lib/coyote/output.rb +10 -16
- data/test/javascript/application.js +1 -2
- metadata +77 -56
data/Rakefile
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'rubygems'
|
2
|
+
require 'rbconfig'
|
2
3
|
require 'rake'
|
3
4
|
require 'echoe'
|
4
5
|
|
@@ -12,6 +13,20 @@ Echoe.new(Coyote::APP_NAME.downcase, Coyote::VERSION) do |p|
|
|
12
13
|
p.author = "Imulus"
|
13
14
|
p.email = "developer@imulus.com"
|
14
15
|
p.ignore_pattern = ["tmp/*", "script/*", "test/*", "assets/*"]
|
15
|
-
|
16
|
-
|
16
|
+
|
17
|
+
dependencies = Array.new
|
18
|
+
dependencies << "term-ansicolor >=1.0.5"
|
19
|
+
target_os = Config::CONFIG['target_os']
|
20
|
+
|
21
|
+
if target_os =~ /darwin/i
|
22
|
+
dependencies << "rb-fsevent >=0.4.0"
|
23
|
+
dependencies << "rb-appscript >=0.6.1"
|
24
|
+
elsif target_os =~ /linux/i
|
25
|
+
dependencies << "rb-inotify >=0.8.4"
|
26
|
+
elsif target_os =~ /mswin|mingw/i
|
27
|
+
dependencies << "rb-fchange >=0.0.5"
|
28
|
+
end
|
29
|
+
|
30
|
+
p.development_dependencies = dependencies
|
31
|
+
p.runtime_dependencies = dependencies
|
17
32
|
end
|
data/bin/coyote
CHANGED
@@ -47,7 +47,7 @@ else
|
|
47
47
|
|
48
48
|
listener.on_change do |files|
|
49
49
|
if files.include?(Coyote::CONFIG_FILENAME)
|
50
|
-
|
50
|
+
Coyote::Notification.new "Config file changed. Reading it in.\n", "warning"
|
51
51
|
config_file_reader(true) #rebuild the sources of the config file
|
52
52
|
coyote_the_sources
|
53
53
|
else
|
data/coyote.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{coyote}
|
5
|
-
s.version = "0.3.
|
5
|
+
s.version = "0.3.2"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Imulus"]
|
9
|
-
s.date = %q{2011-05-
|
9
|
+
s.date = %q{2011-05-27}
|
10
10
|
s.default_executable = %q{coyote}
|
11
11
|
s.description = %q{An intelligent command-line tool for combining and compressing JavaScript files.}
|
12
12
|
s.email = %q{developer@imulus.com}
|
@@ -25,19 +25,25 @@ Gem::Specification.new do |s|
|
|
25
25
|
|
26
26
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
27
27
|
s.add_runtime_dependency(%q<term-ansicolor>, [">= 1.0.5"])
|
28
|
+
s.add_runtime_dependency(%q<rb-fsevent>, [">= 0.4.0"])
|
28
29
|
s.add_runtime_dependency(%q<rb-appscript>, [">= 0.6.1"])
|
29
30
|
s.add_development_dependency(%q<term-ansicolor>, [">= 1.0.5"])
|
31
|
+
s.add_development_dependency(%q<rb-fsevent>, [">= 0.4.0"])
|
30
32
|
s.add_development_dependency(%q<rb-appscript>, [">= 0.6.1"])
|
31
33
|
else
|
32
34
|
s.add_dependency(%q<term-ansicolor>, [">= 1.0.5"])
|
35
|
+
s.add_dependency(%q<rb-fsevent>, [">= 0.4.0"])
|
33
36
|
s.add_dependency(%q<rb-appscript>, [">= 0.6.1"])
|
34
37
|
s.add_dependency(%q<term-ansicolor>, [">= 1.0.5"])
|
38
|
+
s.add_dependency(%q<rb-fsevent>, [">= 0.4.0"])
|
35
39
|
s.add_dependency(%q<rb-appscript>, [">= 0.6.1"])
|
36
40
|
end
|
37
41
|
else
|
38
42
|
s.add_dependency(%q<term-ansicolor>, [">= 1.0.5"])
|
43
|
+
s.add_dependency(%q<rb-fsevent>, [">= 0.4.0"])
|
39
44
|
s.add_dependency(%q<rb-appscript>, [">= 0.6.1"])
|
40
45
|
s.add_dependency(%q<term-ansicolor>, [">= 1.0.5"])
|
46
|
+
s.add_dependency(%q<rb-fsevent>, [">= 0.4.0"])
|
41
47
|
s.add_dependency(%q<rb-appscript>, [">= 0.6.1"])
|
42
48
|
end
|
43
49
|
end
|
data/lib/coyote.rb
CHANGED
data/lib/coyote/config_reader.rb
CHANGED
@@ -68,15 +68,16 @@ module Coyote
|
|
68
68
|
if config.class == Hash && ! config.empty?
|
69
69
|
return config
|
70
70
|
else
|
71
|
-
|
71
|
+
|
72
|
+
Coyote::Notification.new "Coyote configuration exists but has not been defined yet. Configure it in #{Coyote::CONFIG_FILENAME}\n", "failure"
|
72
73
|
exit(0)
|
73
74
|
end
|
74
75
|
rescue ArgumentError => e
|
75
|
-
|
76
|
+
Coyote::Notification.new "Could not parse YAML: #{e.message}\n", "failure"
|
76
77
|
exit
|
77
78
|
end
|
78
79
|
else
|
79
|
-
|
80
|
+
Coyote::Notification.new "Could not find a Coyote configuration file in this directory. Use 'coyote generate' to create one.\n", "failure"
|
80
81
|
exit
|
81
82
|
end
|
82
83
|
end
|
data/lib/coyote/generator.rb
CHANGED
@@ -1,38 +1,39 @@
|
|
1
1
|
module Coyote
|
2
2
|
class Generator
|
3
|
-
|
3
|
+
|
4
4
|
attr_accessor :options, :files_found
|
5
|
-
|
5
|
+
|
6
6
|
def initialize(options)
|
7
7
|
@options = options
|
8
8
|
@files_found = []
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
def generate
|
12
12
|
discover_files
|
13
13
|
if config_exists? && ! options[:force]
|
14
|
-
|
14
|
+
Coyote::Notification.new "Coyote config already exists in this directory. Use --force to overwrite.\n", "failure"
|
15
15
|
elsif (!config_exists?) || (config_exists? && options[:force])
|
16
16
|
copy_config
|
17
17
|
end
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
def discover_files
|
21
21
|
js_files = File.join("**","*.js")
|
22
|
-
Dir.glob(js_files).each do |file|
|
22
|
+
Dir.glob(js_files).each do |file|
|
23
23
|
@files_found.push file
|
24
|
-
end
|
24
|
+
end
|
25
25
|
end
|
26
26
|
|
27
27
|
# check to see if coyote.yaml already exists in directory
|
28
28
|
def config_exists?
|
29
29
|
File.exists?(Coyote::CONFIG_FILENAME)
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
# copy sample coyote.yaml to directory
|
33
33
|
def copy_config
|
34
|
-
|
35
|
-
|
34
|
+
Coyote::Notification.new "\nGenerating Coyote\n"
|
35
|
+
Coyote::Notification.new "#{@files_found.length} JavaScript files discovered\n"
|
36
|
+
|
36
37
|
File.open("#{Coyote::CONFIG_PATH}/#{Coyote::CONFIG_FILENAME}") do |file|
|
37
38
|
output_file = File.open(Coyote::CONFIG_FILENAME, 'w+')
|
38
39
|
generated = file.read
|
@@ -41,8 +42,8 @@ module Coyote
|
|
41
42
|
end
|
42
43
|
output_file.write(generated)
|
43
44
|
end
|
44
|
-
|
45
|
-
Coyote::Notification.new "Coyote generated at #{Coyote::CONFIG_FILENAME}\n\n"
|
45
|
+
|
46
|
+
Coyote::Notification.new "Coyote generated at #{Coyote::CONFIG_FILENAME}\n\n", "success"
|
46
47
|
end
|
47
48
|
end
|
48
49
|
end
|
data/lib/coyote/notification.rb
CHANGED
@@ -1,40 +1,62 @@
|
|
1
|
-
require 'appscript'
|
2
|
-
|
3
1
|
module Coyote
|
4
2
|
class Notification
|
5
|
-
include Appscript
|
6
3
|
|
7
|
-
attr_accessor :growl, :application, :icon, :default_notifications, :notifications
|
4
|
+
attr_accessor :growl, :application, :icon, :default_notifications, :notifications, :type, :message
|
5
|
+
|
6
|
+
def initialize(message, type = "message")
|
7
|
+
@message = message
|
8
|
+
@type = type
|
9
|
+
|
10
|
+
console_notify
|
8
11
|
|
9
|
-
|
10
|
-
|
12
|
+
if Config::CONFIG['target_os'] =~ /darwin/i
|
13
|
+
require 'appscript'
|
14
|
+
@growl = Appscript.app("GrowlHelperApp");
|
11
15
|
|
12
|
-
|
13
|
-
|
14
|
-
|
16
|
+
if @growl.is_running?
|
17
|
+
growl_register
|
18
|
+
growl_notify
|
19
|
+
end
|
15
20
|
end
|
16
21
|
end
|
17
22
|
|
18
|
-
|
19
|
-
def
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
23
|
+
|
24
|
+
def console_notify
|
25
|
+
case @type
|
26
|
+
when "success"
|
27
|
+
print @message.green
|
28
|
+
when "warning"
|
29
|
+
print @message.yellow
|
30
|
+
when "failure"
|
31
|
+
print @message.red
|
32
|
+
else
|
33
|
+
print @message.white
|
34
|
+
end
|
25
35
|
end
|
26
36
|
|
37
|
+
|
27
38
|
# trigger a growl notification
|
28
|
-
|
39
|
+
def growl_notify
|
29
40
|
options = { :title => @application,
|
30
|
-
:description => message,
|
41
|
+
:description => @message.gsub(/[\n]+/, ""),
|
31
42
|
:application_name => @application,
|
32
43
|
:image_from_location => @icon,
|
33
44
|
:sticky => false,
|
34
45
|
:priority => 0,
|
35
46
|
:with_name => notifications.first }
|
36
|
-
@growl.notify options
|
47
|
+
@growl.notify options
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
# register Coyote as an application with Growl
|
52
|
+
def growl_register
|
53
|
+
@application = Coyote::APP_NAME
|
54
|
+
@icon = "#{Coyote::CONFIG_PATH}/#{Coyote::CONFIG_ICON}"
|
55
|
+
@default_notifications = ["Coyote Success"]
|
56
|
+
@notifications = ["Coyote Success", "Coyote Failure"]
|
57
|
+
@growl.register(:as_application => @application, :all_notifications => @notifications, :default_notifications => @default_notifications)
|
37
58
|
end
|
38
59
|
|
60
|
+
|
39
61
|
end
|
40
62
|
end
|
data/lib/coyote/output.rb
CHANGED
@@ -19,7 +19,7 @@ module Coyote
|
|
19
19
|
append(file)
|
20
20
|
end
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
# open file, add contents to output
|
24
24
|
def append(filename)
|
25
25
|
if File.exists?(filename) and ! @input_files.include?(filename)
|
@@ -31,21 +31,16 @@ module Coyote
|
|
31
31
|
end
|
32
32
|
print "+ Added #{filename}\n"
|
33
33
|
else
|
34
|
-
|
34
|
+
Coyote::Notification.new "! Error adding #{filename}\n", "failure"
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
38
|
# save output to file
|
39
39
|
def save
|
40
40
|
add_file_comments
|
41
|
-
|
42
41
|
compress if @compress
|
43
|
-
|
44
42
|
@output_file.write(@input)
|
45
|
-
|
46
|
-
|
47
|
-
Coyote::Notification.new "Successfully saved to #{@output_filename}"
|
48
|
-
|
43
|
+
Coyote::Notification.new "Successfully saved to #{@output_filename}\n\n", "success"
|
49
44
|
@output_file.close
|
50
45
|
end
|
51
46
|
|
@@ -60,20 +55,19 @@ module Coyote
|
|
60
55
|
|
61
56
|
# compress output
|
62
57
|
def compress
|
63
|
-
|
64
|
-
|
65
|
-
|
58
|
+
Coyote::Notification.new "Compiling #{@output_filename}...\n", "warning"
|
59
|
+
|
66
60
|
compiler = ClosureCompiler.new.compile(@input)
|
67
61
|
if compiler.success?
|
68
62
|
@input = compiler.compiled_code
|
69
63
|
add_file_comments
|
70
64
|
elsif compiler.file_too_big?
|
71
|
-
|
65
|
+
Coyote::Notification.new "Input code too big for API, creating uncompiled file\n", "failure"
|
72
66
|
elsif compiler.errors
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
end
|
67
|
+
Coyote::Notification.new "Google closure API failed to compile, creating uncompiled file\n", "failure"
|
68
|
+
Coyote::Notification.new "Errors: \n", "failure"
|
69
|
+
Coyote::Notification.new "#{compiler.errors.to_s}\n\n", "failure"
|
70
|
+
end
|
77
71
|
end
|
78
72
|
end
|
79
73
|
end
|
metadata
CHANGED
@@ -1,69 +1,90 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: coyote
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.2
|
4
5
|
prerelease:
|
5
|
-
version: 0.3.1
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Imulus
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
date: 2011-05-22 00:00:00 -06:00
|
12
|
+
date: 2011-05-27 00:00:00.000000000 -06:00
|
14
13
|
default_executable:
|
15
|
-
dependencies:
|
16
|
-
- !ruby/object:Gem::Dependency
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
17
16
|
name: term-ansicolor
|
18
|
-
|
19
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirement: &2152251500 !ruby/object:Gem::Requirement
|
20
18
|
none: false
|
21
|
-
requirements:
|
22
|
-
- -
|
23
|
-
- !ruby/object:Gem::Version
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
24
22
|
version: 1.0.5
|
25
23
|
type: :runtime
|
26
|
-
version_requirements: *id001
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rb-appscript
|
29
24
|
prerelease: false
|
30
|
-
|
25
|
+
version_requirements: *2152251500
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: rb-fsevent
|
28
|
+
requirement: &2152248100 !ruby/object:Gem::Requirement
|
31
29
|
none: false
|
32
|
-
requirements:
|
33
|
-
- -
|
34
|
-
- !ruby/object:Gem::Version
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.4.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *2152248100
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: rb-appscript
|
39
|
+
requirement: &2152241840 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
35
44
|
version: 0.6.1
|
36
45
|
type: :runtime
|
37
|
-
version_requirements: *id002
|
38
|
-
- !ruby/object:Gem::Dependency
|
39
|
-
name: term-ansicolor
|
40
46
|
prerelease: false
|
41
|
-
|
47
|
+
version_requirements: *2152241840
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: term-ansicolor
|
50
|
+
requirement: &2152231020 !ruby/object:Gem::Requirement
|
42
51
|
none: false
|
43
|
-
requirements:
|
44
|
-
- -
|
45
|
-
- !ruby/object:Gem::Version
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
46
55
|
version: 1.0.5
|
47
56
|
type: :development
|
48
|
-
version_requirements: *id003
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: rb-appscript
|
51
57
|
prerelease: false
|
52
|
-
|
58
|
+
version_requirements: *2152231020
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: rb-fsevent
|
61
|
+
requirement: &2152225520 !ruby/object:Gem::Requirement
|
53
62
|
none: false
|
54
|
-
requirements:
|
55
|
-
- -
|
56
|
-
- !ruby/object:Gem::Version
|
63
|
+
requirements:
|
64
|
+
- - ! '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 0.4.0
|
67
|
+
type: :development
|
68
|
+
prerelease: false
|
69
|
+
version_requirements: *2152225520
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rb-appscript
|
72
|
+
requirement: &2152220960 !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
57
77
|
version: 0.6.1
|
58
78
|
type: :development
|
59
|
-
|
60
|
-
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: *2152220960
|
81
|
+
description: An intelligent command-line tool for combining and compressing JavaScript
|
82
|
+
files.
|
61
83
|
email: developer@imulus.com
|
62
|
-
executables:
|
84
|
+
executables:
|
63
85
|
- coyote
|
64
86
|
extensions: []
|
65
|
-
|
66
|
-
extra_rdoc_files:
|
87
|
+
extra_rdoc_files:
|
67
88
|
- README.md
|
68
89
|
- bin/coyote
|
69
90
|
- lib/coyote.rb
|
@@ -77,7 +98,7 @@ extra_rdoc_files:
|
|
77
98
|
- lib/coyote/generator.rb
|
78
99
|
- lib/coyote/notification.rb
|
79
100
|
- lib/coyote/output.rb
|
80
|
-
files:
|
101
|
+
files:
|
81
102
|
- Manifest
|
82
103
|
- README.md
|
83
104
|
- Rakefile
|
@@ -107,35 +128,35 @@ files:
|
|
107
128
|
has_rdoc: true
|
108
129
|
homepage: http://github.com/imulus/coyote
|
109
130
|
licenses: []
|
110
|
-
|
111
131
|
post_install_message:
|
112
|
-
rdoc_options:
|
132
|
+
rdoc_options:
|
113
133
|
- --line-numbers
|
114
134
|
- --inline-source
|
115
135
|
- --title
|
116
136
|
- Coyote
|
117
137
|
- --main
|
118
138
|
- README.md
|
119
|
-
require_paths:
|
139
|
+
require_paths:
|
120
140
|
- lib
|
121
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
141
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
122
142
|
none: false
|
123
|
-
requirements:
|
124
|
-
- -
|
125
|
-
- !ruby/object:Gem::Version
|
126
|
-
version:
|
127
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - ! '>='
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0'
|
147
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
148
|
none: false
|
129
|
-
requirements:
|
130
|
-
- -
|
131
|
-
- !ruby/object:Gem::Version
|
132
|
-
version:
|
149
|
+
requirements:
|
150
|
+
- - ! '>='
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '1.2'
|
133
153
|
requirements: []
|
134
|
-
|
135
154
|
rubyforge_project: coyote
|
136
155
|
rubygems_version: 1.6.2
|
137
156
|
signing_key:
|
138
157
|
specification_version: 3
|
139
|
-
summary: Coyote selectively concatenates your JS files, combining them into a single
|
158
|
+
summary: Coyote selectively concatenates your JS files, combining them into a single
|
159
|
+
file with the option of running the output through the Google Closure Compiler.
|
160
|
+
Coyote automatically observes your directories and source files for changes and
|
161
|
+
will recompile and save on the fly for easy development.
|
140
162
|
test_files: []
|
141
|
-
|