capistrano-syntax-checking 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,8 +11,8 @@ Install via gems:
11
11
 
12
12
  gem install capistrano-syntax-checking
13
13
 
14
- Usage with Rails
15
- ----------------
14
+ Usage with Rails and Capistrano's standard Rails recipe
15
+ -------------------------------------------------------
16
16
 
17
17
  To use with a Rails application with sensible default, put the following at the
18
18
  top of your `Capfile`:
@@ -29,11 +29,37 @@ To invoke only certain checks, such as only Ruby and ERB:
29
29
  before 'deploy:update', "check_syntax:ruby"
30
30
  before 'deploy:update', "check_syntax:erb"
31
31
 
32
- Usage with generic (non-Rails) application, or when you want to be in control
33
- -----------------------------------------------------------------------------
32
+ Using without Capistrano's standard Rails recipe, or with non-Rails apps
33
+ ------------------------------------------------------------------------
34
+
35
+ If you are not using the Capistrano's built-in Rails support, start the same way:
36
+
37
+ require 'capistrano/recipes/syntax_checking'
38
+
39
+ Then override all the paths to match your application exactly:
40
+
41
+ set :syntax_check_paths,
42
+ :ruby => ["lib/ruby"] # These are just examples
43
+ :erb => ["lib/erb"],
44
+ :javascript => ["public/js"]
45
+
46
+ Then make sure the syntax checks are invoked before your deploy task. If your
47
+ deploy task is named "push", then:
48
+
49
+ desc "Full deploy ahead!"
50
+ task :push do
51
+ # ... your stuff here ...
52
+ end
53
+ before :push, :check_syntax
54
+
55
+ Refer to Capistrano's documentation on how to otherwise structure your
56
+ deployment file.
57
+
58
+ Using the API directly
59
+ ----------------------
34
60
 
35
61
  To use with any other kind of application, you will want to use your own tasks
36
- that providecustom options to the syntax-checker. Start by putting this at the
62
+ that provide custom options to the syntax-checker. Start by putting this at the
37
63
  top of your `Capfile`:
38
64
 
39
65
  require 'capistrano/ext/syntax_checking'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -19,37 +19,41 @@ module Capistrano
19
19
  file_names = [paths].flatten.compact.map { |path|
20
20
  Dir.glob(File.join(path, "**", "*.{erb,rhtml}"))
21
21
  }.flatten
22
- file_names.each_with_index do |file_name, index|
23
- if verbose
24
- $stdout.write("\r#{index} files checked (ctrl-C to skip)")
25
- $stdout.flush
26
- end
27
- old_stderr = $stderr
28
- begin
29
- $stderr = File.open("/dev/null", 'w')
30
- template = ERB.new(File.read(file_name), nil, "-")
22
+ if file_names.any?
23
+ file_names.each_with_index do |file_name, index|
24
+ if verbose
25
+ $stdout.write("\r#{index} files checked (ctrl-C to skip)")
26
+ $stdout.flush
27
+ end
28
+ old_stderr = $stderr
31
29
  begin
32
- template.result
33
- rescue SyntaxError => e
34
- $stderr << "\rSyntax error in ERB template #{file_name}: #{e}\n"
35
- $stderr.flush
36
- errors = true
37
- rescue Exception
38
- # Ignore
30
+ $stderr = File.open("/dev/null", 'w')
31
+ template = ERB.new(File.read(file_name), nil, "-")
32
+ begin
33
+ template.result
34
+ rescue SyntaxError => e
35
+ old_stderr << "\rSyntax error in ERB template #{file_name}: #{e}\n"
36
+ old_stderr.flush
37
+ errors = true
38
+ rescue Exception
39
+ # Ignore
40
+ end
41
+ ensure
42
+ $stderr = old_stderr
39
43
  end
40
- ensure
41
- $stderr = old_stderr
42
44
  end
43
- end
44
- if errors
45
- if verbose
46
- print "\r"
45
+ if errors
46
+ if verbose
47
+ print "\r"
48
+ end
49
+ abort("One or more syntax errors found. Fix and try again.")
50
+ else
51
+ if verbose
52
+ puts ", no problems found."
53
+ end
47
54
  end
48
- abort("One or more syntax errors found. Fix and try again.")
49
55
  else
50
- if verbose
51
- puts ", no problems found."
52
- end
56
+ puts("No ERB files to check.")
53
57
  end
54
58
  rescue Interrupt
55
59
  if verbose
@@ -19,6 +19,7 @@ Capistrano::Configuration.instance.load do
19
19
  erb
20
20
  javascript
21
21
  haml
22
+ puts
22
23
  end
23
24
 
24
25
  desc "Test syntax of all JavaScript files"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-syntax-checking
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Alexander Staubo
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-20 00:00:00 +02:00
18
+ date: 2010-08-30 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency