Is it possible to use nokogiri in rhodes framework? - nokogiri

I want to use nokogiri for my rhodes mobile application. I got an error like
Error: no such file to load --nokogiri.
How can i use nokogiri in rhodes ?

I would imagine (though I haven't used Rhodes properly myself) that due to the way it is written, gems that include C extensions, like Nokogiri, would not work on Rhodes.
Rhodes apparently includes both the Ruby standard ReXML as well as a lightweight implementation called RhoXML. I did find this link that might help: http://wiki.rhomobile.com/index.php/RhodesExtensions#XML_handling.

I went through the full exercise of trying to use nokogiri when I found a bug in REXML that I didn't want to use the workaround for. I was unsuccessful in adding the library. (I got it to the point where it would load, but every single parsed document returned nil.)
According to the developers who watch http://groups.google.com/group/rhomobile , they do not support nokogiri on the device -- only on the RhoSync platform.

Related

Is it possible to use piwik with Rails 4.2 and postgres

I am looking for an open source web analytic for my Rails 4.2 app, so after some research I found that piwik fit my needs. can I use "piwik" with postgresql ? it seems that they only support mysql but I am not sure if it still true at this moment!
also I've found a post about how to integrate it within Rails here but they use piwik_analytics which is a Gem for Ruby on Rails 3.x and may not work with 4.2 !
All the information I've found are a little outdated and I am not sure if there is a way to make it work with my current requirements. any help please ?
Piwik supports only MySQL, that's true
You don't need any gem because Piwik just needs to load some Javascript that needs to be embedded into your layout/views. The Rails app doesn't directly interact with it, only your visitors' browser. Which also means that it shouldn't matter whether it supports Postgres because it will most likely run on another machine as your Rails app.
Edit:
Regarding the gem you mentioned: I looked at it, too, when adding Piwik analytics to my app, but in the end went with writing the few required lines of JS myself.

Alternative to turn gem for rails MiniTest

I've recently upgraded to Rails 4.2.0 and MiniTest ~> 5, and that broke the Turn gem. I noticed that it is no longer being maintained due to the developers getting fed up with API changes https://github.com/turn-project/turn , so I pulled it out of my project.
I'm really missing the better test output that Turn provided. What are some great alternatives to get customizable, colorized, well-structured MiniTest output?
Take a look at minitap and tapout - it's not a simple plug-and-play gem like turn was, but you can get it very nice with a bit of trial and error.

How to make cucumber-rails use watir-webdriver instead of Capybara

I have been searching for a simple answer to this for a few days and can't seem to find an one, on either stackoverflow.com or google. So, firstly, if this is answered elsewhere please point me in the correct direction.
So, I have a relatively new Rails 3 project using the cucumber-rails gem. I am relatively new to Rails but have experience in Ruby and other web frameworks such as Sinatra and Ramaze. My understanding is that out of the box, cucumber-rails uses Capybara for interacting with the web application and somehow does this without starting the rails server. It somehow interacts with rack to simulate the requests. Not sure if I have that entirely correct but I'm pretty sure it does not need a running rails server.
I am not a great fan of the Capybara DSL and I much prefer watir-webdriver which I have used in a few non rails projects (and non Ruby projects even). However, I have not been able to find anywhere to show me how to swap out Capybara for watir-webdriver.
So my questions are these:
Does the cucumber-rails gem have the ability to swap Capybara out for watir-webdriver?
If so, what is the best way to do this?
If not, does that mean I need to ditch cucumber-rails and just set cucumber with watir-webdriver up in my project manually?
Well, it doesn't look hopeful from the project description:
Rails Generators for Cucumber with special support for Capybara and DatabaseCleaner
And sure enough, it explicitly, unconditionally, loads Capybara here
I think that means that you're going to need to hook it up yourself.
Having said that, I don't think there's anything stopping you from installing the gem, running rails g cucumber:install, and then replacing the Capybara-specific bits in the files it produces.

Automatic identification of Ruby Gems no longer in use within Rails

Is it possible to automatically identify Ruby gems that are no longer in use within a Rails project?
For example if a fellow developer added gem 'nokogiri' to the Gemfile, for a piece of functionally, but the code that depended on that gem has now been removed. I am looking to port my entire project to jRuby so removing the gems that we no longer seems a very sensible starting point.
Thanks
Usually gems are used in a specific way, so for each one you will have to look for patterns manually.
For example, if I had to figure if Nokogiri is being used, I'd use git grep to find Nokogiri occurrences (I assume you use git):
git grep Nokogiri
If nothing is returned, you are probably not using it.
Another way is, if you have a test suite, is just to remove it and see if something breaks. Not foolproof, but if you have good tests it should be a pretty safe path.
On rubyforge there is a gem called gem_unused. It adds an 'unused' command to 'gem'. However, I am not able to test this as it seems to be failing on my system. (I'm new to the rails world so maybe this is an issue someone else could troubleshoot. I filed an issue on it on the maintainer's github)

Advice on HTTPS connections using Ruby on Rails

Since I am developing a "secure" OAuth protocol for my RoR3 apps, I need to send protected information over the internet, so I need to use HTTPS connections (SSL/TSL). I read How to Cure Net::HTTP’s Risky Default HTTPS Behavior aticle that mentions the 'always_verify_ssl_certificates' gem, but, since I want to be more "pure" (it means: I do not want to install other gems, but I try to do everything with Ruby on Rails) as possible, I want to do that work without installing new gems.
I read about 'open_uri' (it is also mentioned in the linked article: "open_uri is a common exception - it gets things right!") that is from the Ruby OOPL and I think it can do the same work.
So, for my needs, is 'open_uri' the best choice (although it is more complicated of 'always_verify_ssl_certificates' gem)? If so, can someone help me using that (with an example, if possible) because I have not found good guides about?
You should find the best tool for the job and use it. You should not try to limit your usage of libraries to just Rails and the Ruby standard library, because these two alone will not always provide you with everything you need. As you have indicated, you found the right tool for the job - don't reject it just because it's not part of "official" Ruby or Rails.
You can easily manage which gems your application needs with Bundler, such that everyone on the team is, with a single command, always able to install and run the application, including automatically installing all gem dependencies. Rails 3, by default, integrates with Bundler and expects that you will use Bundler to manage all your gem dependencies.

Resources