coyote 1.0.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest CHANGED
@@ -6,6 +6,7 @@ lib/coyote.rb
6
6
  lib/coyote/asset.rb
7
7
  lib/coyote/assets/coffeescript.rb
8
8
  lib/coyote/assets/javascript.rb
9
+ lib/coyote/assets/less.rb
9
10
  lib/coyote/bundle.rb
10
11
  lib/coyote/cli.rb
11
12
  lib/coyote/closure_compiler.rb
data/Rakefile CHANGED
@@ -8,15 +8,15 @@ require 'coyote'
8
8
 
9
9
  Echoe.new('coyote', Coyote::VERSION) do |p|
10
10
  p.description = "An intelligent command-line tool for combining, compressing and compiling your JavaScript and CoffeeScript files."
11
- p.summary = "Coyote selectively concatenates your files, combining them into a single file with the option of running the output through the Google Closure Compiler before save. It can be used to observe your source files for changes and will recompile and save on the fly for easy development."
11
+ p.summary = "Coyote selectively concatenates your files, combining them into a single file with the option of running the output through the Google Closure Compiler before save. It can be used to observe your source files for changes and will recompile and save on the fly for easy development."
12
12
  p.url = "http://github.com/imulus/coyote"
13
13
  p.author = "Imulus"
14
14
  p.email = "developer@imulus.com"
15
15
  p.ignore_pattern = ["tmp/*", "test/*"]
16
-
16
+
17
17
  dependencies = Array.new
18
18
  target_os = Config::CONFIG['target_os']
19
-
19
+
20
20
  if target_os =~ /darwin/i
21
21
  dependencies << "rb-fsevent >=0.4.0"
22
22
  dependencies << "term-ansicolor >=1.0.5"
@@ -25,13 +25,13 @@ Echoe.new('coyote', Coyote::VERSION) do |p|
25
25
  elsif target_os =~ /mswin|mingw/i
26
26
  dependencies << "rb-fchange >=0.0.5"
27
27
  end
28
-
28
+
29
29
  p.development_dependencies = dependencies
30
- p.runtime_dependencies = dependencies
30
+ p.runtime_dependencies = dependencies
31
31
  end
32
32
 
33
33
  task :build do
34
34
  `rake manifest`
35
35
  `rake build_gemspec`
36
36
  `gem build coyote.gemspec`
37
- end
37
+ end
data/bin/coyote CHANGED
@@ -2,4 +2,4 @@
2
2
 
3
3
  $: << File.expand_path(File.dirname(__FILE__) + "/../lib")
4
4
  require 'rubygems'
5
- require 'coyote/cli'
5
+ require 'coyote/cli'
@@ -2,21 +2,21 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "coyote"
5
- s.version = "1.0.3"
5
+ s.version = "1.1.0"
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 = "2012-02-16"
9
+ s.date = "2012-03-19"
10
10
  s.description = "An intelligent command-line tool for combining, compressing and compiling your JavaScript and CoffeeScript files."
11
11
  s.email = "developer@imulus.com"
12
12
  s.executables = ["coyote"]
