coyote 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest CHANGED
@@ -7,14 +7,15 @@ lib/coyote/asset.rb
7
7
  lib/coyote/assets/coffeescript.rb
8
8
  lib/coyote/assets/javascript.rb
9
9
  lib/coyote/bundle.rb
10
+ lib/coyote/cli.rb
10
11
  lib/coyote/closure_compiler.rb
11
- lib/coyote/configuration.rb
12
12
  lib/coyote/fs_listener.rb
13
13
  lib/coyote/fs_listeners/darwin.rb
14
14
  lib/coyote/fs_listeners/linux.rb
15
15
  lib/coyote/fs_listeners/polling.rb
16
16
  lib/coyote/fs_listeners/windows.rb
17
17
  lib/coyote/notifications.rb
18
+ lib/coyote/rake.rb
18
19
  test/scripts/input1.js
19
20
  test/scripts/input2.js
20
21
  test/scripts/input3.js
data/bin/coyote CHANGED
@@ -2,27 +2,4 @@
2
2
 
3
3
  $: << File.expand_path(File.dirname(__FILE__) + "/../lib")
4
4
  require 'rubygems'
5
- require 'fileutils'
6
- require 'optparse'
7
- require 'coyote'
8
-
9
-
10
- options = {}
11
- OptionParser.new do |opts|
12
- Coyote::options.each do |name|
13
- opts.on("-#{name[0]}", "--#{name}", "#{name.capitalize}") { |o| options[name.to_sym] = o }
14
- end
15
- end.parse!
16
-
17
- if options[:version]
18
- puts "coyote #{Coyote::VERSION}"
19
- exit 0
20
- end
21
-
22
- input, output = ARGV[0].split(':', 2)
23
-
24
- coyote :build do |config|
25
- config.input = input
26
- config.output = output
27
- config.options = options
28
- end
5
+ require 'coyote/cli'
data/coyote.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "coyote"
5
- s.version = "1.0.1"
5
+ s.version = "1.0.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"]
@@ -10,8 +10,8 @@ Gem::Specification.new do |s|
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/closure_compiler.rb", "lib/coyote/configuration.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"]
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/closure_compiler.rb", "lib/coyote/configuration.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", "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/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"]
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"]
data/lib/coyote.rb CHANGED
@@ -1,13 +1,12 @@
1
- require 'coyote/configuration'
1
+ require 'fileutils'
2
2
  require 'coyote/bundle'
3
3
  require 'coyote/fs_listener'
4
4
  require 'coyote/notifications'
5
5
  include Coyote::Notifications
6
6
 
7
-
8
7
  module Coyote
9
8
 
10
- VERSION = '1.0.1'
9
+ VERSION = '1.0.2'
11
10
 
12
11
  def self.run(input_path, output_path, options = {})
13
12
  @@input_path = input_path
