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 | Nedomas/databound-rails | https://github.com/Nedomas/databound-rails | spec/internal/app/controllers/permit_controller.rb | Ruby | mit | 19 | master | 389 | class PermitController < ApplicationController
databound do
model :project
columns :name, :city, :user_id, :dont_permit
permit(:read) do |params, records|
!params.dont_permit
end
permit(:create) do |params|
params.user_id == CURRENT_USER_ID
end
permit(:update, :destroy) do |... |
github | Nedomas/databound-rails | https://github.com/Nedomas/databound-rails | spec/internal/config/routes.rb | Ruby | mit | 19 | master | 308 | Rails.application.routes.draw do
databound :users
databound :no_model
databound :columns
databound :dsl
databound :loose_dsl
databound :messages, columns: :table_columns
databound :permit
databound :posts, columns: %i(title)
databound :projects, columns: %i(city user_id), model: :user
end |
github | Nedomas/databound-rails | https://github.com/Nedomas/databound-rails | spec/internal/db/schema.rb | Ruby | mit | 19 | master | 499 | ActiveRecord::Schema.define do
create_table(:users, force: true) do |t|
t.string :name
t.string :city
t.timestamps
end
create_table(:messages, force: true) do |t|
t.string :name
t.string :city
t.timestamps
end
create_table(:projects, force: true) do |t|
t.string :city
t.integ... |
github | Nedomas/databound-rails | https://github.com/Nedomas/databound-rails | spec/controllers/routes_opts_controller_spec.rb | Ruby | mit | 19 | master | 2,300 | require 'spec_helper'
describe PostsController, type: :controller do
describe '#create' do
it 'raise when param is not permitted' do
data = {
data: {
description: 'Barcelona',
},
scope: {},
}
assert_responses(
-> { post(:create, javascriptize(data)) },... |
github | Nedomas/databound-rails | https://github.com/Nedomas/databound-rails | spec/controllers/columns_controller_spec.rb | Ruby | mit | 19 | master | 2,867 | require 'spec_helper'
describe PostsController, type: :controller do
describe 'via routes' do
it 'raise when param is not permitted' do
data = {
data: {
city: 'Barcelona',
},
scope: {},
}
assert_responses(
-> { post(:create, javascriptize(data)) },
... |
github | Nedomas/databound-rails | https://github.com/Nedomas/databound-rails | spec/controllers/model_controller_spec.rb | Ruby | mit | 19 | master | 600 | require 'spec_helper'
describe ProjectsController do
describe 'via routes' do
it 'should be able to specify model via routes' do
expect(ProjectsController.new.databound_config.read(:model)).to equal(:user)
end
it 'should be able to specify columns via routes' do
expect(ProjectsController.new... |
github | Nedomas/databound-rails | https://github.com/Nedomas/databound-rails | spec/controllers/dsl_controller_spec.rb | Ruby | mit | 19 | master | 4,441 | require 'spec_helper'
describe DslController, type: :controller do
describe '#create' do
describe 'strict' do
describe 'without data usage' do
before :each do
data = {
data: {
name: 'John',
city: 'hottest',
},
scope: {},
... |
github | Nedomas/databound-rails | https://github.com/Nedomas/databound-rails | spec/controllers/databound_spec.rb | Ruby | mit | 19 | master | 3,068 | require 'spec_helper'
describe UsersController, type: :controller do
describe '#create' do
before :each do
data = {
data: {
name: 'John',
},
scope: {},
}
post(:create, javascriptize(data))
end
it 'responds consistently to js' do
expect(rubize(re... |
github | Nedomas/databound-rails | https://github.com/Nedomas/databound-rails | spec/controllers/on_the_fly_spec.rb | Ruby | mit | 19 | master | 684 | require 'spec_helper'
describe MessagesController, type: :controller do
describe '#create' do
before :each do
data = {
data: {
name: 'John',
city: 'Prague',
},
scope: {},
}
post(:create, javascriptize(data))
end
it 'responds consistently to ... |
github | Nedomas/databound-rails | https://github.com/Nedomas/databound-rails | spec/controllers/loose_dsl_controller_spec.rb | Ruby | mit | 19 | master | 2,768 | require 'spec_helper'
describe LooseDslController, type: :controller do
describe '#create strict' do
before :each do
data = {
data: {
name: 'John',
city: 'hottest',
},
scope: {},
}
post(:create, javascriptize(data))
end
it 'responds consiste... |
github | Nedomas/databound-rails | https://github.com/Nedomas/databound-rails | spec/controllers/permit_controller_spec.rb | Ruby | mit | 19 | master | 2,619 | require 'spec_helper'
describe PermitController, type: :controller do
CURRENT_USER_ID = 1
before :each do
Project.create(city: 'LA', user_id: 5)
Project.create(city: 'LA', user_id: 1)
end
describe '#read' do
it 'raise when scope is not permitted' do
data = {
data: {
city: ... |
github | Nedomas/databound-rails | https://github.com/Nedomas/databound-rails | spec/support/rails_test_app/Gemfile | Ruby | mit | 19 | master | 1,336 | source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use Cof... |
github | Nedomas/databound-rails | https://github.com/Nedomas/databound-rails | spec/support/rails_test_app/config/application.rb | Ruby | mit | 19 | master | 1,220 | require File.expand_path('../boot', __FILE__)
# Pick the frameworks you want:
require "active_model/railtie"
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
require "sprockets/railtie"
# require "rails/test_unit/railtie"
# Require the g... |
github | Nedomas/databound-rails | https://github.com/Nedomas/databound-rails | lib/databound.rb | Ruby | mit | 19 | master | 1,769 | require 'databound/initializer'
require 'databound/railtie'
require 'databound/extensions'
require 'databound/version'
require 'databound/data'
require 'databound/manager'
require 'databound/config'
require 'databound/controller'
require 'databound/rails/routes'
module Databound
def where
records = @crud.find_sc... |
github | Nedomas/databound-rails | https://github.com/Nedomas/databound-rails | lib/generators/databound/install/install_generator.rb | Ruby | mit | 19 | master | 888 | require 'rails/generators'
module Databound
module Generators
class InstallGenerator < ::Rails::Generators::Base
source_root File.expand_path('../templates', __FILE__)
desc 'This generator adds Databound to the asset pipeline'
def add_assets
js_manifest = 'app/assets/javascripts/applic... |
github | Nedomas/databound-rails | https://github.com/Nedomas/databound-rails | lib/databound/initializer.rb | Ruby | mit | 19 | master | 612 | module Databound
module Initializer
def databound(model = nil, &block)
include Databound
send(:before_filter, :init_crud, only: %i(where create update destroy))
send(:define_method, :databound_config) do
Databound::Config.new(block, model)
end
if Rails.application.config.co... |
github | Nedomas/databound-rails | https://github.com/Nedomas/databound-rails | lib/databound/config.rb | Ruby | mit | 19 | master | 750 | module Databound
class Config
def initialize(block, model)
@model = model
@permit = {}
instance_eval(&block)
end
def columns(*specified_columns)
@columns = specified_columns
end
def model(specified_model)
raise ConfigError, "Model '#{@model}' already specified" if @... |
github | Nedomas/databound-rails | https://github.com/Nedomas/databound-rails | lib/databound/manager.rb | Ruby | mit | 19 | master | 3,951 | module Databound
class NotPermittedError < RuntimeError; STATUS = 405; end
class ConfigError < RuntimeError; end
class Manager
def initialize(controller)
@controller = controller
@scope = Databound::Data.new(@controller, scope_js, model)
@data = Databound::Data.new(@controller, data_js, mo... |
github | Nedomas/databound-rails | https://github.com/Nedomas/databound-rails | lib/databound/data.rb | Ruby | mit | 19 | master | 1,311 | module Databound
class Data
def initialize(controller, json, model)
return unless json
@controller = controller
@json = json
@data = interpolated_params
@model = model
end
def records
@model.where(@data)
end
def to_h
@data || {}
end
private
... |
github | Nedomas/databound-rails | https://github.com/Nedomas/databound-rails | lib/databound/railtie.rb | Ruby | mit | 19 | master | 229 | module Databound
class Railtie < Rails::Railtie
initializer 'databound.databound_to_action_controller' do
ActiveSupport.on_load(:action_controller) do
extend Databound::Initializer
end
end
end
end |
github | Nedomas/databound-rails | https://github.com/Nedomas/databound-rails | lib/databound/controller.rb | Ruby | mit | 19 | master | 1,136 | module Databound
class Controller
class << self
def find_or_create(name, resource, opts)
find(name) || create(name, resource, opts)
end
def create(name, resource, opts)
opts ||= {}
Object.const_set(as_constant_string(name), new(resource, opts))
end
def new(r... |
github | Nedomas/databound-rails | https://github.com/Nedomas/databound-rails | lib/databound/rails/routes.rb | Ruby | mit | 19 | master | 648 | class ActionDispatch::Routing::Mapper
def databound(*resources)
namespace = @scope[:path]
namespace = namespace[1..-1] if namespace
opts = resources.pop if resources.last.is_a?(Hash)
resources.each do |resource|
Rails.application.routes.draw do
controller_name = [namespace, resource].co... |
github | dwightwatson/laravel-opsworks | https://github.com/dwightwatson/laravel-opsworks | composer/recipes/install.rb | Ruby | mit | 19 | master | 385 | node[:deploy].each do |application, deploy|
script "install_composer" do
interpreter "bash"
user "root"
cwd "#{deploy[:deploy_to]}/current"
code <<-EOH
curl -s https://getcomposer.org/installer | php
php composer.phar install --no-dev --no-interaction --prefer-dist
EOH
only_if { ::File... |
github | dwightwatson/laravel-opsworks | https://github.com/dwightwatson/laravel-opsworks | php/recipes/mcrypt_enable.rb | Ruby | mit | 19 | master | 226 | case node[:platform]
when "debian", "ubuntu"
execute "enable_mcrypt" do
user "root"
command "php5enmod mcrypt && service apache2 restart"
only_if { ::File.exist?("/etc/php5/mods-available/mcrypt.ini") }
end
end |
github | dwightwatson/laravel-opsworks | https://github.com/dwightwatson/laravel-opsworks | laravel/recipes/storage_permissions.rb | Ruby | mit | 19 | master | 267 | node[:deploy].each do |application, deploy|
script "storage_permissions" do
interpreter "bash"
user "root"
cwd "#{deploy[:deploy_to]}/current"
code <<-EOH
chmod -R 777 storage/app storage/framework storage/logs bootstrap/cache
EOH
end
end |
github | dwightwatson/laravel-opsworks | https://github.com/dwightwatson/laravel-opsworks | laravel/recipes/symlink_storage.rb | Ruby | mit | 19 | master | 509 | node[:deploy].each do |application, deploy|
script "symlink_storage" do
interpreter "bash"
user "root"
cwd "#{deploy[:deploy_to]}"
code <<-EOH
chmod -R 777 current/storage/app current/storage/framework current/storage/logs current/bootstrap/cache
mv current/storage/* shared
rm -rf current/... |
github | dwightwatson/laravel-opsworks | https://github.com/dwightwatson/laravel-opsworks | laravel/recipes/environment_variables.rb | Ruby | mit | 19 | master | 375 | node[:deploy].each do |application, deploy|
template "#{deploy[:deploy_to]}/current/.env" do
source ".env.erb"
mode 0755
owner deploy[:user]
group deploy[:group]
variables(
database: deploy[:database],
variables: (deploy[:environment_variables] rescue {}),
)
only_if { ::File.... |
github | logstash-plugins/logstash-input-snmp | https://github.com/logstash-plugins/logstash-input-snmp | Rakefile | Ruby | apache-2.0 | 19 | main | 311 | # encoding: utf-8
require "jars/installer"
require "fileutils"
require "logstash/devutils/rake"
task :default do
system('rake -vT')
end
task :vendor do
exit(1) unless system './gradlew vendor'
end
task :clean do
["vendor/jar-dependencies", "Gemfile.lock"].each do |p|
FileUtils.rm_rf(p)
end
end |
github | logstash-plugins/logstash-input-snmp | https://github.com/logstash-plugins/logstash-input-snmp | logstash-input-snmp.gemspec | Ruby | apache-2.0 | 19 | main | 1,548 | Gem::Specification.new do |s|
s.name = 'logstash-input-snmp'
s.version = '1.3.3'
s.licenses = ['Apache-2.0']
s.summary = "SNMP input plugin"
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plug... |
github | logstash-plugins/logstash-input-snmp | https://github.com/logstash-plugins/logstash-input-snmp | test/test_snmp4j.rb | Ruby | apache-2.0 | 19 | main | 2,984 | require "java"
require "logstash-input-snmp_jars"
java_import "org.snmp4j.CommunityTarget"
java_import "org.snmp4j.PDU"
java_import "org.snmp4j.Snmp"
java_import "org.snmp4j.Target"
java_import "org.snmp4j.TransportMapping"
java_import "org.snmp4j.event.ResponseEvent"
java_import "org.snmp4j.mp.SnmpConstants"
java_imp... |
github | logstash-plugins/logstash-input-snmp | https://github.com/logstash-plugins/logstash-input-snmp | test/test_client.rb | Ruby | apache-2.0 | 19 | main | 1,025 | # encoding: utf-8
$LOAD_PATH.unshift(File.expand_path(File.join(__FILE__, "..", "..", "lib")))
require_relative "loggable"
require "pp"
require "logstash/inputs/snmp/client"
require "logstash/inputs/snmp/clientv3"
require "logstash/inputs/snmp/mib"
mib = LogStash::SnmpMib.new
mib.add_mib_path(File.expand_path(File.jo... |
github | logstash-plugins/logstash-input-snmp | https://github.com/logstash-plugins/logstash-input-snmp | test/test_mib.rb | Ruby | apache-2.0 | 19 | main | 489 | # encoding: utf-8
$LOAD_PATH.unshift(File.expand_path(File.join(__FILE__, "..", "..", "lib")))
require_relative "loggable"
require "pp"
require "logstash/inputs/snmp/mib"
mib = LogStash::SnmpMib.new
# module_name, names, oids = mib.read_mib_dic("tmp/RFC1213-MIB.dic")
# puts(module_name)
# pp(names)
# pp(oids)
mib.ad... |
github | logstash-plugins/logstash-input-snmp | https://github.com/logstash-plugins/logstash-input-snmp | test/loggable.rb | Ruby | apache-2.0 | 19 | main | 916 | # encoding: utf-8
require "logstash/logging/logger"
require "logstash/namespace"
module LogStash module Util
module Loggable
def self.included(klass)
def klass.log4j_name
ruby_name = self.name || self.class.name || self.class.to_s
ruby_name.gsub('::', '.').downcase
end
def kla... |
github | logstash-plugins/logstash-input-snmp | https://github.com/logstash-plugins/logstash-input-snmp | lib/logstash/inputs/snmp.rb | Ruby | apache-2.0 | 19 | main | 15,667 | # encoding: utf-8
require "logstash/inputs/base"
require "logstash/namespace"
require "stud/interval"
require "socket" # for Socket.gethostname
require_relative "snmp/client"
require_relative "snmp/clientv3"
require_relative "snmp/mib"
require 'logstash/plugin_mixins/ecs_compatibility_support'
require 'logstash/plugin... |
github | logstash-plugins/logstash-input-snmp | https://github.com/logstash-plugins/logstash-input-snmp | lib/logstash/inputs/snmp/mib.rb | Ruby | apache-2.0 | 19 | main | 4,864 | # encoding: utf-8
require "logstash/util/loggable"
module LogStash
class SnmpMibError < StandardError
end
class SnmpMib
include LogStash::Util::Loggable
attr_reader :tree
class Oid
def self.parse(oid)
oid.split(".").map(&:to_i)
end
end
class BaseNode
attr_access... |
github | logstash-plugins/logstash-input-snmp | https://github.com/logstash-plugins/logstash-input-snmp | lib/logstash/inputs/snmp/clientv3.rb | Ruby | apache-2.0 | 19 | main | 5,097 | require 'java'
require 'logstash-input-snmp_jars.rb'
module LogStash
class SnmpClientV3 < BaseSnmpClient
java_import 'org.snmp4j.PDU'
java_import 'org.snmp4j.ScopedPDU'
java_import 'org.snmp4j.Snmp'
java_import 'org.snmp4j.Target'
java_import 'org.snmp4j.event.ResponseEvent'
java_import 'org... |
github | logstash-plugins/logstash-input-snmp | https://github.com/logstash-plugins/logstash-input-snmp | lib/logstash/inputs/snmp/client.rb | Ruby | apache-2.0 | 19 | main | 1,514 | require "java"
require "logstash-input-snmp_jars.rb"
require_relative "base_client"
module LogStash
class SnmpClient < BaseSnmpClient
java_import "org.snmp4j.CommunityTarget"
java_import "org.snmp4j.PDU"
java_import "org.snmp4j.ScopedPDU"
java_import "org.snmp4j.Snmp"
java_import "org.snmp4j.Tar... |
github | logstash-plugins/logstash-input-snmp | https://github.com/logstash-plugins/logstash-input-snmp | lib/logstash/inputs/snmp/base_client.rb | Ruby | apache-2.0 | 19 | main | 5,859 | require "java"
require "logstash-input-snmp_jars.rb"
require "logstash/util/loggable"
module LogStash
class SnmpClientError < StandardError
end
class BaseSnmpClient
java_import "org.snmp4j.TransportMapping"
java_import "org.snmp4j.mp.SnmpConstants"
java_import "org.snmp4j.smi.OID"
java_import "... |
github | logstash-plugins/logstash-input-snmp | https://github.com/logstash-plugins/logstash-input-snmp | spec/inputs/snmp_spec.rb | Ruby | apache-2.0 | 19 | main | 16,209 | # encoding: utf-8
require "logstash/devutils/rspec/spec_helper"
require "logstash/devutils/rspec/shared_examples"
require 'logstash/plugin_mixins/ecs_compatibility_support/spec_helper'
require "logstash/inputs/snmp"
describe LogStash::Inputs::Snmp, :ecs_compatibility_support do
let(:mock_client) { double("LogStash:... |
github | logstash-plugins/logstash-input-snmp | https://github.com/logstash-plugins/logstash-input-snmp | spec/inputs/snmp/mib_spec.rb | Ruby | apache-2.0 | 19 | main | 1,651 | # encoding: utf-8
require "logstash/devutils/rspec/spec_helper"
require "logstash/inputs/snmp/mib"
module LogStash
describe SnmpMib do
subject { SnmpMib.new }
let (:fixtures_dir) { ::File.expand_path(::File.join("..", "..", "..", "fixtures/"), __FILE__) }
let (:rfc1213_mib) { ::File.join(fixtures_dir, "... |
github | logstash-plugins/logstash-input-snmp | https://github.com/logstash-plugins/logstash-input-snmp | spec/inputs/snmp/base_client_spec.rb | Ruby | apache-2.0 | 19 | main | 1,790 | # encoding: utf-8
require "logstash/devutils/rspec/spec_helper"
require "logstash/inputs/snmp/base_client"
module LogStash
java_import "org.snmp4j.asn1.BER"
java_import "org.snmp4j.smi.AbstractVariable"
java_import "org.snmp4j.smi.SMIConstants"
java_import "org.snmp4j.smi.Gauge32"
java_import "org.snmp4j.sm... |
github | logstash-plugins/logstash-input-snmp | https://github.com/logstash-plugins/logstash-input-snmp | spec/inputs/integration/it_spec.rb | Ruby | apache-2.0 | 19 | main | 7,666 | require "logstash/devutils/rspec/spec_helper"
require "logstash/inputs/snmp"
describe LogStash::Inputs::Snmp do
let(:config) { {"get" => %w[1.3.6.1.2.1.1.1.0 1.3.6.1.2.1.1.3.0 1.3.6.1.2.1.1.5.0], "ecs_compatibility" => "disabled" } }
let(:plugin) { LogStash::Inputs::Snmp.new(config)}
shared_examples "snmp plugi... |
github | dennisbaskin/bootstrap-growl-rails | https://github.com/dennisbaskin/bootstrap-growl-rails | bootstrap-growl-rails.gemspec | Ruby | mit | 19 | master | 1,030 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'bootstrap/growl/rails/version'
Gem::Specification.new do |spec|
spec.name = "bootstrap-growl-rails"
spec.version = Bootstrap::Growl::Rails::VERSION
spec.authors = ["Den... |
github | cobodo/mikutter-worldon | https://github.com/cobodo/mikutter-worldon | rest.rb | Ruby | mit | 19 | master | 3,304 | Plugin.create(:worldon) do
pm = Plugin::Worldon
settings = {}
on_worldon_request_rest do |slug|
Thread.new {
notice "Worldon: rest request for #{slug}"
domain = settings[slug][:domain]
path = settings[slug][:path]
token = settings[slug][:token]
params = settings[slug][:params]
... |
github | cobodo/mikutter-worldon | https://github.com/cobodo/mikutter-worldon | spell.rb | Ruby | mit | 19 | master | 24,186 | # coding: utf-8
Plugin.create(:worldon) do
pm = Plugin::Worldon
# command
custom_postable = Proc.new do |opt|
world, = Plugin.filtering(:world_current, nil)
[:worldon, :portal].include?(world.class.slug) && opt.widget.editable?
end
def visibility2select(s)
case s
when "public"
:"1publ... |
github | cobodo/mikutter-worldon | https://github.com/cobodo/mikutter-worldon | extractcondition.rb | Ruby | mit | 19 | master | 1,748 | Plugin.create(:worldon) do
cl = Plugin::Worldon::Status
defextractcondition(:worldon_status, name: "Worldonで受信したトゥート", operator: false, args: 0) do |message: raise|
message.is_a?(cl)
end
defextractcondition(:worldon_domain, name: "ドメイン(Worldon)", operator: true, args: 1, sexp: MIKU.parse("`(,compare (host ... |
github | cobodo/mikutter-worldon | https://github.com/cobodo/mikutter-worldon | sse_stream.rb | Ruby | mit | 19 | master | 11,385 | require_relative 'sse_client'
Plugin.create(:worldon) do
pm = Plugin::Worldon
# ストリーム開始&直近取得イベント
defevent :worldon_start_stream, prototype: [String, String, String, pm::World, Integer]
def datasource_used?(slug, include_all = false)
return false if UserConfig[:extract_tabs].nil?
UserConfig[:extract_t... |
github | cobodo/mikutter-worldon | https://github.com/cobodo/mikutter-worldon | worldon.rb | Ruby | mit | 19 | master | 8,538 | # -*- coding: utf-8 -*-
require 'pp'
module Plugin::Worldon
PM = Plugin::Worldon
CLIENT_NAME = 'mikutter Worldon'
WEB_SITE = 'https://github.com/cobodo/mikutter-worldon'
end
require_relative 'util'
require_relative 'api'
require_relative 'parser'
require_relative 'model/model'
require_relative 'patch'
require_r... |
github | cobodo/mikutter-worldon | https://github.com/cobodo/mikutter-worldon | score.rb | Ruby | mit | 19 | master | 486 | Plugin.create(:worldon) do
pm = Plugin::Worldon
# model#scoreを持っている場合のscore_filter
filter_score_filter do |model, note, yielder|
next [model, note, yielder] unless model == note
next [model, note, yielder] unless (model.is_a?(pm::Status) || model.is_a?(pm::AccountProfile))
if model.score.size > 1 ||... |
github | cobodo/mikutter-worldon | https://github.com/cobodo/mikutter-worldon | instance_setting_list.rb | Ruby | mit | 19 | master | 818 | module Plugin::Worldon
class InstanceSettingList < ::Gtk::TreeView
include Gtk::TreeViewPrettyScroll
COL_DOMAIN = 0
def initialize()
super()
set_model(::Gtk::ListStore.new(String))
append_column ::Gtk::TreeViewColumn.new("ドメイン名", ::Gtk::CellRendererText.new, text: COL_DOMAIN)
Ins... |
github | cobodo/mikutter-worldon | https://github.com/cobodo/mikutter-worldon | subparts_status_info.rb | Ruby | mit | 19 | master | 4,063 | class Gdk::SubPartsWorldonStatusInfo < Gdk::SubParts
register
def get_photo(filename)
return nil if filename.nil?
path = Pathname(__dir__) / 'icon' / filename
uri = Diva::URI.new('file://' + path.to_s)
Plugin.filtering(:photo_filter, uri, [])[1].first
end
def filename(visibility)
# アイコン素材取... |
github | cobodo/mikutter-worldon | https://github.com/cobodo/mikutter-worldon | parser.rb | Ruby | mit | 19 | master | 4,661 | require 'cgi' # unescapeHTML
module Plugin::Worldon::Parser
def self.dehtmlize(html)
result = html
.gsub(%r!</p><p>!) { "\n\n" }
.gsub(%r!<span class="ellipsis">([^<]*)</span>!) {|s| $1 + "..." }
.gsub(%r!^<p>|</p>|<span class="invisible">[^<]*</span>|</?span[^>]*>!, '')
.gsub(/<br[^>]*>|... |
github | cobodo/mikutter-worldon | https://github.com/cobodo/mikutter-worldon | api.rb | Ruby | mit | 19 | master | 7,409 | require 'httpclient'
require 'json'
require 'stringio'
module Plugin::Worldon
class APIResult
attr_reader :value
attr_reader :header
def initialize(value, header = nil)
@value = value
@header = header
end
def [](idx)
@value[idx]
end
def []=(idx, val)
@value[idx]... |
github | cobodo/mikutter-worldon | https://github.com/cobodo/mikutter-worldon | setting.rb | Ruby | mit | 19 | master | 4,112 | require_relative 'instance_setting_list'
Plugin.create(:worldon) do
pm = Plugin::Worldon
# 設定の初期化
defaults = {
worldon_enable_streaming: true,
worldon_rest_interval: UserConfig[:retrieve_interval_friendtl],
worldon_show_subparts_visibility: true,
worldon_show_subparts_bot: true,
worldon_show... |
github | cobodo/mikutter-worldon | https://github.com/cobodo/mikutter-worldon | sse_client.rb | Ruby | mit | 19 | master | 5,617 | require 'httpclient'
module Plugin::SseClient
class Parser
attr_reader :buffer
def initialize(plugin, slug)
@plugin = plugin
@slug = slug
@buffer = ''
@records = []
@event = @data = nil
end
def <<(str)
@buffer += str
consume
self
end
def cons... |
github | cobodo/mikutter-worldon | https://github.com/cobodo/mikutter-worldon | model/entity_class.rb | Ruby | mit | 19 | master | 387 | module Diva::Entity
AnchorLinkEntity = RegexpEntity.filter(/<a [^>]*>[^<]*<\/a>/, generator: -> h {
a = h[:url]
if h[:url] =~ /<a [^>]*href="([^"]*)"[^>]*>([^<]*)<\/a>/
h[:url] = h[:open] = $1
h[:face] = $2
end
h
})
end
module Plugin::Worldon
# TODO: タグとかacctとかをいい感じにする
MastodonEntit... |
github | cobodo/mikutter-worldon | https://github.com/cobodo/mikutter-worldon | model/account.rb | Ruby | mit | 19 | master | 3,678 | # coding: utf-8
module Plugin::Worldon
class AccountSource < Diva::Model
#register :worldon_account_source, name: "Mastodonアカウント追加情報(Worldon)"
field.string :privacy
field.bool :sensitive
field.string :note
end
class AccountField < Diva::Model
field.string :name
field.string :value
d... |
github | cobodo/mikutter-worldon | https://github.com/cobodo/mikutter-worldon | model/instance.rb | Ruby | mit | 19 | master | 4,117 | module Plugin::Worldon
class Instance < Diva::Model
register :worldon_instance, name: "Mastodonインスタンス(Worldon)"
field.string :domain, required: true
field.string :client_key, required: true
field.string :client_secret, required: true
field.bool :retrieve, required: true
class << self
d... |
github | cobodo/mikutter-worldon | https://github.com/cobodo/mikutter-worldon | model/application.rb | Ruby | mit | 19 | master | 369 | module Plugin::Worldon
# https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md#application
class Application < Diva::Model
register :worldon_application, name: "Mastodonアプリケーション(Worldon)"
field.string :name, required: true
field.uri :website
def inspect
"worldon-applica... |
github | cobodo/mikutter-worldon | https://github.com/cobodo/mikutter-worldon | model/tag.rb | Ruby | mit | 19 | master | 416 | module Plugin::Worldon
# https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md#tag
class Tag < Diva::Model
register :worldon_tag, name: "Mastodonタグ(Worldon)"
field.string :name, required: true
field.uri :url, required: true
def description
"##{name}"
end
def pa... |
github | cobodo/mikutter-worldon | https://github.com/cobodo/mikutter-worldon | model/model.rb | Ruby | mit | 19 | master | 277 | require_relative 'application'
require_relative 'emoji'
require_relative 'attachment'
require_relative 'mention'
require_relative 'tag'
require_relative 'account'
require_relative 'account_profile'
require_relative 'instance'
require_relative 'status'
require_relative 'world' |
github | cobodo/mikutter-worldon | https://github.com/cobodo/mikutter-worldon | model/status.rb | Ruby | mit | 19 | master | 15,662 | # coding: utf-8
module Plugin::Worldon
# https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md#status
# 必ずStatus.buildメソッドを通して生成すること
class Status < Diva::Model
include Diva::Model::MessageMixin
register :worldon_status, name: "Mastodonステータス(Worldon)", timeline: true, reply: true, m... |
github | cobodo/mikutter-worldon | https://github.com/cobodo/mikutter-worldon | model/mention.rb | Ruby | mit | 19 | master | 437 | module Plugin::Worldon
# https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md#mention
class Mention < Diva::Model
#register :worldon_mention, name: "Mastodonメンション(Worldon)"
field.uri :url, required: true
field.string :username, required: true
field.string :acct, required: tru... |
github | cobodo/mikutter-worldon | https://github.com/cobodo/mikutter-worldon | model/account_profile.rb | Ruby | mit | 19 | master | 1,878 | # coding: utf-8
require 'cgi'
module Plugin::Worldon
class AccountProfile < Diva::Model
extend Memoist
include Diva::Model::MessageMixin
register :worldon_account_profile, name: "Mastodonアカウントプロフィール(Worldon)", timeline: true, myself: true
field.has :account, Account, required: true
alias :user ... |
github | cobodo/mikutter-worldon | https://github.com/cobodo/mikutter-worldon | model/world.rb | Ruby | mit | 19 | master | 10,073 | # coding: utf-8
module Plugin::Worldon
class World < Diva::Model
extend Memoist
register :worldon, name: "Mastodon(Worldon)"
field.string :id, required: true
field.string :slug, required: true
alias :name :slug
field.string :domain, required: true
field.string :access_token, required: tr... |
github | cobodo/mikutter-worldon | https://github.com/cobodo/mikutter-worldon | model/attachment.rb | Ruby | mit | 19 | master | 1,026 | module Plugin::Worldon
class AttachmentMeta < Diva::Model
#register :worldon_attachment_meta, name: "Mastodon添付メディア メタ情報(Worldon)"
field.int :width
field.int :height
field.string :size
field.string :aspect
end
class AttachmentMetaSet < Diva::Model
#register :worldon_attachment_meta, name... |
github | cobodo/mikutter-worldon | https://github.com/cobodo/mikutter-worldon | model/emoji.rb | Ruby | mit | 19 | master | 665 | # coding: utf-8
module Plugin::Worldon
# https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md#emoji
class Emoji < Diva::Model
extend Memoist
#register :worldon_emoji, name: "Mastodon絵文字(Worldon)"
field.string :shortcode, required: true
field.uri :static_url, required: true
... |
github | k1LoW/koma | https://github.com/k1LoW/koma | koma.gemspec | Ruby | mit | 19 | master | 1,396 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'koma/version'
Gem::Specification.new do |spec|
spec.name = 'koma'
spec.version = Koma::VERSION
spec.authors = ['k1LoW']
spec.email = ['k1lowxb@gmail.com']
... |
github | k1LoW/koma | https://github.com/k1LoW/koma | lib/koma.rb | Ruby | mit | 19 | master | 240 | require 'rubygems'
require 'net/ssh'
require 'specinfra'
require 'specinfra/helper/set'
require 'koma/version'
require 'koma/error'
require 'koma/ext'
require 'koma/host_inventory'
require 'koma/backend'
require 'koma/cli'
module Koma
end |
github | k1LoW/koma | https://github.com/k1LoW/koma | lib/koma/ext.rb | Ruby | mit | 19 | master | 276 | require 'koma/ext/specinfra/host_inventory/base'
require 'koma/ext/specinfra/host_inventory/parser_factory'
require 'koma/ext/specinfra/host_inventory/parser'
require 'koma/ext/specinfra/command/redhat/base/inventory'
require 'koma/ext/specinfra/command/redhat/v7/inventory' |
github | k1LoW/koma | https://github.com/k1LoW/koma | lib/koma/cli.rb | Ruby | mit | 19 | master | 5,325 | require 'thor'
require 'json'
require 'yaml'
require 'csv'
module Koma
class CLI < Thor
class_option :version, type: :boolean, aliases: :V
desc 'ssh <host1,host2,..>', 'stdout remote host inventory'
option :key, type: :string, banner: '<key1,key2,..>', desc: 'inventory keys', aliases: :k
option :yam... |
github | k1LoW/koma | https://github.com/k1LoW/koma | lib/koma/host_inventory.rb | Ruby | mit | 19 | master | 727 | module Koma
class HostInventory
EXTRA_KEYS = %w(package service)
DISABLED_KEYS = %w(ec2)
def self.inventory_keys
Specinfra::HostInventory::KEYS + EXTRA_KEYS - DISABLED_KEYS
end
def self.all_inventory_keys
Specinfra::HostInventory::KEYS + EXTRA_KEYS
end
def self.disabled_keys... |
github | k1LoW/koma | https://github.com/k1LoW/koma | lib/koma/backend/base.rb | Ruby | mit | 19 | master | 841 | include Specinfra::Helper::Set
class Koma::Backend::Base
attr_reader :host, :options, :inventory_keys
def initialize(host, options)
@host = host
@options = options
@inventory_keys = Koma::HostInventory.inventory_keys
end
def out(key = nil)
out = {}
keys = if key.nil?
inventor... |
github | k1LoW/koma | https://github.com/k1LoW/koma | lib/koma/backend/ssh.rb | Ruby | mit | 19 | master | 2,163 | require 'parallel'
require 'sconb'
module Koma
module Backend
class Ssh < Base
attr_accessor :stdin
def gather
if host.include?(',')
list = host.split(',').uniq
results = Parallel.map(list) do |h|
gather_via_ssh(h, options)
end
arr = [list,... |
github | k1LoW/koma | https://github.com/k1LoW/koma | lib/koma/ext/specinfra/command/redhat/base/inventory.rb | Ruby | mit | 19 | master | 356 | class Specinfra::Command::Redhat::Base::Inventory < Specinfra::Command::Linux::Base::Inventory
class << self
def get_service
"chkconfig --list"
end
def get_package
"rpm -qa --queryformat 'name:%{NAME}\tversion:%{VERSION}\trelease:%{RELEASE}\tarch:%{ARCH}\tinstalltime:%{INSTALLTIME}\tbuildtime... |
github | k1LoW/koma | https://github.com/k1LoW/koma | lib/koma/ext/specinfra/command/redhat/v7/inventory.rb | Ruby | mit | 19 | master | 207 | class Specinfra::Command::Redhat::V7::Inventory < Specinfra::Command::Redhat::Base::Inventory
class << self
def get_service
"systemctl list-unit-files --quiet -t service | cat"
end
end
end |
github | k1LoW/koma | https://github.com/k1LoW/koma | lib/koma/ext/specinfra/host_inventory/package.rb | Ruby | mit | 19 | master | 375 | module Specinfra
class HostInventory
class Package < Base
def get
cmd = backend.command.get(:get_inventory_package)
ret = backend.run_command(cmd)
if ret.success?
parse(ret.stdout)
else
nil
end
end
def parse(cmd_ret)
parser.get... |
github | k1LoW/koma | https://github.com/k1LoW/koma | lib/koma/ext/specinfra/host_inventory/parser.rb | Ruby | mit | 19 | master | 883 | class Specinfra::HostInventory::Parser;end;
require 'koma/ext/specinfra/host_inventory/parser/base'
require 'koma/ext/specinfra/host_inventory/parser/base/package'
require 'koma/ext/specinfra/host_inventory/parser/base/service'
require 'koma/ext/specinfra/host_inventory/parser/linux'
require 'koma/ext/specinfra/host_... |
github | k1LoW/koma | https://github.com/k1LoW/koma | lib/koma/ext/specinfra/host_inventory/parser_factory.rb | Ruby | mit | 19 | master | 1,498 | module Specinfra
class HostInventory
class ParserFactory
def self.instance
self.new(os)
end
def initialize(os_info)
@os_info = os_info
end
def get(resource_type)
create_parser_class(resource_type)
end
private
def create_parser_class(resou... |
github | k1LoW/koma | https://github.com/k1LoW/koma | lib/koma/ext/specinfra/host_inventory/service.rb | Ruby | mit | 19 | master | 375 | module Specinfra
class HostInventory
class Service < Base
def get
cmd = backend.command.get(:get_inventory_service)
ret = backend.run_command(cmd)
if ret.success?
parse(ret.stdout)
else
nil
end
end
def parse(cmd_ret)
parser.get... |
github | k1LoW/koma | https://github.com/k1LoW/koma | lib/koma/ext/specinfra/host_inventory/parser/base.rb | Ruby | mit | 19 | master | 211 | class Specinfra::HostInventory::Parser::Base
class << self
attr_reader :backend
def create(backend)
@backend = backend
self
end
def parse(cmd_ret)
cmd_ret
end
end
end |
github | k1LoW/koma | https://github.com/k1LoW/koma | lib/koma/ext/specinfra/host_inventory/parser/redhat/v7/service.rb | Ruby | mit | 19 | master | 618 | class Specinfra::HostInventory::Parser::Redhat::V7::Service < Specinfra::HostInventory::Parser::Redhat::Base::Service
class << self
def parse(cmd_ret)
services = {}
lines = cmd_ret.split(/\n/)
lines.each do |line|
status = line.split(/ +/)
next unless status.count == 2
se... |
github | k1LoW/koma | https://github.com/k1LoW/koma | lib/koma/ext/specinfra/host_inventory/parser/redhat/base/package.rb | Ruby | mit | 19 | master | 389 | class Specinfra::HostInventory::Parser::Redhat::Base::Package < Specinfra::HostInventory::Parser::Linux::Package
class << self
def parse(cmd_ret)
packages = {}
lines = cmd_ret.split(/\n/)
lines.each do |line|
h = Hash[line.split("\t").map { |f| f.split(':', 2) }]
idx = h['name']
... |
github | k1LoW/koma | https://github.com/k1LoW/koma | lib/koma/ext/specinfra/host_inventory/parser/redhat/base/service.rb | Ruby | mit | 19 | master | 627 | class Specinfra::HostInventory::Parser::Redhat::Base::Service < Specinfra::HostInventory::Parser::Linux::Service
class << self
def parse(cmd_ret)
services = {}
lines = cmd_ret.split(/\n/)
lines.each do |line|
status = line.split("\t")
next unless status.count == 8
service... |
github | k1LoW/koma | https://github.com/k1LoW/koma | spec/specinfra/host_inventory/redhat/v7/service_spec.rb | Ruby | mit | 19 | master | 2,835 | require 'spec_helper'
str = <<-EOH
UNIT FILE STATE
auditd.service enabled
autovt@.service disabled
blk-availability.service disabled
brandbot.service static
console-getty.service ... |
github | k1LoW/koma | https://github.com/k1LoW/koma | spec/specinfra/host_inventory/redhat/base/service_spec.rb | Ruby | mit | 19 | master | 3,514 | require 'spec_helper'
str = <<-EOH
abrt-ccpp\t0:off\t1:off\t2:off\t3:off\t4:off\t5:off\t6:off
abrt-oops\t0:off\t1:off\t2:off\t3:off\t4:off\t5:off\t6:off
abrtd\t0:off\t1:off\t2:off\t3:off\t4:off\t5:off\t6:off
acpid\t0:off\t1:off\t2:on\t3:on\t4:on\t5:on\t6:off
atd\t0:off\t1:off\t2:off\t3:on\t4:on\t5:on\t6:off
auditd\t0:... |
github | k1LoW/koma | https://github.com/k1LoW/koma | spec/specinfra/host_inventory/redhat/base/package_spec.rb | Ruby | mit | 19 | master | 4,231 | require 'spec_helper'
str = <<-EOH
name:libndp\tversion:1.2\trelease:4.el7\tarch:x86_64\tinstalltime:1454045569\tbuildtime:1402354146
name:filesystem\tversion:3.2\trelease:20.el7\tarch:x86_64\tinstalltime:1454045531\tbuildtime:1439389384
name:dmidecode\tversion:2.12\trelease:9.el7\tarch:x86_64\tinstalltime:1454045569\... |
github | lostisland/faraday-net_http_persistent | https://github.com/lostisland/faraday-net_http_persistent | faraday-net_http_persistent.gemspec | Ruby | mit | 19 | main | 1,133 | # frozen_string_literal: true
lib = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "faraday/net_http_persistent/version"
Gem::Specification.new do |spec|
spec.name = "faraday-net_http_persistent"
spec.version = Faraday::NetHttpPersistent::VERSION
spec.authors = ... |
github | lostisland/faraday-net_http_persistent | https://github.com/lostisland/faraday-net_http_persistent | Gemfile | Ruby | mit | 19 | main | 292 | # frozen_string_literal: true
source "https://rubygems.org"
gemspec
gem "multipart-parser", "~> 0.1.1"
gem "rake", "~> 13.0"
gem "rspec", "~> 3.0"
gem "simplecov", "~> 0.19.0"
gem "standard", "~> 1.30.0" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.7")
gem "webmock", "~> 3.4" |
github | lostisland/faraday-net_http_persistent | https://github.com/lostisland/faraday-net_http_persistent | spec/spec_helper.rb | Ruby | mit | 19 | main | 501 | # frozen_string_literal: true
require "simplecov"
SimpleCov.start
require "faraday"
require "faraday/net_http_persistent"
require "faraday_specs_setup"
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
# Disable RSp... |
github | lostisland/faraday-net_http_persistent | https://github.com/lostisland/faraday-net_http_persistent | spec/faraday/adapter/net_http_persistent_spec.rb | Ruby | mit | 19 | main | 2,300 | # frozen_string_literal: true
RSpec.describe Faraday::Adapter::NetHttpPersistent do
features :request_body_on_query_methods, :reason_phrase_parse, :compression, :trace_method, :streaming
it_behaves_like "an adapter"
it "allows to provide adapter specific configs" do
url = URI("https://example.com")
ad... |
github | lostisland/faraday-net_http_persistent | https://github.com/lostisland/faraday-net_http_persistent | lib/faraday/net_http_persistent.rb | Ruby | mit | 19 | main | 808 | # frozen_string_literal: true
require "faraday"
require "faraday/adapter/net_http_persistent"
require "faraday/net_http_persistent/version"
module Faraday
module NetHttpPersistent
# Faraday allows you to register your middleware for easier configuration.
# This step is totally optional, but it basically all... |
github | lostisland/faraday-net_http_persistent | https://github.com/lostisland/faraday-net_http_persistent | lib/faraday/adapter/net_http_persistent.rb | Ruby | mit | 19 | main | 6,931 | # frozen_string_literal: true
require "net/http/persistent"
module Faraday
class Adapter
# Net::HTTP::Persistent adapter.
class NetHttpPersistent < Faraday::Adapter
exceptions = [
IOError,
Errno::EADDRNOTAVAIL,
Errno::EALREADY,
Errno::ECONNABORTED,
Errno::ECONNR... |
github | reggieb/qwester | https://github.com/reggieb/qwester | qwester.gemspec | Ruby | mit | 19 | develop | 1,412 | $:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "qwester/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "qwester"
s.version = Qwester::VERSION
s.authors = ["Rob Nichols"]
s.email = ["rob@undervale.co.uk... |
github | reggieb/qwester | https://github.com/reggieb/qwester | Rakefile | Ruby | mit | 19 | develop | 801 | #!/usr/bin/env rake
begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
begin
require 'rdoc/task'
rescue LoadError
require 'rdoc/rdoc'
require 'rake/rdoctask'
RDoc::Task = Rake::RDocTask
end
RDoc::Task.new(:rdoc) do |rdoc|
rdoc.r... |
github | reggieb/qwester | https://github.com/reggieb/qwester | Gemfile | Ruby | mit | 19 | develop | 960 | source "http://rubygems.org"
# Declare your gem's dependencies in qwester.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
gemspec
# jquery-rails is used by the dummy application
#gem "jquery-rails"
# Declare... |
github | reggieb/qwester | https://github.com/reggieb/qwester | app/helpers/qwester/questionnaires_helper.rb | Ruby | mit | 19 | develop | 1,562 | module Qwester
module QuestionnairesHelper
def qwester_answers_selection_list(question, list_class = 'qwester_options')
button_name = "question_id[#{question.id}][answer_ids][]"
answers = question.answers
buttons = answers.collect do |answer|
if question.multi_answer?
check_box... |
github | reggieb/qwester | https://github.com/reggieb/qwester | app/controllers/qwester/questionnaires_controller.rb | Ruby | mit | 19 | develop | 606 | module Qwester
class QuestionnairesController < ApplicationController
def index
@questionnaires = current_questionnaires
end
def show
@questionnaire = Qwester::Questionnaire.find(params[:id])
end
def update
@questionnaire = Qwester::Questionnaire.find(params[:id])
update... |
github | reggieb/qwester | https://github.com/reggieb/qwester | app/models/qwester/answer.rb | Ruby | mit | 19 | develop | 1,479 | module Qwester
class Answer < ActiveRecord::Base
if Qwester.rails_three?
attr_accessible :value, :question_id, :position, :weighting
end
DEFAULT_VALUE = 'Not applicable'
STANDARD_VALUES = ['Yes', 'No', DEFAULT_VALUE]
has_and_belongs_to_many(
:rule_sets,
:join_table => :qwester... |
github | reggieb/qwester | https://github.com/reggieb/qwester | app/models/qwester/rule_set.rb | Ruby | mit | 19 | develop | 2,573 | require 'array_logic'
module Qwester
class RuleSet < ActiveRecord::Base
if Qwester.rails_three?
attr_accessible :title, :description, :answers, :url, :rule, :answer_ids, :link_text, :warning_id, :presentation
end
before_save :keep_answers_in_step_with_rule
DEFAULT_RULE_JOIN = 'or'
ANSWERS_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.