The annotate command fails when using the -R option to load additional files before loading the models with version 2.4.1.beta. The files appear to be found, but the error still occurs (if I use a wild-card path the first file is displayed as the error). A similar error message appears here (https://github.com/ctran/annotate_models/issues/78) The solution there is to use:
gem 'annotate', github: 'ctran/annotate_models'
but if I replace annotate in the Gemfile with the above, and do:
gem uninstall annotate
bundle install
Then bundle reports on the first line:
Updating git://github.com/ctran/annotate_models.git
and later:
Using annotate (2.5.0.pre1) from git://github.com/ctran/annotate_models.git (at master)
Note that neither message says "Installing". Then executing annotate ends up with the annotate executable not being found. Any solutions? (Ruby 1.9.2p280, Rails 3.2.2)
Related
In my primary ~/.rspec file, I have the option --order default set up.
I've just started work on a Rails project that uses an older version of RSpec (I'm not sure exactly which of the RSpec gems in the gemfile is the key one, but all are 2.6.something)
When I run bundle exec rspec with the new project, it throws the exception invalid option: --order (OptionParser::InvalidOption).
I've been able to fix this by deleting the option from the main RSpec file, but obviously that's not really what I want to do. But what I've been able to find in RSpec's documentation about overriding locally all refers to either changing options or introducing new ones - not to ignoring them altogether.
The ./.rspec file in my project root has nothing but the option --color, but evidently that's not a command to use only that option.
Is there a way to tell it locally to ignore the line whose syntax it doesn't understand?
Thanks all.
You can use custom config file or set project's one explicitly
rspec spec/ --options .rspec
http://www.relishapp.com/rspec/rspec-core/v/2-10/docs/configuration/read-command-line-configuration-options-from-files#rspec-ignores-./.rspec-when-custom-options-file-is-used
It also ignores ~/.rspec not only ./.rspec as it specified in documentation
I'm trying to configure bundler such that building the mysql2 gem will pass the necessary parameters to extconf. Problem is, I can't figure out how to pass more than one parameter.
In my Gemfile, I just have:
gem mysql2, '= 0.3.11'
(There is some problem with the latest version which prevents compiling it at all, so I'm using 0.3.11 based on a recommendation I found on another post somewhere around here.)
I tried this:
bundle config build.mysql2 --with-mysql-include=C:\DevEnv\Tools\Ruby\mysql-connector-c-noinstall-6.0.2-winx64\include --with-mysql-lib=C:\DevEnv\Tools\Ruby\mysql-connector-c-noinstall-6.0.2-winx64\lib
I also tried quoting the parameters into a single parameter:
bundle config build.mysql2 "--with-mysql-include=C:\DevEnv\Tools\Ruby\mysql-connector-c-noinstall-6.0.2-winx64\include --with-mysql-lib=C:\DevEnv\Tools\Ruby\mysql-connector-c-noinstall-6.0.2-winx64\lib"
I can tell it isn't working because gem is showing me the command-line which is actually being used, and then the build fails because it can't provide the lib):
C:/DevEnv/Tools/Ruby/Ruby200-x64/bin/ruby.exe extconf.rb --with-mysql-include=C:\DevEnv\Tools\Ruby\mysql-connector-c-noinstall-6.0.2-winx64\include
If I provide just the --with-mysql-lib parameter or swap the order of the parameters, the build passes on looking for the lib but fails on a missing include instead.
If I pass the same flags to gem directly, that works fine. But that won't be terribly great when it comes time to deploy.
How are other people doing this?
PS a binary DLL would have been nice, but I guess they stopped doing that.
For the next poor sap that has to deal with this, the answer is a lot of quoting:
bundle config build.mysql2 "--with-mysql-include=\"C:\DevEnv\Tools\Ruby\mysql-connector-c-noinstall-6.0.2-winx64\include\" --with-mysql-lib=\"C:\DevEnv\Tools\Ruby\mysql-connector-c-noinstall-6.0.2-winx64\lib\""
bundle config --local --with-mysql-include 'C:\INC_PATH\include'
bundle config --local --with-mysql-lib 'C:\LIB_PATH\lib'
The above will store configuration directives in current directory in .bundle/config file. After you have these two directives run, try normal build install. Hope it helps.
More info.
I'm currently attempting to create a ruby gem out of a script and, while it works if I take the scripts and put them in the same directory, if I put them in the appropriate /bin and /lib directories after generating my gem structure, build the gem and then attempt to execute it I'm given the uninitialized constant error. Under /bin the relevant section in the file "cjp" is:
Cjb.new(crontabDir, logDir, allowedFrequency, printOnly, testRun).
find_violations autoFix
The class is defined in the file cjp.rb under /lib
class Cjb
def initialize(crontabDir, logDir, allowedFrequency, printOnly, testRun)
#crontabDir, #logDir, #allowedFrequency, #printOnly, #testRun =
crontabDir, logDir, allowedFrequency, printOnly, testRun
Despite this, the error I get is:
ERROR: uninitialized constant Cjb
I also noticed that if I attempt to manually execute the "cjp" script under /bin without the lib script being in the same directory that it also gives the same error. It appears that I'm missing something.
Any help on what I'm missing here to get this working would be appreciated.
bundle gem uses git to manage gem manifest.
If you do not see all your expected files when you run git ls-files in your gem project dir, then you need to add them.
To add individual files:
git add <filename>
To add everything (run from root of project):
git add .
This may have caught you out if you were not expecting to use git on your project. If you don't know git, and have time, it is really recommended to help you manage your project code. In fact so much so that bundle simply assumes that's what you want to do (although other code management tools are available)
I'm trying to work through 'The Cucumber Book', but Cucumber is not behaving as expected.
I'm on Windows 7 (32-bit), and I'm reasonably confident I have Ruby and the necessary gems installed properly.
However, when I run cucumber I get the following message:
WARNING: cannot load such file -- 2.0/gherkin_lexer_en
Couldn't load 2.0/gherkin_lexer_en
The $LOAD_PATH was:
C:/Ruby200/lib/ruby/gems/2.0.0/gems/cucumber-1.2.1/bin/../lib
C:/Ruby200/lib/ruby/gems/2.0.0/gems/gherkin-2.11.6-x86-mingw32/lib
C:/Ruby200/lib/ruby/gems/2.0.0/gems/builder-3.2.0/lib
C:/Ruby200/lib/ruby/gems/2.0.0/gems/diff-lcs-1.2.1/lib
C:/Ruby200/lib/ruby/gems/2.0.0/gems/cucumber-1.2.1/lib
This continues for a bit, listing more paths that were checked, and then a 'Reverting to Ruby lexer', and a message 'No lexer was found for en (cannot load such file --gherkin/lexer/en)...'
Based on the path it is checking it seems like it wants a '2.0' folder in the 'gherkin-2.11.6-x86-mingw32/lib' folder, which obviously doesn't exist. There are, however, '1.8' and '1.9' folders which appear to have the 'gherkin_lexer_en' file (actually 'gherkin_lexer_en.so').
As a wild guess, I duplicated the 1.9 folder and named it 2.0. I didn't really expect that would work, but figured it was worth a shot.
How do I get cucumber to look in one of the folders I have, or alternatively get a 2.0 folder in place that it will accept?
$ gem install gherkin --platform ruby
go to below folder inside your ruby installation directory
{rubyDir}\lib\ruby\gems\2.0.0\gems\gherkin-2.12.2\lib\gherkin
may be different path for you guys
Modify *lib/gherkin/c_lexer.rb:7
change the value of prefix as below:
prefix = ''
Found answer at below link
https://github.com/cucumber/gherkin/issues/273
with reply
mscharley commented on Jan 18, 2014
worked for me like charm..
On Windows, you will have to use Ruby 1.9 for the time being. There isn't a Ruby 2.0 build of gherkin published yet.
If you are using gherkin ver 2.12.1, you should be able to use cucumber with ruby 2.0 on Windows now.
First, install gherkin-2.12.1 with --ignore-dependencies option.
The reson --ignore-dependencies option is required is that without specifying it, it will install json 1.4.X which is very old version and fail to install on ruby 2.0.
At this point, you should be able to ruby cucumber on ruby 2.0, but you'll see the error message like above as warning message. This means you can still use cucumber although you are seeing the message.
If you want to remove the error, follow the step below.
create [2.0] folder on [ruby installed dir]\lib\ruby\gems\2.0.0\gems\gherkin-2.12.1\lib (This folder includes gherkin_lexer_XX.so).
copy all the contents in [ruby installed dir]\lib\ruby\gems\2.0.0\gems\gherkin-2.12.1\lib to the created [2.0] folder (you don't need to copy [2.0] folder you created).
I've got a custom gem that has been working just fine with regards to bundling, building, distributing, & implementing. The gem is the core of a framework from which other gems are derived. Since most derived gems will have the same basic structure, I want to include a Ruby script in the bin path of the gem that can be used to basically copy files from a template folder into a new folder where the user will develop their own gem.
The problem I'm having is that the template folder has a gemspec file named $name$.gemspec with similarly named classes/modules in the file (e.g.: module $Name$), where the $name$ gets replaced with a name provided by the user.
Unfortunately, when I run bundle install from my gem's top-most path, I get an error:
There was a SyntaxError while evaluating $name$.gemspec:
C:/my_gem/template/$name$.gemspec:8: syntax error, unexpected tGVAR
gem.version = MyGem::$Name$::VERSION
It looks like Bundler is using the wrong Gemfile, even if I explicitly pass the Gemfile or path via one of the following:
bundle install --gemfile=Gemfile
bundle install --path=C:\my_gem
I also tried updating the gemspec line of my Gemfile to no avail:
gemspec name: 'my_gem'
Lastly, I've ensured that the template folder isn't even included in my_gem.gemspec, but that doesn't seem to matter:
gem.files = Dir.glob("lib/**/*") + %w(LICENSE.txt README.md)
Does anyone know why Bundler is trying to read the ./template/$name$.gemspec instead of ./my_gem.gemspec?
Inspecting the Bundler source, I may have spotted the culprit in lib/bundler/source/path.rb. There's GLOB used to find gemspecs in load_spec_files. The default glob is "{,*,*/*}.gemspec". This will find *.gemspec in the root directory of your gem or any directory one descendant from root (which will include your template dir).
If this is indeed the culprit, you could work around this by placing your template directory deeper in your gem's dir hierarchy or changing the name of the template file so it doesn't end in .gemspec. The Bundler::Source::Pathobject looks like it can take a different glob at initilization but I haven't dug deep enough to see if there's a viable way to specify this alternative glob in bundle execution via config or cmdline options.