haml-edge 2.3.36 → 2.3.37

Sign up to get free protection for your applications and to get access to all the features.
data/EDGE_GEM_VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.36
1
+ 2.3.37
data/Rakefile CHANGED
@@ -67,11 +67,10 @@ task :install => [:package] do
67
67
  sh %{#{sudo} #{gem} install --no-ri pkg/haml-#{File.read('VERSION').strip}}
68
68
  end
69
69
 
70
- desc "Release a new Haml package to Rubyforge. Requires the NAME and VERSION flags."
71
- task :release => [:package] do
70
+ desc "Release a new Haml package to Rubyforge."
71
+ task :release => [:check_release, :release_elpa, :package] do
72
72
  name = File.read("VERSION_NAME").strip
73
73
  version = File.read("VERSION").strip
74
- raise "VERSION_NAME must not be 'Bleeding Edge'" if name == "Bleeding Edge"
75
74
  sh %{rubyforge login}
76
75
  sh %{rubyforge add_release haml haml "#{name} (v#{version})" pkg/haml-#{version}.gem}
77
76
  sh %{rubyforge add_file haml haml "#{name} (v#{version})" pkg/haml-#{version}.tar.gz}
@@ -79,6 +78,87 @@ task :release => [:package] do
79
78
  sh %{rubyforge add_file haml haml "#{name} (v#{version})" pkg/haml-#{version}.zip}
80
79
  end
81
80
 
81
+ # Releases haml-mode.el and sass-mode.el to ELPA.
82
+ task :release_elpa do
83
+ require 'tlsmail'
84
+ require 'time'
85
+
86
+ version = File.read("VERSION").strip
87
+
88
+ haml_unchanged = mode_unchanged?(:haml, version)
89
+ sass_unchanged = mode_unchanged?(:sass, version)
90
+ next if haml_unchanged && sass_unchanged
91
+ raise "haml-mode.el and sass-mode.el are out of sync." if haml_unchanged ^ sass_unchanged
92
+
93
+ rev = File.read('.git/HEAD').strip
94
+ if rev =~ /^ref: (.*)$/
95
+ rev = File.read(".git/#{$1}").strip
96
+ end
97
+
98
+ from = `git config user.email`
99
+ raise "Don't know how to send emails except via Gmail" unless from =~ /@gmail.com$/
100
+
101
+ to = "elpa@tromey.com"
102
+ Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE)
103
+ Net::SMTP.start('smtp.gmail.com', 587, 'gmail.com', from, read_password("GMail Password"), :login) do |smtp|
104
+ smtp.send_message(<<CONTENT, from, to)
105
+ From: Nathan Weizenbaum <#{from}>
106
+ To: #{to}
107
+ Subject: Submitting haml-mode and sass-mode #{version}
108
+ Date: #{Time.now.rfc2822}
109
+
110
+ haml-mode and sass-mode #{version} are packaged and ready to be included in ELPA.
111
+ They can be downloaded from:
112
+
113
+ http://github.com/nex3/haml/raw/#{rev}/extra/haml-mode.el
114
+ http://github.com/nex3/haml/raw/#{rev}/extra/sass-mode.el
115
+ CONTENT
116
+ end
117
+ end
118
+
119
+ # Ensures that the version have been updated for a new release.
120
+ task :check_release do
121
+ version = File.read("VERSION").strip
122
+ raise "There have been changes since current version (#{version})" if changed_since?(version)
123
+ raise "VERSION_NAME must not be 'Bleeding Edge'" if File.read("VERSION_NAME") == "Bleeding Edge"
124
+ end
125
+
126
+ # Reads a password from the command line.
127
+ #
128
+ # @param name [String] The prompt to use to read the password
129
+ def read_password(prompt)
130
+ require 'readline'
131
+ system "stty -echo"
132
+ Readline.readline("#{prompt}: ").strip
133
+ ensure
134
+ system "stty echo"
135
+ puts
136
+ end
137
+
138
+ # Returns whether or not the repository, or specific files,
139
+ # has/have changed since a given revision.
140
+ #
141
+ # @param rev [String] The revision to check against
142
+ # @param files [Array<String>] The files to check.
143
+ # If this is empty, checks the entire repository
144
+ def changed_since?(rev, *files)
145
+ IO.popen("git diff --exit-code #{rev} #{files.join(' ')}") {}
146
+ return !$?.success?
147
+ end
148
+
149
+ # Returns whether or not the given Emacs mode file (haml or sass)
150
+ # has changed since the given version.
151
+ #
152
+ # @param mode [String, Symbol] The name of the mode
153
+ # @param version [String] The version number
154
+ def mode_unchanged?(mode, version)
155
+ mode_version = File.read("extra/#{mode}-mode.el").scan(/^;; Version: (.*)$/).first.first
156
+ return false if mode_version == version
157
+ return true unless changed_since?(mode_version, "extra/#{mode}-mode.el")
158
+ raise "#{mode}-mode.el version is #{haml_mode_version.inspect}, but it has changed as of #{version.inspect}"
159
+ return false
160
+ end
161
+
82
162
  task :release_edge do
83
163
  ensure_git_cleanup do
84
164
  puts "#{'=' * 50} Running rake release_edge"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.36
1
+ 2.3.37
data/extra/haml-mode.el CHANGED
@@ -4,8 +4,10 @@
4
4
 
5
5
  ;; Author: Nathan Weizenbaum
6
6
  ;; URL: http://github.com/nex3/haml/tree/master
7
- ;; Version: 1.0
8
- ;; Keywords: markup, language
7
+ ;; Version: 2.2.5
8
+ ;; Created: 2007-03-08
9
+ ;; By: Nathan Weizenbaum
10
+ ;; Keywords: markup, language, html
9
11
 
10
12
  ;;; Commentary:
11
13
 
@@ -41,9 +43,9 @@
41
43
  :group 'haml)
42
44
 
43
45
  (defcustom haml-backspace-backdents-nesting t
44
- "Non-nil to have `haml-electric-backspace' re-indent all code
45
- nested beneath the backspaced line be re-indented along with the
46
- line itself."
46
+ "Non-nil to have `haml-electric-backspace' re-indent blocks of code.
47
+ This means that all code nested beneath the backspaced line is
48
+ re-indented along with the line itself."
47
49
  :type 'boolean
48
50
  :group 'haml)
49
51
 
@@ -55,7 +57,8 @@ line itself."
55
57
  :group 'haml)
56
58
 
57
59
  (defvar haml-indent-function 'haml-indent-p
58
- "This function should look at the current line and return t
60
+ "A function for checking if nesting is allowed.
61
+ This function should look at the current line and return t
59
62
  if the next line could be nested within this line.
60
63
 
61
64
  The function can also return a positive integer to indicate
@@ -75,12 +78,15 @@ a specific level to which the current line could be indented.")
75
78
  "^ */\\(\\[.*\\]\\)?[ \t]*$"
76
79
  "^ *-#"
77
80
  "^ *:")
78
- "A list of regexps that match lines of Haml that could have
79
- text nested beneath them.")
81
+ "A list of regexps that match lines of Haml that open blocks.
82
+ That is, a Haml line that can have text nested beneath it should
83
+ be matched by a regexp in this list.")
80
84
 
81
85
  ;; Font lock
82
86
 
83
87
  (defun haml-nested-regexp (re)
88
+ "Create a regexp to match a block starting with RE.
89
+ The line containing RE is matched, as well as all lines indented beneath it."
84
90
  (concat "^\\( *\\)" re "\\(\n\\(?:\\(?:\\1 .*\\| *\\)\n\\)*\\(?:\\1 .*\\| *\\)?\\)?"))
85
91
 
86
92
  (defconst haml-font-lock-keywords
@@ -110,12 +116,14 @@ text nested beneath them.")
110
116
  (font-lock-fontify-region (- beg 1) end)))))
111
117
 
112
118
  (defun haml-highlight-ruby-script (limit)
113
- "Highlight a Ruby script expression (-, =, or ~)."
119
+ "Highlight a Ruby script expression (-, =, or ~).
120
+ LIMIT works as it does in `re-search-forward'."
114
121
  (when (re-search-forward "^ *\\(-\\|[&!]?[=~]\\) \\(.*\\)$" limit t)
115
122
  (haml-fontify-region-as-ruby (match-beginning 2) (match-end 2))))
116
123
 
117
124
  (defun haml-highlight-ruby-tag (limit)
118
125
  "Highlight Ruby code within a Haml tag.
126
+ LIMIT works as it does in `re-search-forward'.
119
127
 
120
128
  This highlights the tag attributes and object refs of the tag,
121
129
  as well as the script expression (-, =, or ~) following the tag.
@@ -189,13 +197,15 @@ For example, this will highlight all of the following:
189
197
  t))
