小编Phi*_*man的帖子

忽略GEM,因为它的扩展未构建

在我的工作和家用计算机上,我最近使用了将Ruby升级到2.3.1 ruby-install.我chruby用作我的Ruby切换器.

我开始在终端看到这个警告:

Ignoring bcrypt-3.1.11 because its extensions are not built.  Try: gem pristine bcrypt --version 3.1.11
Ignoring bcrypt-3.1.10 because its extensions are not built.  Try: gem pristine bcrypt --version 3.1.10
Ignoring binding_of_caller-0.7.2 because its extensions are not built.  Try: gem pristine binding_of_caller --version 0.7.2
Ignoring byebug-9.0.5 because its extensions are not built.  Try: gem pristine byebug --version 9.0.5
Ignoring byebug-5.0.0 because its extensions are not built.  Try: gem pristine byebug --version 5.0.0
Ignoring concurrent-ruby-ext-1.0.2 because its …
Run Code Online (Sandbox Code Playgroud)

ruby rubygems chruby

109
推荐指数
7
解决办法
4万
查看次数

Rails 7 - 将 daisyUI 与 importmap-rails 结合使用

我正在尝试构建一个新的 Rails 7 项目,测试 Hotwire 和一些新的默认内容。我对抛弃 Webpacker(也许还有 React)的想法感到很兴奋。但我无法弄清楚如何让 daisyUI 与新工具链中的 Tailwind 一起工作。

我用创建了该应用程序--css tailwind。我跑了./bin/importmap pin daisyui,这给config/importmap.rb. 我添加require("daisyui")到插件数组中config/tailwind.config.js.

但是当我跑步时./bin/dev,我得到这个:

13:30:55 web.1  | started with pid 36044
13:30:55 css.1  | started with pid 36045
13:30:56 web.1  | => Booting Puma
13:30:56 web.1  | => Rails 7.0.2.3 application starting in development
13:30:56 web.1  | => Run `bin/rails server --help` for more startup options
13:30:56 web.1  | Puma starting in single mode...
13:30:56 …
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails tailwind-css ruby-on-rails-7 daisyui

4
推荐指数
1
解决办法
3200
查看次数

Haml 多行用于很长的 html 属性

我和我的编码伙伴今天花了很多时间试图弄清楚如何重构具有很长属性的链接以使其成为多行:

%a.pull-right{ href: "#", "data-html" => "true", rel: "tooltip", 
  "data-placement" => "left", title: "This is really just so much text. The real thing goes on and on and on, much longer than this. It also contains some line breaks.<br><br>We'd really like to be able to wrap it around so it's readable in the code." }
Run Code Online (Sandbox Code Playgroud)

多行字符串文档中列出的管道方法 ( + |) 似乎在这种情况下不起作用。我们能想到的最易读的解决方案是:

:ruby
  tooltip_text = %Q(
    This is really just so much text. The real thing goes on and on 
    and …
Run Code Online (Sandbox Code Playgroud)

ruby haml ruby-on-rails

2
推荐指数
1
解决办法
1911
查看次数

如何在 rake 任务中调用 RSpec?

我们编写了一些必要的测试,但速度很慢。所以我们配置了 RSpec 来排除它们,除了在 Solano 上,我们设置了一个 ENV 变量。

# spec_helper
unless ENV['RUN_ALL_TESTS'] == 'true'
  config.filter_run_excluding :slow
end
Run Code Online (Sandbox Code Playgroud)

这是可行的,但我正在尝试编写一个 rake 任务,我们可以调用它通过设置相同的 ENV 变量然后运行套件来在本地运行每个测试。我在弄清楚如何触发 RSpec 时遇到了麻烦。这就是我现在所拥有的:

# all_tests.rake
require 'rspec/core/rake_task'

desc 'Run all tests, even those usually excluded.'
task all_tests: :environment do
  ENV['RUN_ALL_TESTS'] = 'true'
  RSpec::Core::RakeTask.new(:spec)
end
Run Code Online (Sandbox Code Playgroud)

当我运行它时,它不运行任何测试。

我发现的大部分内容都是用于在测试中触发 rake 任务、测试 rake 任务或设置 Rakefile。我们正在使用rspec-rails,我们的默认 rake 任务已经设置。

ruby rake rspec ruby-on-rails

1
推荐指数
1
解决办法
1801
查看次数