coffee_without_nodejs 0.8.0 → 0.9.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 26f6c700ba660e8d5a5fc4b655fbdfff56a1a083
4
- data.tar.gz: b99fe1e6622bbe6d58b1cb1a8fded9ceeb7ebd83
3
+ metadata.gz: a4794cbed13504ffea87a2ddec8912937fd22871
4
+ data.tar.gz: 811ac493e1f2a4462fbc46c306b1e993b68cbb57
5
5
  SHA512:
6
- metadata.gz: a61b43c32b9a82a1559ce818fac3f8ad811882607daa4503f3312a2b69c8933298e4ffb29383f3f470b085c1ae0570abd8e37e92088a1b80353ab19bf20183c3
7
- data.tar.gz: 80f2def31dc54856ffce7db941a226a95c4d9ecdffc7544f21d24abc7419cc3b7f400e4d46fca0e8a68b15621d5eb44cf76a197497801073c460ea6994798d43
6
+ metadata.gz: afb4b1202398cf7e36e17b0b8f39c254ffb7b6ee2cb3214e9a400120f4692c5d4ccae00288cd00790786f81e758cb5d451d523b559becb194b6eb05eefd1432a
7
+ data.tar.gz: cab1ab9ee74cd13831bcfb7e9d68ba7996a85daa067cfeeaba8dcd907482aa602e783d56148ffe24bcd05fd184dbafa2ec0d54a513a44c7e10a3ca59a841bded
data/README.md CHANGED
@@ -64,12 +64,10 @@ save literal js outout to file2.js
64
64
 
65
65
  Or ...
66
66
 
67
- `coff` command only support one argument `-e`.
67
+ You can run coffee script directly with: `-e` argments or pipe.
68
68
 
69
- $ coff -e 'x = 100'
70
- var x;
71
-
72
- x = 100;
69
+ ![File](http://zw963.github.io/snapshot15.png)
70
+ ![File](http://zw963.github.io/snapshot16.png)
73
71
 
74
72
  This gem is extract from [Alternative Script Suite](https://github.com/zw963/ass).
75
73
  You can found a lot of useful and interesting scripts here.
data/bin/coff CHANGED
@@ -4,25 +4,47 @@
4
4
  require 'coffee_without_nodejs'
5
5
  require 'coderay'
6
6
 
7
- if ARGV.first == '-e'
7
+ if File.pipe?($stdin)
8
+ content = CoffeeWithoutNodejs.compile($stdin.read).to_s
9
+ unless content.empty?
10
+ token = CodeRay.scan(content, :js)
11
+ print $stdout.tty? ? token.terminal : token.text
12
+ end
13
+ exit
14
+ end
15
+
16
+ if ARGV.empty?
17
+ `notify-send 'Starting coffee compiler.' -t 1000` if system 'which notify-send &>/dev/null'
18
+ CoffeeWithoutNodejs.watch!
19
+ exit
20
+ end
21
+
22
+ if ['-h', '--help'].include? ARGV.first
23
+ STDERR.puts 'coff -e "coffee script", to compile coffee to javascript.'
24
+ exit
25
+ end
26
+
27
+ if ['-e', '--eval'].include? ARGV.first
8
28
  ARGV.shift
9
29
  content = CoffeeWithoutNodejs.compile(ARGV.first).to_s
10
30
  print CodeRay.scan(content, :js).terminal unless content.empty?
11
- else
12
- if ARGV.empty?
13
- `notify-send 'Starting coffee compiler.' -t 1000` if system 'which notify-send &>/dev/null'
14
- CoffeeWithoutNodejs.watch!
15
- elsif test 'd', ARGV.first
16
- Dir.chdir(ARGV.first) { CoffeeWithoutNodejs.watch! }
17
- else
18
- ARGV.each do |file|
19
- fail "`#{file}' is not valid filename." unless File.exist? file
20
-
21
- content = CoffeeWithoutNodejs.compile(file).to_s
22
- unless content.empty?
23
- token = CodeRay.scan(content, :js)
24
- print $stdout.tty? ? token.terminal : token.text
25
- end
26
- end
31
+ exit
32
+ end
33
+
34
+ if test 'd', ARGV.first
35
+ Dir.chdir(ARGV.first) { CoffeeWithoutNodejs.watch! }
36
+ exit
37
+ end
38
+
39
+ ARGV.each do |file|
40
+ unless File.exist? file
41
+ puts "cannot open \`#{file}' for reading: No such file or directory, Skipping"
42
+ next
43
+ end
44
+
45
+ content = CoffeeWithoutNodejs.compile(file).to_s
46
+ unless content.empty?
47
+ token = CodeRay.scan(content, :js)
48
+ print $stdout.tty? ? token.terminal : token.text
27
49
  end
28
50
  end
@@ -2,7 +2,7 @@
2
2
  # -*- coding: utf-8 -*-
3
3
 
4
4
  module CoffeeWithoutNodejs
5
- VERSION = [0, 8, 0]
5
+ VERSION = [0, 9, 0]
6
6
 
7
7
  class << VERSION
8
8
  def to_s
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coffee_without_nodejs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Billy.Zheng(zw963)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-24 00:00:00.000000000 Z
11
+ date: 2015-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: execjs