guard-haskell 1.5.0 → 1.6.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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ODI3NmViYzJlOThiNjQxYjNlM2VlZWRhY2Y4MTIyODc0MThiOGRhMw==
4
+ MTlhNDgyMGFhYTJhZDQxMjQyNjhlMWQxMmMwMTE5YzljYzY4NzNhYw==
5
5
  data.tar.gz: !binary |-
6
- ODYyZTU5ZTM1YzM2OWJlNTU2ZTcxMDRmMTFjOTE2YzkxMTY5MDcyMA==
6
+ NDk2ZjBjMjI0MjdiMDJkMDM5ZDY4ZTg2Y2VjNTk5MWQ3ZmE2ODM5MA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NjVjYmNiOTIwNGM1NzZmYTBkZWYwZTRkMWE1NDY0M2Y1MWEyYzNlOTBjZDU3
10
- NmQ3Y2IzMDhlYjBiZmQ2OTQ2OTc5YmVhOGJiZjg5MGMxNDkzMGM1MDBmYjE4
11
- NjlkNmU3ZmUyMGYwMTQ4NzUxODVlODc0YjRkYjRiZmM1MWQ5MmI=
9
+ MWNhODA4OWM5NDU3ZGJmNzUyYjVmMTUzMWU2Mjc3YmQxMTgyYzkzZjUxMTA5
10
+ ZTk4Y2FiYTc3YWQwYmIzNTMyOGNhYTdhMTQ3ODZiZjY4M2RkZTE4OWNiODNj
11
+ NzA0MTliMDgyZDVmMzI3MGRjODE1ZDkwMDNlOTFlYTdkOGMwOTU=
12
12
  data.tar.gz: !binary |-
13
- NWU4YmJkYmRkY2ZhNTZlMDI1NDI4ODllN2YyMDQ0ZGViODI2NWYwNWI3OWUz
14
- MGJmZDkxMjAxMTRiYjE1ZmVhYTVkYzU3NmYzYTU1ZTFhOWE4ZjI1ODcyYWQ3
15
- MGNkNzQyYTNhMjE1NWFiMjI2Mzg2OTNjN2NiNjc3NTc3YjYzMTI=
13
+ MWExZTU3Mjg0ZDVkODJjMzQzYzg2NzYwYjM3YmE4Y2QwOTg5MThiMjBjMTk3
14
+ MTJmMDNkZTc5ZmE4MWE0ZThlMzhjZTI5NThkMzcwNDMxY2MyOTIyNzVlYjM1
15
+ YWM5YjFmYmVlYzFiNzI1MzM1YTBlM2Y2ODJhZGM1N2U1YzNhYjY=
data/.travis.yml CHANGED
@@ -1,8 +1,11 @@
1
1
  language: ruby
2
+
2
3
  rvm:
3
4
  - 1.9.3
4
5
  - 2.0.0
6
+ - 2.1.1
5
7
  - ruby-head
8
+
6
9
  matrix:
7
10
  allow_failures:
8
11
  - rvm: ruby-head
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ 1.6.0
2
+ =====
3
+
4
+ * Handle Haskell pre-processor phase failures
5
+
6
+ * Handle missing Haskell pre-processor failures
7
+
8
+ * More extensible Guardfile template
9
+
1
10
  1.5.0
2
11
  =====
3
12
 
@@ -13,7 +22,7 @@
13
22
  =====
14
23
 
15
24
  * Ignore user cabal package database if sandbox is found
