GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Rubygem
Fork of nex3/haml
Description: HTML Abstraction Markup Language - A Markup Haiku
Homepage: http://haml.hamptoncatlin.com
Clone URL: git://github.com/chriseppstein/haml.git
A few improvements to executables. They'll give meaningful error codes on 
exit, won't display the entire error traceback by default, and have an 
option to set both --stdin and --stdout.


git-svn-id: svn://hamptoncatlin.com/haml/trunk@470 
7063305b-7217-0410-af8c-cdc13e5119b9
nex3 (author)
Sun Apr 01 00:21:41 -0700 2007
commit  f1195ec95219ad5f96cf9e020764f8e623b4632c
tree    f9d3f1946129a625b6fe596a567c3c4a629e691e
parent  206fe765c474372d0d98519e8193783e8e8e23cb
0
...
8
9
10
11
12
13
14
...
8
9
10
 
11
12
13
0
@@ -8,7 +8,6 @@ Features:
0
   Sass should throw generic errors for undefined constants, not syntax errors
0
   Sass::Plugin should log errors
0
   There should be a way to represent options in-document
0
- Haml and Sass executables should return meaningful exit codes
0
   There should be a way to make Haml tags not insert whitespace
0
   "%li, %a"?
0
   Sass::Engine load_paths option should be set by executable
...
16
17
18
19
20
21
22
 
 
 
 
 
 
 
 
 
 
 
 
 
23
24
 
 
 
25
26
27
...
39
40
41
 
 
 
 
 
 
 
 
 
42
43
44
...
102
103
104
105
 
106
107
108
...
16
17
18
 
 
 
 
19
20
21
22
23
24
25
26
27
28
29
30
31
32
 
33
34
35
36
37
38
...
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
...
122
123
124
 
125
126
127
128
0
@@ -16,12 +16,23 @@ module Haml
0
       end
0
 
0
       def parse!
0
- @opts = OptionParser.new(&(method(:set_opts).to_proc))
0
- @opts.parse!(@args)
0
-
0
- process_result
0
+ begin
0
+ @opts = OptionParser.new(&(method(:set_opts).to_proc))
0
+ @opts.parse!(@args)
0
+
0
+ process_result
0
+
0
+ @options
0
+ rescue Exception => e
0
+ if @options[:trace]
0
+ puts e
0
+ else
0
+ puts "Error: #{e.message}\nUse --trace to see traceback"
0
+ end
0
 
0
- @options
0
+ exit 1
0
+ end
0
+ exit 0
0
       end
0
 
0
       def to_s
0
@@ -39,6 +50,15 @@ module Haml
0
           @options[:output] = $stdout
0
         end
0
 
0
+ opts.on('-s', '--stdio', 'Read input from standard input and print output to standard output') do
0
+ @options[:input] = $stdin
0
+ @options[:output] = $stdout
0
+ end
0
+
0
+ opts.on('--trace', :NONE, 'Show a full traceback on error') do
0
+ @options[:trace] = true
0
+ end
0
+
0
         opts.on_tail("-?", "-h", "--help", "Show this message") do
0
           puts opts
0
           exit
0
@@ -102,7 +122,7 @@ Description:
0
 Options:
0
 END
0
        
0
- opts.on('--rails RAILS_DIR', "Install Haml from the Gem to a Rails project.") do |dir|
0
+ opts.on('--rails RAILS_DIR', "Install Haml from the Gem to a Rails project") do |dir|
0
           original_dir = dir
0
 
0
           dir = File.join(dir, 'vendor', 'plugins')

Comments

    No one has commented yet.