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
davidesantangelo/datoji
https://github.com/davidesantangelo/datoji
db/migrate/20200611122844_install_trigram.rb
Ruby
mit
224
master
253
class InstallTrigram < ActiveRecord::Migration[6.0] def self.up ActiveRecord::Base.connection.execute('CREATE EXTENSION IF NOT EXISTS pg_trgm;') end def self.down ActiveRecord::Base.connection.execute('DROP EXTENSION pg_trgm;') end end
github
davidesantangelo/datoji
https://github.com/davidesantangelo/datoji
db/migrate/20200610130817_create_entries.rb
Ruby
mit
224
master
279
class CreateEntries < ActiveRecord::Migration[6.0] def change create_table :entries, id: :uuid do |t| t.references :pack, index: true, foreign_key: true, type: :uuid t.jsonb :data t.timestamps end add_index :entries, :data, using: :gin end end
github
davidesantangelo/datoji
https://github.com/davidesantangelo/datoji
spec/rails_helper.rb
Ruby
mit
224
master
3,494
# This file is copied to spec/ when you run 'rails generate rspec:install' require 'spec_helper' ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../config/environment', __dir__) # Prevent database truncation if the environment is production abort('The Rails environment is running in production mode!') if Rails.en...
github
davidesantangelo/datoji
https://github.com/davidesantangelo/datoji
spec/controllers/packs_controller_spec.rb
Ruby
mit
224
master
440
# frozen_string_literal: true require 'rails_helper' RSpec.describe PacksController, type: :controller do let(:token) { FactoryBot.create(:token) } describe 'GET #index' do before do request.env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Token.encode_credentials(token.key) get ...
github
davidesantangelo/datoji
https://github.com/davidesantangelo/datoji
spec/models/entry_spec.rb
Ruby
mit
224
master
337
require 'rails_helper' RSpec.describe Entry, type: :model do let(:pack) { Pack.create! } let(:entry) { Entry.new } it { should belong_to(:pack) } describe 'validations' do it { should validate_presence_of(:data) } end it 'is valid with valid attributes' do expect(FactoryBot.create(:entry)).to be...
github
davidesantangelo/datoji
https://github.com/davidesantangelo/datoji
config/routes.rb
Ruby
mit
224
master
359
Rails.application.routes.draw do root 'static#index' resources :tokens, only: [:create] resources :packs, only: %i[index create show destroy] do member do post :clear end resources :entries, only: %i[index create show destroy] do collection do post :bulk end end res...
github
davidesantangelo/datoji
https://github.com/davidesantangelo/datoji
config/deploy.rb
Ruby
mit
224
master
1,844
# config valid for current version and patch releases of Capistrano lock "~> 3.15.0" set :application, "datoji" set :repo_url, "git@github.com:davidesantangelo/datoji.git" # Deploy to the user's home directory set :deploy_to, "/home/deploy/#{fetch :application}" append :linked_dirs, 'log', 'tmp/pids', 'tmp/cache', '...
github
davidesantangelo/datoji
https://github.com/davidesantangelo/datoji
config/application.rb
Ruby
mit
224
master
1,685
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 Datoji class Application < Rails::Application # Initialize configuration defaults for originally generated Rails ve...
github
davidesantangelo/datoji
https://github.com/davidesantangelo/datoji
config/deploy/production.rb
Ruby
mit
224
master
2,150
# server-based syntax # ====================== # Defines a single server with a list of roles and multiple properties. # You can define all roles on a single server, or split them: # server "example.com", user: "deploy", roles: %w{app db web}, my_property: :my_value # server "example.com", user: "deploy", roles: %w{ap...
github
davidesantangelo/datoji
https://github.com/davidesantangelo/datoji
config/environments/production.rb
Ruby
mit
224
master
5,006
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
davidesantangelo/datoji
https://github.com/davidesantangelo/datoji
config/initializers/rack_attack.rb
Ruby
mit
224
master
2,686
class Rack::Attack ### Configure Cache ### # If you don't want to use Rails.cache (Rack::Attack's default), then # configure it here. # # Note: The store is only used for throttling (not blocklisting and # safelisting). It must implement .increment and .write like # ActiveSupport::Cache::Store Rack::A...
github
markolson/kickscraper
https://github.com/markolson/kickscraper
Rakefile
Ruby
mit
224
master
385
require "bundler/gem_tasks" task :console do require 'irb' require 'irb/completion' require 'kickscraper' require './spec/test_constants' Kickscraper.configure do |config| config.email = KICKSCRAPER_TEST_API_EMAIL config.password = KICKSCRAPER_TEST_API_PASSWORD config.proxy = LOCAL_PR...
github
markolson/kickscraper
https://github.com/markolson/kickscraper
kickscraper.gemspec
Ruby
mit
224
master
1,300
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'kickscraper/version' Gem::Specification.new do |spec| spec.name = "kickscraper" spec.version = Kickscraper::VERSION spec.authors = ["Mark Olson", "Ben Rugg", "James All...
github
markolson/kickscraper
https://github.com/markolson/kickscraper
Guardfile
Ruby
mit
224
master
219
guard :rspec do watch(%r{^spec/.+_spec\.rb$}) watch(%r{kickscraper/(?:client/)?(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } watch('spec/spec_helper.rb') { "spec" } watch(%r{spec/support/.*\.rb$}) { "spec" } end
github
markolson/kickscraper
https://github.com/markolson/kickscraper
spec/project_spec.rb
Ruby
mit
224
master
1,951
describe Kickscraper::Project do let(:client) { Kickscraper.client } subject (:project) { client.find_project TEST_PROJECT_ID } it "loads all info for a project" do project.id.should be > 0 project.name.should_not be_empty project.launched_at.should be >= 1262304000 project.blurb.should_not be_em...
github
markolson/kickscraper
https://github.com/markolson/kickscraper
spec/user_spec.rb
Ruby
mit
224
master
957
describe Kickscraper::User do subject { client.find_user TEST_USER_ID } let(:client) { Kickscraper.client } context "loading all info for a user" do its(:id) { should be > 0 } its(:name) { should_not be_empty } its(:avatar) { should have_at_least(0).items } its(:biography) { should_not be_empty...
github
markolson/kickscraper
https://github.com/markolson/kickscraper
spec/no_email_password_client_spec.rb
Ruby
mit
224
master
1,919
describe Kickscraper::Client do context "no email no password client" do before(:all) do @save_token = Kickscraper.token Kickscraper.token=nil end after (:all) do Kickscraper.token=@save_token end let(:client) do Kickscraper.configure do |config| config.email ...
github
markolson/kickscraper
https://github.com/markolson/kickscraper
spec/category_spec.rb
Ruby
mit
224
master
564
describe Kickscraper::Category do let(:client) { Kickscraper.client } let(:category) { client.categories.first } context "loading category info" do subject { category } it { should be_a Kickscraper::Category } its(:name) { should_not be_empty } its(:projects_count) { should be > 0 } end con...
github
markolson/kickscraper
https://github.com/markolson/kickscraper
spec/test_constants.rb
Ruby
mit
224
master
555
# configure kickscraper before the tests # (put your real kickstarter API credentials here) KICKSCRAPER_TEST_API_EMAIL = 'your_kickstarter_email' KICKSCRAPER_TEST_API_PASSWORD = 'your_kickstarter_password' # if you want to use a proxy (like Charles, etc) to capture # data for debugging, set it here #LOCAL_PROXY = 'ht...
github
markolson/kickscraper
https://github.com/markolson/kickscraper
spec/spec_helper.rb
Ruby
mit
224
master
673
@root_dir = File.expand_path(File.join(File.dirname(__FILE__), "../")) $: << './' $: << File.join(@root_dir, "lib", "kickscraper") $: << File.join(@root_dir, "lib", "kickscraper", "client") $: << File.join(@root_dir, "spec") Dir["./spec/support/**/*.rb"].each {|f| require f} require 'rubygems' require 'rspec' requir...
github
markolson/kickscraper
https://github.com/markolson/kickscraper
spec/client_spec.rb
Ruby
mit
224
master
2,460
describe Kickscraper::Client do let(:client) { Kickscraper.client } context "finds a user by id" do subject(:user) { client.find_user TEST_USER_ID } its(:id) { should == TEST_USER_ID } its(:name) { should == 'Zach Braff' } end context "returns nil when finding a non-existent user" do ...
github
markolson/kickscraper
https://github.com/markolson/kickscraper
spec/kickscraper_spec.rb
Ruby
mit
224
master
378
describe Kickscraper do subject { Kickscraper.client } it "accepts configuration" do Kickscraper.email.should == KICKSCRAPER_TEST_API_EMAIL end context "connects to the kickstarter api" do it { should_not be_nil } it { should be_a Kickscraper::Client } its(:user) { should_not be_nil } ...
github
markolson/kickscraper
https://github.com/markolson/kickscraper
spec/no_email_password_project_spec.rb
Ruby
mit
224
master
2,256
describe Kickscraper::Project do context "no email no password client" do before(:all) do @save_token = Kickscraper.token Kickscraper.token=nil end after (:all) do Kickscraper.token=@save_token end let(:client) do Kickscraper.configure do |config| config.email...
github
markolson/kickscraper
https://github.com/markolson/kickscraper
spec/support/shared_examples.rb
Ruby
mit
224
master
4,240
shared_examples_for "a collection" do |type| let(:item) { subject.first } it { should_not be_empty} it "first element is a #{type}" do item.should be_a type item.name.should_not be_empty if item.respond_to? :name end end shared_examples_for "ending_soon projects" do context "finds projects ending...
github
markolson/kickscraper
https://github.com/markolson/kickscraper
examples/my_projects.rb
Ruby
mit
224
master
534
require 'kickscraper' p "configuring.." Kickscraper.configure do |config| config.email = 'your-kickstarter-email-address@domain.com' config.password = 'This is not my real password. Seriously.' end p "logging in.." c = Kickscraper.client p "got access token #{Kickscraper.token.gsub(/\w{30}$/, "X" * 30)}" puts...
github
markolson/kickscraper
https://github.com/markolson/kickscraper
lib/kickscraper.rb
Ruby
mit
224
master
346
require 'hashie' require 'json' require "kickscraper/version" require "kickscraper/configure" require "kickscraper/response" require "kickscraper/connection" require "kickscraper/client" require "kickscraper/api" module Kickscraper extend Configure attr_accessor :client def self.client @client ||= Kickscr...
github
markolson/kickscraper
https://github.com/markolson/kickscraper
lib/kickscraper/client.rb
Ruby
mit
224
master
8,901
require 'uri' module Kickscraper class Client include Connection attr_accessor :user CLIENT_ID = '2II5GGBZLOOZAA5XBU1U0Y44BU57Q58L8KOGM7H0E0YFHP3KTG' def initialize @more_projects_available = false if Kickscraper.email.nil? ...
github
markolson/kickscraper
https://github.com/markolson/kickscraper
lib/kickscraper/connection.rb
Ruby
mit
224
master
2,198
require 'faraday' require 'faraday_middleware' require 'uri/query_params' class KSToken < Faraday::Middleware def initialize(app) @app = app end def call(env) # replace '+' symbols in the query params with their original spaces, because there # seems to be a bug in the way some versions of Fararay e...
github
markolson/kickscraper
https://github.com/markolson/kickscraper
lib/kickscraper/api.rb
Ruby
mit
224
master
750
module Kickscraper class Api extend Connection include Hashie::Extensions::Coercion attr_accessor :raw def initialize(blob) @raw = blob end def method_missing(name) @raw.send(name) if @raw.respond_to? name end def self.coerce...
github
markolson/kickscraper
https://github.com/markolson/kickscraper
lib/kickscraper/client/category.rb
Ruby
mit
224
master
400
module Kickscraper class Category < Api attr_accessor :projects def to_s name end def inspect "<Category: '#{to_s}'>" end def projects return [] unless @projects || self.urls.web.discover @projects ||= Kickscraper.cli...
github
markolson/kickscraper
https://github.com/markolson/kickscraper
lib/kickscraper/client/project.rb
Ruby
mit
224
master
2,183
require_relative 'user.rb' require_relative 'category.rb' module Kickscraper class Project < Api coerce_key :creator, Kickscraper::User coerce_key :category, Kickscraper::Category attr_accessor :comments, :updates, :rewards def to_s name end def inspec...
github
markolson/kickscraper
https://github.com/markolson/kickscraper
lib/kickscraper/client/user.rb
Ruby
mit
224
master
1,073
module Kickscraper class User < Api attr_accessor :backed_projects, :starred_projects def to_s name end def reload! @raw = Kickscraper.client.process_api_url("User", self.urls.api.user, false) Kickscraper::User::do_coercion(self) end de...
github
aphyr/salticid
https://github.com/aphyr/salticid
Rakefile.rb
Ruby
mit
224
master
1,040
$:.unshift(File.join(File.dirname(__FILE__), 'lib')) require 'rubygems' require 'salticid/version' require 'find' require 'rubygems/package_task' # Don't include resource forks in tarballs on Mac OS X. ENV['COPY_EXTENDED_ATTRIBUTES_DISABLE'] = 'true' ENV['COPYFILE_DISABLE'] = 'true' # Gemspec gemspec = Gem::Specif...
github
aphyr/salticid
https://github.com/aphyr/salticid
lib/monkeypatch.rb
Ruby
mit
224
master
500
module Net module SSH class Shell # Like execute! but returns an array: the status and the output. def exec!(command, klass=Net::SSH::Shell::Process, &callback) result = '' process = klass.new(self, command, callback) process.on_output do |p, output| result << output...
github
aphyr/salticid
https://github.com/aphyr/salticid
lib/salticid.rb
Ruby
mit
224
master
4,351
require 'rubygems' require 'net/ssh' require 'net/scp' require 'net/ssh/gateway' require 'thread' $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'salticid/version' class Salticid def self.log(str) File.open('salticid.log', 'a') do |f| f.puts str end end $LOAD_PATH.unshift(File.join(File.dirn...
github
aphyr/salticid
https://github.com/aphyr/salticid
lib/salticid/interface.rb
Ruby
mit
224
master
4,122
class Salticid class Interface require 'curses' require 'salticid/interface/ncurses' require 'salticid/interface/resizable' require 'salticid/interface/view' require 'salticid/interface/tab_view' require 'salticid/interface/host_view' COLORS = { :info => Curses::COLOR_WHITE, :...
github
aphyr/salticid
https://github.com/aphyr/salticid
lib/salticid/role_proxy.rb
Ruby
mit
224
master
812
class RoleProxy # Wraps a Role in the context of a Host: calls to the RoleProxy are passed to # the Role it wraps, but called with the host as the first argument. This # allows role-method chaining for nice namespaces. # # RoleProxy.new(host, role).some_task(*args) => # role.some_task(host, *args) # #...
github
aphyr/salticid
https://github.com/aphyr/salticid
lib/salticid/host.rb
Ruby
mit
224
master
16,019
class Salticid::Host attr_accessor :env, :name, :user, :groups, :roles, :tasks, :salticid, :password def initialize(name, opts = {}) @name = name.to_s @user = opts[:user].to_s @groups = opts[:groups] || [] @roles = opts[:roles] || [] @tasks = opts[:tasks] || [] @salticid = opts[:salticid] ...
github
aphyr/salticid
https://github.com/aphyr/salticid
lib/salticid/group.rb
Ruby
mit
224
master
1,936
class Salticid::Group # A collection of hosts and other groups. attr_reader :name attr_accessor :parent attr_accessor :groups, :hosts def initialize(name, opts = {}) @name = name.to_s @salticid = opts[:salticid] @parent = opts[:parent] @hosts = [] @groups = [] end def ==(other) ...
github
aphyr/salticid
https://github.com/aphyr/salticid
lib/salticid/gateway.rb
Ruby
mit
224
master
497
class Salticid::Gateway < Salticid::Host def initialize(*args) @tunnel_lock = Mutex.new super *args end # Gateways don't need gateways. def gw end # Tunnel for connecting to other hosts. def gateway_tunnel # Multiple hosts will be asking for this tunnel at the same time. # We need to onl...
github
aphyr/salticid
https://github.com/aphyr/salticid
lib/salticid/task.rb
Ruby
mit
224
master
763
class Salticid::Task # A named block, runnable in some context attr_accessor :name, :block def initialize(name, opts = {}) @name = name.to_s end def ==(other) self.name == other.name and self.block == other.block end def dup dup = Salticid::Task.new(@name) dup.block = @block du...
github
aphyr/salticid
https://github.com/aphyr/salticid
lib/salticid/role.rb
Ruby
mit
224
master
2,448
class Salticid::Role # A role is a list of tasks. attr_reader :name, :tasks, :salticid def initialize(name, opts = {}) @name = name.to_s @tasks = [] @salticid = opts[:salticid] end # Runs the block in the context of each. def each_host(&block) hosts.each do |host| host.instance_exec ...
github
aphyr/salticid
https://github.com/aphyr/salticid
lib/salticid/config.rb
Ruby
mit
224
master
238
module Salticid def self.config @config end def self.config=(config) @config = config end def self.load_config(file) @config = Construct.load(file) @config.define :hosts, :default => [] @config end end
github
aphyr/salticid
https://github.com/aphyr/salticid
lib/salticid/host/ip.rb
Ruby
mit
224
master
331
module Salticid::Host::IP # Host methods for IP addresses # Get all active IP addresses. def ips `ifconfig -a`.split("\n\n").map { |stanza| stanza.split("\n").find { |line| line =~ /inet addr:\s*([\d\.]{7..15})/ $1 } }.compact end def private_ips end def public_ips...
github
aphyr/salticid
https://github.com/aphyr/salticid
lib/salticid/interface/view.rb
Ruby
mit
224
master
975
class Salticid class Interface class View include Resizeable attr_accessor :window, :height, :width, :top, :left def initialize(interface, params = {}) @interface = interface @height = params[:height] || Curses.lines @width = params[:width] || Curses.cols @top =...
github
aphyr/salticid
https://github.com/aphyr/salticid
lib/salticid/interface/tab_view.rb
Ruby
mit
224
master
2,909
class Salticid class Interface class TabView < View def initialize(interface, params = {}) super @tabs = [] @active = -1 end # Gets the active tab def active @tabs[@active] || nil end # Sets the active tab def active=(tab) @acti...
github
aphyr/salticid
https://github.com/aphyr/salticid
lib/salticid/interface/host_view.rb
Ruby
mit
224
master
2,812
class Salticid class Interface class HostView < View attr_accessor :messages, :window, :state def initialize(interface, params = {}) @messages = [] @scroll_position = -1 super @host = params[:host] @host.on_log do |message| self << message ...
github
aphyr/salticid
https://github.com/aphyr/salticid
lib/salticid/interface/resizable.rb
Ruby
mit
224
master
685
class Salticid class Interface module Resizeable def resize(dimensions = nil) case dimensions when Hash # Resize self @height = dimensions[:height] if dimensions[:height] @width = dimensions[:width] if dimensions[:width] @top = dimensions[:top] ...
github
aphyr/salticid
https://github.com/aphyr/salticid
lib/salticid/interface/ncurses.rb
Ruby
mit
224
master
536
module Curses # Returns size of screen [y, x] def self.dimensions [Curses.stdscr.maxy, Curses.stdscr.maxx] end class Window # Adds a FormattedString def add_formatted_string(string) string.each do |part| # Set attributes part[1..-1].each {| attribute| attron attribute } ...
github
aphyr/salticid
https://github.com/aphyr/salticid
lib/snippets/symbol/to_proc.rb
Ruby
mit
224
master
514
# DEPRECATED: when we move to ruby 1.8.7. unless :to_proc.respond_to?(:to_proc) class Symbol # Turns the symbol into a simple proc, which is especially useful for enumerations. Examples: # # # The same as people.collect { |p| p.name } # people.collect(&:name) # # # The same as people.sel...
github
aphyr/salticid
https://github.com/aphyr/salticid
lib/snippets/object/__dir__.rb
Ruby
mit
224
master
707
# Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com # All files in this distribution are subject to the terms of the Ruby license. # Stolen from Ramaze class Object unless defined?(__DIR__) # This is similar to +__FILE__+ and +__LINE__+, and returns a String # representing the directory o...
github
aphyr/salticid
https://github.com/aphyr/salticid
lib/snippets/object/instance_exec.rb
Ruby
mit
224
master
457
class Object module InstanceExecHelper; end include InstanceExecHelper def instance_exec(*args, &block) # !> method redefined; discarding old instance_exec mname = "__instance_exec_#{Thread.current.object_id.abs}_#{object_id.abs}" InstanceExecHelper.module_eval{ define_method(mname, &block) } begin ...
github
aphyr/salticid
https://github.com/aphyr/salticid
spec/host.rb
Ruby
mit
224
master
937
#!/usr/bin/env ruby require 'rubygems' require 'bacon' require File.expand_path("#{File.dirname(__FILE__)}/../lib/salticid") describe "A Host" do @h = Salticid.new @h.role :awesome do task :setup do 'awesome setup' end end @h.role :dreary do task :setup do 'dreary setup' end ...
github
aphyr/salticid
https://github.com/aphyr/salticid
spec/test.rb
Ruby
mit
224
master
2,670
#!/usr/bin/env ruby require 'rubygems' require 'bacon' require File.expand_path "#{File.dirname(__FILE__)}/../lib/salticid" describe "A Host" do @h = Salticid.new @h.host :localhost do user ENV['USER'] end should 'start in /' do @h.host :localhost do pwd.should === '/' end end should...
github
aphyr/salticid
https://github.com/aphyr/salticid
spec/groups.rb
Ruby
mit
224
master
1,334
#!/usr/bin/env ruby require 'rubygems' require 'bacon' require File.expand_path "#{File.dirname(__FILE__)}/../lib/salticid" describe "Groups" do @h = Salticid.new @h.host :foo do end @h.group :top do group :sub do host :foo end end @h.host :bar do group :top end @h.host :baz do ...
github
aphyr/salticid
https://github.com/aphyr/salticid
spec/task.rb
Ruby
mit
224
master
633
#!/usr/bin/env ruby require 'rubygems' require 'bacon' require File.expand_path "#{File.dirname(__FILE__)}/../lib/salticid" describe "Tasks" do @h = Salticid.new @h.host :localhost do user ENV['USER'] end @h.task :task1 do name end should 'call tasks as methods' do @h.host :localhost do ...
github
aphyr/salticid
https://github.com/aphyr/salticid
spec/role.rb
Ruby
mit
224
master
387
#!/usr/bin/env ruby require 'rubygems' require 'bacon' require File.expand_path "#{File.dirname(__FILE__)}/../lib/salticid" describe "Roles" do @h = Salticid.new @h.host :localhost do user ENV['USER'] end should 'define methods on hosts' do @h.role :defined do define_method :foo do 1 ...
github
luke-gru/riml
https://github.com/luke-gru/riml
Rakefile
Ruby
mit
223
master
802
require File.expand_path('../lib/riml/environment', __FILE__) require 'rake/testtask' require 'bundler/setup' require 'bundler/gem_tasks' task :default => :test task :test => [:parser] desc 'Run all tests (default)' Rake::TestTask.new(:test) do |t| t.test_files = FileList['test/**/*_test.rb'].to_a end desc 'Run be...
github
luke-gru/riml
https://github.com/luke-gru/riml
riml.gemspec
Ruby
mit
223
master
1,204
require File.expand_path("../version", __FILE__) Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = 'riml' s.version = Riml::VERSION.join('.') s.summary = 'Riml is a language that compiles into VimL' s.description = <<-desc Riml is ruby-like version of VimL with some ...
github
luke-gru/riml
https://github.com/luke-gru/riml
lib/riml.rb
Ruby
mit
223
master
11,606
require 'pathname' require 'fileutils' require 'ostruct' if RUBY_VERSION < '1.9' require 'thread' end require File.expand_path('../riml/environment', __FILE__) require 'riml/lexer' require 'riml/nodes' require 'riml/parser' require 'riml/compiler' require 'riml/warning_buffer' require 'riml/include_cache' require '...
github
luke-gru/riml
https://github.com/luke-gru/riml
lib/riml/environment.rb
Ruby
mit
223
master
267
module Riml module Environment ROOTDIR = File.expand_path('../../..', __FILE__) require File.join(ROOTDIR, 'version') LIBDIR = File.join(ROOTDIR, 'lib') BINDIR = File.join(ROOTDIR, 'bin') $:.unshift(LIBDIR) unless $:.include? LIBDIR end end
github
luke-gru/riml
https://github.com/luke-gru/riml
lib/riml/class_dependency_graph.rb
Ruby
mit
223
master
2,911
# topological sorting module from stdlib require 'tsort' module Riml # Used for reordering `riml_include`s based on class dependencies. class ClassDependencyGraph include TSort attr_reader :definition_graph, :encountered_graph # definition_graph: { "faster_car.riml" => { "s:FasterCar" => "s:Car" }, ...
github
luke-gru/riml
https://github.com/luke-gru/riml
lib/riml/walker.rb
Ruby
mit
223
master
798
module Riml class Walker MAX_RECURSION_LVL_ACTUAL = 1_000_000 def self.walk_node(node, method, max_recursion_lvl = -1) if max_recursion_lvl == -1 max_recursion_lvl = MAX_RECURSION_LVL_ACTUAL end # breadth-first walk to_visit = [node] lvl = 0 while to_visit.length >...
github
luke-gru/riml
https://github.com/luke-gru/riml
lib/riml/parser.rb
Ruby
mit
223
master
163,832
# # DO NOT MODIFY!!!! # This file is automatically generated by Racc 1.8.1 # from Racc grammar file "grammar.y". # require 'racc/parser.rb' require File.expand_path("../lexer", __FILE__) require File.expand_path("../nodes", __FILE__) require File.expand_path("../errors", __FILE__) require File.expand_path(".....
github
luke-gru/riml
https://github.com/luke-gru/riml
lib/riml/repl.rb
Ruby
mit
223
master
4,311
begin require 'readline' rescue LoadError end require 'ostruct' require File.expand_path('../../riml', __FILE__) module Riml class Repl attr_reader :line attr_reader :parser, :compiler, :compiler_options private :parser, :compiler COMPILE_ON = %w(compile c) EXIT_ON = %w(quit q) EVAL_RIML_...
github
luke-gru/riml
https://github.com/luke-gru/riml
lib/riml/ast_rewriter.rb
Ruby
mit
223
master
36,790
require File.expand_path("../constants", __FILE__) require File.expand_path("../imported_class", __FILE__) require File.expand_path("../class_map", __FILE__) require File.expand_path("../class_dependency_graph", __FILE__) require File.expand_path("../walker", __FILE__) module Riml class AST_Rewriter include Riml...
github
luke-gru/riml
https://github.com/luke-gru/riml
lib/riml/nodes.rb
Ruby
mit
223
master
23,639
require File.expand_path('../constants', __FILE__) require File.expand_path('../errors', __FILE__) require File.expand_path('../walkable', __FILE__) require 'set' module Riml module Visitable include Walkable def accept(visitor) visitor.visit(self) end attr_accessor :parent_node, :scope, :for...
github
luke-gru/riml
https://github.com/luke-gru/riml
lib/riml/path_cache.rb
Ruby
mit
223
master
1,125
module Riml class PathCache def initialize @cache = {} end def []=(path, val) path = normalize_path(path) @cache[path] = val end def [](path) path = normalize_path(path) @cache[path] end def cache(path) path = normalize_path(path) @cache[path] =...
github
luke-gru/riml
https://github.com/luke-gru/riml
lib/riml/imported_class.rb
Ruby
mit
223
master
1,264
require File.expand_path('../nodes', __FILE__) module Riml class ImportedClass ANCHOR_BEGIN = '\A' ANCHOR_END = '\Z' attr_reader :name def initialize(name) @name = rm_modifier(name) end def imported? true end # an ImportedClass is #globbed? if its name contains 1 or mo...
github
luke-gru/riml
https://github.com/luke-gru/riml
lib/riml/rewritten_ast_cache.rb
Ruby
mit
223
master
614
module Riml class RewrittenASTCache def initialize @cache = {} @ast_classes_registered_cache = {} end def [](filename) @cache[filename] end def fetch(filename) ast = @cache[filename] return ast if ast @cache[filename] = yield end def clear @cach...
github
luke-gru/riml
https://github.com/luke-gru/riml
lib/riml/warning_buffer.rb
Ruby
mit
223
master
1,037
module Riml # Thread-safe output buffer. Used internally for all Riml warnings. Only # one of these objects exists during compile. class WarningBuffer # This class acts as a singleton, so no instance-level mutexes are # required. This facilitates locking both class and instance # methods with a single...
github
luke-gru/riml
https://github.com/luke-gru/riml
lib/riml/constants.rb
Ruby
mit
223
master
4,101
module Riml module Constants VIML_KEYWORDS = %w(function function! if else elseif while for in return is isnot finish break continue call let unlet unlet! try catch finally) VIML_END_KEYWORDS = %w(endfunction endif endwhile endfor endtry) RIML_END_KEYWORDS = %w(end) END_...
github
luke-gru/riml
https://github.com/luke-gru/riml
lib/riml/lexer.rb
Ruby
mit
223
master
13,289
# encoding: utf-8 require 'strscan' require File.expand_path('../constants', __FILE__) require File.expand_path('../errors', __FILE__) module Riml class Lexer include Riml::Constants SINGLE_LINE_COMMENT_REGEX = /\A[ \t\f]*"(.*)$/ OPERATOR_REGEX = /\A#{Regexp.union(['||', '&&', '===', '+=', '-=', '.='] ...
github
luke-gru/riml
https://github.com/luke-gru/riml
lib/riml/file_rollback.rb
Ruby
mit
223
master
1,959
require 'set' module Riml class FileRollback @files_created = Set.new # { 'main.vim' => nil, 'existed.vim' => "\nsource code..." } @previous_file_states = {} @guarding = 0 @m = Mutex.new # NOTE: Used only in main thread. # Only call this method in one thread at a time. It's okay if #...
github
luke-gru/riml
https://github.com/luke-gru/riml
lib/riml/walkable.rb
Ruby
mit
223
master
2,031
module Riml module Walkable include Enumerable def each(&block) children.each(&block) end alias walk each def previous idx = index_by_member if idx && parent.members[idx - 1] attr = parent.members[idx - 1] return send(attr) else idx = index_by_chil...
github
luke-gru/riml
https://github.com/luke-gru/riml
lib/riml/backtrace_filter.rb
Ruby
mit
223
master
912
require File.expand_path('../environment', __FILE__) module Riml class BacktraceFilter include Riml::Environment RIML_INTERNAL_FILE_REGEX = /#{ROOTDIR}/ attr_reader :error def initialize(error) @error = error end def filter!(first_i = 0, last_i = -1) if first_i < 0 rai...
github
luke-gru/riml
https://github.com/luke-gru/riml
lib/riml/include_cache.rb
Ruby
mit
223
master
1,146
module Riml class IncludeCache def initialize @cache = {} @m = Mutex.new # TODO: Ruby 2.0+ has Mutex#owned? method @owns_lock = nil end # `fetch` can be called recursively in the `yield`ed block, so must # make sure not to try to lock the Mutex if it's already locked by the ...
github
luke-gru/riml
https://github.com/luke-gru/riml
lib/riml/errors.rb
Ruby
mit
223
master
1,534
require File.expand_path('../constants', __FILE__) module Riml class RimlError < StandardError attr_accessor :node def initialize(msg = nil, node = nil) super(msg) @node = node end def verbose_message "#{self.class}\n" << "location: #{location_info}\n" << "message: #{me...
github
luke-gru/riml
https://github.com/luke-gru/riml
lib/riml/compiler.rb
Ruby
mit
223
master
25,527
require File.expand_path('../nodes', __FILE__) require File.expand_path('../errors', __FILE__) # visits AST nodes and translates them into VimL module Riml class Compiler attr_accessor :parser attr_writer :options # compiler options def options @options ||= {} end def output_dir ...
github
luke-gru/riml
https://github.com/luke-gru/riml
lib/riml/class_map.rb
Ruby
mit
223
master
1,879
require File.expand_path("../errors", __FILE__) require File.expand_path("../imported_class", __FILE__) module Riml # Map of {"ClassName" => ClassDefinitionNode} # Can also query object for superclass of a named class, etc... # # Ex : class_map.superclass("g:SomeClass") => "g:SomeClassBase" class ClassMap ...
github
luke-gru/riml
https://github.com/luke-gru/riml
test/test_helper.rb
Ruby
mit
223
master
3,767
if RUBY_VERSION < '1.9' require 'rubygems' unless defined?(Gem) end gem 'minitest' require 'minitest/autorun' require 'mocha/minitest' # TODO: use minitest/mock instead require 'pathname' require 'debug' $VERBOSE = 1 require File.expand_path('../../lib/riml', __FILE__) module Riml class TestCase < Minitest::Test ...
github
luke-gru/riml
https://github.com/luke-gru/riml
test/lexer_test.rb
Ruby
mit
223
master
8,196
#encoding: utf-8 require File.expand_path('../test_helper', __FILE__) module Riml class BasicLexerTest < Riml::TestCase test "if statement" do riml = <<-Riml if 1 print '...' if false do_something end end print "omg"; Riml expected = [ [:IF, "if"], [:NUMBE...
github
luke-gru/riml
https://github.com/luke-gru/riml
test/error_messages_test.rb
Ruby
mit
223
master
715
require File.expand_path('../test_helper', __FILE__) module Riml class ErrorMessagesTest < Riml::TestCase test "gives proper lineno and filename for unexpected construct during compilation" do riml = <<Riml echo "line1" echo "line2" super echo "line4" Riml assert_raises( Riml::CompileError, /#{...
github
luke-gru/riml
https://github.com/luke-gru/riml
test/parser_test.rb
Ruby
mit
223
master
5,316
require File.expand_path('../test_helper', __FILE__) module Riml class BasicParserTest < Riml::TestCase test "parsing basic method" do code = <<-Viml def a_method(a, b) true end Viml expected = Nodes.new([ DefNode.new('!', nil, nil, "a_method", ['a', 'b'], nil, Nodes.new([Tru...
github
luke-gru/riml
https://github.com/luke-gru/riml
test/compiler_test.rb
Ruby
mit
223
master
58,620
require File.expand_path('../test_helper', __FILE__) module Riml class BasicCompilerTest < Riml::TestCase test "basic function compiles" do riml = <<Riml def a_method(a, b) return true end Riml nodes = Nodes.new([ DefNode.new('!', nil, nil, "a_method", ['a', 'b'], nil, Nodes.new([ ReturnNod...
github
luke-gru/riml
https://github.com/luke-gru/riml
test/splats_in_calling_context_test.rb
Ruby
mit
223
master
10,503
require File.expand_path('../test_helper', __FILE__) module Riml class SplatsInCallingContextTest < Riml::TestCase test "explicit splat in base class inside initialize using super with splat arg" do riml = <<Riml class Animal def initialize(name, color) self.name = name self.color = color end end c...
github
luke-gru/riml
https://github.com/luke-gru/riml
test/integration/surround/surround_compiler_test.rb
Ruby
mit
223
master
332
require File.expand_path('../../../test_helper', __FILE__) class SurroundCompilerTest < Riml::TestCase test "compiles to target" do source = File.read File.expand_path("../surround.riml", __FILE__) compiled = File.read File.expand_path("../surround.vim", __FILE__) assert_equal compiled, compile(source...
github
luke-gru/riml
https://github.com/luke-gru/riml
test/integration/riml_commands/riml_include_reordering_test.rb
Ruby
mit
223
master
770
require File.expand_path('../../../test_helper', __FILE__) class RimlIncludeReorderingTest < Riml::TestCase test "riml_includes get reordered based on class dependencies" do riml = <<Riml riml_include 'riml_include_lib2' riml_include 'riml_include_lib' lib1 = new Lib1() Riml expected = <<Viml " included: '...
github
luke-gru/riml
https://github.com/luke-gru/riml
test/integration/riml_commands/compiler_test.rb
Ruby
mit
223
master
11,839
require File.expand_path('../../../test_helper', __FILE__) class RimlCommandsCompilerTest < Riml::TestCase test "riml_source raises error if the file is not in Riml.source_path" do riml = <<Riml riml_source "nonexistent_file.riml" Riml assert_raises Riml::FileNotFound do compile(riml) end end ...
github
luke-gru/riml
https://github.com/luke-gru/riml
test/integration/bin/riml_test.rb
Ruby
mit
223
master
8,397
require File.expand_path('../../../test_helper', __FILE__) require 'shellwords' require 'fileutils' class BinRimlTest < Riml::TestCase EXEC = Shellwords.escape(File.join(Riml::Environment::BINDIR, 'riml')) test "compiles riml from stdin to viml on stdout with -s option" do pathogen_riml_path = File.expand_pat...
github
luke-gru/riml
https://github.com/luke-gru/riml
test/integration/vim-fugitive/fugitive_compiler_test.rb
Ruby
mit
223
master
2,405
require File.expand_path('../../../test_helper', __FILE__) class FugitiveCompilerTest < Riml::TestCase test "compiles to target" do source = File.read File.expand_path("../fugitive.riml", __FILE__) compiled = File.read File.expand_path("../fugitive.vim", __FILE__) viml = nil assert(viml = compile(...
github
luke-gru/riml
https://github.com/luke-gru/riml
test/integration/pathogen/pathogen_parser_test.rb
Ruby
mit
223
master
632
require File.expand_path('../../../test_helper', __FILE__) class PathogenParserTest < Riml::TestCase test "parses without error" do source = File.read File.expand_path("../pathogen.riml", __FILE__) assert parse(source) end test "gives proper lineno when raises parse error" do source = File.read(File...
github
luke-gru/riml
https://github.com/luke-gru/riml
test/integration/pathogen/pathogen_compiler_test.rb
Ruby
mit
223
master
4,268
require File.expand_path('../../../test_helper', __FILE__) class PathogenCompilerTest < Riml::TestCase test "compiles to target" do source = File.read File.expand_path("../pathogen.riml", __FILE__) compiled = File.read File.expand_path("../pathogen.vim", __FILE__) assert_equal compiled, compile(source...
github
luke-gru/riml
https://github.com/luke-gru/riml
test/integration/smartinput/smartinput_parser_test.rb
Ruby
mit
223
master
3,350
require File.expand_path('../../../test_helper', __FILE__) class SmartInputParserTest < Riml::TestCase test "parses without error" do source = File.read File.expand_path("../smartinput.riml", __FILE__) assert parse(source) end test "gives proper lineno when raises parse error" do source = File.read(...
github
luke-gru/riml
https://github.com/luke-gru/riml
test/integration/smartinput/smartinput_compiler_test.rb
Ruby
mit
223
master
2,717
require File.expand_path('../../../test_helper', __FILE__) class SmartInputCompilerTest < Riml::TestCase test "compiles to target" do source = File.read File.expand_path("../smartinput.riml", __FILE__) compiled = File.read File.expand_path("../smartinput.vim", __FILE__) assert_equal compiled, compile(...
github
luke-gru/riml
https://github.com/luke-gru/riml
test/integration/smartinput/smartinput_lexer_test.rb
Ruby
mit
223
master
240
require File.expand_path('../../../test_helper', __FILE__) class SmartInputLexerTest < Riml::TestCase test "lexes without error" do source = File.read File.expand_path("../smartinput.riml", __FILE__) assert lex(source) end end
github
luke-gru/riml
https://github.com/luke-gru/riml
test/integration/nerdtree/nerdtree_compiler_test.rb
Ruby
mit
223
master
355
require File.expand_path('../../../test_helper', __FILE__) class NerdTreeCompilerTest < Riml::TestCase test "compiles to target" do source = File.read File.expand_path("../nerdtree.riml", __FILE__) compiled = File.read File.expand_path("../nerdtree.vim", __FILE__) assert(viml = compile(source)) ass...
github
meilisearch/meilisearch-ruby
https://github.com/meilisearch/meilisearch-ruby
meilisearch.gemspec
Ruby
mit
223
main
925
# frozen_string_literal: true require File.join(File.dirname(__FILE__), 'lib', 'meilisearch', 'version') Gem::Specification.new do |s| s.name = 'meilisearch' s.version = Meilisearch::VERSION s.authors = ['Meili'] s.email = 'bonjour@meilisearch.com' s.summary = 'An easy-to-use ruby c...
github
meilisearch/meilisearch-ruby
https://github.com/meilisearch/meilisearch-ruby
Gemfile
Ruby
mit
223
main
464
# frozen_string_literal: true source 'https://rubygems.org' git_source(:github) { |repo_name| "https://github.com/#{repo_name}" } # meilisearchsearch.gemspec dependencies gemspec group :development, :test do gem 'byebug' gem 'rspec', '~> 3.0' gem 'simplecov' gem 'simplecov-cobertura' # Used only for test...
github
meilisearch/meilisearch-ruby
https://github.com/meilisearch/meilisearch-ruby
spec/spec_helper.rb
Ruby
mit
223
main
2,910
# 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...