13
- s.extra_rdoc_files = ["README.md", "bin/coyote", "lib/coyote.rb", "lib/coyote/asset.rb", "lib/coyote/assets/coffeescript.rb", "lib/coyote/assets/javascript.rb", "lib/coyote/bundle.rb", "lib/coyote/cli.rb", "lib/coyote/closure_compiler.rb", "lib/coyote/fs_listener.rb", "lib/coyote/fs_listeners/darwin.rb", "lib/coyote/fs_listeners/linux.rb", "lib/coyote/fs_listeners/polling.rb", "lib/coyote/fs_listeners/windows.rb", "lib/coyote/notifications.rb", "lib/coyote/rake.rb"]
14
- s.files = ["README.md", "Rakefile", "bin/coyote", "coyote.gemspec", "lib/coyote.rb", "lib/coyote/asset.rb", "lib/coyote/assets/coffeescript.rb", "lib/coyote/assets/javascript.rb", "lib/coyote/bundle.rb", "lib/coyote/cli.rb", "lib/coyote/closure_compiler.rb", "lib/coyote/fs_listener.rb", "lib/coyote/fs_listeners/darwin.rb", "lib/coyote/fs_listeners/linux.rb", "lib/coyote/fs_listeners/polling.rb", "lib/coyote/fs_listeners/windows.rb", "lib/coyote/notifications.rb", "lib/coyote/rake.rb", "test/scripts/input1.js", "test/scripts/input2.js", "test/scripts/input3.js", "test/scripts/input4.js", "test/scripts/lib/input5.coffee", "test/scripts/lib/input6.js", "test/scripts/lib/keystone/input7.js", "test/scripts/vendor/input8.coffee", "Manifest"]
13
+ s.extra_rdoc_files = ["README.md", "bin/coyote", "lib/coyote.rb", "lib/coyote/asset.rb", "lib/coyote/assets/coffeescript.rb", "lib/coyote/assets/javascript.rb", "lib/coyote/assets/less.rb", "lib/coyote/bundle.rb", "lib/coyote/cli.rb", "lib/coyote/closure_compiler.rb", "lib/coyote/fs_listener.rb", "lib/coyote/fs_listeners/darwin.rb", "lib/coyote/fs_listeners/linux.rb", "lib/coyote/fs_listeners/polling.rb", "lib/coyote/fs_listeners/windows.rb", "lib/coyote/notifications.rb", "lib/coyote/rake.rb"]
14
+ s.files = ["README.md", "Rakefile", "bin/coyote", "coyote.gemspec", "lib/coyote.rb", "lib/coyote/asset.rb", "lib/coyote/assets/coffeescript.rb", "lib/coyote/assets/javascript.rb", "lib/coyote/assets/less.rb", "lib/coyote/bundle.rb", "lib/coyote/cli.rb", "lib/coyote/closure_compiler.rb", "lib/coyote/fs_listener.rb", "lib/coyote/fs_listeners/darwin.rb", "lib/coyote/fs_listeners/linux.rb", "lib/coyote/fs_listeners/polling.rb", "lib/coyote/fs_listeners/windows.rb", "lib/coyote/notifications.rb", "lib/coyote/rake.rb", "test/scripts/input1.js", "test/scripts/input2.js", "test/scripts/input3.js", "test/scripts/input4.js", "test/scripts/lib/input5.coffee", "test/scripts/lib/input6.js", "test/scripts/lib/keystone/input7.js", "test/scripts/vendor/input8.coffee", "Manifest"]
15
15
  s.homepage = "http://github.com/imulus/coyote"
16
16
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Coyote", "--main", "README.md"]
17
17
  s.require_paths = ["lib"]
18
18
  s.rubyforge_project = "coyote"
19
- s.rubygems_version = "1.8.16"
19
+ s.rubygems_version = "1.8.17"
20
20
  s.summary = "Coyote selectively concatenates your files, combining them into a single file with the option of running the output through the Google Closure Compiler before save. It can be used to observe your source files for changes and will recompile and save on the fly for easy development."
21
21
 
22
22
  if s.respond_to? :specification_version then
@@ -6,9 +6,8 @@ require 'coyote/notifications'
6
6
  include Coyote::Notifications
7
7
 
8
8
  module Coyote
9
-
10
- VERSION = '1.0.3'
11
-
9
+ VERSION = '1.1.0'
10
+
12
11
  def self.run(input_path, output_path, options = {})
13
12
  @@input_path = input_path
14
13
  @@output_path = output_path
@@ -18,12 +17,10 @@ module Coyote
18
17
  watch if @@options[:watch]
19
18
  end
20
19
 
21
-
22
20
  def self.options
23
21
  ['compress', 'watch', 'quiet', 'version']
24
22
  end
25
23
 
26
-
27
24
  def self.build(&block)
28
25
  time = Benchmark.realtime do
29
26
  yield @@bundle unless block.nil?
@@ -32,10 +29,9 @@ module Coyote
32
29
  @@bundle.save
33
30
  end
34
31
 
35
- notify "#{Time.new.strftime("%I:%M:%S")} Saved bundle to #{@@output_path} [#{@@bundle.files.length} files in #{(time).round(5)}s]", :success
32
+ notify "#{Time.new.strftime("%I:%M:%S")} Saved bundle to #{@@output_path} [#{@@bundle.files.length} files in #{(time).round(5)}s]", :success
36
33
  end
37
34
 
38
-
39
35
  def self.watch
40
36
  listener = Coyote::FSListener.select_and_init
41
37
 
@@ -51,4 +47,4 @@ module Coyote
51
47
  notify "#{Time.new.strftime("%I:%M:%S")} Watching for changes to your bundle. CTRL+C to stop."
52
48
  listener.start
53
49
  end
54
- end
50
+ end
@@ -1,6 +1,7 @@
1
1
  module Coyote
