guard-alfred 0.0.1.alpha

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 89e77383d72c0cd5cd1aee0757caad4408385d55
4
+ data.tar.gz: 23f1ce5a5d39191f51205c177abe667da3ebf928
5
+ SHA512:
6
+ metadata.gz: 7ef42fc16ae5327208b7213c77fdbc8db18fa22a195e3eedc299f2548878161c5f5535e716bde61f8e166c950b3637f89094e1a104e764d8d7d71c575b7a0330
7
+ data.tar.gz: 6b0bdcf2ba9f1aa37e886ea358718c3aaa149b53b3bb13a08be97c9641990f5f5a6592a754abfa93c4fd865062d2c893af0f13fe8bcae9aff4545c9fbc0955b1
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.travis.yml ADDED
@@ -0,0 +1,10 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1.1
6
+ - ruby-head
7
+
8
+ matrix:
9
+ allow_failures:
10
+ - rvm: ruby-head
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in guard-alfred.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Johan van Zonneveld
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,71 @@
1
+ ## Guard Alfred
2
+
3
+ [![Gem Version](http://img.shields.io/gem/v/guard-alfred.svg)][gem]
4
+ [![Build Status](http://img.shields.io/travis/jhnvz/guard-alfred.svg)][travis]
5
+ [![Coverage Status](http://img.shields.io/coveralls/jhnvz/guard-alfred.svg)][coveralls]
6
+ [![Code Climate](http://img.shields.io/codeclimate/github/jhnvz/guard-alfred.svg)][codeclimate]
7
+ [![Dependency Status](http://img.shields.io/gemnasium/jhnvz/guard-alfred.svg)][gemnasium]
8
+
9
+ [gem]: https://rubygems.org/gems/guard-alfred
10
+ [travis]: http://travis-ci.org/jhnvz/guard-alfred
11
+ [coveralls]: https://coveralls.io/r/jhnvz/guard-alfred
12
+ [codeclimate]: https://codeclimate.com/github/jhnvz/guard-alfred
13
+ [gemnasium]: https://gemnasium.com/jhnvz/guard-alfred
14
+
15
+ Automatically creates fixture files of your controller action responses under several conditions.
16
+
17
+ Installation
18
+ ------------
19
+
20
+ Add the gem to your Gemfile (inside development group):
21
+
22
+ ``` ruby
23
+ gem 'guard-alfred', :require => false
24
+ ```
25
+
26
+ Add guard definition to your Guardfile by running this command:
27
+
28
+ ```
29
+ $ guard init alfred
30
+ ```
31
+
32
+ Usage
33
+ ------------
34
+
35
+ Please read [Guard usage doc](https://github.com/guard/guard#readme).
36
+
37
+ Guardfile
38
+ ------------
39
+
40
+ Make sure to put this block on top of your Guardfile so all fixtures are created before running tests.
41
+
42
+ ```ruby
43
+ guard :alfred do
44
+ watch(%r{^app/controllers/(.+)\.rb$}) { |m| "spec/alfreds/#{m[1]}.rb" }
45
+ watch(%r{^spec/alfreds/(.+)\.rb$}) { |m| "spec/alfreds/#{m[1]}.rb" }
46
+ end
47
+ ```
48
+
49
+ Supported Ruby Versions
50
+ ------------
51
+
52
+ This library is tested against Travis and aims to support the following Ruby
53
+ implementations:
54
+
55
+ * Ruby 1.9.3
56
+ * Ruby 2.0.0
57
+ * Ruby 2.1.1
58
+
59
+ Contributing
60
+ ------------
61
+
62
+ 1. Fork it
63
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
64
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
65
+ 4. Push to the branch (`git push origin my-new-feature`)
66
+ 5. Create new Pull Request
67
+
68
+ Copyright
69
+ ------------
70
+
71
+ Copyright (c) 2014 Johan van Zonneveld. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,5 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+ task :default => :spec
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'guard/alfred/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "guard-alfred"
8
+ gem.version = Guard::AlfredVersion::VERSION
9
+ gem.authors = ["Johan van Zonneveld"]
10
+ gem.email = ["johan@vzonneveld.nl"]
11
+ gem.summary = %q{Guard gem for Alfred::Rails}
12
+ gem.description = %q{Guard::Alfred automatically creates javascript fixtures on file changes'}
13
+ gem.homepage = "https://github.com/jhnvz/guard-alfred"
14
+ gem.license = "MIT"
15
+
16
+ gem.files = `git ls-files -z`.split("\x0")
17
+ gem.executables = gem.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
+ gem.require_paths = ["lib"]
20
+
21
+ gem.add_dependency 'guard'
22
+ gem.add_dependency 'alfred_rails'
23
+
24
+ gem.add_development_dependency 'bundler', '~> 1.5'
25
+ gem.add_development_dependency 'rake'
26
+ gem.add_development_dependency 'coveralls'
27
+ gem.add_development_dependency 'rspec', '>= 2.3'
28
+ end
@@ -0,0 +1,64 @@
1
+ require 'guard'
2
+ require 'guard/plugin'
3
+
4
+ module Guard
5
+ class Alfred < Plugin
6
+ require 'guard/alfred/runner'
7
+
8
+ attr_accessor :options, :runner
9
+
10
+ ##
11
+ # Initialize plugin.
12
+ #
13
+ # === Params
14
+ #
15
+ # [options [Hash]] optional options hash.
16
+ #
17
+ # === Example
18
+ #
19
+ # guard :alfred, :all_on_start => false do
20
+ # watch(%r{^app/controllers/(.+)\.rb$}) { |m| "#{::Alfred.configuration.test_path}/alfreds/#{m[1]}.rb" }
21
+ # watch(%r{^spec/alfreds/(.+)\.rb$}) { |m| "#{::Alfred.configuration.test_path}/alfreds/#{m[1]}.rb" }
22
+ # end
23
+ #
24
+ def initialize(options = {})
25
+ super
26
+
27
+ @options = {
28
+ :all_on_start => true,
29
+ :run_all => {},
30
+ :run_on_modifications => {}
31
+ }.merge(options)
32
+
33
+ @runner = Runner.new
34
+ end
35
+
36
+ ##
37
+ # Runs all the scenario's if option all_on_start is true.
38
+ #
39
+ def start
40
+ ::Guard::UI.info 'Guard::Alfred is serving'
41
+ run_all if @options[:all_on_start]
42
+ end
43
+
44
+ ##
45
+ # Runs all the scenario's.
46
+ #
47
+ def run_all
48
+ runner.run_all
49
+ end
50
+
51
+ ##
52
+ # Runs scenario's for the modified controller.
53
+ #
54
+ # === Params
55
+ #
56
+ # [paths (Array)] the controllers to lookup
57
+ #
58
+ def run_on_modifications(paths)
59
+ return false if paths.empty?
60
+ runner.run(paths)
61
+ end
62
+
63
+ end # Alfred
64
+ end # Guard
@@ -0,0 +1,22 @@
1
+ module Guard
2
+ class Alfred
3
+ class Runner
4
+
5
+ ##
6
+ # Runs all the scenario's.
7
+ #
8
+ def run_all
9
+ Bundler.with_clean_env { Kernel.system('bundle exec alfred') }
10
+ end
11
+
12
+ ##
13
+ # Runs scenario's for controller paths.
14
+ #
15
+ def run(paths)
16
+ return true if paths.empty?
17
+ Bundler.with_clean_env { Kernel.system("bundle exec alfred #{paths.join(' ')}") }
18
+ end
19
+
20
+ end # Runner
21
+ end # Alfred
22
+ end # Guard
@@ -0,0 +1,6 @@
1
+ # Make sure to put this block on top op the Guardfile so all
2
+ # fixtures get generated before the tests are run.
3
+ guard :alfred do
4
+ watch(%r{^app/controllers/(.+)\.rb$}) { |m| "#{::Alfred.configuration.test_path}/alfreds/#{m[1]}.rb" }
5
+ watch(%r{^spec/alfreds/(.+)\.rb$}) { |m| "#{::Alfred.configuration.test_path}/alfreds/#{m[1]}.rb" }
6
+ end
@@ -0,0 +1,5 @@
1
+ module Guard
2
+ module AlfredVersion
3
+ VERSION = "0.0.1.alpha"
4
+ end
5
+ end
@@ -0,0 +1,46 @@
1
+ require 'spec_helper'
2
+
3
+ describe Guard::Alfred::Runner do
4
+
5
+ let!(:runner) { Guard::Alfred::Runner.new }
6
+
7
+ describe '#run_all' do
8
+
9
+ it 'should run alfred executable' do
10
+ Kernel.should_receive(:system).with('bundle exec alfred')
11
+ runner.run_all
12
+ end
13
+
14
+ end
15
+
16
+ describe '#run' do
17
+
18
+ context 'no paths' do
19
+
20
+ let!(:paths) { [] }
21
+
22
+ it 'return true and do nothing' do
23
+ runner.run(paths).should be_true
24
+ end
25
+
26
+ it 'should not run alfred executable' do
27
+ Kernel.should_not_receive(:system)
28
+ runner.run(paths)
29
+ end
30
+
31
+ end
32
+
33
+ context 'with paths' do
34
+
35
+ let!(:paths) { ['file1', 'file2'] }
36
+
37
+ it 'should run alfred executable' do
38
+ Kernel.should_receive(:system).with('bundle exec alfred file1 file2')
39
+ runner.run(paths)
40
+ end
41
+
42
+ end
43
+
44
+ end
45
+
46
+ end
@@ -0,0 +1,39 @@
1
+ require 'spec_helper'
2
+
3
+ describe Guard::Alfred do
4
+
5
+ let!(:options) { {} }
6
+ let!(:plugin) { Guard::Alfred.new(options) }
7
+
8
+ describe '#start' do
9
+
10
+ it "calls #run_all by default" do
11
+ Guard::Alfred.any_instance.should_receive(:run_all)
12
+ subject.start
13
+ end
14
+
15
+ context 'with all_on_start at false' do
16
+ let(:options) { { :all_on_start => false } }
17
+
18
+ it "doesn't calls #run_all" do
19
+ Guard::Alfred.any_instance.should_not_receive(:run_all)
20
+ plugin.start
21
+ end
22
+ end
23
+ end
24
+
25
+ describe '#run_all' do
26
+ it "runs all scenario's via runner" do
27
+ Guard::Alfred::Runner.any_instance.should_receive(:run_all)
28
+ plugin.run_all
29
+ end
30
+ end
31
+
32
+ describe '#run_on_modifications' do
33
+ it "runs the scenario's via runner" do
34
+ Guard::Alfred::Runner.any_instance.should_receive(:run).with(['file1', 'file2'])
35
+ plugin.run_on_modifications(['file1', 'file2'])
36
+ end
37
+ end
38
+
39
+ end
@@ -0,0 +1,13 @@
1
+ ## Guard
2
+
3
+ require 'guard/alfred'
4
+
5
+ ## Test coverage
6
+
7
+ require 'coveralls'
8
+ Coveralls.wear!
9
+
10
+ ## Rspec
11
+
12
+ require 'rspec'
13
+ require 'rspec/autorun'
metadata ADDED
@@ -0,0 +1,145 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: guard-alfred
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1.alpha
5
+ platform: ruby
6
+ authors:
7
+ - Johan van Zonneveld
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-09 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: alfred_rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.5'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.5'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: coveralls
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '2.3'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '2.3'
97
+ description: Guard::Alfred automatically creates javascript fixtures on file changes'
98
+ email:
99
+ - johan@vzonneveld.nl
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - ".travis.yml"
106
+ - Gemfile
107
+ - LICENSE.txt
108
+ - README.md
109
+ - Rakefile
110
+ - guard-alfred.gemspec
111
+ - lib/guard/alfred.rb
112
+ - lib/guard/alfred/runner.rb
113
+ - lib/guard/alfred/templates/Guardfile
114
+ - lib/guard/alfred/version.rb
115
+ - spec/guard/alfred/runner_spec.rb
116
+ - spec/guard/alfred_spec.rb
117
+ - spec/spec_helper.rb
118
+ homepage: https://github.com/jhnvz/guard-alfred
119
+ licenses:
120
+ - MIT
121
+ metadata: {}
122
+ post_install_message:
123
+ rdoc_options: []
124
+ require_paths:
125
+ - lib
126
+ required_ruby_version: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ required_rubygems_version: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - ">"
134
+ - !ruby/object:Gem::Version
135
+ version: 1.3.1
136
+ requirements: []
137
+ rubyforge_project:
138
+ rubygems_version: 2.2.2
139
+ signing_key:
140
+ specification_version: 4
141
+ summary: Guard gem for Alfred::Rails
142
+ test_files:
143
+ - spec/guard/alfred/runner_spec.rb
144
+ - spec/guard/alfred_spec.rb
145
+ - spec/spec_helper.rb