guard

Swift: Nil is incompatible with return type String

删除回忆录丶 提交于 2019-12-30 06:36:14
问题 I have this code in Swift: guard let user = username else{ return nil } But I'm getting the following errors: Nil is incompatible with return type String Any of you knows why or how I return nil in this case? I'll really appreciate your help 回答1: you have to tell the compiler that you want to return nil. How do you that? by assigning '?' after your object. For instance take a look at this code: func newFriend(friendDictionary: [String : String]) -> Friend? { guard let name = friendDictionary[

undefined local variable or method `root_path' (Rspec Spork Guard)

五迷三道 提交于 2019-12-24 00:47:22
问题 I have a newbie question :-) I'm "creating" an app, and I use M. Hartl's Tutorial to do so. But I have some problems since I decided to change my routes.rb. I know the question has already been posted, but the answer doesn't work for me, so I supposed I should ask a new one... Here are the codes : config/routes.rb root to: 'static_pages#home' match '/help', to: 'static_pages#help' match '/contact', to: 'static_pages#contact' match '/about', to: 'static_pages#about' spec/requests/static_pages

Guard Ruby On Rails 3.2 Tutorial

落爺英雄遲暮 提交于 2019-12-23 03:32:12
问题 I'm following along with the Ruby on Rails Tutorial. Things are working pretty well, but I noticed that Guard only runs after I save some files (view or controller files), but doesn't run when I save others (routes or spec files). I've got Guard hooked up to Spork, not sure if that matters. When I looked at the console window running Guard/Spork, I noticed an error after I saved the non-running tests: Exception encountered: #<LoadError: no such file to load -- /Users/Tyler/Development

Listen gem not forwarding events to guard

安稳与你 提交于 2019-12-23 01:59:06
问题 I can't get Guard to run any action. I'm using: Gentoo x64 ( 3.14.14 ) rbx-2.5.2 guard 2.11.1 listen 2.8.5 Guardfile is just catch-it-all from Understanding guard guard :rspec, cmd: "bundle exec rspec" do watch(/(.*)/) { |m| Guard::UI.puts "Unknown file: #{m[1]}"; nil } end And here is the output of $ LISTEN_GEM_DEBUGGING=2 bundle exec guard -d I, [2015-02-04T08:11:34.995518 #25370] INFO -- : Celluloid loglevel set to: 0 I, [2015-02-04T08:11:34.997566 #25370] INFO -- : Listen version: 2.8.5

Go Auto-Recompile and Reload Server on file change

怎甘沉沦 提交于 2019-12-22 03:54:08
问题 I know AppEngine does this, but I'm not coding for it. I tried using Guard from Ruby world, to listen on changes on .go files, and execute the following commands: killall foo go build -race ./foo & But it never sends foo into background, it just hangs indefinitely. How are you guys solving this problem? Solution has to be cross-platform too (GNU/Linux and Mac). 回答1: A friend wrote a simple Compile Daemon for go, worked like a charm for my own small net/http-projects. You can find the

Why is guard stopping?

﹥>﹥吖頭↗ 提交于 2019-12-20 23:24:35
问题 I have a rails application that I just threw guard and minitest and my gaurd file is guard 'minitest', :cli => '--drb --format doc --color' do # with Minitest::Unit watch(%r|^test/(.*)\/?test_(.*)\.rb|) watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "test/#{m[1]}test_#{m[2]}.rb" } watch(%r|^test/test_helper\.rb|) { "test" } # Rails watch(%r|^app/controllers/(.*)\.rb|) { |m| "test/functional/#{m[1]}_test.rb" } watch(%r|^app/helpers/(.*)\.rb|) { |m| "test/helpers/#{m[1]}_test.rb" } watch(%r|^app/models/

Xcode 4: Can't use Enable Guard Malloc due to dylib error for iPad simulator

喜欢而已 提交于 2019-12-20 14:23:40
问题 In Xcode 4.x I've edited my Run scheme to 'Enable Guard Malloc' since I have a nondescript malloc error I need to track down. I'm aware I need to run in the simulator to use this feature. However, when I do so the app immediately freezes and Xcode shows me a stack trace that looks like this: I've googled around to find a solution, but thus far no joy. It was reported elsewhere that I should be setting an environment variable in my scheme: DYLD_INSERT_LIBRARIES -> /usr/lib/libgmalloc.dylib

Foreman running guard with color ouput

浪子不回头ぞ 提交于 2019-12-20 10:25:29
问题 I can run guard from within my foreman procfile - but the output is not as colorful as I'd like. The only color I see in my output is from Foreman... I want to have a guardfile that manages rspec, cucumber and jasmine - AND have that nice color output when those tests run. It would seem as if foreman ignores guard file settings. Any idea how to change that? 回答1: Add the --tty option to your rspec guard cli: guard "rspec", :version => 2, :cli => "--tty ...other options..." 回答2: For version 4.5

How do you get cucumber/guard to filter on tags like @wip?

旧巷老猫 提交于 2019-12-19 18:49:26
问题 I'm running spork and guard and all has been going very well with my RSpec tests which were all run correctly. In order to speed up the tests I could successfully filter my RSpec tests with tags I placed in my .rspec file. .rspec --colour --debug --tag focus --tag now Unfortunately though I have not been able to filter my cucumber tags. Every time cucumber runs it runs either everything or just the file that changed. How can I get cucumber/spork/guard to respect tags like @wip, @now etc and

Why is Guard not detecting file changes after dockerizing Rails app?

空扰寡人 提交于 2019-12-12 16:48:59
问题 I am trying to "dockerize" an existing Rails development app. This is my first time experimenting with Docker. I want to set up Guard to listen for file changes and run relevant specs. The Guard service appears to be running correctly, and the logs show: guard_1 | 16:35:12 - INFO - Guard is now watching at '/app' But when I edit/save spec files Guard is not running any tests. This is an existing app that I'm moving into Docker. It has a guardfile that works outside of Docker. I've searched