guard-hologram 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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bdc168d46de456a5feca932b3924cf15e5c425b8
4
+ data.tar.gz: 3957a3f6d387a7a527fff388fa63a36adc20fd9e
5
+ SHA512:
6
+ metadata.gz: c835b3562802989522918e8160b71f8d8cfbbd159302c3797ada65fb910e50441ae73bcb519bf615dccf3aeb999b5491cfae27b8e97e11d071cc654a1a6d048d
7
+ data.tar.gz: c22c09e5294eefa69e6fba457199e86b0b2788dbb50e515e9b31272b405b8c2707cbe3cd9b6bfa8899ddd7da6aaaae0b20e7d6d6d5130e9ece0716b5b49fad7a
@@ -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/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in guard-hologram.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Ken Mayer
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,49 @@
1
+ # Guard::Hologram
2
+
3
+ Guard plugin for the https://github.com/trulia/hologram gem
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'guard-hologram', :require => false
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install guard-hologram
18
+
19
+ ## Setup
20
+
21
+ guard init
22
+
23
+ ## Usage
24
+
25
+ bundle exec guard
26
+
27
+ ## Configuration
28
+
29
+ | Option | Definition | Default |
30
+ |-------------|------------------------------------------|---------------------|
31
+ | config_path | relative path to your configuration file | hologram_config.yml |
32
+
33
+ ### Sample Guardfile
34
+
35
+ ```ruby
36
+ guard "hologram", config_path: "hologram.yml" do
37
+ watch(%r{app/assets/stylesheets/.*css})
38
+ watch(%r{app/views/docs/styleguide/doc_assets/.+})
39
+ watch('hologram.yml')
40
+ end
41
+ ```
42
+
43
+ ## Contributing
44
+
45
+ 1. Fork it
46
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
47
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
48
+ 4. Push to the branch (`git push origin my-new-feature`)
49
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'guard/hologram/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "guard-hologram"
8
+ spec.version = Guard::HologramVersion::VERSION
9
+ spec.authors = ["Ken Mayer", "Greg Cobb"]
10
+ spec.email = ["ken@bitwrangler.com"]
11
+ spec.description = %q{Guard plugin for the Hologram gem (https://github.com/trulia/hologram)}
12
+ spec.summary = %q{Guard plugin for the Hologram gem}
13
+ spec.homepage = "https://github.com/kmayer/guard-hologram"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
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_dependency "guard", "~> 2.0"
22
+ spec.add_dependency "hologram"
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.3"
25
+ spec.add_development_dependency "rake"
26
+ spec.add_development_dependency "rspec"
27
+ end
@@ -0,0 +1,99 @@
1
+ require "guard/hologram/version"
2
+ require "guard"
3
+ require "guard/plugin"
4
+
5
+ module Guard
6
+ class Hologram < Plugin
7
+ include HologramVersion
8
+ attr_reader :options
9
+
10
+ DEFAULT_OPTIONS = {
11
+ config_path: "hologram_config.yml"
12
+ }
13
+ # Initializes a Guard plugin.
14
+ # Don't do any work here, especially as Guard plugins get initialized even if they are not in an active group!
15
+ #
16
+ # @param [Hash] options the custom Guard plugin options
17
+ # @option options [Array<Guard::Watcher>] watchers the Guard plugin file watchers
18
+ # @option options [Symbol] group the group this Guard plugin belongs to
19
+ # @option options [Boolean] any_return allow any object to be returned from a watcher
20
+ #
21
+ def initialize(options = {})
22
+ super
23
+ @options = DEFAULT_OPTIONS.merge(options)
24
+ end
25
+
26
+ # Called once when Guard starts. Please override initialize method to init stuff.
27
+ #
28
+ # @raise [:task_has_failed] when start has failed
29
+ # @return [Object] the task result
30
+ #
31
+ def start
32
+ end
33
+
34
+ # Called when `stop|quit|exit|s|q|e + enter` is pressed (when Guard quits).
35
+ #
36
+ # @raise [:task_has_failed] when stop has failed
37
+ # @return [Object] the task result
38
+ #
39
+ def stop
40
+ end
41
+
42
+ # Called when `reload|r|z + enter` is pressed.
43
+ # This method should be mainly used for "reload" (really!) actions like reloading passenger/spork/bundler/...
44
+ #
45
+ # @raise [:task_has_failed] when reload has failed
46
+ # @return [Object] the task result
47
+ #
48
+ def reload
49
+ end
50
+
51
+ # Called when just `enter` is pressed
52
+ # This method should be principally used for long action like running all specs/tests/...
53
+ #
54
+ # @raise [:task_has_failed] when run_all has failed
55
+ # @return [Object] the task result
56
+ #
57
+ def run_all
58
+ system *"bundle exec hologram #{options[:config_path]}".split or throw :task_has_failed
59
+ end
60
+
61
+ # Default behaviour on file(s) changes that the Guard plugin watches.
62
+ # @param [Array<String>] paths the changes files or paths
63
+ # @raise [:task_has_failed] when run_on_change has failed
64
+ # @return [Object] the task result
65
+ #
66
+ def run_on_changes(paths)
67
+ run_all
68
+ end
69
+
70
+ # Called on file(s) additions that the Guard plugin watches.
71
+ #
72
+ # @param [Array<String>] paths the changes files or paths
73
+ # @raise [:task_has_failed] when run_on_additions has failed
74
+ # @return [Object] the task result
75
+ #
76
+ def run_on_additions(paths)
77
+ run_all
78
+ end
79
+
80
+ # Called on file(s) modifications that the Guard plugin watches.
81
+ #
82
+ # @param [Array<String>] paths the changes files or paths
83
+ # @raise [:task_has_failed] when run_on_modifications has failed
84
+ # @return [Object] the task result
85
+ #
86
+ def run_on_modifications(paths)
87
+ run_all
88
+ end
89
+
90
+ # Called on file(s) removals that the Guard plugin watches.
91
+ #
92
+ # @param [Array<String>] paths the changes files or paths
93
+ # @raise [:task_has_failed] when run_on_removals has failed
94
+ # @return [Object] the task result
95
+ #
96
+ def run_on_removals(paths)
97
+ end
98
+ end
99
+ end
@@ -0,0 +1 @@
1
+ guard "hologram"
@@ -0,0 +1,5 @@
1
+ module Guard
2
+ module HologramVersion
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
@@ -0,0 +1,36 @@
1
+ require "spec_helper"
2
+
3
+ module Guard
4
+ describe Hologram do
5
+ let(:options) { {} }
6
+ subject(:hologram) { Guard::Hologram.new(options) }
7
+
8
+ describe "#start" do
9
+ it "does not call #run_all" do
10
+ hologram.should_not_receive(:run_all)
11
+ hologram.start
12
+ end
13
+ end
14
+
15
+ describe "#run_all" do
16
+ it "builds the styleguide" do
17
+ hologram.should_receive(:system).with(*"bundle exec hologram hologram_config.yml".split) { true }
18
+ hologram.run_all
19
+ end
20
+
21
+ context "with a custom config option" do
22
+ let(:options) { {config_path: "path/to/config/file.yml"} }
23
+
24
+ it "builds the styleguide" do
25
+ hologram.should_receive(:system).with(*"bundle exec hologram path/to/config/file.yml".split) { true }
26
+ hologram.run_all
27
+ end
28
+ end
29
+
30
+ it "raises an error if the build fails" do
31
+ hologram.should_receive(:system) { false }
32
+ expect { hologram.run_all }.to throw_symbol(:task_has_failed)
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,14 @@
1
+ require 'rspec'
2
+ require 'guard/hologram'
3
+
4
+ RSpec.configure do |config|
5
+ config.color_enabled = true
6
+ config.filter_run :focus => true
7
+ config.run_all_when_everything_filtered = true
8
+
9
+ config.before(:each) do
10
+ ENV["GUARD_ENV"] = 'test'
11
+ # @fixture_path = Pathname.new(File.expand_path('../fixtures/', __FILE__))
12
+ @lib_path = Pathname.new(File.expand_path('../../lib/', __FILE__))
13
+ end
14
+ end
metadata ADDED
@@ -0,0 +1,128 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: guard-hologram
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Ken Mayer
8
+ - Greg Cobb
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-02-20 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: guard
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ~>
19
+ - !ruby/object:Gem::Version
20
+ version: '2.0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ version: '2.0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: hologram
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - '>='
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: bundler
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ~>
47
+ - !ruby/object:Gem::Version
48
+ version: '1.3'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ~>
54
+ - !ruby/object:Gem::Version
55
+ version: '1.3'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rake
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: rspec
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ description: Guard plugin for the Hologram gem (https://github.com/trulia/hologram)
85
+ email:
86
+ - ken@bitwrangler.com
87
+ executables: []
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - .gitignore
92
+ - Gemfile
93
+ - LICENSE.txt
94
+ - README.md
95
+ - Rakefile
96
+ - guard-hologram.gemspec
97
+ - lib/guard/hologram.rb
98
+ - lib/guard/hologram/templates/Guardfile
99
+ - lib/guard/hologram/version.rb
100
+ - spec/guard/hologram_spec.rb
101
+ - spec/spec_helper.rb
102
+ homepage: https://github.com/kmayer/guard-hologram
103
+ licenses:
104
+ - MIT
105
+ metadata: {}
106
+ post_install_message:
107
+ rdoc_options: []
108
+ require_paths:
109
+ - lib
110
+ required_ruby_version: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - '>='
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ required_rubygems_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - '>='
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ requirements: []
121
+ rubyforge_project:
122
+ rubygems_version: 2.0.14
123
+ signing_key:
124
+ specification_version: 4
125
+ summary: Guard plugin for the Hologram gem
126
+ test_files:
127
+ - spec/guard/hologram_spec.rb
128
+ - spec/spec_helper.rb