【问题标题】:Githug Gem Level IssueGithub 宝石级别问题
【发布时间】:2013-12-04 06:37:22
【问题描述】:

我正在为 Githug gem 写一个关卡,这是一个教 github 的游戏 https://github.com/Gazler/githug

我分叉/克隆了 repo 并创建了一个名为“delete_branch”的级别:

difficulty 2

description "You have created too many branches for your project. There is an old branch in your repo called 'delete_me', you should delete it."

setup do
  repo.init
  FileUtils.touch("README")
  repo.add "README"
  repo.commit_all("Initial commit")
  repo.git.native :checkout, {"b" => true}, 'delete_me'
  repo.git.native :checkout, {}, 'master'
end

solution do
 return true unless repo.branches.map(&:name).include?('delete_me')
end

hint do
  puts "Running 'git --help branch' will give you a list of branch commands."
end

我无法弄清楚如何对其进行测试,并且很难在我的本地计算机上运行关卡。这是我的分叉仓库的链接:

https://github.com/smilansky/githug

这是我的第一个开源贡献,任何帮助将不胜感激。

【问题讨论】:

    标签: ruby github open-source gem


    【解决方案1】:

    据我所知,您可以调用 ruby​​ 之类的 ruby -Ilib bin/githug 来调整 ruby​​ 在哪里寻找“包含”(把它想象成 ruby​​ 在哪里寻找它的“必需”模块)。

    由于 githug 将创建一个目录,您将在其中 cd,您的调用实际上可能看起来像 ruby -I../lib/ ../bin/githug 。我确信有更复杂的解决方案将 gem 安装在单独的环境或类似的环境中。

    Otoh,githug github page/ its README 非常清楚地说明了如何测试关卡(请阅读到最后...)。

    【讨论】:

      【解决方案2】:

      @Felix,谢谢,我能弄明白 - README 声明使用不存在的加载命令,但其他贡献者正在使用重置命令。在 githug 目录中,我需要传入完整路径:

      githug reset ~/documents/programming/open_source/githug_project/githug/levels/delete_branch.rb
      

      我昨晚提交了拉取请求,Gazler 已经回复了我:)

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-01-18
        • 2016-03-23
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多