guard-jasmine-rails 1.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 877aa26df5335413da671494e46f6bc47ba02c0a
4
+ data.tar.gz: 6cbe72291827b389a4ae776dd7ab64dabe7ce578
5
+ SHA512:
6
+ metadata.gz: ca4ab5ffd83a1d6bf3d4e5e230f881feb0bd10aa899296da4fb3c0088eb9735032f895cb9507601000d94349885389c8ceea0b99b810a07297e05e54b7978802
7
+ data.tar.gz: ab838b0a6e75fcf2ea2de380ab7563682e16188cc3b7df07e23b886cd2aba58d9674856b6ad45626c9a77aa390524fb905b348985a2c592a019f2cbeb8b0125a
data/.gitignore ADDED
@@ -0,0 +1,33 @@
1
+ # See http://help.github.com/ignore-files/ for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor
4
+ # or operating system, you probably want to add a global ignore instead:
5
+ # git config --global core.excludesfile '~/.gitignore_global'
6
+
7
+ # Ignore bundler config.
8
+ /.bundle
9
+
10
+ # Ignore the default SQLite database.
11
+ /db/*.sqlite3
12
+ /db/*.sqlite3-journal
13
+
14
+ # Ignore all logfiles and tempfiles.
15
+ /log/*.log
16
+ /tmp
17
+
18
+ # OSX files
19
+ .DS_Store
20
+
21
+ # Simplecov files
22
+ coverage
23
+
24
+ # vagrant files
25
+ boxes/*
26
+ .vagrant
27
+
28
+ # jasmine-rails files
29
+ spec/tmp
30
+ spec/javascripts/fixtures/generated/
31
+
32
+ # Rubygem files
33
+ /pkg
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in guard-jshintrb.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 The Garage
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # Guard::JasmineRails
2
+
3
+ Guard Plugin for running Jasmine Javascript tests via the [JasmineRails gem](https://github.com/searls/jasmine-rails)
4
+
5
+ ## Installation
6
+
7
+ ```
8
+ # Gemfile
9
+ gem 'jasmine-rails'
10
+ gem 'guard-jasmine-rails'
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```
16
+ # Guardfile
17
+ guard 'jasmine-rails' do
18
+ watch(%r{spec/javascripts/.+_spec\.(js\.coffee|js|coffee)$})
19
+ watch(%r{app/assets/javascripts/(.+?)\.(js\.coffee|js|coffee)(?:\.\w+)*$}) do |m|
20
+ "spec/javascripts/#{ m[1] }_spec.#{ m[2] }"
21
+ end
22
+ end
23
+ ```
24
+
25
+ ### Options
26
+
27
+ configure the plugin by passing options into the guard initializer. ex:
28
+ ```
29
+ # example to configure plugin
30
+ guard 'jasmine-rails', all_on_start: false do
31
+ end
32
+ ```
33
+
34
+ #### `all_on_start` (default true)
35
+ toggle running all Jasmine tests when Guard is first started.
36
+
37
+ ## Contributing
38
+
39
+ 1. Fork it
40
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
41
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
42
+ 4. Push to the branch (`git push origin my-new-feature`)
43
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "guard-jasmine-rails"
7
+ spec.version = "1.0.0"
8
+ spec.authors = ["Ryan Sonnek"]
9
+ spec.email = ["ryan@codecrate.com"]
10
+ spec.description = "A Guard for Jasmine Rails."
11
+ spec.summary = "A plugin to run Jasmine Javascript specs automatically through Guard."
12
+ spec.homepage = ""
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files`.split($/)
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_runtime_dependency 'guard'
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.3"
23
+ spec.add_development_dependency "rake"
24
+ end
@@ -0,0 +1,64 @@
1
+ require 'guard'
2
+ require 'guard/guard'
3
+ require 'guard/watcher'
4
+
5
+ module Guard
6
+ class JasmineRails < Guard
7
+ DEFAULTS = {
8
+ all_on_start: true
9
+ }
10
+
11
+ def initialize(watchers = [], options = {})
12
+ super watchers, DEFAULTS.merge(options)
13
+ end
14
+
15
+ def start
16
+ log 'is now running'
17
+ run_all if options[:all_on_start]
18
+ end
19
+
20
+ def run_all
21
+ spec_filter = nil
22
+ run spec_filter
23
+ end
24
+
25
+ # run jasmine specs for only the changed files
26
+ # if the changed file does not contain a jasmine describe block,
27
+ # re-run the entire jasmine test suite
28
+ def run_on_changes(paths)
29
+ spec_filters = paths.collect {|path| spec_description(path) }.uniq
30
+ spec_filters = [nil] if spec_filters.include?(nil)
31
+ spec_filters.each do |spec_filter|
32
+ run spec_filter
33
+ end
34
+ end
35
+
36
+ private
37
+
38
+ # parse the outermost describe block from a Jasmine spec file
39
+ # returns nil if no describe block is found
40
+ def spec_description(path)
41
+ File.read(path).scan(/describe\(['"](.+)['"]\,/).flatten.first
42
+ end
43
+
44
+ def run(spec_filter = nil)
45
+ message = 'Running Jasmine specs'
46
+ message += " with filter: #{spec_filter}" if spec_filter
47
+ log message
48
+
49
+ command = "bundle exec rake spec:javascript RAILS_ENV=test"
50
+ command += " SPEC=#{spec_filter}" if spec_filter
51
+ log "Running: #{command}", :debug
52
+ success = system(command)
53
+ if success
54
+ log 'Success!'
55
+ else
56
+ log "Error running specs", :error
57
+ end
58
+ end
59
+
60
+ def log(message, level = :info)
61
+ UI.send(level, "Guard::JasmineRails #{message}")
62
+ end
63
+ end
64
+ end
metadata ADDED
@@ -0,0 +1,93 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: guard-jasmine-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Ryan Sonnek
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-09-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: guard
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: A Guard for Jasmine Rails.
56
+ email:
57
+ - ryan@codecrate.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - .gitignore
63
+ - Gemfile
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
67
+ - guard-jasmine-rails.gemspec
68
+ - lib/guard/jasmine-rails.rb
69
+ homepage: ''
70
+ licenses:
71
+ - MIT
72
+ metadata: {}
73
+ post_install_message:
74
+ rdoc_options: []
75
+ require_paths:
76
+ - lib
77
+ required_ruby_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - '>='
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ requirements: []
88
+ rubyforge_project:
89
+ rubygems_version: 2.0.6
90
+ signing_key:
91
+ specification_version: 4
92
+ summary: A plugin to run Jasmine Javascript specs automatically through Guard.
93
+ test_files: []