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 | realityforge/chef-glassfish | https://github.com/realityforge/chef-glassfish | providers/deployable_linux.rb | Ruby | apache-2.0 | 19 | master | 8,468 | #
# Copyright:: Peter Donald
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
github | realityforge/chef-glassfish | https://github.com/realityforge/chef-glassfish | providers/asadmin.rb | Ruby | apache-2.0 | 19 | master | 972 | #
# Copyright:: Peter Donald
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
github | realityforge/chef-glassfish | https://github.com/realityforge/chef-glassfish | providers/jvm_options.rb | Ruby | apache-2.0 | 19 | master | 4,141 | #
# Copyright:: Peter Donald
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
github | realityforge/chef-glassfish | https://github.com/realityforge/chef-glassfish | providers/managed_thread_factory.rb | Ruby | apache-2.0 | 19 | master | 2,939 | #
# Copyright:: Peter Donald
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
github | snaptortoise/jekyll-pinboard-plugin | https://github.com/snaptortoise/jekyll-pinboard-plugin | jekyll-pinboard.gemspec | Ruby | mit | 19 | master | 656 | Gem::Specification.new do |s|
s.name = 'jekyll-pinboard'
s.version = '0.2.5'
s.date = '2020-11-09'
s.summary = "A Jekyll plugin that makes your Pinboard bookmarks accessible"
s.description = "This plugin makes your Pinboard bookmarks accessible within your Jekyll templates."
s.authors ... |
github | snaptortoise/jekyll-pinboard-plugin | https://github.com/snaptortoise/jekyll-pinboard-plugin | lib/jekyll-pinboard.rb | Ruby | mit | 19 | master | 1,025 | # Jekyll Pinboard Plugin
# https://github.com/snaptortoise/jekyll-pinboard-plugin
# Author: George Mandis (http://george.mand.is, https://snaptortoise.com)
require "open-uri"
require "json"
Jekyll::Hooks.register :site, :after_init do |site|
pinboard_token = site.config['pinboard']['token']
site.config['pinb... |
github | jronallo/abrizer | https://github.com/jronallo/abrizer | Vagrantfile | Ruby | mit | 19 | master | 956 | # -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "geerlingguy/centos7"
config.vm.box_version = "1.2.5"
# Create a private network, which allows host-only access to the machine
# using a specific IP.
config.vm.network "private_network", ip: "192.168.33.40"
co... |
github | jronallo/abrizer | https://github.com/jronallo/abrizer | abrizer.gemspec | Ruby | mit | 19 | master | 1,245 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'abrizer/version'
Gem::Specification.new do |spec|
spec.name = "abrizer"
spec.version = Abrizer::VERSION
spec.authors = ["Jason Ronallo"]
spec.email = ["jronal... |
github | jronallo/abrizer | https://github.com/jronallo/abrizer | lib/abrizer.rb | Ruby | mit | 19 | master | 746 | require 'yajl'
require 'multi_json'
MultiJson.use :yajl
MultiJson.dump_options = {pretty: true}
require 'jbuilder'
require 'video_sprites'
require 'ostruct'
%w[
version
errors
filepath_helpers
read_adaptations
debug_settings
identifier_helpers
information_helpers
package_dash_shaka
package_hls_shaka... |
github | jronallo/abrizer | https://github.com/jronallo/abrizer | lib/abrizer/all.rb | Ruby | mit | 19 | master | 1,186 | module Abrizer
class All
def initialize(filename, output_dir, base_url, vp9=false)
@filename = filename
@output_directory = output_dir
FileUtils.mkdir_p @output_directory
@base_url = base_url
@vp9 = vp9
end
def run
Abrizer::FfprobeFile.new(@filename, @output_directory... |
github | jronallo/abrizer | https://github.com/jronallo/abrizer | lib/abrizer/ffmpeg_processor.rb | Ruby | mit | 19 | master | 1,711 | module Abrizer
# Creates the fMP4 files that are then packaged
class FfmpegProcessor
include FilepathHelpers
include DebugSettings
def initialize(filename, output_dir)
@filename = filename
@output_directory = output_dir
@adaptation_finder = Abrizer::AdaptationFinder.new(filepath: @fi... |
github | jronallo/abrizer | https://github.com/jronallo/abrizer | lib/abrizer/identifier_helpers.rb | Ruby | mit | 19 | master | 984 | module Abrizer
module IdentifierHelpers
def media_base_url
@base_url
end
def canvas_id
File.join media_base_url, canvas_partial_filepath
end
def data_id
File.join media_base_url, data_partial_filepath
end
def poster_id
File.join media_base_url, poster_partial_fi... |
github | jronallo/abrizer | https://github.com/jronallo/abrizer | lib/abrizer/progressive_vp9.rb | Ruby | mit | 19 | master | 1,757 | module Abrizer
class ProgressiveVp9
include FilepathHelpers
include DebugSettings
def initialize(filename, output_dir=nil)
@filename = filename
@output_directory = output_dir
make_directory
Dir.chdir @output_directory
find_adaptation
end
def create
`#{ffmpeg_... |
github | jronallo/abrizer | https://github.com/jronallo/abrizer | lib/abrizer/package_dash_bento.rb | Ruby | mit | 19 | master | 949 | module Abrizer
class PackageDashBento
include FilepathHelpers
def initialize(output_dir)
@output_directory = output_dir
@adaptations = Abrizer::AdaptationFinder.new(output_directory: @output_directory).adaptations
end
def package
# Must change to output directory so this all works... |
github | jronallo/abrizer | https://github.com/jronallo/abrizer | lib/abrizer/errors.rb | Ruby | mit | 19 | master | 929 | module Abrizer
# This error is raised if Abrizer::ReadAdaptations is unable to determine
# the adaptations that have or will be created for a given mezzanine file.
class ReadAdaptationsError < StandardError
def initialize
msg = "Unable to read adaptations. Either inlude the path to a master file or an ... |
github | jronallo/abrizer | https://github.com/jronallo/abrizer | lib/abrizer/ffprobe_file.rb | Ruby | mit | 19 | master | 422 | module Abrizer
class FfprobeFile
include FilepathHelpers
def initialize(filename, output_directory)
@informer = FfprobeInformer.new(filepath: filename)
@output_directory = output_directory
FileUtils.mkdir_p @output_directory unless File.exist? @output_directory
end
def run
F... |
github | jronallo/abrizer | https://github.com/jronallo/abrizer | lib/abrizer/progressive_mp3.rb | Ruby | mit | 19 | master | 462 | module Abrizer
# TODO: Allow MP3 to be created from the adaptation audio
class ProgressiveMp3
include FilepathHelpers
include DebugSettings
def initialize(filepath, output_directory)
@filepath = filepath
@output_directory = output_directory
end
def create
`#{ffmpeg_cmd}`
... |
github | jronallo/abrizer | https://github.com/jronallo/abrizer | lib/abrizer/debug_settings.rb | Ruby | mit | 19 | master | 278 | module Abrizer
module DebugSettings
# This is useful for testing an encoding setting on just part of a video.
# This gets applied before the input video is set.
def debug_settings
ENV['ABRIZER_DEBUG_SETTINGS'] || ''
# "-ss 10 -t 10"
end
end
end |
github | jronallo/abrizer | https://github.com/jronallo/abrizer | lib/abrizer/audio.rb | Ruby | mit | 19 | master | 1,594 | module Abrizer
class Audio
include FilepathHelpers
include DebugSettings
def initialize(filename, output_dir, base_url)
@filename = filename
@output_directory = output_dir
FileUtils.mkdir_p @output_directory
@base_url = base_url
end
def run
Abrizer::FfprobeFile.new... |
github | jronallo/abrizer | https://github.com/jronallo/abrizer | lib/abrizer/data_audio.rb | Ruby | mit | 19 | master | 1,626 | module Abrizer
# Creates a JSON file with information about the videos
class DataAudio
include FilepathHelpers
include IdentifierHelpers
include InformationHelpers
include ReadAdaptations
def initialize(output_directory, base_url)
@output_directory = output_directory
@base_url = ba... |
github | jronallo/abrizer | https://github.com/jronallo/abrizer | lib/abrizer/canvas.rb | Ruby | mit | 19 | master | 4,844 | module Abrizer
# Creates a IIIF Canvas JSON-LD document.
class Canvas
include FilepathHelpers
include IdentifierHelpers
include InformationHelpers
include ReadAdaptations
# TODO: allow control of items/versions listed on canvas
def initialize(filepath, output_directory, base_url)
@fi... |
github | jronallo/abrizer | https://github.com/jronallo/abrizer | lib/abrizer/data.rb | Ruby | mit | 19 | master | 3,430 | module Abrizer
# Creates a JSON file with information about the videos
class Data
include FilepathHelpers
include IdentifierHelpers
include InformationHelpers
include ReadAdaptations
def initialize(filepath, output_directory, base_url)
@filepath = filepath
@output_directory = outpu... |
github | jronallo/abrizer | https://github.com/jronallo/abrizer | lib/abrizer/progressive_mp4.rb | Ruby | mit | 19 | master | 1,000 | module Abrizer
class ProgressiveMp4
include FilepathHelpers
def initialize(output_dir)
@output_directory = output_dir
find_adaptation
end
def create
if File.exist? input_video_filepath
`#{ffmpeg_cmd}`
else
raise Mp4AdaptationNotFoundError
end
end
... |
github | jronallo/abrizer | https://github.com/jronallo/abrizer | lib/abrizer/captions.rb | Ruby | mit | 19 | master | 1,061 | module Abrizer
# Copies over any WebVTT captions that are beside the original video resource
# into the destination folder.
# TODO: This may only be needed if fMP4 derivatives aren't created since captions are copied over.
# TODO: Allow for more than one captions/subtitle file to be copied over.
class Caption... |
github | jronallo/abrizer | https://github.com/jronallo/abrizer | lib/abrizer/package_hls_bento.rb | Ruby | mit | 19 | master | 907 | module Abrizer
class PackageHlsBento
include FilepathHelpers
def initialize(output_dir)
@output_directory = output_dir
@adaptations = Abrizer::AdaptationFinder.new(output_directory: @output_directory).adaptations
end
def package
# Must change to output directory so this all works ... |
github | jronallo/abrizer | https://github.com/jronallo/abrizer | lib/abrizer/sprites.rb | Ruby | mit | 19 | master | 1,158 | module Abrizer
class Sprites
def initialize(filename, output_dir=nil)
@filename = filename
@output_directory = File.join output_dir, 'sprites'
# TODO: make video sprites options configurable
@options = {
seconds: 10,
width: 160,
columns: 4,
group: 20,
... |
github | jronallo/abrizer | https://github.com/jronallo/abrizer | lib/abrizer/adaptation.rb | Ruby | mit | 19 | master | 1,510 | module Abrizer
class Adaptation
include FilepathHelpers
include DebugSettings
attr_reader :width, :height, :bitrate
def initialize(width:, height:, bitrate:)
@width = width
@height = height
@bitrate = bitrate
end
def ffmpeg_cmd(input, output_directory, pass)
cmd = %... |
github | jronallo/abrizer | https://github.com/jronallo/abrizer | lib/abrizer/information_helpers.rb | Ruby | mit | 19 | master | 665 | module Abrizer
module InformationHelpers
# TODO: Could this be more flexible to potentially use a file
# other than the mp4_filepath?
def duration
informer = Abrizer::FfprobeInformer.new(filepath: mp4_filepath, output_directory: @output_directory)
informer.duration.to_f
end
def max_w... |
github | jronallo/abrizer | https://github.com/jronallo/abrizer | lib/abrizer/cli.rb | Ruby | mit | 19 | master | 7,785 | require 'thor'
if ENV['DEBUG_ABRIZER']
require 'byebug'
end
module Abrizer
class CLI < Thor
# Adapted from http://stackoverflow.com/a/24829698/620065
# Add a name for the option that allows for more variability
class << self
def add_shared_option(name, option_name, options = {})
@shared... |
github | jronallo/abrizer | https://github.com/jronallo/abrizer | lib/abrizer/package_dash_shaka.rb | Ruby | mit | 19 | master | 1,256 | module Abrizer
class PackageDashShaka
include FilepathHelpers
def initialize(filename, output_dir=nil)
@filename = filename
@adaptations = Abrizer::AdaptationFinder.new(filepath: @filename).adaptations
end
def package
make_directory
Dir.chdir output_directory
`#{shaka_... |
github | jronallo/abrizer | https://github.com/jronallo/abrizer | lib/abrizer/adaptations_file.rb | Ruby | mit | 19 | master | 586 | module Abrizer
class AdaptationsFile
include FilepathHelpers
def initialize(filepath, output_directory)
@filepath = filepath
@output_directory = output_directory
FileUtils.mkdir_p @output_directory unless File.exist? @output_directory
end
def adaptations
adapt = Abrizer::Ada... |
github | jronallo/abrizer | https://github.com/jronallo/abrizer | lib/abrizer/ffprobe_informer.rb | Ruby | mit | 19 | master | 2,461 | module Abrizer
class FfprobeInformer
include FilepathHelpers
attr_reader :json_result, :info
def initialize(filepath: nil, output_directory: nil)
@filepath = filepath
@output_directory = output_directory
get_info
end
def get_info
if @filepath && File.exist?(@filepath) &&... |
github | jronallo/abrizer | https://github.com/jronallo/abrizer | lib/abrizer/read_adaptations.rb | Ruby | mit | 19 | master | 1,376 | module Abrizer
module ReadAdaptations
def read_adaptations
# Either we have a filepath to an original or we make the assumption we
# really have an identifier instead of a filepath and we use that
# identifier to look for an adaptations.json file. Failing finding the
# adaptations.json fi... |
github | jronallo/abrizer | https://github.com/jronallo/abrizer | lib/abrizer/temporary_poster.rb | Ruby | mit | 19 | master | 600 | module Abrizer
# It is usually better for a human to select a poster image, but we try to
# select a temporary one.
# Creating sprites leaves some images around so that is a prerequisite for
# this step.
# TODO: selection of a temporary poster image could be improved
class TemporaryPoster
include Filep... |
github | jronallo/abrizer | https://github.com/jronallo/abrizer | lib/abrizer/cleaner.rb | Ruby | mit | 19 | master | 875 | module Abrizer
class Cleaner
include FilepathHelpers
def initialize(output_dir)
@output_directory = output_dir
@adaptations = Abrizer::AdaptationFinder.new(output_directory: @output_directory).adaptations
end
def clean
delete_adaptations(@adaptations)
clean_audio_file
... |
github | jronallo/abrizer | https://github.com/jronallo/abrizer | lib/abrizer/adaptation_finder.rb | Ruby | mit | 19 | master | 2,417 | module Abrizer
# TODO: AdaptationFinder is incomplete. Basically what we want to do is to
# find out the height, width, and aspect ratio of the original and then
# determine which adaptations to create. So for a 3:2 video we'll have 4
# adaptations but ought to only create ones that are the same size and smalle... |
github | jronallo/abrizer | https://github.com/jronallo/abrizer | lib/abrizer/package_hls_shaka.rb | Ruby | mit | 19 | master | 1,492 | module Abrizer
class PackageHlsShaka
include FilepathHelpers
def initialize(filename, output_dir=nil)
@filename = filename
@adaptations = Abrizer::AdaptationFinder.new(filepath: @filename).adaptations
end
def package
make_directory
Dir.chdir hls_directory
`#{shaka_cmd}... |
github | jronallo/abrizer | https://github.com/jronallo/abrizer | lib/abrizer/waveform.rb | Ruby | mit | 19 | master | 513 | module Abrizer
class Waveform
include FilepathHelpers
include DebugSettings
def initialize(filename, output_dir)
@filename = filename
@output_directory = File.join output_dir
make_directory
end
def create
`#{audiowaveform_cmd}`
end
def audiowaveform_cmd
"a... |
github | jronallo/abrizer | https://github.com/jronallo/abrizer | lib/abrizer/filepath_helpers.rb | Ruby | mit | 19 | master | 3,300 | module Abrizer
module FilepathHelpers
def all_media_paths
[mpd_filepath, hlsts_filepath, vp9_filepath, mp4_filepath, captions_filepath, sprites_filepath]
end
def audio_filepath
File.join output_directory, "adaptation-audio.m4a"
end
def audio_filepath_fragmented
File.join outpu... |
github | jronallo/abrizer | https://github.com/jronallo/abrizer | test/abrizer_test.rb | Ruby | mit | 19 | master | 202 | require 'test_helper'
class AbrizerTest < Minitest::Test
def test_that_it_has_a_version_number
refute_nil ::Abrizer::VERSION
end
def test_it_does_something_useful
assert false
end
end |
github | jicheng1014/docapurl | https://github.com/jicheng1014/docapurl | docapurl.gemspec | Ruby | mit | 19 | master | 1,538 | lib = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "docapurl/version"
Gem::Specification.new do |spec|
spec.name = "docapurl"
spec.version = Docapurl::VERSION
spec.authors = ["atpking"]
spec.email = ["atpking@gmail.com"]
spec.s... |
github | jicheng1014/docapurl | https://github.com/jicheng1014/docapurl | lib/docapurl.rb | Ruby | mit | 19 | master | 1,364 | require_relative './docapurl/version'
require_relative './docapurl/browser'
require 'thor'
module Docapurl
class Error < StandardError; end
# Your code goes here...
class Cli < Thor
desc 'cap [url]', 'cap url'
method_option :browser_path, type: :string, desc: 'specify chrome browser path', required: fal... |
github | jicheng1014/docapurl | https://github.com/jicheng1014/docapurl | lib/docapurl/browser.rb | Ruby | mit | 19 | master | 3,211 | require 'ferrum'
require 'logger'
module Docapurl
class Browser
SYSTEM_MAX_PAGE_DOWN_TO_BOTTOM = 50
attr_accessor :browser, :save_path, :logger, :context, :page
def initialize(options)
@save_path = options[:save_path]
options[:timeout] ||= 30
options[:slowmo] = 0.5
@logger = opt... |
github | jicheng1014/docapurl | https://github.com/jicheng1014/docapurl | spec/spec_helper.rb | Ruby | mit | 19 | master | 364 | require "bundler/setup"
require "docapurl"
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!
config.expect_with :rs... |
github | etrex/everybody-can-build-kamigo-demo | https://github.com/etrex/everybody-can-build-kamigo-demo | ironman/Gemfile | Ruby | mit | 19 | master | 2,098 | source 'https://rubygems.org'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1.6'
# Use sqlite3 as the database for Active Record... |
github | etrex/everybody-can-build-kamigo-demo | https://github.com/etrex/everybody-can-build-kamigo-demo | ironman/app/models/user.rb | Ruby | mit | 19 | master | 252 | class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable,
:recoverable, :rememberable, :trackable, :validatable
end |
github | etrex/everybody-can-build-kamigo-demo | https://github.com/etrex/everybody-can-build-kamigo-demo | ironman/app/controllers/keyword_mappings_controller.rb | Ruby | mit | 19 | master | 2,269 | class KeywordMappingsController < ApplicationController
before_action :authenticate_user!
before_action :set_keyword_mapping, only: [:show, :edit, :update, :destroy]
# GET /keyword_mappings
# GET /keyword_mappings.json
def index
@keyword_mappings = KeywordMapping.all
end
# GET /keyword_mappings/1
... |
github | etrex/everybody-can-build-kamigo-demo | https://github.com/etrex/everybody-can-build-kamigo-demo | ironman/app/controllers/push_messages_controller.rb | Ruby | mit | 19 | master | 965 | class PushMessagesController < ApplicationController
before_action :authenticate_user!
# GET /push_messages/new
def new
end
# POST /push_messages
def create
text = params[:text]
Channel.all.each do |channel|
push_to_line(channel.channel_id, text)
end
redirect_to '/push_messages/new'
... |
github | etrex/everybody-can-build-kamigo-demo | https://github.com/etrex/everybody-can-build-kamigo-demo | ironman/app/controllers/kamigo_controller.rb | Ruby | mit | 19 | master | 6,038 | require 'line/bot'
class KamigoController < ApplicationController
protect_from_forgery with: :null_session
def webhook
# 查天氣
reply_image = get_weather(received_text)
# 有查到的話 後面的事情就不作了
unless reply_image.nil?
# 傳送訊息到 line
response = reply_image_to_line(reply_image)
# 回應 200
... |
github | etrex/everybody-can-build-kamigo-demo | https://github.com/etrex/everybody-can-build-kamigo-demo | ironman/config/routes.rb | Ruby | mit | 19 | master | 524 | Rails.application.routes.draw do
devise_for :users
resources :keyword_mappings
get '/kamigo/eat', to: 'kamigo#eat'
get '/kamigo/request_headers', to: 'kamigo#request_headers'
get '/kamigo/request_body', to: 'kamigo#request_body'
get '/kamigo/response_headers', to: 'kamigo#response_headers'
get '/kamigo/re... |
github | etrex/everybody-can-build-kamigo-demo | https://github.com/etrex/everybody-can-build-kamigo-demo | ironman/config/application.rb | Ruby | mit | 19 | master | 594 | require_relative 'boot'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Ironman
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails v... |
github | etrex/everybody-can-build-kamigo-demo | https://github.com/etrex/everybody-can-build-kamigo-demo | ironman/config/environments/production.rb | Ruby | mit | 19 | master | 3,785 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web serve... |
github | etrex/everybody-can-build-kamigo-demo | https://github.com/etrex/everybody-can-build-kamigo-demo | ironman/config/initializers/devise.rb | Ruby | mit | 19 | master | 13,817 | # frozen_string_literal: true
# Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
# The secret key used by Devise. Devise uses this key to generate
# random tokens. Changing this key will render inv... |
github | etrex/everybody-can-build-kamigo-demo | https://github.com/etrex/everybody-can-build-kamigo-demo | ironman/test/controllers/keyword_mappings_controller_test.rb | Ruby | mit | 19 | master | 1,448 | require 'test_helper'
class KeywordMappingsControllerTest < ActionDispatch::IntegrationTest
setup do
@keyword_mapping = keyword_mappings(:one)
end
test "should get index" do
get keyword_mappings_url
assert_response :success
end
test "should get new" do
get new_keyword_mapping_url
assert... |
github | etrex/everybody-can-build-kamigo-demo | https://github.com/etrex/everybody-can-build-kamigo-demo | ironman/test/system/keyword_mappings_test.rb | Ruby | mit | 19 | master | 227 | require "application_system_test_case"
class KeywordMappingsTest < ApplicationSystemTestCase
# test "visiting the index" do
# visit keyword_mappings_url
#
# assert_selector "h1", text: "KeywordMapping"
# end
end |
github | etrex/everybody-can-build-kamigo-demo | https://github.com/etrex/everybody-can-build-kamigo-demo | ironman/db/schema.rb | Ruby | mit | 19 | master | 2,245 | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# dat... |
github | etrex/everybody-can-build-kamigo-demo | https://github.com/etrex/everybody-can-build-kamigo-demo | ironman/db/migrate/20180422160825_devise_create_users.rb | Ruby | mit | 19 | master | 1,391 | # frozen_string_literal: true
class DeviseCreateUsers < ActiveRecord::Migration[5.1]
def change
create_table :users do |t|
## Database authenticatable
t.string :email, null: false, default: ""
t.string :encrypted_password, null: false, default: ""
## Recoverable
t.stri... |
github | etrex/everybody-can-build-kamigo-demo | https://github.com/etrex/everybody-can-build-kamigo-demo | ironman/db/migrate/20180422015318_create_keyword_mappings.rb | Ruby | mit | 19 | master | 200 | class CreateKeywordMappings < ActiveRecord::Migration[5.1]
def change
create_table :keyword_mappings do |t|
t.string :keyword
t.string :message
t.timestamps
end
end
end |
github | hugolantaume/iso-swift | https://github.com/hugolantaume/iso-swift | iso.gemspec | Ruby | mit | 19 | master | 984 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'iso/version'
Gem::Specification.new do |spec|
spec.name = "iso-swift"
spec.version = ISO::VERSION
spec.authors = ["Hugo Lantaume"]
spec.email = ["hugolantaume... |
github | hugolantaume/iso-swift | https://github.com/hugolantaume/iso-swift | Rakefile | Ruby | mit | 19 | master | 248 | require "rspec/core/rake_task"
require "bundler/gem_tasks"
# Default directory to look in is `/specs`
# Run with `rake spec`
desc "Run all examples"
RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = %w[--color]
end
task :default => [:spec] |
github | hugolantaume/iso-swift | https://github.com/hugolantaume/iso-swift | lib/iso/swift.rb | Ruby | mit | 19 | master | 6,165 | require 'yaml'
require 'countries'
module ISO
# SWIFT
#
# Usage
# =====
#
# require 'iso/swift'
# ==== new instance - valid SWIFT code
# swift = ISO::SWIFT.new('PSST FR PP SCE') # => #<ISO::SWIFT:0x007fb4a393e220 @data={"formatted"=>"PSSTFRPPSCE", "bank_code"=>"PSST", "country_code"=>"FR",... |
github | hugolantaume/iso-swift | https://github.com/hugolantaume/iso-swift | spec/iso_swift_spec.rb | Ruby | mit | 19 | master | 4,525 | # encoding: utf-8
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe '[ISO::SWIFT]' do
context 'a new ISO::SWIFT instance' do
let(:swift) { ISO::SWIFT.new('PSSTFRPPSCE') }
it 'responds to :valid?' do
expect(swift).to respond_to(:valid?)
end
it 'responds to :errors' ... |
github | spenserblack/repofetch | https://github.com/spenserblack/repofetch | Rakefile | Ruby | mit | 19 | main | 560 | # frozen_string_literal: true
require 'bundler/setup'
require 'rake'
require 'os'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
require 'yard'
RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = if OS.windows?
'--exclude-pattern spec/**/*_unix_spec.rb'
else
... |
github | spenserblack/repofetch | https://github.com/spenserblack/repofetch | Gemfile | Ruby | mit | 19 | main | 437 | # frozen_string_literal: true
source 'https://rubygems.org'
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
gemspec
gem 'os', '~> 1.1'
gem 'overcommit', '~> 0.59'
gem 'rake', '~> 13.0'
gem 'rspec', '~> 3.11'
gem 'rspec-snapshot', '~> 2.0'
gem 'rubocop', '~> 1.36'
gem 'rubocop-rake', '~> 0.6'
g... |
github | spenserblack/repofetch | https://github.com/spenserblack/repofetch | repofetch.gemspec | Ruby | mit | 19 | main | 1,817 | # frozen_string_literal: true
require_relative 'lib/repofetch/version'
LONG_DESCRIPTION = 'A plugin-based tool to fetch stats, with some git repository host stat fetchers included by default'
Gem::Specification.new do |spec|
spec.name = 'repofetch'
spec.version ... |
github | spenserblack/repofetch | https://github.com/spenserblack/repofetch | lib/repofetch.rb | Ruby | mit | 19 | main | 3,599 | # frozen_string_literal: true
require 'action_view'
require 'git'
require 'repofetch/config'
require 'repofetch/env'
require 'repofetch/exceptions'
require 'repofetch/plugin'
require 'repofetch/stat'
require 'repofetch/timespan_stat'
require 'repofetch/theme'
require 'repofetch/util'
require 'repofetch/version'
# Mai... |
github | spenserblack/repofetch | https://github.com/spenserblack/repofetch | lib/repofetch/timespan_stat.rb | Ruby | mit | 19 | main | 368 | # frozen_string_literal: true
require 'repofetch/stat'
class Repofetch
# Timespan stat for "x units ago" stats.
class TimespanStat < Stat
include ActionView::Helpers::DateHelper
# Formats the value as "x units ago".
def format_value(now = nil)
now = Time.now if now.nil?
"#{distance_of_tim... |
github | spenserblack/repofetch | https://github.com/spenserblack/repofetch | lib/repofetch/util.rb | Ruby | mit | 19 | main | 1,259 | # frozen_string_literal: true
class Repofetch
# Provides uncategorized utilities.
module Util
# Converts a format string into a plain string (e.g. +"%{green}OK"+ -> +"OK"+)
def remove_format_params(str)
str.gsub(/%{[\w\d]+?}/, '')
end
# Removes ANSI escape sequences from +str+.
def clean... |
github | spenserblack/repofetch | https://github.com/spenserblack/repofetch | lib/repofetch/stat.rb | Ruby | mit | 19 | main | 1,646 | # frozen_string_literal: true
class Repofetch
# Base class for stats.
class Stat
attr_reader :label, :value, :emoji
attr_writer :theme
# Creates a stat
#
# @param [String] label The label of the stat
# @param value The value of the stat
# @param [String] emoji An optional emoji for the... |
github | spenserblack/repofetch | https://github.com/spenserblack/repofetch | lib/repofetch/bitbucketcloud.rb | Ruby | mit | 19 | main | 3,184 | # frozen_string_literal: true
require 'action_view'
require 'optparse'
require 'repofetch/bitbucketcloud/stats'
require 'repofetch/exceptions'
require 'repofetch/plugin'
require 'repofetch/util'
require 'sawyer'
class Repofetch
# Adds support for Bitbucket repositories.
class BitbucketCloud < Repofetch::Plugin
... |
github | spenserblack/repofetch | https://github.com/spenserblack/repofetch | lib/repofetch/plugin.rb | Ruby | mit | 19 | main | 5,514 | # frozen_string_literal: true
require 'repofetch'
require 'repofetch/util'
require 'repofetch/stat'
class Repofetch
# @abstract Subclass to create a plugin.
class Plugin
include Repofetch::Util
# Plugin intializer arguments should come from the +from_git+ or +from_args+
# class methods.
def initi... |
github | spenserblack/repofetch | https://github.com/spenserblack/repofetch | lib/repofetch/github.rb | Ruby | mit | 19 | main | 4,755 | # frozen_string_literal: true
require 'action_view'
require 'octokit'
require 'optparse'
require 'repofetch/exceptions'
require 'repofetch/plugin'
require 'repofetch/util'
class Repofetch
# Adds support for GitHub repositories.
class Github < Repofetch::Plugin
include ActionView::Helpers::NumberHelper
inc... |
github | spenserblack/repofetch | https://github.com/spenserblack/repofetch | lib/repofetch/gitlab.rb | Ruby | mit | 19 | main | 4,088 | # frozen_string_literal: true
require 'cgi'
require 'repofetch/exceptions'
require 'repofetch/plugin'
require 'repofetch/util'
require 'sawyer'
class Repofetch
# Adds support for GitLab repositories.
class Gitlab < Repofetch::Plugin
include Repofetch::Util
extend Repofetch::Util
HTTP_REMOTE_REGEX = %... |
github | spenserblack/repofetch | https://github.com/spenserblack/repofetch | lib/repofetch/env.rb | Ruby | mit | 19 | main | 404 | # frozen_string_literal: true
require 'dotenv'
class Repofetch
# Environment variable manager. Basically a wrapper around dotenv.
class Env
DOTENV_NAMES = ['repofetch.env', '.repofetch.env'].freeze
def self.load
dotenv_paths.each { |dotenv| Dotenv.load(dotenv) }
end
def self.dotenv_paths
... |
github | spenserblack/repofetch | https://github.com/spenserblack/repofetch | lib/repofetch/config.rb | Ruby | mit | 19 | main | 1,109 | # frozen_string_literal: true
require 'yaml'
class Repofetch
# Utilities for managing config.
class Config
DEFAULT_CONFIG = File.read(File.expand_path('DEFAULT_CONFIG', __dir__))
# Loads from config file.
def self.load
new(File.read(path))
end
# The path to the config file.
def sel... |
github | spenserblack/repofetch | https://github.com/spenserblack/repofetch | lib/repofetch/theme.rb | Ruby | mit | 19 | main | 1,127 | # frozen_string_literal: true
class Repofetch
# Provides a theme for styling output.
class Theme
DEFAULT_STYLES = {
black: 30,
red: 31,
green: 32,
yellow: 33,
blue: 34,
magenta: 35,
cyan: 36,
white: 37,
on_black: 40,
on_red: 41,
on_green: 42,
... |
github | spenserblack/repofetch | https://github.com/spenserblack/repofetch | lib/repofetch/exceptions.rb | Ruby | mit | 19 | main | 373 | # frozen_string_literal: true
class Repofetch
class Error < RuntimeError
end
# Raised when there aren't any available plugins.
class NoPluginsError < Error
end
# Raised when more than one plugin is activated.
class TooManyPluginsError < Error
end
# Raised when a user incorrectly uses the CLI with ... |
github | spenserblack/repofetch | https://github.com/spenserblack/repofetch | lib/repofetch/cli.rb | Ruby | mit | 19 | main | 2,849 | # frozen_string_literal: true
require 'optparse'
require 'repofetch'
require 'repofetch/config'
require 'repofetch/exceptions'
require 'repofetch/version'
class Repofetch
# Command line interface for repofetch.
class CLI
attr_reader :repository_path, :plugin
# Define the command line interface.
#
... |
github | spenserblack/repofetch | https://github.com/spenserblack/repofetch | lib/repofetch/bitbucketcloud/stats.rb | Ruby | mit | 19 | main | 2,097 | # frozen_string_literal: true
require 'repofetch'
class Repofetch
class BitbucketCloud < Repofetch::Plugin
# Methods to get Bitbucket Cloud stats.
module Stats
protected
def repo_data
@repo_data ||= agent.call(:get, "repositories/#{@repo_identifier}").data
end
def clone_url... |
github | spenserblack/repofetch | https://github.com/spenserblack/repofetch | spec/repofetch_spec.rb | Ruby | mit | 19 | main | 5,375 | # frozen_string_literal: true
require 'git'
require 'repofetch'
require 'repofetch/config'
RSpec.describe Repofetch do
describe '#register_plugin' do
before { described_class.send(:clear_plugins) }
context 'with empty mock_plugin' do
let(:mock_plugin) { Class.new(described_class::Plugin) }
it ... |
github | spenserblack/repofetch | https://github.com/spenserblack/repofetch | spec/spec_helper.rb | Ruby | mit | 19 | main | 5,531 | # frozen_string_literal: true
# This file was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
# this file to always be loaded, without a need to expl... |
github | spenserblack/repofetch | https://github.com/spenserblack/repofetch | spec/repofetch/timespan_stat_spec.rb | Ruby | mit | 19 | main | 762 | # frozen_string_literal: true
require 'repofetch'
RSpec.describe Repofetch::TimespanStat do
describe '#format_value' do
context 'when value is 2022/10/31 and now is 2022/12/31' do
let(:value) { Time.new(2022, 10, 31) }
let(:now) { Time.new(2022, 12, 31) }
it 'returns "2 months ago"' do
... |
github | spenserblack/repofetch | https://github.com/spenserblack/repofetch | spec/repofetch/plugin_spec.rb | Ruby | mit | 19 | main | 1,684 | # frozen_string_literal: true
require 'repofetch'
RSpec.describe Repofetch::Plugin do
describe '#matches_repo?' do
it 'returns false' do
expect(described_class.matches_repo?(nil)).to be false
end
end
describe '#matches_path?' do
it 'returns false' do
expect(described_class.matches_path?... |
github | spenserblack/repofetch | https://github.com/spenserblack/repofetch | spec/repofetch/stat_spec.rb | Ruby | mit | 19 | main | 1,270 | # frozen_string_literal: true
require 'repofetch'
require 'repofetch/theme'
RSpec.describe Repofetch::Stat do
before { Repofetch.config = Repofetch::Config.new }
describe '#format_value' do
it "calls the value's to_s method" do
stat = described_class.new('label', 'foo')
expect(stat.format_value).... |
github | spenserblack/repofetch | https://github.com/spenserblack/repofetch | spec/repofetch/env_spec.rb | Ruby | mit | 19 | main | 527 | # frozen_string_literal: true
require 'dotenv'
require 'repofetch/env'
RSpec.describe Repofetch::Env do
describe '#load' do
before { allow(Dotenv).to receive(:load) }
it 'loads from ~/.repofetch.env' do
described_class.load
expect(Dotenv).to have_received(:load).with(File.expand_path('.repofetc... |
github | spenserblack/repofetch | https://github.com/spenserblack/repofetch | spec/repofetch/cli_windows_spec.rb | Ruby | mit | 19 | main | 1,067 | # frozen_string_literal: true
require 'git'
require 'repofetch'
require 'repofetch/cli'
require 'repofetch/config'
require 'stringio'
RSpec.describe Repofetch::CLI do
before { allow(Dir).to receive(:home).and_return('C:/Users/me') }
context 'when +Namespace::Myplugin+ is a registered plugin' do
let(:config) ... |
github | spenserblack/repofetch | https://github.com/spenserblack/repofetch | spec/repofetch/cli_unix_spec.rb | Ruby | mit | 19 | main | 1,061 | # frozen_string_literal: true
require 'git'
require 'repofetch'
require 'repofetch/cli'
require 'repofetch/config'
require 'stringio'
RSpec.describe Repofetch::CLI do
before { allow(Dir).to receive(:home).and_return('/home/me') }
context 'when +Namespace::Myplugin+ is a registered plugin' do
let(:config) { R... |
github | spenserblack/repofetch | https://github.com/spenserblack/repofetch | spec/repofetch/cli_spec.rb | Ruby | mit | 19 | main | 3,294 | # frozen_string_literal: true
require 'git'
require 'repofetch'
require 'repofetch/cli'
require 'repofetch/config'
require 'repofetch/exceptions'
require 'stringio'
RSpec.describe Repofetch::CLI do
before { allow(Dir).to receive(:home).and_return('/home/me') }
context 'when +Namespace::Myplugin+ is a registered ... |
github | spenserblack/repofetch | https://github.com/spenserblack/repofetch | spec/repofetch/plugin_snapshot_spec.rb | Ruby | mit | 19 | main | 1,202 | # frozen_string_literal: true
require 'repofetch'
RSpec.describe Repofetch::Plugin do
describe '#to_s' do
let(:mock_plugin) do
Class.new described_class do
attr_reader :stats
def initialize(stats)
super
@stats = stats
end
def header
'plugin h... |
github | spenserblack/repofetch | https://github.com/spenserblack/repofetch | spec/repofetch/github_spec.rb | Ruby | mit | 19 | main | 5,324 | # frozen_string_literal: true
require 'git'
require 'repofetch/exceptions'
require 'repofetch/github'
RSpec.describe Repofetch::Github do
context 'when the remote is "http://github.com/ghost/boo.git"' do
let(:remote) { 'http://github.com/ghost/boo.git' }
describe '#matches_remote?' do
it 'is true' do... |
github | spenserblack/repofetch | https://github.com/spenserblack/repofetch | spec/repofetch/bitbucket_cloud_spec.rb | Ruby | mit | 19 | main | 6,103 | # frozen_string_literal: true
require 'repofetch/bitbucketcloud'
require 'repofetch/exceptions'
RSpec.describe Repofetch::BitbucketCloud do
context 'when the remote is "http://bitbucket.org/foo/bar.git"' do
let(:remote) { 'http://bitbucket.org/foo/bar.git' }
describe '#matches_remote?' do
it 'is true... |
github | spenserblack/repofetch | https://github.com/spenserblack/repofetch | spec/repofetch/config_spec.rb | Ruby | mit | 19 | main | 1,839 | # frozen_string_literal: true
require 'repofetch/config'
RSpec.describe Repofetch::Config do
describe '#load' do
it 'calls #new with the contents of the given file' do
allow(File).to receive(:read).and_return('plugins: []')
described_class.load
expect(File).to have_received(:read).with(describ... |
github | spenserblack/repofetch | https://github.com/spenserblack/repofetch | spec/repofetch/bitbucket_cloud_snapshot_spec.rb | Ruby | mit | 19 | main | 2,271 | # frozen_string_literal: true
require 'repofetch/bitbucketcloud'
require 'sawyer'
describe Repofetch::BitbucketCloud do
describe '#to_s' do
let(:agent) { instance_double(Sawyer::Agent) }
let(:instance) { described_class.new('foo/bar') }
before do
# TODO: Instead of making time relative to test, t... |
github | spenserblack/repofetch | https://github.com/spenserblack/repofetch | spec/repofetch/util_spec.rb | Ruby | mit | 19 | main | 1,523 | # frozen_string_literal: true
require 'git'
require 'repofetch/util'
describe Repofetch::Util do
subject(:dummy) { Class.new { include Repofetch::Util }.new }
describe '#default_remote' do
let(:git) { instance_double(Git::Base) }
let(:origin) { instance_double(Git::Remote, name: 'origin') }
let(:upst... |
github | spenserblack/repofetch | https://github.com/spenserblack/repofetch | spec/repofetch/gitlab_spec.rb | Ruby | mit | 19 | main | 6,208 | # frozen_string_literal: true
require 'git'
require 'repofetch/exceptions'
require 'repofetch/gitlab'
require 'sawyer'
RSpec.describe Repofetch::Gitlab do
context 'when the remote is "http://gitlab.com/gitlab-org/gitlab.git"' do
let(:remote) { 'http://gitlab.com/gitlab-org/gitlab.git' }
describe '#matches_... |
github | spenserblack/repofetch | https://github.com/spenserblack/repofetch | spec/repofetch/github_snapshot_spec.rb | Ruby | mit | 19 | main | 1,865 | # frozen_string_literal: true
require 'octokit'
require 'repofetch/github'
describe Repofetch::Github do
describe '#to_s' do
let(:client) { instance_double(Octokit::Client) }
before do
# TODO: Instead of making time relative to test, the raw time should be used.
last_year = Time.new(Time.now.ye... |
github | spenserblack/repofetch | https://github.com/spenserblack/repofetch | spec/repofetch/gitlab_snapshot_spec.rb | Ruby | mit | 19 | main | 1,902 | # frozen_string_literal: true
require 'repofetch/gitlab'
require 'sawyer'
describe Repofetch::Gitlab do
describe '#to_s' do
let(:agent) { instance_double(Sawyer::Agent) }
let(:instance) { described_class.new('123') }
before do
# TODO: Instead of making time relative to test, the raw time should b... |
github | shyouhei/optdown | https://github.com/shyouhei/optdown | Rakefile | Ruby | mit | 19 | master | 3,988 | #! /your/favourite/path/to/rake
# -*- mode: ruby; coding: utf-8; indent-tabs-mode: nil; ruby-indent-level: 2 -*-
# -*- frozen_string_literal: true -*-
# -*- warn_indent: true -*-
# Copyright (c) 2017 Urabe, Shyouhei
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software an... |
github | shyouhei/optdown | https://github.com/shyouhei/optdown | Gemfile | Ruby | mit | 19 | master | 1,625 | #! /your/favourite/path/to/bundler
# -*- mode: ruby; coding: utf-8; indent-tabs-mode: nil; ruby-indent-level: 2 -*-
# -*- frozen_string_literal: true -*-
# -*- warn_indent: true -*-
# Copyright (c) 2017 Urabe, Shyouhei
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software... |
github | shyouhei/optdown | https://github.com/shyouhei/optdown | test/always_frozen.rb | Ruby | mit | 19 | master | 1,900 | #! /your/favourite/path/to/ruby
# -*- mode: ruby; coding: utf-8; indent-tabs-mode: nil; ruby-indent-level: 2 -*-
# -*- frozen_string_literal: true -*-
# -*- warn_indent: true -*-
# Copyright (c) 2017 Urabe, Shyouhei
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software an... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.