guard-karma 0.0.2

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 341a5d5b1978a0333bb65d6465f84d6187729246
4
+ data.tar.gz: f377973ca24552c9230712047bcf00e0da1bf25c
5
+ SHA512:
6
+ metadata.gz: f9401c431108ec033d453c8735d941131de9f262c3ecd970c7013905b0631a8235f66b9c6c8384c07b785e9ca0ab1c7a9fa858cc0a2a221a0b8bd3a43b8abe2a
7
+ data.tar.gz: 7e899ce1dcb8ee1639b05aefc88b99a570008e4545e5459c7a58576609f9eb5ccee26b4c5b4d8f468eccfabcb5b373b490a7b08c0b84c046e3c26ceb121893ae
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in guard-karma.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Ania Slimak
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.
@@ -0,0 +1,48 @@
1
+ # Guard::Karma
2
+
3
+ Guard plugin for [Karma](http://karma-runner.github.io/0.12/index.html).
4
+ Unfortunatelly I couldn't find a way to run specific test file, so it runs them all, but it's still useful for me.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'guard-karma'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ ```
17
+ bundle
18
+ ```
19
+
20
+ Or install it yourself as:
21
+
22
+ ```
23
+ gem install guard-karma
24
+ ```
25
+
26
+ ## Usage
27
+
28
+ ```
29
+ guard init guard-karma
30
+ ```
31
+
32
+ Supported options:
33
+ - `cmd` - command which will be run on each change; by default `./bin/karma` is used, you can put there e. g.:
34
+ ```bash
35
+ #!/bin/bash
36
+
37
+ ./node_modules/karma/bin/karma start spec/karma.conf.coffee --single-run
38
+ ```
39
+ - `all_on_start` - when true, tests will be run on guard start
40
+
41
+
42
+ ## Contributing
43
+
44
+ 1. Fork it ( https://github.com/[my-github-username]/guard-karma/fork )
45
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
46
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
47
+ 4. Push to the branch (`git push origin my-new-feature`)
48
+ 5. Create a new Pull Request
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'guard/karma/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "guard-karma"
8
+ spec.version = Guard::KarmaVersion::VERSION
9
+ spec.authors = ["Ania Slimak"]
10
+ spec.email = ["anna.slimak@lunarlogic.io"]
11
+ spec.summary = %q{Guard plugin for Karma runner}
12
+ spec.description = %q{Guard plugin for Karma runner}
13
+ spec.homepage = "https://github.com/lesniakania/guard-karma"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_dependency "guard", "~> 2.1"
24
+ spec.add_dependency 'guard-compat', '~> 1.1'
25
+ end
@@ -0,0 +1,89 @@
1
+ require "guard/karma/version"
2
+
3
+ module Guard
4
+ class Karma < Guard::Plugin
5
+ # Initializes a Guard plugin.
6
+ # Don't do any work here, especially as Guard plugins get initialized even if they are not in an active group!
7
+ #
8
+ # @param [Hash] options the custom Guard plugin options
9
+ # @option options [Array<Guard::Watcher>] watchers the Guard plugin file watchers
10
+ # @option options [Symbol] group the group this Guard plugin belongs to
11
+ # @option options [Boolean] any_return allow any object to be returned from a watcher
12
+ #
13
+ def initialize(options = {})
14
+ super
15
+ end
16
+
17
+ # Called once when Guard starts. Please override initialize method to init stuff.
18
+ #
19
+ # @raise [:task_has_failed] when start has failed
20
+ # @return [Object] the task result
21
+ #
22
+ def start
23
+ run_cmd if options[:all_on_start]
24
+ end
25
+
26
+ # Called when `stop|quit|exit|s|q|e + enter` is pressed (when Guard quits).
27
+ #
28
+ # @raise [:task_has_failed] when stop has failed
29
+ # @return [Object] the task result
30
+ #
31
+ def stop
32
+ end
33
+
34
+ # Called when `reload|r|z + enter` is pressed.
35
+ # This method should be mainly used for "reload" (really!) actions like reloading passenger/spork/bundler/...
36
+ #
37
+ # @raise [:task_has_failed] when reload has failed
38
+ # @return [Object] the task result
39
+ #
40
+ def reload
41
+ end
42
+
43
+ # Called when just `enter` is pressed
44
+ # This method should be principally used for long action like running all specs/tests/...
45
+ #
46
+ # @raise [:task_has_failed] when run_all has failed
47
+ # @return [Object] the task result
48
+ #
49
+ def run_all
50
+ run_cmd
51
+ end
52
+
53
+ # Called on file(s) additions that the Guard plugin watches.
54
+ #
55
+ # @param [Array<String>] paths the changes files or paths
56
+ # @raise [:task_has_failed] when run_on_additions has failed
57
+ # @return [Object] the task result
58
+ #
59
+ def run_on_additions(paths)
60
+ run_cmd
61
+ end
62
+
63
+ # Called on file(s) modifications that the Guard plugin watches.
64
+ #
65
+ # @param [Array<String>] paths the changes files or paths
66
+ # @raise [:task_has_failed] when run_on_modifications has failed
67
+ # @return [Object] the task result
68
+ #
69
+ def run_on_modifications(paths)
70
+ run_cmd
71
+ end
72
+
73
+ # Called on file(s) removals that the Guard plugin watches.
74
+ #
75
+ # @param [Array<String>] paths the changes files or paths
76
+ # @raise [:task_has_failed] when run_on_removals has failed
77
+ # @return [Object] the task result
78
+ #
79
+ def run_on_removals(paths)
80
+ run_cmd
81
+ end
82
+
83
+ private
84
+
85
+ def run_cmd
86
+ system(options[:cmd])
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,15 @@
1
+ guard :karma,
2
+ cmd: './bin/karma',
3
+ all_on_start: true do
4
+ watch(%r{spec/javascripts/spec\.(js\.coffee|js|coffee)$}) do
5
+ 'spec/javascripts'
6
+ end
7
+ watch(%r{spec/javascripts/.+_spec\.(js\.coffee|js|coffee)$})
8
+ watch(%r{spec/javascripts/fixtures/.+$})
9
+ watch(
10
+ %r{app/assets/javascripts/(.+?)\.(js\.coffee|js|coffee)(?:\.\w+)*$}
11
+ ) do |m|
12
+ "spec/javascripts/#{ m[1] }_spec.#{ m[2] }"
13
+ end
14
+ end
15
+
@@ -0,0 +1,5 @@
1
+ module Guard
2
+ module KarmaVersion
3
+ VERSION = "0.0.2"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: guard-karma
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Ania Slimak
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-05-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: guard
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.1'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.1'
55
+ - !ruby/object:Gem::Dependency
56
+ name: guard-compat
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.1'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.1'
69
+ description: Guard plugin for Karma runner
70
+ email:
71
+ - anna.slimak@lunarlogic.io
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - Gemfile
78
+ - LICENSE.txt
79
+ - README.md
80
+ - Rakefile
81
+ - guard-karma.gemspec
82
+ - lib/guard/karma.rb
83
+ - lib/guard/karma/templates/Guardfile
84
+ - lib/guard/karma/version.rb
85
+ homepage: https://github.com/lesniakania/guard-karma
86
+ licenses:
87
+ - MIT
88
+ metadata: {}
89
+ post_install_message:
90
+ rdoc_options: []
91
+ require_paths:
92
+ - lib
93
+ required_ruby_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ requirements: []
104
+ rubyforge_project:
105
+ rubygems_version: 2.2.2
106
+ signing_key:
107
+ specification_version: 4
108
+ summary: Guard plugin for Karma runner
109
+ test_files: []
110
+ has_rdoc: