File tree 10 files changed +217
-0
lines changed
10 files changed +217
-0
lines changed Original file line number Diff line number Diff line change @@ -532,6 +532,15 @@ PostCheckout:
532
532
required : false
533
533
quiet : false
534
534
535
+ BowerInstall :
536
+ enabled : false
537
+ description : ' Installing bower dependencies'
538
+ requires_files : true
539
+ required_executable : ' bower'
540
+ install_command : ' npm install -g bower'
541
+ flags : ['install']
542
+ include : ' bower.json'
543
+
535
544
IndexTags :
536
545
enabled : false
537
546
description : ' Generating tags file from source'
@@ -561,6 +570,15 @@ PostCommit:
561
570
required : false
562
571
quiet : false
563
572
573
+ BowerInstall :
574
+ enabled : false
575
+ description : ' Installing bower dependencies'
576
+ requires_files : true
577
+ required_executable : ' bower'
578
+ install_command : ' npm install -g bower'
579
+ flags : ['install']
580
+ include : ' bower.json'
581
+
564
582
GitGuilt :
565
583
enabled : false
566
584
description : ' Calculating changes in blame since last commit'
@@ -597,6 +615,15 @@ PostMerge:
597
615
requires_files : false
598
616
quiet : false
599
617
618
+ BowerInstall :
619
+ enabled : false
620
+ description : ' Installing bower dependencies'
621
+ requires_files : true
622
+ required_executable : ' bower'
623
+ install_command : ' npm install -g bower'
624
+ flags : ['install']
625
+ include : ' bower.json'
626
+
600
627
IndexTags :
601
628
enabled : false
602
629
description : ' Generating tags file from source'
@@ -625,6 +652,15 @@ PostRewrite:
625
652
requires_files : false
626
653
quiet : false
627
654
655
+ BowerInstall :
656
+ enabled : false
657
+ description : ' Installing bower dependencies'
658
+ requires_files : true
659
+ required_executable : ' bower'
660
+ install_command : ' npm install -g bower'
661
+ flags : ['install']
662
+ include : ' bower.json'
663
+
628
664
IndexTags :
629
665
enabled : false
630
666
description : ' Generating tags file from source'
Original file line number Diff line number Diff line change
1
+ require 'overcommit/hook/shared/bower_install'
2
+
3
+ module Overcommit ::Hook ::PostCheckout
4
+ # Runs `bower install` when a change is detected in the repository's
5
+ # dependencies.
6
+ #
7
+ # @see {Overcommit::Hook::Shared::BowerInstall}
8
+ class BowerInstall < Base
9
+ include Overcommit ::Hook ::Shared ::BowerInstall
10
+ end
11
+ end
Original file line number Diff line number Diff line change
1
+ require 'overcommit/hook/shared/bower_install'
2
+
3
+ module Overcommit ::Hook ::PostCommit
4
+ # Runs `bower install` when a change is detected in the repository's
5
+ # dependencies.
6
+ #
7
+ # @see {Overcommit::Hook::Shared::BowerInstall}
8
+ class BowerInstall < Base
9
+ include Overcommit ::Hook ::Shared ::BowerInstall
10
+ end
11
+ end
Original file line number Diff line number Diff line change
1
+ require 'overcommit/hook/shared/bower_install'
2
+
3
+ module Overcommit ::Hook ::PostMerge
4
+ # Runs `bower install` when a change is detected in the repository's
5
+ # dependencies.
6
+ #
7
+ # @see {Overcommit::Hook::Shared::BowerInstall}
8
+ class BowerInstall < Base
9
+ include Overcommit ::Hook ::Shared ::BowerInstall
10
+ end
11
+ end
Original file line number Diff line number Diff line change
1
+ require 'overcommit/hook/shared/bower_install'
2
+
3
+ module Overcommit ::Hook ::PostRewrite
4
+ # Runs `bower install` when a change is detected in the repository's
5
+ # dependencies.
6
+ #
7
+ # @see {Overcommit::Hook::Shared::BowerInstall}
8
+ class BowerInstall < Base
9
+ include Overcommit ::Hook ::Shared ::BowerInstall
10
+ end
11
+ end
Original file line number Diff line number Diff line change
1
+ module Overcommit ::Hook ::Shared
2
+ # Shared code used by all BowerInstall hooks. Runs `bower install` when a
3
+ # change is detected in the repository's dependencies.
4
+ #
5
+ # @see http://bower.io/
6
+ module BowerInstall
7
+ def run
8
+ result = execute ( command )
9
+ return :fail , result . stderr unless result . success?
10
+ :pass
11
+ end
12
+ end
13
+ end
Original file line number Diff line number Diff line change
1
+ require 'spec_helper'
2
+
3
+ describe Overcommit ::Hook ::PostCheckout ::BowerInstall do
4
+ let ( :config ) { Overcommit ::ConfigurationLoader . default_configuration }
5
+ let ( :context ) { double ( 'context' ) }
6
+ subject { described_class . new ( config , context ) }
7
+
8
+ let ( :result ) { double ( 'result' ) }
9
+
10
+ before do
11
+ subject . stub ( :execute ) . and_return ( result )
12
+ end
13
+
14
+ context 'when bower install exits successfully' do
15
+ before do
16
+ result . stub ( :success? ) . and_return ( true )
17
+ end
18
+
19
+ it { should pass }
20
+ end
21
+
22
+ context 'when bower install exits unsuccessfully' do
23
+ before do
24
+ result . stub ( success? : false , stderr : normalize_indent ( <<-OUT ) )
25
+ bower EMALFORMED Failed to read bower.json
26
+ OUT
27
+ end
28
+
29
+ it { should fail_hook }
30
+ end
31
+ end
Original file line number Diff line number Diff line change
1
+ require 'spec_helper'
2
+
3
+ describe Overcommit ::Hook ::PostCommit ::BowerInstall do
4
+ let ( :config ) { Overcommit ::ConfigurationLoader . default_configuration }
5
+ let ( :context ) { double ( 'context' ) }
6
+ subject { described_class . new ( config , context ) }
7
+
8
+ let ( :result ) { double ( 'result' ) }
9
+
10
+ before do
11
+ subject . stub ( :execute ) . and_return ( result )
12
+ end
13
+
14
+ context 'when bower install exits successfully' do
15
+ before do
16
+ result . stub ( :success? ) . and_return ( true )
17
+ end
18
+
19
+ it { should pass }
20
+ end
21
+
22
+ context 'when bower install exits unsuccessfully' do
23
+ before do
24
+ result . stub ( success? : false , stderr : normalize_indent ( <<-OUT ) )
25
+ bower EMALFORMED Failed to read bower.json
26
+ OUT
27
+ end
28
+
29
+ it { should fail_hook }
30
+ end
31
+ end
Original file line number Diff line number Diff line change
1
+ require 'spec_helper'
2
+
3
+ describe Overcommit ::Hook ::PostMerge ::BowerInstall do
4
+ let ( :config ) { Overcommit ::ConfigurationLoader . default_configuration }
5
+ let ( :context ) { double ( 'context' ) }
6
+ subject { described_class . new ( config , context ) }
7
+
8
+ let ( :result ) { double ( 'result' ) }
9
+
10
+ before do
11
+ subject . stub ( :execute ) . and_return ( result )
12
+ end
13
+
14
+ context 'when bower install exits successfully' do
15
+ before do
16
+ result . stub ( :success? ) . and_return ( true )
17
+ end
18
+
19
+ it { should pass }
20
+ end
21
+
22
+ context 'when bower install exits unsuccessfully' do
23
+ before do
24
+ result . stub ( success? : false , stderr : normalize_indent ( <<-OUT ) )
25
+ bower EMALFORMED Failed to read bower.json
26
+ OUT
27
+ end
28
+
29
+ it { should fail_hook }
30
+ end
31
+ end
Original file line number Diff line number Diff line change
1
+ require 'spec_helper'
2
+
3
+ describe Overcommit ::Hook ::PostRewrite ::BowerInstall do
4
+ let ( :config ) { Overcommit ::ConfigurationLoader . default_configuration }
5
+ let ( :context ) { double ( 'context' ) }
6
+ subject { described_class . new ( config , context ) }
7
+
8
+ let ( :result ) { double ( 'result' ) }
9
+
10
+ before do
11
+ subject . stub ( :execute ) . and_return ( result )
12
+ end
13
+
14
+ context 'when bower install exits successfully' do
15
+ before do
16
+ result . stub ( :success? ) . and_return ( true )
17
+ end
18
+
19
+ it { should pass }
20
+ end
21
+
22
+ context 'when bower install exits unsuccessfully' do
23
+ before do
24
+ result . stub ( success? : false , stderr : normalize_indent ( <<-OUT ) )
25
+ bower EMALFORMED Failed to read bower.json
26
+ OUT
27
+ end
28
+
29
+ it { should fail_hook }
30
+ end
31
+ end
You can’t perform that action at this time.
0 commit comments