This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# encoding utf-8 | |
require 'bunny' | |
STDOUT.sync = true | |
conn = Bunny.new(host: 'rmq', user: 'guest', pass: 'guest') | |
conn.start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# encoding utf-8 | |
require 'bunny' | |
require 'logger' | |
require 'redis' | |
logger = Logger.new(STDOUT) | |
STDOUT.sync = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# encoding utf-8 | |
require 'bunny' | |
require 'json' | |
STDOUT.sync = true | |
conn = Bunny.new(host: 'rmq', user: 'guest', pass: 'guest') | |
conn.start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
gem 'bunny' | |
gem 'redis' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let(:factories) do | |
ROM::Factory.configure do |config| | |
config.rom = MAIN_CONTAINER | |
end | |
end | |
before do | |
factories.define(:post) do |f| | |
f.url { fake(:internet, :url, 'example.com') } | |
f.se_post false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CreateCompany < ROM::Commands::Create[:sql] | |
relation :companies | |
register_as :create | |
result :one | |
use :timestamps | |
timestamp :created_at, :updated_at | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Companies < ROM::Relation[:sql] | |
schema(:companies, infer: true) do | |
associations do | |
has_many :posts | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ROM::SQL.migration do | |
change do | |
create_table :companies do | |
primary_key :id | |
column :name, String, null: false | |
column :domain, String, null: false | |
column :state, String, null: false, default: 'running' | |
column :created_at, DateTime | |
column :updated_at, DateTime | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require_relative 'boot' | |
require 'rom/sql/rake_task' | |
namespace :db do | |
task :setup do | |
configuration = ROM::Configuration.new(:sql, "mysql2:///#{CONFIG['db']['name']}", CONFIG['db']) | |
ROM::SQL::RakeSupport.env = configuration | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require_relative 'boot' | |
db_config = { | |
name: 'rom_app_development', | |
host: 'db', | |
user: 'root', | |
password: '', | |
port: 3306, | |
encoding: 'utf8mb4' |
NewerOlder