data/lib/coyote/cli.rb ADDED
@@ -0,0 +1,18 @@
1
+ require 'coyote'
2
+ require 'optparse'
3
+
4
+ options = {}
5
+ OptionParser.new do |opts|
6
+ Coyote::options.each do |name|
7
+ opts.on("-#{name[0]}", "--#{name}", "#{name.capitalize}") { |o| options[name.to_sym] = o }
8
+ end
9
+ end.parse!
10
+
11
+ if options[:version]
12
+ puts "coyote #{Coyote::VERSION}"
13
+ exit 0
14
+ end
15
+
16
+ input, output = ARGV[0].split(':', 2)
17
+
18
+ Coyote::run(input, output, options)
@@ -0,0 +1,41 @@
1
+ require 'coyote'
2
+
3
+ def coyote(task_name, *args, &block)
4
+
5
+ args ||= []
6
+
7
+ args.insert 0, task_name
8
+
9
+ # Create an anonymous class with input, output and options accessors
10
+ config = Struct.new(:input, :output, :options).new
11
+
12
+ # Start off with options as an empty hash
13
+ config.options = {}
14
+
15
+ # Give them the config struct to configure in the block
16
+ yield config
17
+
18
+ # Make sure we've got an input
19
+ if config.input.empty?
20
+ notify "Coyote: Input filepath must be defined", :failure
21
+ exit 0
22
+ end
23
+
24
+ # Make sure we've got an output
25
+ if config.output.empty?
26
+ notify "Coyote: Output filepath must be defined", :failure
27
+ exit 0
28
+ end
29
+
30
+ # If they call the task 'watch', then let's set the watch option for them
31
+ if task_name == :watch
32
+ config.options[:watch] = true
33
+ end
34
+
35
+ # Pass the runner along to Rake as a proc
36
+ body = proc {
37
+ Coyote::run(config.input, config.output, config.options)
38
+ }
39
+
40
+ Rake::Task.define_task(*args, &body)
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.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-02-16 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rb-fsevent
16
- requirement: &2168527360 !ruby/object:Gem::Requirement
16
+ requirement: &2165621740 !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: *2168527360
24
+ version_requirements: *2165621740
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: term-ansicolor
27
- requirement: &2168524180 !ruby/object:Gem::Requirement
27
+ requirement: &2165621140 !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: *2168524180
35
+ version_requirements: *2165621140
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rb-fsevent
38
- requirement: &2168522140 !ruby/object:Gem::Requirement
38
+ requirement: &2165620600 !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: *2168522140
46
+ version_requirements: *2165620600
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: term-ansicolor
49
- requirement: &2168520400 !ruby/object:Gem::Requirement
49
+ requirement: &2165620040 !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: *2168520400
57
+ version_requirements: *2165620040
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
@@ -69,14 +69,15 @@ extra_rdoc_files:
69
69
  - lib/coyote/assets/coffeescript.rb
70
70
  - lib/coyote/assets/javascript.rb
71
71
  - lib/coyote/bundle.rb
72
+ - lib/coyote/cli.rb
72
73
  - lib/coyote/closure_compiler.rb
73
- - lib/coyote/configuration.rb
74
74
  - lib/coyote/fs_listener.rb
75
75
  - lib/coyote/fs_listeners/darwin.rb
76
76
  - lib/coyote/fs_listeners/linux.rb
77
77
  - lib/coyote/fs_listeners/polling.rb
78
78
  - lib/coyote/fs_listeners/windows.rb
79
79
  - lib/coyote/notifications.rb
80
+ - lib/coyote/rake.rb
80
81
  files:
81
82
  - README.md
82
83
  - Rakefile
@@ -87,14 +88,15 @@ files:
87
88
  - lib/coyote/assets/coffeescript.rb
88
89
  - lib/coyote/assets/javascript.rb
89
90
  - lib/coyote/bundle.rb
91
+ - lib/coyote/cli.rb
90
92
  - lib/coyote/closure_compiler.rb
91
- - lib/coyote/configuration.rb
92
93
  - lib/coyote/fs_listener.rb
93
94
  - lib/coyote/fs_listeners/darwin.rb
94
95
  - lib/coyote/fs_listeners/linux.rb
95
96
  - lib/coyote/fs_listeners/polling.rb
96
97
  - lib/coyote/fs_listeners/windows.rb
97
98
  - lib/coyote/notifications.rb
99
+ - lib/coyote/rake.rb
98
100
  - test/scripts/input1.js
99
101
  - test/scripts/input2.js
100
102
  - test/scripts/input3.js
@@ -1,31 +0,0 @@
1
- module Coyote
2
- class Configuration
3
- attr_accessor :input, :output, :options
4
-
5
- def initialize
6
- @input = ""; @output = ""; @options = {}
7
- end
8
- end
9
- end
10
-
11
-
12
- def coyote(method, &block)
13
- config = Coyote::Configuration.new
14
- yield config
15
-
16
- if config.input.empty?
17
- notify "Coyote: Input filepath must be defined", :failure
18
- exit 0
19
- end
20
-
21
- if config.output.empty?
22
- notify "Coyote: Output filepath must be defined", :failure
23
- exit 0
24
- end
25
-
26
- if method == :watch
27
- config.options[:watch] = true
28
- end
29
-
30
- Coyote::run config.input, config.output, config.options
31
- end