2
2
  autoload :JavaScript, 'coyote/assets/javascript'
3
3
  autoload :CoffeeScript, 'coyote/assets/coffeescript'
4
+ autoload :Less, 'coyote/assets/less'
4
5
 
5
6
  class Asset
6
7
 
@@ -13,11 +14,11 @@ module Coyote
13
14
  case File.extname(path)
14
15
  when /\.js/i ; JavaScript.new(path)
15
16
  when /\.coffee/i ; CoffeeScript.new(path)
17
+ when /\.less/i ; Less.new(path)
16
18
  else ; self.new(path)
17
19
  end
18
20
  end
19
21
 
20
-
21
22
  def initialize(relative_path)
22
23
  @relative_path = File.expand_path(relative_path).gsub("#{Dir.pwd}/", '')
23
24
  @absolute_path = File.expand_path(@relative_path)
@@ -26,12 +27,11 @@ module Coyote
26
27
  update!
27
28
  end
28
29
 
29
-
30
30
  def update!
31
31
  @contents = File.exists?(@absolute_path) ? File.open(@absolute_path, 'r').read : ""
32
32
  find_dependencies
33
33
  end
34
-
34
+
35
35
  def dependencies_have_changed?
36
36
  @last_dependencies != @dependencies
37
37
  end
@@ -49,7 +49,5 @@ module Coyote
49
49
  matches = @contents.scan(require_pattern)
50
50
  @dependencies = matches.reverse.collect { |match| "#{@relative_directory}/#{match.last.strip}" }
51
51
  end
52
-
53
-
54
52
  end
55
53
  end
@@ -1,13 +1,10 @@
1
1
  module Coyote
2
- class CoffeeScript < Asset
3
-
4
-
2
+ class CoffeeScript < Asset
5
3
  def update!
6
4
  super
7
5
  compile!
8
6
  end
9
7
 
10
-
11
8
  protected
12
9
 
13
10
  # Defines the regex pattern for scanning the contents of the
