Skip to content

Instantly share code, notes, and snippets.

View MaksimenkoPG's full-sized avatar

Maksimenko Pavel MaksimenkoPG

  • [d.i.p]team
  • Luxembourg
View GitHub Profile
# bin/console
PrintRepositoryInfo.perform(url: 'https://api.github.com/repos/rails/rails')
chmod +x bin/console
#!/usr/bin/env ruby
require 'irb'
require_relative File.join(File.dirname(File.expand_path(__dir__)), 'config/application')
def reload!
puts Application.load_libs
end
IRB.start
rake print_repository_info repository_url=https://api.github.com/repos/rails/rails
# lib/tasks/print_repository_info.rake
desc 'Print repo info, usage: rake print_repository_info repository_url=repository_url'
task print_repository_info: :environment do
PrintRepositoryInfo.perform url: ENV['repository_url']
end
# Rakefile
task :environment do
require_relative 'config/application'
end
Dir.glob('lib/tasks/**/*.rake').each { |file_path| load file_path }
desc 'Foo'
task foo: :environment do
...
end
# irb
require_relative 'config/application'
PrintRepositoryInfo.perform(url: 'https://api.github.com/repos/rails/rails')
# config/boot.rb
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
require 'bundler/setup' # Set up gems listed in the Gemfile.