190
198
 
191
199
  (defun haml-move (re)
192
- "Try matching and moving to the end of a regular expression."
200
+ "Try matching and moving to the end of regular expression RE.
201
+ Returns non-nil if the expression was sucessfully matched."
193
202
  (when (looking-at re)
194
203
  (goto-char (match-end 0))
195
204
  t))
196
205
 
197
206
  (defun haml-highlight-interpolation (limit)
198
- "Highlight Ruby interpolation (#{foo})."
207
+ "Highlight Ruby interpolation (#{foo}).
208
+ LIMIT works as it does in `re-search-forward'."
199
209
  (when (re-search-forward "\\(#{\\)" limit t)
200
210
  (save-match-data
201
211
  (forward-char -1)
@@ -209,8 +219,8 @@ For example, this will highlight all of the following:
209
219
  t)))
210
220
 
211
221
  (defun haml-limited-forward-sexp (limit &optional arg)
212
- "Move forward using `forward-sexp' or to limit,
213
- whichever comes first."
222
+ "Move forward using `forward-sexp' or to LIMIT, whichever comes first.
223
+ With ARG, do it that many times."
214
224
  (let (forward-sexp-function)
215
225
  (condition-case err
216
226
  (save-restriction
@@ -279,7 +289,7 @@ whichever comes first."
279
289
  (modify-syntax-entry ?: "." table)
280
290
  (modify-syntax-entry ?_ "w" table)
281
291
  table)
282
- "Syntax table in use in haml-mode buffers.")
292
+ "Syntax table in use in `haml-mode' buffers.")
283
293
 
284
294
  (defvar haml-mode-map
285
295
  (let ((map (make-sparse-keymap)))
@@ -338,7 +348,8 @@ whichever comes first."
338
348
  (haml-reindent-region-by (- haml-indent-offset))))
339
349
 
340
350
  (defun haml-replace-region (start end)
341
- "Replaces the current block of Haml code with the HTML equivalent."
351
+ "Replace the current block of Haml code with the HTML equivalent.
352
+ Called from a program, START and END specify the region to indent."
342
353
  (interactive "r")
343
354
  (save-excursion
344
355
  (goto-char end)
@@ -350,9 +361,10 @@ whichever comes first."
350
361
  (shell-command-on-region start end "haml" "haml-output" t)))
351
362
 
352
363
  (defun haml-output-region (start end)
353
- "Displays the HTML output for the current block of Haml code."
364
+ "Displays the HTML output for the current block of Haml code.
365
+ Called from a program, START and END specify the region to indent."
354
366
  (interactive "r")
355
- (kill-new (buffer-substring start end))
367
+ (kill-new (buffer-substring start end))
356
368
  (with-temp-buffer
357
369
  (yank)
358
370
  (haml-indent-region (point-min) (point-max))
@@ -366,10 +378,11 @@ whichever comes first."
366
378
  ;; Navigation
367
379
 
368
380
  (defun haml-forward-through-whitespace (&optional backward)
369
- "Move the point forward at least one line, until it reaches
381
+ "Move the point forward through any whitespace.
382
+ The point will move forward at least one line, until it reaches
370
383
  either the end of the buffer or a line with no whitespace.
371
384
 
372
- If `backward' is non-nil, move the point backward instead."
385
+ If BACKWARD is non-nil, move the point backward instead."
373
386
  (let ((arg (if backward -1 1))
374
387
  (endp (if backward 'bobp 'eobp)))
375
388
  (loop do (forward-line arg)
@@ -377,9 +390,7 @@ If `backward' is non-nil, move the point backward instead."
377
390
  (looking-at "^[ \t]*$")))))
378
391
 
379
392
  (defun haml-at-indent-p ()
380
- "Returns whether or not the point is at the first
381
- non-whitespace character in a line or whitespace preceding that
382
- character."
393
+ "Return non-nil if the point is before any text on the line."
383
394
  (let ((opoint (point)))
384
395
  (save-excursion
385
396
  (back-to-indentation)
@@ -387,7 +398,7 @@ character."
387
398
 
388
399
  (defun haml-forward-sexp (&optional arg)
389
400
  "Move forward across one nested expression.
390
- With `arg', do it that many times. Negative arg -N means move
401
+ With ARG, do it that many times. Negative arg -N means move
391
402
  backward across N balanced expressions.
392
403
 
393
404
  A sexp in Haml is defined as a line of Haml code as well as any
@@ -444,14 +455,14 @@ With ARG, do this that many times."
444
455
  (back-to-indentation))
445
456
 
446
457
  (defun haml-mark-sexp ()
447
- "Marks the next Haml block."
458
+ "Mark the next Haml block."
448
459
  (let ((forward-sexp-function 'haml-forward-sexp))
449
460
  (mark-sexp)))
450
461
 
451
462
  (defun haml-mark-sexp-but-not-next-line ()
452
- "Marks the next Haml block, but puts the mark at the end of the
453
- last line of the sexp rather than the first non-whitespace
454
- character of the next line."
463
+ "Mark the next Haml block, but not the next line.
464
+ Put the mark at the end of the last line of the sexp rather than
465
+ the first non-whitespace character of the next line."
455
466
  (haml-mark-sexp)
456
467
  (set-mark
457
468
  (save-excursion
@@ -508,7 +519,7 @@ beginning the hash."
508
519
  (when (eq (char-before) ?,) (return-from haml-unclosed-attr-hash-p t))
509
520
  (re-search-backward "(\\|^")
510
521
  (haml-move "(")
511
- (haml-parse-new-attr-hash)))
522
+ (haml-parse-new-attr-hash)))
512
523
 
513
524
  (defun* haml-parse-new-attr-hash (&optional (fn (lambda (type beg end) ())))
514
525
  "Parse a new-style attribute hash on this line, and returns
@@ -550,7 +561,8 @@ and BEG and END delimit that text in the buffer."
550
561
  "Indent each nonblank line in the region.
551
562
  This is done by indenting the first line based on
552
563
  `haml-compute-indentation' and preserving the relative
553
- indentation of the rest of the region.
564
+ indentation of the rest of the region. START and END specify the
565
+ region to indent.
554
566
 
555
567
  If this command is used multiple times in a row, it will cycle
556
568
  between possible indentations."
@@ -611,7 +623,8 @@ lines in the region have indentation >= that of the first line."
611
623
  "Delete characters or back-dent the current line.
612
624
  If invoked following only whitespace on a line, will back-dent
613
625
  the line and all nested lines to the immediately previous
614
- multiple of `haml-indent-offset' spaces.
626
+ multiple of `haml-indent-offset' spaces. With ARG, do it that
627
+ many times.
615
628
 
616
629
  Set `haml-backspace-backdents-nesting' to nil to just back-dent
617
630
  the current line."
data/extra/sass-mode.el CHANGED
@@ -4,8 +4,10 @@
4
4
 
5
5
  ;; Author: Nathan Weizenbaum
6
6
  ;; URL: http://github.com/nex3/haml/tree/master
7
- ;; Version: 1.0
8
- ;; Keywords: markup, language
7
+ ;; Version: 2.2.5
8
+ ;; Created: 2007-03-15
9
+ ;; By: Nathan Weizenbaum
10
+ ;; Keywords: markup, language, css
9
11
 
10
12
  ;;; Commentary:
11
13
 
@@ -42,8 +44,9 @@
42
44
  (defvar sass-non-block-openers
43
45
  '("^ *:[^ \t]+[ \t]+[^ \t]"
44
46
  "^ *[^ \t:]+[ \t]*[=:][ \t]*[^ \t]")
45
- "A list of regexps that match lines of Sass that couldn't have
46
- text nested beneath them.")
47
+ "A list of regexps that match lines of Sass that don't open blocks.
48
+ That is, a Sass line that can't have text nested beneath it
49
+ should be matched by a regexp in this list.")
47
50
 
48
51
  ;; Font lock
49
52
 
@@ -93,18 +96,18 @@ text nested beneath them.")
93
96
  ("\\(\\w+\\)\s*=" 1 font-lock-variable-name-face sass-highlight-script-after-match)
94
97
  ("\\(:\\w+\\)\s*=" 1 font-lock-variable-name-face sass-highlight-script-after-match)
95
98
  (".*" sass-highlight-selector))
96
- "A list of full-line Sass syntax to highlight,
97
- used by `sass-highlight-line'.
99
+ "A list of full-line Sass syntax to highlight, used by `sass-highlight-line'.
98
100
 
99
101
  Each item is either of the form (REGEXP SUBEXP FACE), (REGEXP FN),
100
- or (REGEXP SUBEXP FACE FN). Each REGEXP is run successively on the
102
+ or (REGEXP SUBEXP FACE FN). Each REGEXP is run successively on the
101
103
  beginning of non-whitespace on the current line until one matches.
102
104
  If it has SUBEXP and FACE, then SUBEXP is highlighted using FACE.
103
105
  If it has FN, FN is run.")
104
106
 
105
107
  (defun sass-highlight-line (limit)
106
- "Highlight a single line using some Sass single-line syntax,
107
- taken from `sass-line-keywords'."
108
+ "Highlight a single line using some Sass single-line syntax.
109
+ This syntax is taken from `sass-line-keywords'.
110
+ LIMIT is the limit of the search."
108
111
  (save-match-data
109
112
  (when (re-search-forward "^ *\\(.+\\)$" limit t)
110
113
  (goto-char (match-beginning 1))
@@ -121,8 +124,7 @@ taken from `sass-line-keywords'."
121
124
  (return t)))))))
122
125
 
123
126
  (defun sass-highlight-selector ()
124
- "Highlight a CSS selector starting at `point'
125
- and ending at `end-of-line'."
127
+ "Highlight a CSS selector starting at `point' and ending at `end-of-line'."
126
128
  (let ((font-lock-keywords sass-selector-font-lock-keywords)
127
129
  font-lock-multiline)
128
130
  (font-lock-fontify-region
@@ -139,10 +141,12 @@ and ending at `end-of-line'."
139
141
  (font-lock-fontify-region beg end)))))
140
142
 
141
143
  (defun sass-highlight-script-after-match ()
144
+ "Highlight a section of SassScript after the last match."
142
145
  (end-of-line)
143
146
  (sass-highlight-script (match-end 0) (point)))
144
147
 
145
148
  (defun sass-highlight-directive ()
149
+ "Highlight a Sass directive."
146
150
  (goto-char (match-end 0))
147
151
  (block nil
148
152
  (case (intern (match-string 1))
@@ -188,7 +192,7 @@ and ending at `end-of-line'."
188
192
  ;; Indentation
189
193
 
190
194
  (defun sass-indent-p ()
191
- "Returns t if the current line can have lines nested beneath it."
195
+ "Return non-nil if the current line can have lines nested beneath it."
192
196
  (loop for opener in sass-non-block-openers
193
197
  unless (looking-at opener) return t
194
198
  return nil))
data/lib/haml/exec.rb CHANGED
@@ -369,7 +369,8 @@ END
369
369
  require 'haml/html'
370
370
  rescue LoadError => err
371
371
  dep = err.message.scan(/^no such file to load -- (.*)/)[0]
372
- puts "Required dependency #{dep} not found!"
372
+ raise err if @options[:trace] || dep.nil? || dep.empty?
373
+ $stderr.puts "Required dependency #{dep} not found!\n Use --trace for backtrace."
373
374
  exit 1
374
375
  end
375
376
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haml-edge
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.36
4
+ version: 2.3.37
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Weizenbaum
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-09-20 00:00:00 -04:00
13
+ date: 2009-09-21 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -44,8 +44,8 @@ extensions: []
44
44
 
45
45
  extra_rdoc_files:
46
46
  - README.md
47
- - REVISION
48
47
  - VERSION
48
+ - REVISION
49
49
  - CONTRIBUTING
50
50
  - MIT-LICENSE
51
51
  - VERSION_NAME
@@ -257,8 +257,8 @@ files:
257
257
  - init.rb
258
258
  - .yardopts
259
259
  - README.md
260
- - REVISION
261
260
  - VERSION
261
+ - REVISION
262
262
  - CONTRIBUTING
263
263
  - MIT-LICENSE
264
264
  - VERSION_NAME