load-path

JRuby loadpath messed up

人走茶凉 提交于 2020-01-16 19:01:26
问题 I am embedding JRuby on a JAR file and it's being used by a EAR file that I am deploying to WebSphere. When I call the class from my workspace, it works fine, however when I call it inside WebSphere, here's what I get: [3/31/11 11:21:15:984 BRT] 00000042 SystemErr R classpath:/lib/xmlcompare.rb:4:in `require': no such file to load -- rubygems (LoadError) from classpath:/lib/xmlcompare.rb:4 from classpath:/lib/xmlcompare.rb:1:in `require' from <script>:1 After some research, I noticed that

gulp-sass work around for load_path support?

烂漫一生 提交于 2019-12-21 04:11:36
问题 Problem: I'm using gulp-sass and would like to define a load_path so that I don't have to have really long @import rules voor bower dependencies e.g. @import "normalize" instead of @import "../../../../../bower_components/bootstrap-sass/assets/stylesheets/bootstrap/normalize" What is the best way to i achieve this when using gulp-sass which uses the LibSass engine to process sass files? 回答1: After struggling with this myself I found a option in gulp-sass : sass({ includePaths: ['./bower

How to refer a local gem in ruby?

一曲冷凌霜 提交于 2019-12-20 23:23:58
问题 I pack some ruby code into a gem. I want to refer the code in the gem in some other code. So in the Gemfile I specify the gem's name, version, and local path. Like: gem 'gemname','0.x', :path => 'RELATIVE_PATH_TO_GEM_FILE' After bundle install, I see Using gemname (0.x) from source at RELATIVE_PATH_TO_GEM_FILE But when I run the code, it can't find the code in the gem. LOAD_PATH shows ABSOLUTE_PATH_TO_GEM_FILE/lib. No wonder it can't find the code, there's only gem file under ABSOLUTE_PATH_TO

Why does Ruby 1.9.2 remove “.” from LOAD_PATH, and what's the alternative?

孤人 提交于 2019-12-16 20:43:19
问题 The latest changesets to Ruby 1.9.2 no longer make the current directory . part of your LOAD_PATH . I have a non-trivial number of Rakefiles that assume that . is part of the LOAD_PATH , so this broke them (they reported "no such file to load" for all require statements that based off the project path). Was there a particular justification for doing this? As for a fix, adding $: << "." everywhere works, but seems incredibly hacky and I don't want to do that. What's the preferred way to make

Organization of Locale Files in rails app

无人久伴 提交于 2019-12-06 17:15:24
问题 I currently have the following 4 files in my config/locales of my root application: -en.yml -de.yml -simple_form.en.yml -simple_form.de.yml In my application.rb which resides in a spec/dummy folder for testing the application gem I have the following line of code which seems to be retrieving the translations as expected: # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to

what is “$:” in ruby?

允我心安 提交于 2019-12-04 17:31:48
问题 Usually be seen in .gemspec file. eg. i18n.gemspec. $: << File.expand_path('../lib', __FILE__) 回答1: Pre-defined variables $! The exception information message set by 'raise'. $@ Array of backtrace of the last exception thrown. $& The string matched by the last successful match. $` The string to the left of the last successful match. $' The string to the right of the last successful match. $+ The highest group matched by the last successful match. $1 The Nth group of the last successful match.

what is “$:” in ruby?

匆匆过客 提交于 2019-12-03 11:22:58
Usually be seen in .gemspec file. eg. i18n.gemspec . $: << File.expand_path('../lib', __FILE__) Pre-defined variables $! The exception information message set by 'raise'. $@ Array of backtrace of the last exception thrown. $& The string matched by the last successful match. $` The string to the left of the last successful match. $' The string to the right of the last successful match. $+ The highest group matched by the last successful match. $1 The Nth group of the last successful match. May be > 1. $~ The information about the last match in the current scope. $= The flag for case insensitive

How to refer a local gem in ruby?

泪湿孤枕 提交于 2019-12-03 07:31:16
I pack some ruby code into a gem. I want to refer the code in the gem in some other code. So in the Gemfile I specify the gem's name, version, and local path. Like: gem 'gemname','0.x', :path => 'RELATIVE_PATH_TO_GEM_FILE' After bundle install, I see Using gemname (0.x) from source at RELATIVE_PATH_TO_GEM_FILE But when I run the code, it can't find the code in the gem. LOAD_PATH shows ABSOLUTE_PATH_TO_GEM_FILE/lib. No wonder it can't find the code, there's only gem file under ABSOLUTE_PATH_TO_GEM_FILE. it's not unpacked. So there's no lib directory. if I gem install that gem file into my

how to distribute a ruby script via homebrew

喜你入骨 提交于 2019-12-01 12:11:14
How can I deploy a simple ruby script via homebrew? Here's what I tried Wrote formula in a GitHub repo named homebrew-foo # file https://github.com/foo/homebrew-foo/blob/master/foo.rb class Foo < Formula desc "A command line tool" url "https://github.com/foo/foo/archive/master.zip" version "5.0.1" def install bin.install "foo" lib.install Dir["lib/*"] end end The other repository contains the ruby script. These are the files ./foo ./lib/libfile1.rb here's what the script does #!/usr/bin/env ruby require './lib/libfile1.rb' puts "came here" The problem is that the require fails. $ brew install

how to distribute a ruby script via homebrew

余生长醉 提交于 2019-12-01 10:36:36
问题 How can I deploy a simple ruby script via homebrew? Here's what I tried Wrote formula in a GitHub repo named homebrew-foo # file https://github.com/foo/homebrew-foo/blob/master/foo.rb class Foo < Formula desc "A command line tool" url "https://github.com/foo/foo/archive/master.zip" version "5.0.1" def install bin.install "foo" lib.install Dir["lib/*"] end end The other repository contains the ruby script. These are the files ./foo ./lib/libfile1.rb here's what the script does #!/usr/bin/env