source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/workflow_method.rb | Ruby | apache-2.0 | 197 | main | 1,825 | RSpec.shared_examples 'a Hyrax workflow method' do
before do
raise 'workflow_method must be set with `let(:workflow_method)`' unless
defined? workflow_method
end
subject { workflow_method }
let(:expected_call_method_keywords){ [:target, :comment, :user] }
describe '#call' do
it "handles the :... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/factories/generic_works.rb | Ruby | apache-2.0 | 197 | main | 7,928 | # frozen_string_literal: true
FactoryBot.define do
factory :work, aliases: [:generic_work, :private_generic_work], class: 'GenericWork' do
transient do
user { FactoryBot.create(:user) }
# Set to true (or a hash) if you want to create an admin set
with_admin_set { false }
end
# It is re... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/factories/hyrax_lease.rb | Ruby | apache-2.0 | 197 | main | 779 | # frozen_string_literal: true
FactoryBot.define do
factory :hyrax_lease, class: "Hyrax::Lease" do
lease_expiration_date { (Time.zone.today + 10).to_datetime }
visibility_after_lease { 'authenticated' }
visibility_during_lease { 'open' }
after(:build) do |lease, evaluator|
lease.lease_expirat... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/factories/administrative_sets.rb | Ruby | apache-2.0 | 197 | main | 3,674 | # frozen_string_literal: true
FactoryBot.define do
##
# This factory creates a Valkyrized adminstrative set; by default a Hyrax::AdministrativeSet
#
# Why the antics around the class? Because of the Hyrax needs and potential downstream
# applciation needs.
#
# Downstream applications might implement a d... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/factories/collection_branding_infos.rb | Ruby | apache-2.0 | 197 | main | 308 | # frozen_string_literal: true
FactoryBot.define do
factory :collection_branding_info do
collection_id { "1" }
role { "banner" }
local_path { "/fake/path/to/banner.png" }
alt_text { "This is the banner" }
target_url { "http://example.com/" }
height { "" }
width { "" }
end
end |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/factories/hyrax_default_admin_set.rb | Ruby | apache-2.0 | 197 | main | 226 | # frozen_string_literal: true
FactoryBot.define do
factory :stored_default_admin_set_id, class: Hyrax::DefaultAdministrativeSet do
id { 1 }
default_admin_set_id { Hyrax::AdminSetCreateService::DEFAULT_ID }
end
end |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/factories/collections_factory.rb | Ruby | apache-2.0 | 197 | main | 4,430 | # frozen_string_literal: true
FactoryBot.define do
factory :collection do
# DEPRECATION: This factory is being replaced by collection_lw defined in collections.rb. New tests should use the
# light weight collection factory. DO NOT ADD tests using this factory.
#
# rubocop:disable Layout/LineLength
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/factories/permission_templates.rb | Ruby | apache-2.0 | 197 | main | 4,509 | # frozen_string_literal: true
FactoryBot.define do
factory :permission_template, class: Hyrax::PermissionTemplate do
# Given that there is a one to one strong relation between permission_template and admin_set,
# with a unique index on the source_id, I don't want to have duplication in source_id
sequence(... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/factories/hyrax_embargo.rb | Ruby | apache-2.0 | 197 | main | 684 | # frozen_string_literal: true
FactoryBot.define do
factory :hyrax_embargo, class: "Hyrax::Embargo" do
embargo_release_date { (Time.zone.today + 10).to_datetime }
visibility_after_embargo { 'open' }
visibility_during_embargo { 'authenticated' }
after(:build) do |embargo, evaluator|
embargo... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/factories/collections.rb | Ruby | apache-2.0 | 197 | main | 15,301 | # frozen_string_literal: true
FactoryBot.define do
# Tests that create a Fedora Object are very slow. This factory lets you control which parts of the object ecosystem
# get built.
#
# PREFERRED: Use build whenever possible. You can control the creation of the permission template, collection type, and
# ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/factories/collection_type_participants.rb | Ruby | apache-2.0 | 197 | main | 360 | # frozen_string_literal: true
FactoryBot.define do
factory :collection_type_participant, class: Hyrax::CollectionTypeParticipant do
association :hyrax_collection_type, factory: :collection_type
sequence(:agent_id) { |n| "user#{n}@example.com" }
agent_type { 'user' }
access { Hyrax::CollectionTyp... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/factories/permission_template_accesses.rb | Ruby | apache-2.0 | 197 | main | 331 | # frozen_string_literal: true
FactoryBot.define do
factory :permission_template_access, class: Hyrax::PermissionTemplateAccess do
permission_template
trait :manage do
access { 'manage' }
end
trait :deposit do
access { 'deposit' }
end
trait :view do
access { 'view' }
end... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/factories/admin_sets_lw.rb | Ruby | apache-2.0 | 197 | main | 11,965 | # frozen_string_literal: true
FactoryBot.define do
# Tests that create a Fedora Object are very slow. This factory lets you control which parts of the object ecosystem
# get built.
#
# PREFERRED: Use build whenever possible. You can control the creation of the permission template and solr document
# ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/factories/file_sets.rb | Ruby | apache-2.0 | 197 | main | 1,223 | # frozen_string_literal: true
FactoryBot.define do
factory :file_set do
transient do
user { FactoryBot.create(:user) }
content { nil }
end
after(:build) do |fs, evaluator|
fs.apply_depositor_metadata evaluator.user.user_key
end
after(:create) do |file, evaluator|
Hydra::Wo... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/factories/hyrax_collection.rb | Ruby | apache-2.0 | 197 | main | 3,731 | # frozen_string_literal: true
##
# Use this factory for generic Hyrax/HydraWorks Collections in valkyrie.
#
# This factory creates a Valkyrized collection set; by default a Hyrax::PcdmCollection
#
# Why the antics around the class? Because of the Hyrax needs and potential downstream
# applciation needs.
#
# Downstrea... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/factories/hyrax_file_metadata.rb | Ruby | apache-2.0 | 197 | main | 3,126 | # frozen_string_literal: true
##
# Use this factory for FileMetadata for Files in valkyrie.
FactoryBot.define do
factory :hyrax_file_metadata, class: 'Hyrax::FileMetadata', aliases: [:file_metadata] do
transient do
use { nil }
visibility_setting { nil }
end
after(:build) do |file_metadata, e... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/factories/admin_sets.rb | Ruby | apache-2.0 | 197 | main | 1,523 | # frozen_string_literal: true
FactoryBot.define do
factory :admin_set do
sequence(:title) { |n| ["Title #{n}"] }
# Given the relationship between permission template and admin set, when
# an admin set is created via a factory, I believe it is appropriate to go ahead and
# create the corresponding per... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/factories/uploaded_files.rb | Ruby | apache-2.0 | 197 | main | 336 | # frozen_string_literal: true
FactoryBot.define do
factory :uploaded_file, class: Hyrax::UploadedFile do
user
file { File.open(Hyrax::Engine.root.join('spec', 'fixtures', 'image.jp2').to_s) }
trait :audio do
file { File.open(Hyrax::Engine.root.join('spec', 'fixtures', 'sample_mpeg4.mp4').to_s) }
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/factories/users.rb | Ruby | apache-2.0 | 197 | main | 1,620 | # frozen_string_literal: true
FactoryBot.define do
factory :user do
sequence(:email) { |n| "user#{n}@example.com" }
password { 'password' }
transient do
# Allow for custom groups when a user is instantiated.
# @example create(:user, groups: 'avacado')
groups { [] }
end
after(:b... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/factories/counter_metrics.rb | Ruby | apache-2.0 | 197 | main | 312 | # frozen_string_literal: true
FactoryBot.define do
factory :counter_metric, class: "Hyrax::CounterMetric" do
worktype { "Generic Work" }
resource_type { "Book" }
work_id { "12345678" }
date { Date.new(2023, 7, 17) }
total_item_investigations { 10 }
total_item_requests { 5 }
end
end |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/factories/collection_types.rb | Ruby | apache-2.0 | 197 | main | 4,241 | # frozen_string_literal: true
FactoryBot.define do
factory :collection_type, class: Hyrax::CollectionType do
sequence(:title) { |n| "Collection Type #{n}" }
sequence(:machine_id) { |n| "title_#{n}" }
description { 'Collection type with all options' }
nestable { true }
discoverable { true }
sh... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/factories/access_control.rb | Ruby | apache-2.0 | 197 | main | 313 | # frozen_string_literal: true
FactoryBot.define do
factory :access_control, class: Hyrax::AccessControl do
permissions { build(:permission) }
trait :with_target do
access_to { valkyrie_create(:hyrax_resource).id }
permissions { build(:permission, access_to: access_to) }
end
end
end |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/factories/api_items.rb | Ruby | apache-2.0 | 197 | main | 2,176 | # frozen_string_literal: true
FactoryBot.define do
factory :post_item, class: Hash do
skip_create
token { 'mock_token' }
metadata do
{
resourceType: 'Dataset',
title: 'Findings from NSF Study',
creators: [
{
creatorType: 'author',
firstName... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/factories/hyrax_work.rb | Ruby | apache-2.0 | 197 | main | 9,324 | # frozen_string_literal: true
##
# Use this factory for generic Hyrax/HydraWorks Works in valkyrie.
# rubocop:disable Metrics/BlockLength
FactoryBot.define do
factory :hyrax_work, class: 'Hyrax::Test::SimpleWork' do
trait :under_embargo do
association :embargo, factory: :hyrax_embargo
after(:create)... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/factories/hyrax_resource.rb | Ruby | apache-2.0 | 197 | main | 356 | # frozen_string_literal: true
##
# Use for generic Resources, with Hyrax assumptions.
FactoryBot.define do
factory :hyrax_resource, class: "Hyrax::Resource" do
trait :under_embargo do
embargo_id { FactoryBot.create(:hyrax_embargo).id }
end
trait :under_lease do
lease_id { FactoryBot.create(:... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/factories/operations.rb | Ruby | apache-2.0 | 197 | main | 499 | # frozen_string_literal: true
FactoryBot.define do
factory :operation, class: Hyrax::Operation do
operation_type { "Test operation" }
trait :failing do
status { Hyrax::Operation::FAILURE }
end
trait :pending do
status { Hyrax::Operation::PENDING }
end
trait :successful do
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/factories/hyrax_file_set.rb | Ruby | apache-2.0 | 197 | main | 5,026 | # frozen_string_literal: true
FactoryBot.define do
factory :hyrax_file_set, class: 'Hyrax::FileSet' do
transient do
files { nil }
original_file { nil }
extracted_text { nil }
thumbnail { nil }
visibility_setting { nil }
edit_users { [] }
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/factories/single_use_links.rb | Ruby | apache-2.0 | 197 | main | 300 | # frozen_string_literal: true
FactoryBot.define do
factory :single_use_link do
factory :show_link do
item_id { 'fs-id' }
path { '/concerns/generic_work/1234' }
end
factory :download_link do
item_id { 'fs-id' }
path { '/downloads/1234' }
end
end
end |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/factories/sipity_entities.rb | Ruby | apache-2.0 | 197 | main | 432 | # frozen_string_literal: true
FactoryBot.define do
factory :sipity_entity, class: Sipity::Entity do
transient do
proxy_for { nil }
end
proxy_for_global_id { 'gid://internal/Mock/1' }
workflow { workflow_state.workflow }
workflow_state
after(:build) do |entity, evaluator|
entity.p... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/factories/strategies/valkyrie_resource.rb | Ruby | apache-2.0 | 197 | main | 710 | # frozen_string_literal: true
# @see https://github.com/thoughtbot/factory_bot/blob/master/GETTING_STARTED.md#custom-strategies
# @example
# let(:resource) { FactoryBot.valkyrie_create(:hyrax_work) }
class ValkyrieCreateStrategy
def initialize
@strategy = FactoryBot.strategy_by_name(:create).new
end
delega... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/factories/strategies/json_strategy.rb | Ruby | apache-2.0 | 197 | main | 278 | # frozen_string_literal: true
class JsonStrategy
def initialize
@strategy = FactoryBot.strategy_by_name(:create).new
end
delegate :association, to: :@strategy
def result(evaluation)
@strategy.result(evaluation).to_json
end
def to_sym
:json
end
end |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/arkivo/schema_validator.rb | Ruby | apache-2.0 | 197 | main | 1,534 | # frozen_string_literal: true
require 'json-schema'
module Hyrax
module Arkivo
ITEM_SCHEMA = {
type: 'object',
properties: {
token: { type: 'string', required: true },
metadata: {
type: 'object',
required: true,
properties: {
title: { type: 's... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/arkivo/config.rb | Ruby | apache-2.0 | 197 | main | 300 | # frozen_string_literal: true
module Hyrax
module Arkivo
def self.config
@config ||= YAML.safe_load(ERB.new(IO.read(Rails.root.join('config', 'arkivo.yml'))).result).with_indifferent_access[Rails.env]
end
def self.new_subscription_url
'/api/subscription'
end
end
end |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/arkivo/create_subscription_job.rb | Ruby | apache-2.0 | 197 | main | 1,703 | # frozen_string_literal: true
module Hyrax
module Arkivo
class SubscriptionError < RuntimeError
end
class CreateSubscriptionJob < Hyrax::ApplicationJob
attr_reader :user
def perform(user_key)
@user = ::User.find_by_user_key(user_key)
validate_user!
# post json to API... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/arkivo/metadata_munger.rb | Ruby | apache-2.0 | 197 | main | 2,030 | # frozen_string_literal: true
module Hyrax
module Arkivo
CREATOR_TYPES = ['author', 'interviewer', 'director', 'scriptwriter',
'inventor', 'composer', 'cartographer', 'programmer', 'artist',
'bookAuthor'].freeze
CONTRIBUTOR_TYPES = ['contributor', 'editor', 'translat... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/arkivo/actor.rb | Ruby | apache-2.0 | 197 | main | 3,093 | # frozen_string_literal: true
require 'base64'
require 'tempfile'
# Ugly monkeypatch to make Tempfiles quack like UploadedFiles
Tempfile.class_eval do
attr_accessor :original_filename, :content_type
end
module Hyrax
module Arkivo
class Actor
attr_reader :user, :item
def initialize(user, item)
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/rubocop/custom_cops.rb | Ruby | apache-2.0 | 197 | main | 918 | # frozen_string_literal: true
require 'rubocop'
module Hyrax
module RuboCop
module CustomCops
# This custom cop checks for mixins of Hyrax::ArResource
class ArResource < ::RuboCop::Cop::Cop
MSG = 'Do not `include Hyrax::ArResource`.'
# checks for `include Hyrax::ArResource`
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/zotero/config.rb | Ruby | apache-2.0 | 197 | main | 379 | # frozen_string_literal: true
module Hyrax
module Zotero
def self.config
@config ||= reload_config!
end
def self.reload_config!
@config = YAML.safe_load(ERB.new(IO.read(Rails.root.join('config', 'zotero.yml'))).result)['zotero']
end
def self.publications_url(zotero_userid)
"/us... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/resource_sync/resource_list_writer.rb | Ruby | apache-2.0 | 197 | main | 2,938 | # frozen_string_literal: true
module Hyrax
module ResourceSync
# TODO: the big assumption I'm making here is that the repository has fewer
# than 50,000 resources to list. The Sitemap protocol is limited at 50,000
# items, so if we require more than that, we must have multiple Resource
# lists and add... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/resource_sync/source_description_writer.rb | Ruby | apache-2.0 | 197 | main | 884 | # frozen_string_literal: true
module Hyrax
module ResourceSync
class SourceDescriptionWriter
attr_reader :capability_list_url
def initialize(capability_list_url: 'http://example.com/dataset1/capabilitylist.xml')
@capability_list_url = capability_list_url
end
def write
buil... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/resource_sync/capability_list_writer.rb | Ruby | apache-2.0 | 197 | main | 1,368 | # frozen_string_literal: true
module Hyrax
module ResourceSync
class CapabilityListWriter
attr_reader :resource_list_url, :change_list_url, :description_url
def initialize(resource_list_url:, change_list_url:, description_url:)
@resource_list_url = resource_list_url
@change_list_url = ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/resource_sync/change_list_writer.rb | Ruby | apache-2.0 | 197 | main | 3,294 | # frozen_string_literal: true
module Hyrax
module ResourceSync
# TODO: the big assumption I'm making here is that the repository has fewer
# than 50,000 resources to list. The Sitemap protocol is limited at 50,000
# items, so if we require more than that, we must have multiple Change
# lists and add ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/health_checks/solr_check.rb | Ruby | apache-2.0 | 197 | main | 590 | # frozen_string_literal: true
module Hyrax
module HealthChecks
class SolrCheck < OkComputer::Check
def initialize(service: Hyrax::SolrService)
@service = service
end
def check
return if @service.ping
mark_message 'Solr connection failed'
mark_failure
resc... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/controlled_vocabulary/importer/downloader.rb | Ruby | apache-2.0 | 197 | main | 417 | # frozen_string_literal: true
require 'ruby-progressbar'
module Hyrax
module ControlledVocabulary
module Importer
class Downloader
def self.fetch(url, output)
open(url) do |io|
IO.copy_stream(io, output)
end
rescue OpenURI::HTTPError => e
raise "Una... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/controlled_vocabulary/importer/language.rb | Ruby | apache-2.0 | 197 | main | 1,932 | # frozen_string_literal: true
require_relative 'downloader'
require 'rdf/rdfxml'
module Hyrax
module ControlledVocabulary
module Importer
class Language
URL = 'http://www.lexvo.org/resources/lexvo_2013-02-09.rdf.gz'
def initialize
stdout_logger = Logger.new(STDOUT)
stdou... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/controlled_vocabularies/resource_label_caching.rb | Ruby | apache-2.0 | 197 | main | 1,146 | # frozen_string_literal: true
module Hyrax
module ControlledVocabularies
##
# adds caching to the {#rdf_label} method.
#
# for systems that check the {#rdf_label}and use {#fetch} to get upstream
# data if it is not present, this can be used to avoid making round trips
# to an authoritative web... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/controlled_vocabularies/location.rb | Ruby | apache-2.0 | 197 | main | 668 | # frozen_string_literal: true
module Hyrax
module ControlledVocabularies
class Location < ActiveTriples::Resource
configure rdf_label: ::RDF::Vocab::GEONAMES.name
include ResourceLabelCaching
# Return a tuple of url & label
def solrize
label = full_label || rdf_label.first.to_s
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/rails/routes.rb | Ruby | apache-2.0 | 197 | main | 2,483 | # frozen_string_literal: true
module ActionDispatch::Routing
class Mapper
# @yield If a block is passed it is yielded for each curation_concern
# @example
# curation_concerns_basic_routes do
# concerns :exportable
# end
def curation_concerns_basic_routes(&block) # rubocop:disable Metri... |
github | samvera/hyrax | https://github.com/samvera/hyrax | tasks/hyrax_dev.rake | Ruby | apache-2.0 | 197 | main | 1,071 | # frozen_string_literal: true
require 'English'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
desc 'Run style checker'
RuboCop::RakeTask.new(:rubocop) do |task|
task.fail_on_error = true
end
RSpec::Core::RakeTask.new(:spec)
desc "Sort locales keys in alphabetic order."
task :i18n_sorter do
require '... |
github | samvera/hyrax | https://github.com/samvera/hyrax | tasks/benchmark.rake | Ruby | apache-2.0 | 197 | main | 1,563 | # frozen_string_literal: true
namespace :wings do
if ENV['IN_DOCKER'] && !Module.const_defined?(:APP_RAKEFILE)
APP_RAKEFILE = File.expand_path("Rakefile", Pathname.new(__dir__).join("..", "..", "hyrax-webapp"))
load 'rails/tasks/engine.rake'
end
task benchmark_convert: :environment do
setup_logger
... |
github | joatmon08/tdd-infrastructure | https://github.com/joatmon08/tdd-infrastructure | tf-aws-s3/tests/integration/spec/bucket_spec.rb | Ruby | mit | 197 | main | 1,115 | require './spec_helper'
bucket_policy = JSON.parse(File.open("../../policies/bucket.json").read)
describe s3_bucket(@bucket_name) do
it { should exist }
its(:acl_grants_count) { should eq 1 }
its('policy.policy.read') { should include bucket_policy['Statement'][0]['Sid'] }
its('policy.policy.read') { ... |
github | joatmon08/tdd-infrastructure | https://github.com/joatmon08/tdd-infrastructure | tf-aws-s3/tests/integration/spec/iam_spec.rb | Ruby | mit | 197 | main | 732 | require './spec_helper'
bucket_write_user = "#{@bucket_name}WriteUser"
bucket_write_user_policy = "#{@bucket_name}WriteUserPolicy"
bucket_read_user = "#{@bucket_name}ReadUser"
bucket_read_user_policy = "#{@bucket_name}ReadUserPolicy"
bucket_admin_role = "#{@bucket_name}AdminRole"
bucket_admin_role_policy = "#{@bucket_... |
github | joatmon08/tdd-infrastructure | https://github.com/joatmon08/tdd-infrastructure | tf-aws-ec2/test/integration/default/controls/db_test.rb | Ruby | mit | 197 | main | 420 | control 'db' do
impact 0.6
title 'Database: check routing from public to private subnet'
describe host('10.128.0.43', port: 27017, protocol: 'tcp') do
it { should be_reachable }
it { should be_resolvable }
end
end
control 'outbound' do
impact 0.6
title 'Public Subnet: check routing out to public i... |
github | chriseppstein/sass-css-importer | https://github.com/chriseppstein/sass-css-importer | Rakefile | Ruby | mit | 197 | master | 205 | require 'bundler'
Bundler::GemHelper.install_tasks
require 'rake/testtask'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.libs << 'test'
t.pattern = 'test/**/*_test.rb'
t.verbose = false
end |
github | chriseppstein/sass-css-importer | https://github.com/chriseppstein/sass-css-importer | sass-css-importer.gemspec | Ruby | mit | 197 | master | 740 | # -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "sass/css_importer/version"
Gem::Specification.new do |s|
s.name = "sass-css-importer"
s.version = Sass::CssImporter::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["Chris Eppstein"]
s.email = ["chri... |
github | chriseppstein/sass-css-importer | https://github.com/chriseppstein/sass-css-importer | test/sass_css_importer_test.rb | Ruby | mit | 197 | master | 851 | require 'test/unit'
require 'sass'
require 'sass/css_importer'
class SassCssImporterTest < Test::Unit::TestCase
def test_can_import_css_files_files
css = render_file("imports_css.scss")
assert_match(/\.css-partial/, css)
assert_match(/\.css-file/, css)
end
private
def render_file(filename)
fixt... |
github | chriseppstein/sass-css-importer | https://github.com/chriseppstein/sass-css-importer | lib/sass/css_importer/monkey_patches.rb | Ruby | mit | 197 | master | 450 | require 'sass'
class Sass::Engine
alias initialize_without_css_importer initialize
def initialize(template, options={})
initialize_without_css_importer(template, options)
css_importer = self.options[:load_paths].find {|lp| lp.is_a?(Sass::CssImporter::Importer) }
unless css_importer
root = Fi... |
github | chriseppstein/sass-css-importer | https://github.com/chriseppstein/sass-css-importer | lib/sass/css_importer/importer.rb | Ruby | mit | 197 | master | 997 | require 'pathname'
require 'singleton'
class Sass::CssImporter::Importer < Sass::Importers::Filesystem
def initialize(root)
super(root)
end
# Enable watching of css files in Sass 3.3+
def watched_directories
[root]
end
# Enable watching of css files in Sass 3.3+
def watched_file?(file)
fil... |
github | akretion/ooor | https://github.com/akretion/ooor | Gemfile | Ruby | mit | 197 | master | 442 | source "http://rubygems.org"
gemspec
gem "activemodel", "~> #{ENV["RAILS_VERSION"]}" if ENV["RAILS_VERSION"]
if ENV["RAILS_VERSION"].to_i >= 5
gem 'activemodel-serializers-xml'
gem 'active_model_serializers'
end
group :test do
gem 'rspec'
if ENV["CI"]
gem "coveralls", require: false
end
end
group :d... |
github | akretion/ooor | https://github.com/akretion/ooor | ooor.gemspec | Ruby | mit | 197 | master | 861 | $:.push File.expand_path("../lib", __FILE__)
require "ooor/version"
Gem::Specification.new do |s|
s.name = %q{ooor}
s.version = Ooor::VERSION
s.date = %q{2013-05-04}
s.authors = ["Raphael Valyi - www.akretion.com"]
s.email = %q{raphael.valyi@akretion.com}
s.summary = %q{OOOR - OpenObject On Ruby}
s.hom... |
github | akretion/ooor | https://github.com/akretion/ooor | lib/ooor.rb | Ruby | mit | 197 | master | 6,742 | # OOOR: OpenObject On Ruby
# Copyright (C) 2009-2013 Akretion LTDA (<http://www.akretion.com>).
# Author: Raphaël Valyi
# Licensed under the MIT license, see MIT-LICENSE file
require 'active_support/dependencies/autoload'
require 'active_support/concern'
require 'active_support/cache'
require 'logger'
mo... |
github | akretion/ooor | https://github.com/akretion/ooor | lib/ooor/type_casting.rb | Ruby | mit | 197 | master | 6,542 | # OOOR: OpenObject On Ruby
# Copyright (C) 2009-2014 Akretion LTDA (<http://www.akretion.com>).
# Author: Raphaël Valyi
# Licensed under the MIT license, see MIT-LICENSE file
module Ooor
module TypeCasting
extend ActiveSupport::Concern
OPERATORS = ["=", "!=", "<=", "<", ">", ">=", "=?", "=like",... |
github | akretion/ooor | https://github.com/akretion/ooor | lib/ooor/session.rb | Ruby | mit | 197 | master | 8,962 | require 'ooor/services'
require 'active_support/configurable'
require 'active_support/core_ext/hash/slice'
module Ooor
class Session
include ActiveSupport::Configurable
include Transport
attr_accessor :web_session, :id, :models
def common(); @common_service ||= CommonService.new(self); end
def... |
github | akretion/ooor | https://github.com/akretion/ooor | lib/ooor/errors.rb | Ruby | mit | 197 | master | 4,440 | module Ooor
class OpenERPServerError < RuntimeError
attr_accessor :request, :faultCode, :faultString
def self.create_from_trace(error, method, *args)
begin
#extracts the eventual error log from OpenERP response as OpenERP doesn't enforce carefully*
#the XML/RPC spec, see https://bugs.la... |
github | akretion/ooor | https://github.com/akretion/ooor | lib/ooor/field_methods.rb | Ruby | mit | 197 | master | 7,066 | require 'active_support/concern'
module Ooor
module FieldMethods
extend ActiveSupport::Concern
module ClassMethods
def reload_fields_definition(force=false)
if force || !fields
@t.fields = {}
@columns_hash = {}
if session.odoo_serie < 10
fields_get = ... |
github | akretion/ooor | https://github.com/akretion/ooor | lib/ooor/railtie.rb | Ruby | mit | 197 | master | 947 | require "rails/railtie"
require "ooor/rack"
require "yaml"
module Ooor
class Railtie < Rails::Railtie
initializer "ooor.middleware" do |app|
Ooor.logger = Rails.logger unless $0 != 'irb'
Ooor.cache_store = Rails.cache
Ooor.new("#{Rails.root}/config/ooor.yml")
Ooor.logger.level = Ooor.defa... |
github | akretion/ooor | https://github.com/akretion/ooor | lib/ooor/autosave_association.rb | Ruby | mit | 197 | master | 8,495 | require 'ostruct'
require 'active_support/concern'
module Ooor
# = Ooor Autosave Association, adapted from ActiveRecord 4.1
#
# +AutosaveAssociation+ is a module that takes care of automatically saving
# associated records when their parent is saved. In addition to saving, it
# also destroys any associated r... |
github | akretion/ooor | https://github.com/akretion/ooor | lib/ooor/rack.rb | Ruby | mit | 197 | master | 5,186 | require 'active_support/concern'
module Ooor
DEFAULT_OOOR_SESSION_CONFIG_MAPPER = Proc.new do |env|
Ooor.logger.debug "\n\nWARNING: using DEFAULT_OOOR_SESSION_CONFIG_MAPPER, you should probably define your own instead!
You can define an Ooor::Rack.ooor_session_config_mapper block that will be evaled
... |
github | akretion/ooor | https://github.com/akretion/ooor | lib/ooor/model_schema.rb | Ruby | mit | 197 | master | 1,077 | # OOOR: OpenObject On Ruby
# Copyright (C) 2009-2014 Akretion LTDA (<http://www.akretion.com>).
# Author: Raphaël Valyi
# Licensed under the MIT license, see MIT-LICENSE file
module Ooor
# Meta data shared across sessions, a cache of the data in ir_model in OpenERP.
# in Activerecord, ModelSchema is a... |
github | akretion/ooor | https://github.com/akretion/ooor | lib/ooor/locale.rb | Ruby | mit | 197 | master | 371 | module Ooor
module Locale
# Odoo requires a locale+zone mapping while Rails uses locale only, so mapping is likely to be required
def self.to_erp_locale(locale)
unless mapping = Ooor.default_config[:locale_mapping]
mapping = {'fr' => 'fr_FR', 'en' => 'en_US'}
end
(mapping[locale.to_s... |
github | akretion/ooor | https://github.com/akretion/ooor | lib/ooor/base64.rb | Ruby | mit | 197 | master | 503 | # OOOR: OpenObject On Ruby
# Copyright (C) 2009-2012 Akretion LTDA (<http://www.akretion.com>).
# Author: Raphaël Valyi
# Licensed under the MIT license, see MIT-LICENSE file
autoload :Base64, 'base64'
module Base64
def serialize_binary_from_file(binary_path)
return Base64.encode64(File.read(binary_... |
github | akretion/ooor | https://github.com/akretion/ooor | lib/ooor/model_registry.rb | Ruby | mit | 197 | master | 854 | module Ooor
# Enables to cache expensive model metadata and reuse these metadata
# according to connection parameters. Indeed, these metadata are
# expensive before they require a fields_get request to OpenERP
# so in a web application with several worker processes, it's a good
# idea to cache them and share ... |
github | akretion/ooor | https://github.com/akretion/ooor | lib/ooor/persistence.rb | Ruby | mit | 197 | master | 13,287 | # OOOR: OpenObject On Ruby
# Copyright (C) 2009-2014 Akretion LTDA (<http://www.akretion.com>).
# Author: Raphaël Valyi
# Licensed under the MIT license, see MIT-LICENSE file
require 'active_support/core_ext/hash/indifferent_access'
require 'active_model/attribute_methods'
require 'active_model/dirty'
requ... |
github | akretion/ooor | https://github.com/akretion/ooor | lib/ooor/services.rb | Ruby | mit | 197 | master | 5,481 | # OOOR: OpenObject On Ruby
# Copyright (C) 2009-2013 Akretion LTDA (<http://www.akretion.com>).
# Author: Raphaël Valyi
# Licensed under the MIT license, see MIT-LICENSE file
require 'json'
module Ooor
autoload :InvalidSessionError, 'ooor/errors'
class Service
def initialize(session)
@sess... |
github | akretion/ooor | https://github.com/akretion/ooor | lib/ooor/reflection_ooor.rb | Ruby | mit | 197 | master | 3,613 | require 'active_support/core_ext/class/attribute'
require 'active_support/core_ext/object/inclusion'
module Ooor
# = Ooor Reflection
module ReflectionOoor # :nodoc:
extend ActiveSupport::Concern
def column_for_attribute(name)
self.class.columns_hash[name.to_s]
end
def has_attribute?(attr_na... |
github | akretion/ooor | https://github.com/akretion/ooor | lib/ooor/serialization.rb | Ruby | mit | 197 | master | 1,717 | # OOOR: OpenObject On Ruby
# Copyright (C) 2009-TODAY Akretion LTDA (<http://www.akretion.com>).
# Author: Raphaël Valyi
# Licensed under the MIT license, see MIT-LICENSE file
module Ooor
module Serialization
extend ActiveSupport::Concern
included do
self.include_root_in_json = false
... |
github | akretion/ooor | https://github.com/akretion/ooor | lib/ooor/report.rb | Ruby | mit | 197 | master | 1,645 | require 'active_support/concern'
module Ooor
module Report
extend ActiveSupport::Concern
module ClassMethods
#Added methods to obtain report data for a model
def report(report_name, ids, report_type='pdf', context={}) #TODO move to ReportService
context = session.object.inject_session_co... |
github | akretion/ooor | https://github.com/akretion/ooor | lib/ooor/session_handler.rb | Ruby | mit | 197 | master | 1,900 | require 'active_support/core_ext/hash/indifferent_access'
require 'ooor/session'
module Ooor
autoload :SecureRandom, 'securerandom'
# The SessionHandler allows to retrieve a session with its loaded proxies to OpenERP
class SessionHandler
def noweb_session_spec(config)
"#{config[:url]}-#{config[:databa... |
github | akretion/ooor | https://github.com/akretion/ooor | lib/ooor/base.rb | Ruby | mit | 197 | master | 4,638 | # OOOR: OpenObject On Ruby
# Copyright (C) 2009-2014 Akretion LTDA (<http://www.akretion.com>).
# Author: Raphaël Valyi
# Licensed under the MIT license, see MIT-LICENSE file
require 'active_support/core_ext/module/delegation.rb'
require 'active_model/attribute_methods'
require 'active_model/dirty'
require... |
github | akretion/ooor | https://github.com/akretion/ooor | lib/ooor/nested_attributes.rb | Ruby | mit | 197 | master | 2,342 | require 'ostruct'
require 'active_support/concern'
module Ooor
module NestedAttributes #:nodoc:
extend ActiveSupport::Concern
module ClassMethods
# Defines an attributes writer for the specified association(s).
# Note that in Ooor this is active by default for all one2many and many2one associat... |
github | akretion/ooor | https://github.com/akretion/ooor | lib/ooor/transport.rb | Ruby | mit | 197 | master | 999 | # OOOR: OpenObject On Ruby
# Copyright (C) 2013 Akretion LTDA (<http://www.akretion.com>).
# Author: Raphaël Valyi
# Licensed under the MIT license, see MIT-LICENSE file
require 'active_support/dependencies/autoload'
module Ooor
module Transport
extend ActiveSupport::Autoload
autoload :XmlRpcCli... |
github | akretion/ooor | https://github.com/akretion/ooor | lib/ooor/callbacks.rb | Ruby | mit | 197 | master | 516 | module Ooor
module Callbacks
extend ActiveSupport::Concern
CALLBACKS = [
:before_validation, :after_validation, :before_save, :around_save, :after_save,
:before_create, :around_create, :after_create, :before_update, :around_update,
:after_update, :before_destroy, :around_destroy, :after_des... |
github | akretion/ooor | https://github.com/akretion/ooor | lib/ooor/naming.rb | Ruby | mit | 197 | master | 3,288 | require 'active_support/concern'
module Ooor
module Naming
extend ActiveSupport::Concern
class Name < ActiveModel::Name
def initialize(klass, namespace = nil, name = nil)
super
@singular = klass.openerp_model
@plural = klass.openerp_model # OpenERP doesn't enforce plural / sing... |
github | akretion/ooor | https://github.com/akretion/ooor | lib/ooor/associations.rb | Ruby | mit | 197 | master | 2,443 | module Ooor
module Associations
# similar to ActiveRecord CollectionProxy but without lazy loading work yet
class CollectionProxy < Relation
def to_ary
to_a.dup
end
# alias_method :to_a, :to_ary
def class
Array
end
def is_a?(*args)
@records.is_a?(... |
github | akretion/ooor | https://github.com/akretion/ooor | lib/ooor/mini_active_resource.rb | Ruby | mit | 197 | master | 2,968 | require 'active_support'
require 'active_support/core_ext/class/attribute_accessors'
require 'active_model'
if ActiveModel.respond_to?(:version) && ActiveModel.version.version.to_i >= 5
begin
require 'active_model_serializers'
require 'activemodel-serializers-xml'
rescue LoadError
puts """When using Ac... |
github | akretion/ooor | https://github.com/akretion/ooor | lib/ooor/reflection.rb | Ruby | mit | 197 | master | 6,144 | require 'active_support/core_ext/class/attribute'
require 'active_support/core_ext/object/inclusion'
module Ooor
# = Active Record Reflection
# NOTE this is a shrinked copy of ActiveRecord reflection.rb
# the few necessary hacks are explicited with a FIXME or a NOTE
# an addition Ooor specific reflection modul... |
github | akretion/ooor | https://github.com/akretion/ooor | lib/ooor/relation.rb | Ruby | mit | 197 | master | 5,415 | # OOOR: OpenObject On Ruby
# Copyright (C) 2009-TODAY Akretion LTDA (<http://www.akretion.com>).
# Author: Raphaël Valyi
# Licensed under the MIT license, see MIT-LICENSE file
#TODO chainability of where via scopes
module Ooor
# = Similar to Active Record Relation
# subset of https://github.com/rails/... |
github | akretion/ooor | https://github.com/akretion/ooor | lib/ooor/relation/finder_methods.rb | Ruby | mit | 197 | master | 5,928 | require 'active_support/concern'
module Ooor
module FinderMethods
extend ActiveSupport::Concern
module ClassMethods
def find(*arguments)
if arguments.size == 1 &&
arguments[0].is_a?(Hash) ||
(arguments[0].is_a?(Array) && !([arguments[0][1]] & Ooor::TypeCasting::OPERATOR... |
github | akretion/ooor | https://github.com/akretion/ooor | lib/ooor/helpers/core_helpers.rb | Ruby | mit | 197 | master | 3,021 | # OOOR: OpenObject On Ruby
# Copyright (C) 2009-2012 Akretion LTDA (<http://www.akretion.com>).
# Author: Akretion: Raphaël Valyi: CampToCamp: Nicolas Bessi, Joel Grand-Guillaume
# Licensed under the MIT license, see MIT-LICENSE file
Ooor.xtend('ir.module.module') do
####################################... |
github | akretion/ooor | https://github.com/akretion/ooor | lib/ooor/transport/json_client.rb | Ruby | mit | 197 | master | 2,485 | require 'faraday'
module Ooor
module Transport
module JsonClient
module OeAdapter # NOTE use a middleware here?
def oe_service(session_info, service, obj, method, *args)
if service == :exec_workflow
url = '/web/dataset/exec_workflow'
params = {"model"=>obj, "id"=>... |
github | akretion/ooor | https://github.com/akretion/ooor | lib/ooor/transport/xml_rpc_client.rb | Ruby | mit | 197 | master | 532 | require 'xmlrpc/client'
module Ooor
module Transport
class XmlRpcClient < XMLRPC::Client
def call2(method, *args)
request = create().methodCall(method, *args)
data = (["<?xml version='1.0' encoding='UTF-8'?>\n"] + do_rpc(request, false).lines.to_a[1..-1]).join #encoding is not defined by O... |
github | akretion/ooor | https://github.com/akretion/ooor | lib/generators/ooor/install_generator.rb | Ruby | mit | 197 | master | 386 | require 'rails/generators/base'
module Ooor
module Generators
MissingORMError = Class.new(Thor::Error)
class InstallGenerator < Rails::Generators::Base
source_root File.expand_path("..", __FILE__)
desc "Creates an Ooor configuration in your application."
def copy_configuration
te... |
github | akretion/ooor | https://github.com/akretion/ooor | spec/cli_spec.rb | Ruby | mit | 197 | master | 4,110 | # Copyright (C) 2017 Akretion (<http://www.akretion.com>).
# Author: Raphaël Valyi
# Licensed under the MIT license, see MIT-LICENSE file
if ENV["CI"]
require 'coveralls'
Coveralls.wear!
end
require File.dirname(__FILE__) + '/../lib/ooor'
OOOR_URL = ENV['OOOR_URL'] || 'http://localhost:8069'
OOOR_DB_PASS... |
github | akretion/ooor | https://github.com/akretion/ooor | spec/ooor_spec.rb | Ruby | mit | 197 | master | 33,988 | # OOOR: OpenObject On Ruby
# Copyright (C) 2009-2014 Akretion LTDA (<http://www.akretion.com>).
# Author: Raphaël Valyi
# Licensed under the MIT license, see MIT-LICENSE file
if ENV["CI"]
require 'coveralls'
Coveralls.wear!
end
require File.dirname(__FILE__) + '/../lib/ooor'
OOOR_URL = ENV['OOOR_URL']... |
github | joshbuddy/http_router | https://github.com/joshbuddy/http_router | Rakefile | Ruby | mit | 197 | master | 4,846 | # encoding: utf-8
require 'bundler'
Bundler::GemHelper.install_tasks
# Rake::Task['release'].enhance([:test, :release_js]) FIXME, this just doesn't work.
task :default => [:test]
task :release_js do
$: << 'lib'
require 'http_router/version'
File.open('js/package.json', 'w') do |f|
f << <<-EOT
{
"name": "h... |
github | joshbuddy/http_router | https://github.com/joshbuddy/http_router | http_router.gemspec | Ruby | mit | 197 | master | 1,614 | # -*- encoding: utf-8 -*-
require File.join(File.dirname(__FILE__), 'lib', 'http_router', 'version')
Gem::Specification.new do |s|
s.name = 'http_router'
s.version = HttpRouter::VERSION
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Joshua... |
github | joshbuddy/http_router | https://github.com/joshbuddy/http_router | examples/glob.ru | Ruby | mit | 197 | master | 283 | require 'http_router'
run HttpRouter.new {
get('/*glob').to { |env| [200, {'Content-type' => 'text/plain'}, ["My glob is\n#{env['router.params'][:glob].map{|v| " * #{v}\n"}.join}"]]}
}
# $ curl http://127.0.0.1:3000/123/345/123
# => My glob is
# => * 123
# => * 345
# => * 123 |
github | joshbuddy/http_router | https://github.com/joshbuddy/http_router | examples/rack_mapper.ru | Ruby | mit | 197 | master | 743 | require 'http_router'
run HttpRouter.new do
add('/get/:id', :match_with => {:id => /\d+/}) { |env|
[200, {'Content-type' => 'text/plain'}, ["My id is #{env['router.params'][:id]}, which is a number\n"]]
}
# you have post, get, head, put and delete.
post('/get/:id') { |env|
[200, {'Content-type' => 'tex... |
github | joshbuddy/http_router | https://github.com/joshbuddy/http_router | examples/variable.ru | Ruby | mit | 197 | master | 265 | require 'http_router'
run HttpRouter.new {
get('/:variable').to { |env| [200, {'Content-type' => 'text/plain'}, ["my variables are\n#{env['router.params'].inspect}\n"]]}
}
# $ curl http://127.0.0.1:3000/heyguys
# => my variables are
# => {:variable=>"heyguys"} |
github | joshbuddy/http_router | https://github.com/joshbuddy/http_router | examples/variable_with_regex.ru | Ruby | mit | 197 | master | 323 | require 'http_router'
run HttpRouter.new {
get('/get/:id', :id => /\d+/).to { |env| [200, {'Content-type' => 'text/plain'}, ["id is #{Integer(env['router.params'][:id]) * 2} * 2\n"]]}
}
# $ curl http://127.0.0.1:3000/get/123
# => id is 246 * 2
# $ curl http://127.0.0.1:3000/get/asd
# => Your request couldn't be fou... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.