开发者

Tell Netbeans it's a Ruby file

I've got a file named Vagrantfile and it开发者_如何学编程's a ruby file but it cannot have the .rb at the end of the filename.

Is there a way to tell Netbeans that it's Ruby file?


Right-click the file in Files view (Ctrl-Shift-2 or -Shift-2) and look for "Open As...". When the context menu opens, select "text/x-ruby". Note that this works only when a file type is not detected automatically.
There is a caveat with this: Once a file w/o extension is opened as Ruby file, it treats all files w/o extension as Ruby files.


I was wondering this myself today, and came up with this:

# Vagrantfile.rb
Vagrant::Config.run do |config|
  config.vm.box = "base"
  # ...
end

and

# Vagrantfile
require "Vagrantfile.rb"

It's just Ruby after all!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