Using rake with Teamcity gives a RegexError - continuous-integration

Every time that I try use team city to build a .NET solution using rake I receive the same
"Format_exception_msg : Invalid escape character syntax: /path to rakefile/ (RegexError)
My natural assumption would be that I have in fact a invalid escape character somewhere in my rake code, I admit that I've never used ruby or rake before, but the script itself executes without problems and behaves as it should when executed on the command line without the use of teamcity.
Furthermore, I went through my code slowly commenting out lines to try to narrow down where the invalid character could be and the team city process continuted to fail even with a completely commented out rake file.
Thanks for the help, let me know if more information is needed.

Related

How do I run individual tests on Rails 5 with ruby-test on Atom

When I left my company I also lost my license to RubyMine so I started working with Atom. One feature I really missed from RubyMine was the ability to run individual tests directly from the editor.
After poking around a bit I found a library for Atom that accomplished this: https://atom.io/packages/ruby-test
This package is great, except I found that whenever I ran a test that had spaces in the name, the test wouldn't actually run.
How can I get the package to run tests that have spaces in their name?
The command the package was using was:
ruby -I test {relative_path} -n "/{regex}/"
If you go into the settings, you can modify this to use TESTOPTS which supports spaces in the names:
ruby -I test {relative_path} TESTOPTS="-n /{regex}/"

Bash Pipe File-Redirect Prints �

I have a program that runs and I pipe the output to a file.
program > file.txt
The above command is run every half hour. One time it printed new data, followed by about a page of �, and then old data. I'm curious on why this happened, or how this happened. It's been running for ~3k times and failed this one time. Did the OS (mac) just hickup?
The program is maven and it runs some automation code (e.g. mvn clean test -Dtest=XYZ). If the maven fails then it will re-run the same command again (pmvn clean...). I am not sure how to duplicate this. Since it has happened it has been running fine.
This is almost certainly not an issue with bash or your OS, but with the program you're running. The � symbol means that your program is outputting something that doesn't consist of printable characters. Either it's outputting binary data rather than text (whether by design or otherwise), or an error's occurring that causes its textual output to be garbled.

Rake feature -- strange argument

I have the "foo.feature" file and I want to execute the commands in this file via Rake:
rake feature['foo.feature',100000]
The first argument (or what is it) is completely clear, but what about the other one? Is it an amount of scripts executions or something like this?
Unfortunately I am unable to find this in the docs.
If memory serves, that is the syntax used to call rake feature and deliver two arguments to the feature task, namely 'foo.feature' and 100000.
You'll want to look into your rakefile and see what is expected for the task in question.
For what it's worth, it's an unwieldily and error-prone syntax. There are better libraries to build scripts that accept arguments and options such as OptionParse or Thor. Even better, use rake as a replacement for make, and use something else to develop shell-based commands.

Passing environment variables as rake arguments?

I am trying to run a rake task that takes two parameters. These parameters are already stored as environment variables. I am getting what seems to be an escaping issue. What is wrong with this.
rake deploy:web_server[%parameter1%,%parameter2%]
I am getting this error message when I run this, where is my last squared bracket disappearing to?
Don't know how to build task 'deploy:web_server[param1_val,param2val'
I ended up figuring out that my %parameter2% environment value had a trailing space at the end. That is what was causing the issue. Have to be careful with spaces for environment variables.

Calling Rspec with syntax like ruby -I

I am trying to use https://github.com/rifraf/Vendorize which is run using a command like
D:\projects\SomeLibrary\lib>ruby -I..\..\Vendorize\lib -rvendorize some_lib.rb
It does something clever where it intercepts required files and logs them, but only the ones that get executed in your command line. On it's documentation pages it says
You can run the program several times with different options if the
required files depend on the options.
Or just run your tests…
I want to run all the tests with the -I function from the command line above, so that all the different avenues of code are run, and the libraries loaded (and logged). Given that I can run them like:
D:\projects\SomeLibrary\lib>rspec ..\spec\some_spec.rb
How do I do this? Thanks!
NB: I am a/ a ruby newbie and b/ running windows
I would try writing something like this at the top of some_spec.rb:
require_relative '..\..\Vendorize\lib\vendorize'
You might need to change that a bit depending on what your working directory is.
Then just runs your specs with rspec as you normally do without any extra commands.
If that doesn't work, then locate the rspec.rb executable and run:
ruby -I..\..\Vendorize\lib -rvendorize path/to/rspec.rb ..\spec\some_spec.rb

Resources