16
- * Catch CPP failures (previously did n't work because of the typo)
25
+ * Catch CPP failures (previously didn't work because of the typo)
17
26
  * Add `focus_on_fail` option
18
27
 
19
28
  1.2.0
@@ -3,11 +3,6 @@ require 'open3'
3
3
  class ::Guard::Haskell::Repl
4
4
  attr_reader :stdin, :listener, :thread, :result
5
5
 
6
- def initialize
7
- @running = false
8
- @result = :success
9
- end
10
-
11
6
  def self.test(str)
12
7
  case str
13
8
  when /\d+ examples?, 0 failures/,
@@ -19,13 +14,18 @@ class ::Guard::Haskell::Repl
19
14
  /\*{3} Exception:/,
20
15
  /cannot find object file for module/,
21
16
  /phase `C pre-processor' failed/,
17
+ /phase `Haskell pre-processor' failed/,
22
18
  /GHCi runtime linker: fatal error:/,
23
- /During interactive linking, GHCi couldn't find the following symbol:/
19
+ /During interactive linking, GHCi couldn't find the following symbol:/,
20
+ /ghc: could not execute:/
24
21
  :compile_failure
25
22
  end
26
23
  end
27
24
 
28
- def start(ghci_options, sandbox_glob)
25
+ def initialize(ghci_options, sandbox_glob)
26
+ @running = false
27
+ @result = :success
28
+
29
29
  cmd = ["ghci"]
30
30
 
31
31
  Dir["*"].each { |d| cmd << "-i#{d}" if File.directory?(d) }
@@ -1,4 +1,8 @@
1
- guard :haskell, ghci_options: ["-ignore-dot-ghci"] do
1
+ ghci_options =
2
+ [ "-ignore-dot-ghci" \
3
+ ]
4
+
5
+ guard :haskell, ghci_options: ghci_options do
2
6
  watch(%r{test/.+Spec\.l?hs$})
3
7
  watch(%r{src/.+\.l?hs$})
4
8
  end
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module HaskellVersion
3
- VERSION = '1.5.0'
3
+ VERSION = '1.6.0'
4
4
  end
5
5
  end
data/lib/guard/haskell.rb CHANGED
@@ -22,7 +22,8 @@ module ::Guard
22
22
 
23
23
  require 'guard/haskell/repl'
24
24
 
25
- attr_reader :repl, :targets, :last_run, :opts
25
+ attr_accessor :opts, :repl
26
+ attr_reader :targets, :last_run
26
27
 
27
28
  Options = Struct.new(
28
29
  :top_spec,
@@ -44,14 +45,12 @@ module ::Guard
44
45
 
45
46
  def initialize(user_options = {})
46
47
  super
47
-
48
- @last_run = :success # try to prove it wasn't :-)
49
- @opts = Options.new(*DEFAULT_OPTIONS.merge(user_options).values)
50
- @repl = Repl.new
48
+ self.opts = Options.new(*DEFAULT_OPTIONS.merge(user_options).values)
51
49
  end
52
50
 
53
51
  def start
54
- repl.start(opts.ghci_options, opts.sandbox_glob)
52
+ @last_run = :success # try to prove it wasn't :-)
53
+ self.repl = Repl.new(opts.ghci_options, opts.sandbox_glob)
55
54
  repl.init(opts.top_spec)
56
55
 
57
56
  @targets = ::Set.new(::Dir.glob("**/*.{hs,lhs}"))
@@ -95,6 +95,10 @@ describe ::Guard::Haskell::Repl do
95
95
  expect(::Guard::Haskell::Repl.test("phase `C pre-processor' failed")).to eq(:compile_failure)
96
96
  end
97
97
 
98
+ it "handles Haskell pre-processor errors" do
99
+ expect(::Guard::Haskell::Repl.test("phase `Haskell pre-processor' failed")).to eq(:compile_failure)
100
+ end
101
+
98
102
  it "handles runtime linker errors" do
99
103
  expect(::Guard::Haskell::Repl.test("GHCi runtime linker: fatal error:")).to eq(:compile_failure)
100
104
  end
@@ -173,6 +177,26 @@ describe ::Guard::Haskell::Repl do
173
177
  expect(repl.instance_variable_get(:@running)).to eq(false)
174
178
  expect(repl.instance_variable_get(:@result)).to eq(:compile_failure)
175
179
  end
180
+
181
+ it "handles preprocessor phase failures" do
182
+ in_stream = ::File.open(run_file["preprocessor-phase-failed.error"])
183
+ repl.instance_variable_set(:@running, true)
184
+
185
+ repl.send(:listen, in_stream, dev_null)
186
+
187
+ expect(repl.instance_variable_get(:@running)).to eq(false)
188
+ expect(repl.instance_variable_get(:@result)).to eq(:compile_failure)
189
+ end
190
+
191
+ it "handles missing preprocessor error" do
192
+ in_stream = ::File.open(run_file["missing-preprocessor.error"])
193
+ repl.instance_variable_set(:@running, true)
194
+
195
+ repl.send(:listen, in_stream, dev_null)
196
+
197
+ expect(repl.instance_variable_get(:@running)).to eq(false)
198
+ expect(repl.instance_variable_get(:@result)).to eq(:compile_failure)
199
+ end
176
200
  end
177
201
  end
178
202
 
@@ -33,12 +33,16 @@ describe "monkey patching" do
33
33
  end
34
34
  end
35
35
 
36
+ class ::Guard::Haskell::Repl
37
+ def initialize(*args)
38
+ end
39
+ end
40
+
36
41
  describe ::Guard::Haskell do
37
42
  let(:guard) { ::Guard::Haskell.new }
38
43
 
39
44
  before :each do
40
45
  ::Guard.stub(:add_group)
41
- ::Guard::Haskell::Repl.any_instance.stub(:start)
42
46
  ::Guard::Haskell::Repl.any_instance.stub(:init)
43
47
  end
44
48
 
@@ -127,10 +131,10 @@ describe ::Guard::Haskell do
127
131
  it "reruns failing examples if last run was a runtime failure and @focus_on_fail is set" do
128
132
  expect_any_instance_of(::Guard::Haskell::Repl).to receive(:reload_and_rerun)
129
133
  expect_any_instance_of(::Guard::Haskell::Repl).not_to receive(:reload_and_run_matching).with("Foo")
130
- guard.instance_variable_set(:@last_run, :runtime_failure)
131
- guard.opts.focus_on_fail = true
132
134
 
135
+ guard.opts.focus_on_fail = true
133
136
  guard.start
137
+ guard.instance_variable_set(:@last_run, :runtime_failure)
134
138
  guard.run("Foo")
135
139
  end
136
140
 
@@ -149,7 +153,6 @@ describe ::Guard::Haskell do
149
153
  it "checks success after run" do
150
154
  expect_any_instance_of(::Guard::Haskell::Repl).to receive(:reload_and_run_matching)
151
155
  expect(guard).to receive(:success?)
152
- guard.instance_variable_set(:@last_run, :success)
153
156
 
154
157
  guard.start
155
158
  guard.run_all
@@ -161,9 +164,9 @@ describe ::Guard::Haskell do
161
164
  ::Guard::Haskell::Repl.any_instance.stub(:result) { received }
162
165
  expect_any_instance_of(::Guard::Haskell::Repl).to receive(:result)
163
166
  yield
164
- guard.instance_variable_set(:@last_run, before)
165
167
 
166
168
  guard.start
169
+ guard.instance_variable_set(:@last_run, before)
167
170
  guard.success?
168
171
  expect(guard.instance_variable_get(:@last_run)).to eq(after)
169
172
  end
@@ -224,33 +227,30 @@ describe ::Guard::Haskell do
224
227
 
225
228
  it "does not run all specs on success after failure by default" do
226
229
  ::Guard::Haskell::Repl.any_instance.stub(:success?) { true }
227
- guard.instance_variable_set(:@last_run, :failure)
228
-
229
230
  expect(guard).not_to receive(:run_all)
230
231
 
231
232
  guard.start
233
+ guard.instance_variable_set(:@last_run, :failure)
232
234
  guard.success?
233
235
  end
234
236
 
235
237
  it "runs all examples on success after runtime failure with :all_on_pass option" do
236
238
  ::Guard::Haskell::Repl.any_instance.stub(:result) { :success }
237
239
  custom_guard = ::Guard::Haskell.new(all_on_pass: true)
238
- custom_guard.instance_variable_set(:@last_run, :runtime_failure)
239
-
240
240
  expect(custom_guard).to receive(:run_all)
241
241
 
242
242
  custom_guard.start
243
+ custom_guard.instance_variable_set(:@last_run, :runtime_failure)
243
244
  custom_guard.success?
244
245
  end
245
246
 
246
247
  it "runs all examples on success after compile time failure with :all_on_pass option" do
247
248
  ::Guard::Haskell::Repl.any_instance.stub(:result) { :success }
248
249
  custom_guard = ::Guard::Haskell.new(all_on_pass: true)
249
- custom_guard.instance_variable_set(:@last_run, :compile_failure)
250
-
251
250
  expect(custom_guard).to receive(:run_all)
252
251
 
253
252
  custom_guard.start
253
+ custom_guard.instance_variable_set(:@last_run, :compile_failure)
254
254
  custom_guard.success?
255
255
  end
256
256
  end
@@ -0,0 +1,9 @@
1
+ Cabal sandboxes found:
2
+ .cabal-sandbox/x86_64-linux-ghc-7.6.3-packages.conf.d
3
+ Cabal sandbox used:
4
+ .cabal-sandbox/x86_64-linux-ghc-7.6.3-packages.conf.d
5
+ GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help
6
+ Loading package ghc-prim ... linking ... done.
7
+ Loading package integer-gmp ... linking ... done.
8
+ Loading package base ... linking ... done.
9
+ ghc: could not execute: hspec-disco
@@ -0,0 +1,5 @@
1
+ *Main> hspec-discover: unexpected argument `o'
2
+
3
+ Usage: hspec-discover SRC CUR DST [--formatter=FORMATTER] [--no-main]
4
+
5
+ phase `Haskell pre-processor' failed (exitcode = 1)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-haskell
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matvey Aksenov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-08 00:00:00.000000000 Z
11
+ date: 2014-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard
@@ -117,6 +117,8 @@ files:
117
117
  - spec/guard/haskell_spec.rb
118
118
  - spec/run-files/cpp-exception.error
119
119
  - spec/run-files/hspec-exception.error
120
+ - spec/run-files/missing-preprocessor.error
121
+ - spec/run-files/preprocessor-phase-failed.error
120
122
  - spec/run-files/runtime-linker-cannot-find-object-file.error
121
123
  - spec/run-files/runtime-linker-couldn't-find-symbol.error
122
124
  - spec/run-files/runtime-linker-duplicate-definition-for-symbol.error
@@ -152,6 +154,8 @@ test_files:
152
154
  - spec/guard/haskell_spec.rb
153
155
  - spec/run-files/cpp-exception.error
154
156
  - spec/run-files/hspec-exception.error
157
+ - spec/run-files/missing-preprocessor.error
158
+ - spec/run-files/preprocessor-phase-failed.error
155
159
  - spec/run-files/runtime-linker-cannot-find-object-file.error
156
160
  - spec/run-files/runtime-linker-couldn't-find-symbol.error
157
161
  - spec/run-files/runtime-linker-duplicate-definition-for-symbol.error