Jruby和Cucumber / Cucumber Rails - 无法找到发电机黄瓜:安装 [英] Jruby and Cucumber / Cucumber Rails - Could not find generator cucumber:install

查看:172
本文介绍了Jruby和Cucumber / Cucumber Rails - 无法找到发电机黄瓜:安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

虽然我经常来这里为解决方案,但这是我的第一篇文章!



问题:
$ b

尝试运行rails generate cucumber:install
我收到错误:找不到生成器cucumber:install



注意:在Windows上使用纯Ruby时,我已经成功配置了黄瓜,但由于对java库的依赖和Jruby的需求而不得不改变...



背景:设置需要Windows和Java 6的测试电脑。




  • 使用Windows XP

  • 下载并安装了Jruby 1.7.9

  • 下载了Ruby Dev Kit 4.5.2(32位)

  • 使用jruby

    -S gem install x

  • 为项目安装了所需的gem(以前在普通ruby上运行)


  • 尝试进行黄瓜安装以便生成所需的工件。



已安装的gem列表:jruby -S gem list --local

* LOCAL GEMS *




  • actionmailer >
  • actionpack(4.0.2)

  • activemodel(4.0.2)


  • activerecord-deprecated_finders(1.0.3)

  • activerecord-jdbc适配器(1.3.3)

  • activerecord -jdbcsqlite3-adapter(1.3.3)

  • activesupport(4.0.2)

  • arel(4.0.1)

  • 原子(1.1.14 java)

  • builder(3.2.2,3.1.4)

  • / li>



  • 2.2.0)

  • coffee-script-source(1.6.3)

  • 黄瓜(1.3.10)

  • cucumber-rails(1.4.0)

  • diff-lcs(1.2.5)

  • erubis >
  • execjs(2.0.2)

  • gherkin(2.12.2 java)

  • / li>

  • jbc-sqlite3(3.7。 2.1)

  • jquery-rails(3.0.4)

  • jruby-win32ole(0.8.5)

  • json(1.8.1 java)

  • mail(2.5.4)

  • mime-types(1.25.1)

  • mini_portile(0.5.2)

  • minitest(4.7.5)

  • multi_json(1.8.2)
    multi_test (0.0.2)

  • nokogiri(1.6.0 java)

  • polyglot(0.3.3)

  • rack(1.5.2)

  • rack-test(0.6.2)

  • rails(4.0.2)

  • railties(4.0.2)

  • rake(10.1.0)

  • rdoc(3.12.2)

  • ruby​​gems-update(2.1.11)

  • sass(3.2.12)

  • / li>



  • 1)

  • therubyrhino(2.0.2)

  • therubyrhino_jar(1.7.4)

  • .1)

  • thread_safe(0.1.3 java)

  • tilt(1.4.1)

  • (1.4.15)

  • turbolinks(2.0.0)

  • tzinfo(0.3.38)

  • uglifier(2.3.2)

  • xpath(2.0.0)



