repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
sonots/triglav | app/serializers/job_message_each_serializer.rb | class JobMessageEachSerializer < ActiveModel::Serializer
attributes :id,
:job_id,
:time,
:timezone
include Swagger::Blocks
swagger_schema :JobMessageEachResponse do
property :id do
key :type, :integer
key :format, :int64
end
property :job_id do
key :type, :integer
... |
sonots/triglav | app/models/settings.rb | # NOTE: This file would be `require`ed by unicorn.rb before loading rails
require 'settingslogic'
class Settings < Settingslogic
source File.expand_path("../../config/settings.yml", __dir__)
namespace defined?(Rails) ? Rails.env : ENV['RACK_ENV'] # unicorn -E RACK_ENV
end
|
sonots/triglav | lib/triglav/error/not_authorized.rb | <reponame>sonots/triglav
module Triglav
module Error
class NotAuthorized < Triglav::Error::StandardError
def initialize
@code = 403
@message = "Not authorized."
end
end
end
end
|
sonots/triglav | app/controllers/api/v1/auth_controller.rb | <filename>app/controllers/api/v1/auth_controller.rb<gh_stars>1-10
module Api
module V1
class AuthController < ApplicationController
include Swagger::Blocks
before_action :authenticate!, only: [:destroy, :me]
swagger_path '/auth/token' do
operation :post do
key :description, '... |
sonots/triglav | app/serializers/aggregated_resource_each_serializer.rb | class AggregatedResourceEachSerializer < ActiveModel::Serializer
attributes :uri, :unit, :timezone, :span_in_days
include Swagger::Blocks
swagger_schema :AggregatedResourceEachResponse do
property :uri do
key :type, :string
key :description, "resource uri"
end
property :unit do
key... |
sonots/triglav | spec/requests/api/v1/auth_spec.rb | <gh_stars>1-10
# coding: utf-8
require 'rails_helper'
RSpec.describe 'Auth', :type => :request do
describe "Get token", :autodoc do
let(:description) do
"Returns access_token if authenticated.<br/>" \
"Authenticate with username, password registered via /api/v1/users<br/>" \
"If other APIs ar... |
sonots/triglav | app/serializers/message_each_serializer.rb | <filename>app/serializers/message_each_serializer.rb
class MessageEachSerializer < ActiveModel::Serializer
attributes :id,
:resource_uri,
:resource_unit,
:resource_time,
:resource_timezone,
:payload,
:created_at,
:updated_at
include Swagger::Blocks
swagger_schema :MessageEachResponse... |
sonots/triglav | script/purge.rb | <reponame>sonots/triglav<filename>script/purge.rb
#!/usr/bin/env ruby
# Purge messages table
#
# $ script/purge.rb --purge-date 32 --exec
require_relative '../lib/rails_runner'
require 'optparse'
class Purge
class CLI
DEFAULT_PURGE_DATE = 32
attr_reader :opts, :args
def initialize
@opts, @args =... |
sonots/triglav | spec/requests/api/v1/jobs_spec.rb | <reponame>sonots/triglav
# coding: utf-8
require 'rails_helper'
RSpec.describe 'Job resources', :type => :request do
let(:params) do
{}
end
let(:env) do
{
'CONTENT_TYPE' => 'application/json',
'HOST' => 'triglav.analytics.mbga.jp',
'HTTP_ACCEPT' => 'application/json',
'HTTP_AUTH... |
sonots/triglav | app/serializers/job_serializer.rb | class JobSerializer < ActiveModel::Serializer
attributes :id, :uri, :logical_op, :created_at, :updated_at
has_many :input_resources
has_many :output_resources
def self.request_params(params)
params.permit(
:id, :uri,
input_resources: ResourceSerializer.request_permit_params,
output_resour... |
sonots/triglav | lib/tasks/ridgepole.rake | require "open3"
namespace :db do
def apply(argopts)
config_file = File.join("#{Rails.root}", "config", "database.yml")
schema_file = File.join("#{Rails.root}", "db", "schemas", "Schemafile")
command = "ridgepole --file #{schema_file} -c #{config_file} --ignore-table repli_chk,repli_clock #{argopts} -E #{... |
sonots/triglav | app/serializers/message_serializer.rb | class MessageSerializer < ActiveModel::Serializer
attributes :id,
:uuid,
:resource_uri,
:resource_unit,
:resource_time,
:resource_timezone,
:payload,
:created_at,
:updated_at
def self.request_params(params)
params.permit(*request_permit_params)
end
def self.request_permit_p... |
sonots/triglav | lib/triglav/error/invalid_authenticity_token.rb | module Triglav
module Error
class InvalidAuthenticityToken < Triglav::Error::StandardError
def initialize
@code = 401
@message = "Unauthenticated. Invalid or expired token."
end
end
end
end
|
exKAZUu/ParserTests | fixture/IronRuby/expected_xml/block.rb | <reponame>exKAZUu/ParserTests
<block startline="1">
<lasgn startline="1">
<Symbol>i</Symbol>
<lit startline="1">
<Fixnum>0</Fixnum>
</lit>
</lasgn>
<if startline="3">
<call startline="3">
<lvar startline="3">
<Symbol>i</Symbol>
</lvar>
<Symbol>==</Symbol>
<arg... |
exKAZUu/ParserTests | fixture/Ruby19/input_code/Block1.rb | <reponame>exKAZUu/ParserTests
i = 0
if i == 0 then p 'test' end
unless i != 0 then p 'test' end
case i
when 0
p "test"
end
while i != 0 do p 'test' end
until i == 0 do p 'test' end
for y in [] do p 'test' end
loop do p 'test' end
loop { p 'test' }
[].each do |b| p 'test' end
[].each { |b| p 'test' }
lambda do |x| ... |
exKAZUu/ParserTests | fixture/Ruby19/expected_xml/hierarchy.rb | <gh_stars>0
<block startline="1">
<class startline="1">
<Symbol>A</Symbol>
<nil />
<defn startline="2">
<Symbol>a</Symbol>
<args startline="3"></args>
<nil startline="3"></nil>
</defn>
</class>
<module startline="6">
<Symbol>B</Symbol>
<defn startline="7">
<Symbol>b... |
exKAZUu/ParserTests | fixture/Ruby19/input_code/hierarchy.rb | class A
def a
end
end
module B
def b
end
end
class C
module CC
def cc
end
end
end
class << C
def c
end
end
class << C.new
def c2
end
end
c3 = C.new
class << c3
end
def z
end
|
exKAZUu/ParserTests | fixture/Ruby19/expected_xml/ruby19.rb | <reponame>exKAZUu/ParserTests<gh_stars>0
<block startline="1">
<defn startline="1">
<Symbol>set_pixel</Symbol>
<args startline="1">
<Symbol>h</Symbol>
</args>
<attrasgn startline="3">
<call startline="3">
<ivar startline="3">
<Symbol>@field</Symbol>
</ivar>
... |
exKAZUu/ParserTests | fixture/Ruby19/input_code/fibonacci.rb | def fibonacci(n)
if (n < 2)
return n
else
return fibonacci(n - 1) + fibonacci(n - 2)
end
end
|
exKAZUu/ParserTests | fixture/Ruby18/input_code/coverage.rb | p(1, 2)
if 1 == 1
p(2)
end
stmt(); p(1)
if branch(1 == 1)
stmt(); p(2)
end |
exKAZUu/ParserTests | fixture/Ruby19/expected_xml/prime.rb | <block startline="1">
<defn startline="1">
<Symbol>prime_table</Symbol>
<args startline="1">
<Symbol>max</Symbol>
</args>
<lasgn startline="2">
<Symbol>result</Symbol>
<call startline="2">
<const startline="2">
<Symbol>Array</Symbol>
</const>
<Symbol... |
exKAZUu/ParserTests | fixture/Ruby19/expected_xml/fibonacci.rb | <gh_stars>0
<defn startline="1">
<Symbol>fibonacci</Symbol>
<args startline="1">
<Symbol>n</Symbol>
</args>
<if startline="2">
<call startline="2">
<lvar startline="2">
<Symbol>n</Symbol>
</lvar>
<Symbol><</Symbol>
<lit startline="2">
<Fixnum>2</Fixnum>
<... |
exKAZUu/ParserTests | fixture/Ruby19/input_code/student.rb | <reponame>exKAZUu/ParserTests
class Student
def initialize(name)
@name = name
end
def name()
@name
end
end
students = Array.new(2)
students[0] = Student.new('Tom')
students[1] = Student.new('Anna')
for student in students
puts student.name
end
|
exKAZUu/ParserTests | fixture/Ruby19/expected_xml/Block3.rb | <block startline="1">
<lasgn startline="1">
<Symbol>i</Symbol>
<lit startline="1">
<Fixnum>0</Fixnum>
</lit>
</lasgn>
<if startline="3">
<call startline="3">
<lvar startline="3">
<Symbol>i</Symbol>
</lvar>
<Symbol>==</Symbol>
<lit startline="3">
<Fixnu... |
exKAZUu/ParserTests | fixture/Ruby18/expected_xml/block.rb | <gh_stars>0
<block startline="1">
<lasgn startline="1">
<Symbol>i</Symbol>
<lit startline="1">
<Fixnum>0</Fixnum>
</lit>
</lasgn>
<if startline="5">
<call startline="5">
<lvar startline="5">
<Symbol>i</Symbol>
</lvar>
<Symbol>==</Symbol>
<lit startline="5">
... |
exKAZUu/ParserTests | fixture/Ruby18/input_code/block.rb | i = 0
;
;
p i if i == 0
if i == 0 then p 'c'; p 'c'; end
if i == 0 then p 'c' end
if i == 0 then end
if i == 0; p 'c'; p 'c'; end
if i == 0; p 'c' end
if i == 0; end
if i == 0
end
if i == 0
else
end
if i == 0
elsif i == 0
end
if i == 0
elsif i == 0
else
end
p i unless i == 0
unless i != 0 then p 'c'; p 'c'; end
unle... |
exKAZUu/ParserTests | fixture/Ruby19/input_code/Block2.rb | <reponame>exKAZUu/ParserTests<filename>fixture/Ruby19/input_code/Block2.rb
i = 0
if i == 0 then
p 'test'
end
unless i != 0 then
p 'test'
end
case i
when 0
p "test"
end
while i != 0 do
p 'test'
end
until i == 0 do
p 'test'
end
for y in [] do
p 'test'
end
loop do
p 'test'
end
loop {
p 'test'
}
[].... |
exKAZUu/ParserTests | fixture/Ruby19/input_code/Block4.rb | i = 0
if i == 0 then end
unless i != 0 then end
case i
when 0
p "test"
end
while i != 0 do p "test" end
until i == 0 do p "test" end
for y in [] do p "test" end
loop do p "test" end
loop { p "test" }
[].each do |b| p "test" end
[].each { |b| p "test" }
lambda do |x| p "test" end
lambda { |x| p "test" }
i = 0
if ... |
exKAZUu/ParserTests | fixture/Ruby19/expected_xml/Block1.rb | <block startline="1">
<lasgn startline="1">
<Symbol>i</Symbol>
<lit startline="1">
<Fixnum>0</Fixnum>
</lit>
</lasgn>
<if startline="3">
<call startline="3">
<lvar startline="3">
<Symbol>i</Symbol>
</lvar>
<Symbol>==</Symbol>
<lit startline="3">
<Fixnu... |
exKAZUu/ParserTests | fixture/IronRuby/expected_xml/Block3.rb | <filename>fixture/IronRuby/expected_xml/Block3.rb
<block startline="1">
<lasgn startline="1">
<Symbol>i</Symbol>
<lit startline="1">
<Fixnum>0</Fixnum>
</lit>
</lasgn>
<if startline="3">
<call startline="3">
<lvar startline="3">
<Symbol>i</Symbol>
</lvar>
<Symbol>==... |
exKAZUu/ParserTests | fixture/IronRuby/expected_xml/Block2.rb | <block startline="1">
<lasgn startline="1">
<Symbol>i</Symbol>
<lit startline="1">
<Fixnum>0</Fixnum>
</lit>
</lasgn>
<if startline="3">
<call startline="3">
<lvar startline="3">
<Symbol>i</Symbol>
</lvar>
<Symbol>==</Symbol>
<arglist startline="3">
<l... |
exKAZUu/ParserTests | fixture/IronRuby/expected_xml/ruby2ruby_test.rb | <reponame>exKAZUu/ParserTests
<block startline="1">
<lasgn startline="1">
<Symbol>i</Symbol>
<lit startline="1">
<Fixnum>0</Fixnum>
</lit>
</lasgn>
<if startline="2">
<call startline="2">
<lvar startline="2">
<Symbol>i</Symbol>
</lvar>
<Symbol>==</Symbol>
<arg... |
exKAZUu/ParserTests | fixture/Ruby19/expected_xml/sjis.rb | <filename>fixture/Ruby19/expected_xml/sjis.rb
<call startline="1">
<nil />
<Symbol>p</Symbol>
<str startline="1">
<String>ú{ê\Â\</String>
</str>
</call> |
exKAZUu/ParserTests | fixture/Ruby19/input_code/Block3.rb | i = 0
if i == 0 then end
unless i != 0 then end
case i
when 0
p "test"
end
while i != 0 do end
until i == 0 do end
for y in [] do end
loop do end
loop { }
[].each do |b| end
[].each { |b| }
lambda do |x| end
lambda { |x| }
i = 0
if i == 0 then
end
unless i != 0 then
end
case i
when 0
end
while i != 0 do
end
... |
exKAZUu/ParserTests | fixture/IronRuby/expected_xml/Block4.rb | <gh_stars>0
<block startline="1">
<lasgn startline="1">
<Symbol>i</Symbol>
<lit startline="1">
<Fixnum>0</Fixnum>
</lit>
</lasgn>
<if startline="3">
<call startline="3">
<lvar startline="3">
<Symbol>i</Symbol>
</lvar>
<Symbol>==</Symbol>
<arglist startline="3"... |
exKAZUu/ParserTests | fixture/Ruby19/input_code/ruby2ruby_test.rb | i = 0
if (i == 0) then
p(i)
else
end
|
exKAZUu/ParserTests | fixture/Ruby19/input_code/prime.rb | def prime_table(max)
result = Array.new(max + 1, true)
result[0] = result[1] = false
(2..Math::sqrt(max).ceil).each { |i|
next unless result[i]
(i*2).step(max, i) { |j|
result[j] = false
}
}
result
end
def prime_list(table)
result = []
table.each_with_index { |b, i|
result << i if b
}
result
end
d... |
exKAZUu/ParserTests | fixture/Ruby19/expected_xml/Block4.rb | <block startline="1">
<lasgn startline="1">
<Symbol>i</Symbol>
<lit startline="1">
<Fixnum>0</Fixnum>
</lit>
</lasgn>
<if startline="3">
<call startline="3">
<lvar startline="3">
<Symbol>i</Symbol>
</lvar>
<Symbol>==</Symbol>
<lit startline="3">
<Fixnu... |
exKAZUu/ParserTests | fixture/Ruby19/expected_xml/student.rb | <filename>fixture/Ruby19/expected_xml/student.rb
<block startline="1">
<class startline="1">
<Symbol>Student</Symbol>
<nil />
<defn startline="2">
<Symbol>initialize</Symbol>
<args startline="2">
<Symbol>name</Symbol>
</args>
<iasgn startline="3">
<Symbol>@name</Sym... |
Alamex/mailboxer | lib/mailboxer/version.rb | module Mailboxer
VERSION = "0.12.4"
end
|
esjeon/graveyard | eml2mbox.rb | #!/usr/bin/ruby
#============================================================================================#
# eml2mbox.rb v0.08 #
# Last updated: Jan 23, 2004 #
# ... |
JumpMaster/PiSofa | API/PiSofa.rb | gem 'pi_piper', '= 1.3.2'
#gem 'pi_piper', '= 2.0.beta.4'
require 'pi_piper'
require './PiSeat'
class PiSofa
include PiPiper
def initialize
puts Gem.loaded_specs["pi_piper"].version.version
@up, @down = 1, 2
@crazyMode = false
@switchRelay = PiPiper::Pin.new(:pin => 27, :direction => :out)
... |
JumpMaster/PiSofa | API/PiSeat.rb | <reponame>JumpMaster/PiSofa
gem 'pi_piper', '= 1.3.2'
#gem 'pi_piper', '= 2.0.beta.4'
require 'pi_piper'
class PiSeat
def initialize(seat, pinDownRelay, pinUpRelay, feetUpTime, flatTime)
self.setRelays(pinUpRelay, pinDownRelay)
self.setTimings(feetUpTime, flatTime)
@seat = seat
@dClickTime = 500
... |
JumpMaster/PiSofa | API/Site.rb | require 'sinatra'
require './PiSofa'
class PiSofaSite < Sinatra::Base
configure do
@@piSofa = PiSofa.new
end
before do
expires 0, :public, :must_revalidate, :'no-cache'
end
get '/' do
erb :index
end
get '/moveToUp/:id' do
id = params[:id].to_i
@@piSofa.moveToUp(id)
status 200
... |
JumpMaster/PiSofa | API/config.ru | require './Site.rb'
run PiSofaSite
|
cosmo0920/fluent-plugin-docker_metadata_filter | test/plugin/test_filter_docker_metadata.rb | <gh_stars>1-10
#
# Fluentd Docker Metadata Filter Plugin - Enrich Fluentd events with Docker
# metadata
#
# Copyright 2015 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... |
cosmo0920/fluent-plugin-docker_metadata_filter | test/helper.rb | <reponame>cosmo0920/fluent-plugin-docker_metadata_filter
#
# Fluentd Docker Metadata Filter Plugin - Enrich Fluentd events with Docker
# metadata
#
# Copyright 2015 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You ... |
jb41/smsapi-ruby | lib/smsapi.rb | <gh_stars>0
require 'smsapi/version'
require 'net/http'
module Smsapi
class Client
def initialize(username, password)
@username = username
@password = password
end
def send!(to, message)
uri = URI('https://api.smsapi.pl/sms.do')
Net::HTTP.post_form(uri, {
"username" => @... |
bonomali/jruby_mahout | lib/jruby_mahout/data_model.rb | <reponame>bonomali/jruby_mahout
module JrubyMahout
class DataModel
java_import org.apache.mahout.cf.taste.impl.model.file.FileDataModel
attr_accessor :data_model
def initialize(data_model_type, params)
case data_model_type
when "file"
@data_model = FileDataModel.new(java.io.File.... |
bonomali/jruby_mahout | lib/jruby_mahout/recommender_builder.rb | module JrubyMahout
class RecommenderBuilder
java_import org.apache.mahout.cf.taste.eval.RecommenderBuilder
java_import org.apache.mahout.cf.taste.impl.similarity.PearsonCorrelationSimilarity
java_import org.apache.mahout.cf.taste.impl.similarity.EuclideanDistanceSimilarity
java_import org.apache.mahou... |
bonomali/jruby_mahout | lib/jruby_mahout/evaluator.rb | <filename>lib/jruby_mahout/evaluator.rb
module JrubyMahout
class Evaluator
java_import org.apache.mahout.cf.taste.impl.eval.AverageAbsoluteDifferenceRecommenderEvaluator
def initialize(data_model, recommender_builder)
@data_model = data_model
@recommender_builder = recommender_builder
@maho... |
bonomali/jruby_mahout | lib/jruby_mahout/postgres_manager.rb | module JrubyMahout
class PostgresManager
java_import org.apache.mahout.cf.taste.impl.model.jdbc.PostgreSQLJDBCDataModel
begin
java_import org.postgresql.ds.PGPoolingDataSource
rescue Exception => e
puts e
end
attr_accessor :data_model, :data_source, :statement
def initialize(par... |
bonomali/jruby_mahout | spec/recommender_spec.rb | <reponame>bonomali/jruby_mahout
require 'spec_helper'
describe JrubyMahout::Recommender do
describe ".new" do
context "with valid arguments" do
it "should return an instance of JrubyMahout::Recommender for PearsonCorrelationSimilarity and GenericUserBasedRecommender" do
JrubyMahout::Recommender.new... |
bonomali/jruby_mahout | lib/jruby_mahout/mysql_manager.rb | module JrubyMahout
class MysqlManager
# TODO: implement
end
end |
bonomali/jruby_mahout | lib/jruby_mahout/recommender.rb | <gh_stars>0
module JrubyMahout
class Recommender
attr_accessor :is_weighted, :neighborhood_size, :similarity_name, :recommender_name, :data_model
def initialize(similarity_name, neighborhood_size, recommender_name, is_weighted)
@is_weighted = is_weighted
@neighborhood_size = neighborhood_size
... |
bonomali/jruby_mahout | lib/jruby_mahout.rb | <reponame>bonomali/jruby_mahout
module JrubyMahout
require 'java'
require File.join(ENV["MAHOUT_DIR"], 'mahout-core-0.7.jar')
require File.join(ENV["MAHOUT_DIR"], 'mahout-integration-0.7.jar')
require File.join(ENV["MAHOUT_DIR"], 'mahout-math-0.7.jar')
Dir.glob(File.join(ENV["MAHOUT_DIR"], 'lib/*.jar')).each ... |
bonomali/jruby_mahout | lib/jruby_mahout/version.rb | module JrubyMahout
VERSION = '0.2.2'
end |
bonomali/jruby_mahout | jruby_mahout.gemspec | <filename>jruby_mahout.gemspec
$:.push File.expand_path("../lib", __FILE__)
require "jruby_mahout/version"
Gem::Specification.new do |gem|
gem.name = "jruby_mahout"
gem.version = JrubyMahout::VERSION
gem.authors = ["<NAME>"]
gem.email = ["<EMAIL>"]
gem.homepage = "https://github.com/v... |
Alexx/food-review | spec/features/product_integration_spec.rb | <reponame>Alexx/food-review<filename>spec/features/product_integration_spec.rb
require 'rails_helper'
describe "the add a product and review process" do
# FactoryBot.create(:user)
it "adds a new product" do
visit products_path
click_link 'Create new product'
fill_in 'Name', :with => 'Burrito'
fill_... |
Alexx/food-review | app/models/review.rb | class Review < ApplicationRecord
belongs_to :product
validates :author, presence: true
validates :content_body, presence: true
validates :rating, presence: true
validates_length_of :content_body, minimum: 50
validates_length_of :content_body, maximum: 250
before_save(:titleize_author)
private
def ... |
Alexx/food-review | db/seeds.rb | # This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Ch... |
Alexx/food-review | spec/models/product_spec.rb | <gh_stars>0
require 'rails_helper'
describe Product do
it { should have_many(:reviews) }
it { should validate_presence_of :name }
it { should validate_presence_of :cost }
it { should validate_presence_of :country_of_origin }
it("titleizes the name of a product") do
product = Product.create({name: "meatb... |
Alexx/food-review | spec/factories.rb | require 'rails_helper'
FactoryBot.define do
factory :user do
email {"<EMAIL>"}
password{"<PASSWORD>"}
password_confirmation{"<PASSWORD>"}
end
end
|
Alexx/food-review | app/controllers/reviews_controller.rb | <gh_stars>0
class ReviewsController < ApplicationController
# before_action :authenticate_user!, :except => [:show, :index]
def new
@product = Product.find(params[:product_id])
@review = @product.reviews.new
render :new
end
def create
@product = Product.find(params[:product_id])
@review = ... |
Alexx/food-review | spec/models/review_spec.rb | require 'rails_helper'
describe Review do
it { should belong_to(:product) }
it { should validate_presence_of :author }
it { should validate_presence_of :content_body }
it { should validate_presence_of :rating }
it { should validate_length_of(:content_body).is_at_least(50) }
it { should validate_length_of(:... |
Alexx/food-review | db/migrate/20190816174239_devise_create_admins.rb | # frozen_string_literal: true
class DeviseCreateAdmins < ActiveRecord::Migration[5.2]
def change
create_table :admins do |t|
t.string :email, :null => false, :default => ""
t.string :encrypted_password, :null => false, :default => ""
t.integer :sign_in_count, :default => 0
t... |
project-renard/homebrew-project-renard | Formula/curie.rb | require 'formula'
class Curie < Formula
class Perl510 < Requirement
fatal true
satisfy do
`perl -E 'print $]'`.to_f >= 5.01000
end
def message
"Curie requires Perl 5.10.0 or greater."
end
end
homepage 'https://project-renard.github.io/'
desc "Document reader component from ... |
project-renard/homebrew-project-renard | Formula/curie_dependencies.rb | require 'formula'
class CurieDependencies < Formula
version '0.002'
url "https://fastapi.metacpan.org/v1/source/ZMUGHAL/Renard-Curie-#{stable.version}/META.json", :using => :nounzip
sha256 '1d9eafa402230afbcb1a9322d8f4275407271c57614fa0ef44c0c8f57a8cc855'
homepage 'https://project-renard.github... |
HappyDevops/XsltRuby | lib/ModuleXSL.rb | # frozen_string_literal: true
require 'nokogiri'
module ModuleXSL
# @return [String]
def readFile(path)
File.read(path)
end
# @return [String]
def transform(xmlFile, xsltFile)
xmlDocument = Nokogiri::XML(xmlFile)
xsltDocument = Nokogiri::XSLT(xsltFile)
xsltDocument.transform(xmlDocument).to... |
HappyDevops/XsltRuby | lib/main.rb | <reponame>HappyDevops/XsltRuby
require_relative 'ModuleXSL'
include ModuleXSL
xmlFile = ModuleXSL::readFile('xmlDocument.xml')
xsltFile = ModuleXSL::readFile('xsltDocument.xslt')
puts ModuleXSL::transform(xmlFile, xsltFile) |
joshweir/tormanager | lib/tormanager/eye/eye.tor.test.rb | <gh_stars>1-10
require 'eye'
# Adding application
Eye.application 'tormanager-tor-9250-1234' do
# All options inherits down to the config leafs.
# except `env`, which merging down
# uid "user_name" # run app as a user_name (optional) - available only on ruby >= 2.0
# gid "group_name" # run app as a group_name... |
joshweir/tormanager | spec/tormanager_spec.rb | require "spec_helper"
RSpec.describe TorManager do
it "has a version number" do
expect(TorManager::VERSION).not_to be nil
end
end
|
joshweir/tormanager | lib/tormanager/process_helper.rb | require 'socket'
module TorManager
CannotKillProcess = Class.new(StandardError)
class ProcessHelper
class << self
def query_process query
return [] unless query
query_process_bash_cmd(query).split("\n").map{ |query_output_line|
get_pid_from_query_process_output_line(query_outpu... |
joshweir/tormanager | spec/tormanager/create_eye_config_spec.rb | <filename>spec/tormanager/create_eye_config_spec.rb<gh_stars>1-10
require "spec_helper"
module TorManager
describe CreateEyeConfig do
subject {
CreateEyeConfig.new(
eye_tor_config_path: '/tmp/tor.config.eye.rb',
eye_tor_config_template: File.join(File.expand_path('../../..', __FILE__),
... |
joshweir/tormanager | spec/tormanager/tor_process_spec.rb | <gh_stars>1-10
require "spec_helper"
module TorManager
describe TorProcess do
#before do
# allow_any_instance_of(TorProcess).to receive(:`)
# .with("tor --quiet --hash-password '<PASSWORD>'")
# .and_return('16:foo')
#end
context 'when initialized with default params' do
before d... |
joshweir/tormanager | lib/tormanager/tor_process.rb | <reponame>joshweir/tormanager
require 'eye'
require 'eyemanager'
require 'fileutils'
require 'securerandom'
module TorManager
Error = Class.new(StandardError)
TorPortInUse = Class.new(Error)
TorControlPortInUse = Class.new(Error)
TorFailedToStart = Class.new(Error)
TorFailedToStop = Class.new(Error)
class... |
joshweir/tormanager | lib/tormanager.rb | <gh_stars>1-10
require "tormanager/version"
require "tormanager/process_helper"
require "tormanager/control"
require "tormanager/tor_process"
require "tormanager/proxy"
require "tormanager/ip_address_control"
require "tormanager/create_eye_config"
|
joshweir/tormanager | spec/features/ip_address_control_spec.rb | require "spec_helper"
module TorManager
describe IpAddressControl do
let(:tor_process) { TorManager::TorProcess.new tor_port: 9350, control_port: 53500 }
let(:tor_proxy) { Proxy.new tor_process: tor_process }
let(:tor_ip_control) { IpAddressControl.new tor_process: tor_process,
... |
joshweir/tormanager | spec/tormanager/control_spec.rb | <reponame>joshweir/tormanager<filename>spec/tormanager/control_spec.rb
require "spec_helper"
module Tor
describe Controller do
describe '.connect' do
context 'with default params' do
it 'initializes itself with default params' do
expected = {host: '127.0.0.1', port: 9051}
mockSo... |
joshweir/tormanager | lib/tormanager/control.rb | require 'socket' unless defined?(Socket)
module Tor
##
# Tor Control Protocol (TC) client.
# pulled from tor.rb:
# https://github.com/dryruby/tor.rb/blob/master/lib/tor/control.rb
# because latest version was not pushed to rubygems and needed to bundle into my gem
#
# The Tor control protocol is used by ... |
joshweir/tormanager | lib/tormanager/create_eye_config.rb | <reponame>joshweir/tormanager
module TorManager
class CreateEyeConfig
def initialize params={}
@settings = params
end
def create
File.open(@settings[:eye_tor_config_path], "w") do |file|
file.puts read_eye_tor_config_template_and_substitute_keywords
end
end
private
... |
joshweir/tormanager | spec/features/process_helper_spec.rb | require "spec_helper"
module TorManager
describe ProcessHelper do
after :all do
ProcessHelper.kill_process(
ProcessHelper.query_process ['test process','ruby'])
end
describe ".query_process" do
before :all do
@pid1 = Process.spawn("ruby -e \"loop{puts 'test process 1'; sle... |
joshweir/tormanager | lib/tormanager/proxy.rb | require 'socksify'
module TorManager
class Proxy
#Socksify::debug = true
def initialize params={}
@tor_process = params.fetch(:tor_process, nil)
end
def proxy
enable_socks_server
yield.tap { disable_socks_server }
ensure
disable_socks_server
end
private
def... |
joshweir/tormanager | lib/tormanager/ip_address_control.rb | require 'rest-client'
module TorManager
TorUnavailable = Class.new(StandardError)
class IpAddressControl
attr_accessor :ip
def initialize params={}
@tor_process = params.fetch(:tor_process, nil)
@tor_proxy = params.fetch(:tor_proxy, nil)
@ip = nil
@endpoint_change_attempts = 5
... |
joshweir/tormanager | spec/spec_helper.rb | <reponame>joshweir/tormanager<gh_stars>1-10
require 'coveralls'
Coveralls.wear!
require "bundler/setup"
require "tormanager"
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
config.expect_with :rspec do |c|
c.syn... |
joshweir/tormanager | spec/features/tor_process_spec.rb | require "spec_helper"
module TorManager
describe TorProcess do
after :all do
EyeManager.destroy
end
context 'when initialized with default params' do
before :all do
@tp = TorProcess.new
end
describe "#start" do
before :all do
EyeManager.destroy
... |
joshweir/tormanager | spec/tormanager/ip_address_control_spec.rb | require "spec_helper"
module TorManager
describe IpAddressControl do
let(:tor_process) { TorManager::TorProcess.new tor_port: 9350, control_port: 53500 }
let(:tor_proxy) { Proxy.new tor_process: tor_process }
let(:subject) { IpAddressControl.new tor_process: tor_process,
... |
joshweir/tormanager | lib/tormanager/eye/tor.template.eye.rb | <gh_stars>1-10
require 'eye'
if %w(true 1).include?('[[[eye_logging]]]')
Eye.config do
logger File.join('[[[log_dir]]]', 'tormanager.eye.log')
end
end
Eye.application 'tormanager-tor-[[[tor_port]]]-[[[parent_pid]]]' do
stdall File.join('[[[log_dir]]]', 'tormanager-tor-[[[tor_port]]]-[[[parent_pid]]].log') i... |
joshweir/tormanager | spec/tormanager/process_helper_spec.rb | <gh_stars>1-10
require "spec_helper"
module TorManager
describe ProcessHelper do
describe ".query_process" do
context "when param is empty" do
it "returns an empty array" do
expect(ProcessHelper.query_process(nil)).to eq []
end
end
context "when param is a string (sin... |
joshweir/tormanager | spec/tormanager/proxy_spec.rb | require "spec_helper"
module TorManager
describe Proxy do
let(:tor_process) { TorManager::TorProcess.new tor_port: 9350, control_port: 53500 }
let(:subject) { Proxy.new tor_process: tor_process }
describe "#proxy" do
it 'enables the socks server only for the yielded block' do
socks_socket_... |
andresamayadiaz/autofactura | autofactura.gemspec | <reponame>andresamayadiaz/autofactura
$:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "autofactura/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "autofactura"
s.version = Autofactura::VERSION
s.authors = ["Fco... |
andresamayadiaz/autofactura | test/autofactura_test.rb | require 'test_helper'
class AutofacturaTest < ActiveSupport::TestCase
test "truth" do
assert_kind_of Module, Autofactura
end
test "comprobante" do
comp = create_comprobante()
comprobante = Autofactura::Comprobante.new( comp )
#puts "COMPROBANTE: " + comprobante.to_json
assert_... |
andresamayadiaz/autofactura | lib/autofactura.rb | require "uri"
require "net/http"
require "date"
module Autofactura
# Clase Principal Autofactura
class Autofactura
attr_accessor :url, :user, :sucursal
# Initialize
def initialize(params)
self.url = params[:url].blank? ? "http://app.autofactura.com/users/api/" : params[:url]
... |
JackSullivan/databasedotcom | lib/databasedotcom/sobject.rb | <filename>lib/databasedotcom/sobject.rb
require 'databasedotcom/sobject/sobject'
require 'databasedotcom/sobject/aggregate_result'
|
JackSullivan/databasedotcom | spec/lib/sobject/sobject_spec.rb | <reponame>JackSullivan/databasedotcom<filename>spec/lib/sobject/sobject_spec.rb
require 'rspec'
require 'spec_helper'
require 'databasedotcom'
describe Databasedotcom::Sobject::Sobject do
class TestClass < Databasedotcom::Sobject::Sobject
end
before do
@client = Databasedotcom::Client.new(File.join(File.dir... |
JackSullivan/databasedotcom | lib/databasedotcom/sobject/aggregate_result.rb | <reponame>JackSullivan/databasedotcom
module Databasedotcom
module Sobject
class AggregateResult
def initialize(raw_result)
@vals = raw_result.inject({}) do |hsh,(k,v)|
hsh[k.to_sym] = v
hsh
end
end
def method_missing(field, *args)
unless... |
AcnologiatheEnd/MineEstate | backend/app/serializers/house_serializer.rb | class HouseSerializer < ActiveModel::Serializer
def initialize(house_object)
@house = house_object
end
def to_serialized_json
options = {
include: {
user: {
only: [:id, :username, :state, :country, :session]
}
},
except: [:updated_at, :created_at],
}
@h... |
AcnologiatheEnd/MineEstate | backend/app/controllers/sessions_controller.rb | class SessionsController < ApplicationController
def create
@user = User.find_by(username: params[:username])
if @user && @user.authenticate(params[:password])
log_in @user
allHouses = House.all
render json: HouseSerializer.new(allHouses).to_serialized_json
end
... |
AcnologiatheEnd/MineEstate | backend/db/migrate/20201108042241_add_user_id_to_houses.rb | class AddUserIdToHouses < ActiveRecord::Migration[6.0]
def change
add_column :houses, :user_id, :integer
end
end
|
AcnologiatheEnd/MineEstate | backend/app/models/house.rb | class House < ApplicationRecord
has_many_attached :pictures
belongs_to :user
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.