Search code examples
ruby-on-railsjmeterruby-jmeter

Creating a simple ruby project


Creating a ruby project

I am trying to create a simple ruby project to use the rubygem and ruby-jmeter, but unsure on how to proceed further. Below is the github of project. https://github.com/flood-io/ruby-jmeter

//Below is my test.rb

require 'rubygems'
require 'ruby-jmeter'

test do
  threads count: 10 do
    visit name: 'Google Search', url: 'http://google.com'
  end
end.jmx

How can i creating a ruby project with needed gems, Its not a rails application.... a simple ruby project.


Solution

  • Well the way I would do it is first create a folder for your project and then run:

    bundle init
    

    Edit the Gemfile that was just created and make it look like this

    # A sample Gemfile
    source "https://rubygems.org"
    
    gem "ruby-jmeter"
    

    After this you run

    bundle install
    

    From now on you can run your ruby app with a bundle exec and it loads all the gems from your Gemfile. In addition to this if you provide a path like bundle exec --path vendor/bundle it will install the gems locally to the project so you keep the dependencies independent of your global ruby installation.