b

  • 控制器

  • 发电机

  • 助手

  • integration_test

  • jbuilder

  • mailer

  • 迁移

  • 资源




  • coffee:assets

  • Jdbc:

  • jdbc

  • Jquery:

  • jquery:install

  • Js:

  • js:assets

  • TestUnit:

  • test_unit:plugin



  • -rails生成器添加到rails生成器列表中?



    我搜索论坛,没有提出答案,请尝试帮助回答问题和不要只是张贴网址到另一篇文章/论坛,因为这看起来不是重复的。



    您的帮助将不胜感激!



    按照要求 - 这里是rails generate project_name创建的项目目录中的Gemfile



      source'https://rubygems.org'

    #Bundle edge Rails改为:gem'rails',github:'rails / rails'
    gem' ,'4.0.2'

    #使用jdbcsqlite3作为活动记录的数据库
    gem'activerecord-jdbcsqlite3-adapter'

    #使用SCSS样式表
    gem'sass-rails','〜> 4.0.0'

    #使用Uglifier作为JavaScript资源的压缩器
    gem'uglifier','> = 1.3.0'

    #使用CoffeeScript。 js.coffee assets and views
    gem'coffee-rails','〜> 4.0.0'

    #查看https://github.com/sstephenson/execjs#readme以获得更多支持的运行时
    gem'therubyrhino'

    #使用jquery作为JavaScript库
    gem'jquery-rails'

    #Turbolinks使您的Web应用程序中的以下链接更快。阅读更多:https://github.com/rails/turbolinks
    gem'turbolinks'

    #轻松构建JSON API。阅读更多:https://github.com/rails/jbuilder
    gem'jbuilder','〜> 1.2'

    group:doc do
    #bundle exec rake doc:rails在doc / api下生成API。
    gem'sdoc',require:false
    end

    #使用ActiveModel has_secure_password
    #gem'bcrypt-ruby','〜> 3.1.2'

    #使用unicorn作为应用服务器
    #gem'unicorn'

    #使用Capistrano进行部署
    #gem'capistrano' ,group::development

    注意:我还是新到这个Jruby / Ruby和黄瓜,

    解决方案

    问题与Jruby没有设置 GEM_HOME GEM_PATH 变量,它们没有在Jruby安装上默认设置。
    要修复,这将需要您的ruby安装的gem位置(运行gem env找到GEM PATHS)。在我的特殊情况下,这是: c:\jruby-1.7.9 / lib / ruby​​ / gems / shared



    创建系统变量



    此后,项目目录中的Gemfile需要手动更新才能包含以下行:

      gem'cucumber-rails'

    注意:我还添加了黄瓜的好的措施如下在Gemfile中。

      gem'cucumber'

    然后运行:

      bundle install 

    然后安装cucumber:

      rails generate cucumber:install 

    A特别感谢Gregory的支持,虽然这不是完整的解决方案,他提供了一些关键步骤在修复环境后需要。


    Although I've often come here for solutions, however this is my first post!

    Problem:

    When trying to run "rails generate cucumber:install" I receive the error: Could not find generator cucumber:install

    Note: When using plain Ruby on Windows I have managed to successfully configure cucumber, but had to change because of the dependency on java libraries and requirement for Jruby...

    Background: Setting up a testing pc that requires Windows and Java 6.

    • Using Windows XP
    • Downloaded and installed Jruby 1.7.9
    • Downloaded Ruby Dev Kit 4.5.2 (32 bit)
    • installed the required gems for the project (which worked previously on plain ruby) using "jruby
      -S gem install x"
    • generated a new rails project
    • Did the necessary bundle init and bundle install
    • Get stuck trying to do the cucumber install for the project to generate the required artifacts.

    List of installed gems: "jruby -S gem list --local"

    * LOCAL GEMS *

    • actionmailer (4.0.2)
    • actionpack (4.0.2)
    • activemodel (4.0.2)
    • activerecord (4.0.2)
    • activerecord-deprecated_finders (1.0.3)
    • activerecord-jdbc-adapter (1.3.3)
    • activerecord-jdbcsqlite3-adapter (1.3.3)
    • activesupport (4.0.2)
    • arel (4.0.1)
    • atomic (1.1.14 java)
    • builder (3.2.2, 3.1.4)
    • bundler (1.3.5)
    • capybara (2.2.0)
    • coffee-rails (4.0.1)
    • coffee-script (2.2.0)
    • coffee-script-source (1.6.3)
    • cucumber (1.3.10)
    • cucumber-rails (1.4.0)
    • diff-lcs (1.2.5)
    • erubis (2.7.0)
    • execjs (2.0.2)
    • gherkin (2.12.2 java)
    • hike (1.2.3)
    • i18n (0.6.9)
    • jbuilder (1.5.3)
    • jdbc-sqlite3 (3.7.2.1)
    • jquery-rails (3.0.4)
    • jruby-win32ole (0.8.5)
    • json (1.8.1 java)
    • mail (2.5.4)
    • mime-types (1.25.1)
    • mini_portile (0.5.2)
    • minitest (4.7.5)
    • multi_json (1.8.2) multi_test (0.0.2)
    • nokogiri (1.6.0 java)
    • polyglot (0.3.3)
    • rack (1.5.2)
    • rack-test (0.6.2)
    • rails (4.0.2)
    • railties (4.0.2)
    • rake (10.1.0)
    • rdoc (3.12.2)
    • rubygems-update (2.1.11)
    • sass (3.2.12)
    • sass-rails (4.0.1)
    • sdoc (0.3.20)
    • sprockets (2.10.1)
    • sprockets-rails (2.0.1)
    • therubyrhino (2.0.2)
    • therubyrhino_jar (1.7.4)
    • thor (0.18.1)
    • thread_safe (0.1.3 java)
    • tilt (1.4.1)
    • treetop (1.4.15)
    • turbolinks (2.0.0)
    • tzinfo (0.3.38)
    • uglifier (2.3.2)
    • xpath (2.0.0)

    List of Generators:

    • Rails:
    • assets
    • controller
    • generator
    • helper
    • integration_test
    • jbuilder
    • mailer
    • migration
    • model
    • resource
    • scaffold
    • scaffold_controller
    • task
    • Coffee:
    • coffee:assets
    • Jdbc:
    • jdbc
    • Jquery:
    • jquery:install
    • Js:
    • js:assets
    • TestUnit:
    • test_unit:plugin

    So how can I get the cucumber-rails generator to be added to the rails generator list?

    I have searched forums and have not come up with an answer, please try to the assist in answering the questions and not simply post a url to another article/forum, as this does not appear to be a duplicate.

    Your help would be appreciated!

    As requested - here is the Gemfile from the project directory created by "rails generate project_name"

    source 'https://rubygems.org'
    
    # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
    gem 'rails', '4.0.2'
    
    # Use jdbcsqlite3 as the database for Active Record
    gem 'activerecord-jdbcsqlite3-adapter'
    
    # Use SCSS for stylesheets
    gem 'sass-rails', '~> 4.0.0'
    
    # Use Uglifier as compressor for JavaScript assets
    gem 'uglifier', '>= 1.3.0'
    
    # Use CoffeeScript for .js.coffee assets and views
    gem 'coffee-rails', '~> 4.0.0'
    
    # See https://github.com/sstephenson/execjs#readme for more supported runtimes
    gem 'therubyrhino'
    
    # Use jquery as the JavaScript library
    gem 'jquery-rails'
    
    # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
    gem 'turbolinks'
    
    # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
    gem 'jbuilder', '~> 1.2'
    
    group :doc do
      # bundle exec rake doc:rails generates the API under doc/api.
      gem 'sdoc', require: false
    end
    
    # Use ActiveModel has_secure_password
    # gem 'bcrypt-ruby', '~> 3.1.2'
    
    # Use unicorn as the app server
    # gem 'unicorn'
    
    # Use Capistrano for deployment
    # gem 'capistrano', group: :development
    

    Note: I am still new to this Jruby/Ruby and cucumber, so not yet sure what to look for.

    解决方案

    The problem was related to Jruby not setting the GEM_HOME and GEM_PATH variables, they were not set by default on the Jruby install. To fix, this you will need the gem location for your ruby installation (run "gem env" to find the GEM PATHS). In my particular case this was: c:\jruby-1.7.9/lib/ruby/gems/shared

    Create the System Variables for both GEM_HOME and GEM_PATH and set the value to the path you found above.

    Thereafter the Gemfile in the project directory required a manual update to include the line:

    gem 'cucumber-rails'
    

    Note: I also added cucumber for good measure as below in the Gemfile.

    gem 'cucumber' 
    

    Then run:

    bundle install
    

    Then install cucumber:

    rails generate cucumber:install  
    

    A Special thanks to Gregory for his support, although it was not the complete solution, he provided some key steps that were required after fixing the Environment.

    这篇关于Jruby和Cucumber / Cucumber Rails - 无法找到发电机黄瓜:安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