@@ -16,14 +13,10 @@ module Coyote
16
13
  Regexp.new(/#=\s*require\s(.*)$/i) # '#= require a/b/c.coffee' => 'a/b/c.coffee'
17
14
  end
18
15
 
19
-
20
16
  private
21
17
 
22
18
  def compile!
23
19
  @contents = `cat #{@absolute_path} | coffee -sc`
24
20
  end
25
-
26
-
27
-
28
21
  end
29
22
  end
@@ -1,4 +1,4 @@
1
1
  module Coyote
2
- class JavaScript < Asset
2
+ class JavaScript < Asset
3
3
  end
4
4
  end
@@ -0,0 +1,22 @@
1
+ module Coyote
2
+ class Less < Asset
3
+ def update!
4
+ super
5
+ compile!
6
+ end
7
+
8
+ protected
9
+
10
+ # Defines the regex pattern for scanning the contents of the
11
+ # file to look for require directives
12
+ def require_pattern
13
+ Regexp.new(/\/\/=\s*require\s(.*)$/i) # '//= require a/b/c.less' => 'a/b/c.less'
14
+ end
15
+
16
+ private
17
+
18
+ def compile!
19
+ @contents = `lessc #{@absolute_path}`
20
+ end
21
+ end
22
+ end
@@ -53,22 +53,22 @@ module Coyote
53
53
  end
54
54
  end
55
55
 
56
-
56
+
57
57
  def refresh
58
58
  @contents = ""
59
- files(true).each { |path| @contents += "#{@assets[path].contents} \n\n" }
59
+ files(true).each { |path| @contents += "#{@assets[path].contents} \n\n" }
60
60
  end
61
61
 
62
62
 
63
63
  def build
64
64
  empty!
65
- add @entry_point
65
+ add @entry_point
66
66
  end
67
67
 
68
68
 
69
69
  def empty!
70
70
  @assets = {}
71
- @contents = ""
71
+ @contents = ""
72
72
  end
73
73
 
74
74
 
@@ -15,4 +15,4 @@ end
15
15
 
16
16
  input, output = ARGV[0].split(':', 2)
17
17
 
18
- Coyote::run(input, output, options)
18
+ Coyote::run(input, output, options)
@@ -5,7 +5,7 @@ module Coyote
5
5
  autoload :Linux, 'coyote/fs_listeners/linux'
6
6
  autoload :Windows, 'coyote/fs_listeners/windows'
7
7
  autoload :Polling, 'coyote/fs_listeners/polling'
8
-
8
+
9
9
  class FSListener
10
10
  attr_reader :last_event, :sha1_checksums_hash
11
11
 
@@ -73,4 +73,4 @@ module Coyote
73
73
  Config::CONFIG['target_os'] =~ /mswin|mingw/i
74
74
  end
75
75
  end
76
- end
76
+ end
@@ -6,7 +6,7 @@ module Coyote
6
6
 
7
7
  def self.notify(msg, type = "message")
8
8
  notify msg, type
9
- end
9
+ end
10
10
 
11
11
  def notify(msg, type = :message)
12
12
  msg = "#{msg}\n"
@@ -17,6 +17,6 @@ module Coyote
17
17
  else ; print msg.white
18
18
  end
19
19
  end
20
-
20
+
21
21
  end
22
- end
22
+ end
@@ -5,7 +5,7 @@ def coyote(task_name, *args, &block)
5
5
  args ||= []
6
6
 
7
7
  args.insert 0, task_name
8
-
8
+
9
9
  # Create an anonymous class with input, output and options accessors
10
10
  config = Struct.new(:input, :output, :options).new
11
11
 
@@ -14,14 +14,14 @@ def coyote(task_name, *args, &block)
14
14
 
15
15
  # Give them the config struct to configure in the block
16
16
  yield config
17
-
17
+
18
18
  # Make sure we've got an input
19
19
  if config.input.empty?
20
20
  notify "Coyote: Input filepath must be defined", :failure
21
21
  exit 0
22
22
  end
23
23
 
24
- # Make sure we've got an output
24
+ # Make sure we've got an output
25
25
  if config.output.empty?
26
26
  notify "Coyote: Output filepath must be defined", :failure
27
27
  exit 0
@@ -31,11 +31,11 @@ def coyote(task_name, *args, &block)
31
31
  if task_name == :watch
32
32
  config.options[:watch] = true
33
33
  end
34
-
34
+
35
35
  # Pass the runner along to Rake as a proc
36
- body = proc {
37
- Coyote::run(config.input, config.output, config.options)
36
+ body = proc {
37
+ Coyote::run(config.input, config.output, config.options)
38
38
  }
39
-
39
+
40
40
  Rake::Task.define_task(*args, &body)
41
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coyote
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-16 00:00:00.000000000Z
12
+ date: 2012-03-19 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rb-fsevent
16
- requirement: &2168553680 !ruby/object:Gem::Requirement
16
+ requirement: &2169230340 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.4.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2168553680
24
+ version_requirements: *2169230340
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: term-ansicolor
27
- requirement: &2168552860 !ruby/object:Gem::Requirement
27
+ requirement: &2169229860 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.0.5
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2168552860
35
+ version_requirements: *2169229860
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rb-fsevent
38
- requirement: &2168552160 !ruby/object:Gem::Requirement
38
+ requirement: &2169229380 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.4.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2168552160
46
+ version_requirements: *2169229380
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: term-ansicolor
49
- requirement: &2168551280 !ruby/object:Gem::Requirement
49
+ requirement: &2169228900 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: 1.0.5
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2168551280
57
+ version_requirements: *2169228900
58
58
  description: An intelligent command-line tool for combining, compressing and compiling
59
59
  your JavaScript and CoffeeScript files.
60
60
  email: developer@imulus.com
@@ -68,6 +68,7 @@ extra_rdoc_files:
68
68
  - lib/coyote/asset.rb
69
69
  - lib/coyote/assets/coffeescript.rb
70
70
  - lib/coyote/assets/javascript.rb
71
+ - lib/coyote/assets/less.rb
71
72
  - lib/coyote/bundle.rb
72
73
  - lib/coyote/cli.rb
73
74
  - lib/coyote/closure_compiler.rb
@@ -87,6 +88,7 @@ files:
87
88
  - lib/coyote/asset.rb
88
89
  - lib/coyote/assets/coffeescript.rb
89
90
  - lib/coyote/assets/javascript.rb
91
+ - lib/coyote/assets/less.rb
90
92
  - lib/coyote/bundle.rb
91
93
  - lib/coyote/cli.rb
92
94
  - lib/coyote/closure_compiler.rb
@@ -132,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
134
  version: '1.2'
133
135
  requirements: []
134
136
  rubyforge_project: coyote
135
- rubygems_version: 1.8.16
137
+ rubygems_version: 1.8.17
136
138
  signing_key:
137
139
  specification_version: 3
138
140
  summary: Coyote selectively concatenates your files, combining them into a single