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 | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | components/stdlib.rb | Ruby | bsd-3-clause | 96 | master | 686 | def any_or_k(trec)
case trec
when RDL::Type::FiniteHashType
RDL::Type::UnionType.new(* trec.elts.keys.map { |sym| RDL::Type::SingletonType.new(sym) })
else
RDL::Globals.parser.scan_str "#T k"
end
end
def output_type(trec, targs)
case trec
when RDL::Type::FiniteHashType
targ = targs[0]
case ... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | components/active_record.rb | Ruby | bsd-3-clause | 96 | master | 5,248 | class DBTypes
def self.table_name_to_schema_hash(table)
schema = DBUtils.get_schema(table).params[0]
Hash[schema.elts.except(:__associations).map { |k, v|
[k, RDL::Type::OptionalType.new(v)]
}]
end
def self.schema_type(trec)
case trec
when RDL::Type::SingletonType
trec = trec.val
... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | lib/rbsyn.rb | Ruby | bsd-3-clause | 96 | master | 1,068 | require "rdl"
require "unparser"
require 'parser/current'
require "sqlite3"
require "active_record"
require "pry"
require "minisat"
require "minitest"
require "timeout"
require "rbsyn/version"
require "rbsyn/utils"
require "rbsyn/type_ops"
require "rbsyn/exceptions"
require "rbsyn/effects"
require "rbsyn/assertions"
r... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | lib/rbsyn/bool_cond.rb | Ruby | bsd-3-clause | 96 | master | 2,405 | class BoolCond
include AST
attr_reader :conds
def initialize
@conds = []
end
def <<(cond)
raise RbSynError, "expected TypedAST, got #{cond}" unless cond.is_a? TypedNode
# raise RuntimeError, "don't expect holes" if cond.has_hole?
@conds << cond unless @conds.include? cond
end
def posit... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | lib/rbsyn/prog_cache.rb | Ruby | bsd-3-clause | 96 | master | 661 | class ProgCache
include AST
def initialize(ctx)
@cache = Set.new
@ctx = ctx
end
def add(prog)
@cache.add(prog)
end
def find_prog(precond, postcond)
@cache.each { |prog|
begin
res, klass = eval_ast(@ctx, prog.to_ast, precond)
rescue RbSynError => err
raise err
... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | lib/rbsyn/prog_tuple.rb | Ruby | bsd-3-clause | 96 | master | 8,333 | class ProgTuple
include AST
include SynHelper
include Utils
attr_reader :ctx, :branch, :preconds, :postconds
attr_accessor :prog
def initialize(ctx, prog, branch, preconds, postconds)
@ctx = ctx
if branch.is_a? BoolCond
@branch = RDL.type_cast(branch, 'BoolCond')
else
raise RbSynEr... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | lib/rbsyn/type_ops.rb | Ruby | bsd-3-clause | 96 | master | 3,701 | module TypeOperations
def compute_targs(trec, tmeth)
# TODO: we use only the first definition, ignoring overloaded method definitions
type = tmeth[0]
targs = type.args
return targs.map { |targ| RDL::Type::DynamicType.new } if ENV.key? 'DISABLE_TYPES'
targs.map { |targ|
case targ
when ... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | lib/rbsyn/exceptions.rb | Ruby | bsd-3-clause | 96 | master | 272 | class RbSynError < StandardError; end
class AssertionError < RbSynError
attr_reader :passed_count, :read_set, :write_set
def initialize(passed_count, read_set, write_set)
@passed_count = passed_count
@read_set = read_set
@write_set = write_set
end
end |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | lib/rbsyn/sig.rb | Ruby | bsd-3-clause | 96 | master | 7,791 | RDL.type Proc, :initialize, '() { (%any) -> %any } -> Proc'
RDL.type RDL::Globals, 'self.types', '() -> Hash<Symbol, RDL::Type::Type>'
RDL.type RDL::Type::Type, :<=, '(RDL::Type::Type) -> %bool'
RDL.type MiniSat::Var, :-@, '() -> MiniSat::Var'
RDL.type MiniSat::Var, :initialize, '(MiniSat::Solver) -> MiniSat::Var'
RDL.... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | lib/rbsyn/assertions.rb | Ruby | bsd-3-clause | 96 | master | 1,423 | module Assertions
# Note: The same count will correspond to the same failure reason all the time
def assert(&blk)
@count += 1
ans = yield
if !!ans
@passed_count += 1
ans
else
return if ENV.key? 'DISABLE_EFFECTS'
ret = @ctx.functype.ret
raise RbSynError, "expected only o... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | lib/rbsyn/reachability.rb | Ruby | bsd-3-clause | 96 | master | 2,357 | =begin
path = (type -> method -> type -> ..., tenv)
queue = initial_set of path
while depth < max_depth {
type = consume item from queue
find all possible methods in the type
compute targs of the methods
check if the targs can be constructed from the tenv
if yes {
compute tout for that method
push the... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | lib/rbsyn/dsl.rb | Ruby | bsd-3-clause | 96 | master | 2,087 | class SpecProxy
attr_reader :pre_blk, :post_blk
def initialize(mth_name)
@mth_name = mth_name
end
def setup(&blk)
@pre_blk = blk
end
def post(&blk)
@post_blk = blk
end
end
class SynthesizerProxy
include AST
require "minitest/assertions"
include Minitest::Assertions
attr_accessor :... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | lib/rbsyn/synthesizer.rb | Ruby | bsd-3-clause | 96 | master | 3,632 | COVARIANT = :+
CONTRAVARIANT = :-
TRUE_POSTCOND = Proc.new { |result| result == true }
class Synthesizer
include AST
include SynHelper
include Utils
def initialize(ctx)
@ctx = ctx
end
def run
if ENV.key? 'EFFECT_PREC'
eff_prec = ENV['EFFECT_PREC'].strip.to_i
else
eff_prec = 0
... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | lib/rbsyn/effects.rb | Ruby | bsd-3-clause | 96 | master | 4,857 | class EffectAnalysis
def self.effect_leq(e1, e2)
# TODO: unhandled right now: Singleton classes
raise RbSynError, "cannot have self during leq of effects" if has_self?([e1]) || has_self?([e2])
if e1 == ''
true
elsif e1 == '*'
if e2 == ''
false
elsif e2 == '*'
true
... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | lib/rbsyn/context.rb | Ruby | bsd-3-clause | 96 | master | 1,400 | require 'logger'
class Context
attr_accessor :max_prog_size, :components, :preconds, :postconds, :mth_name,
:reset_func, :functype, :tenv, :max_hash_size, :max_arg_length, :max_hash_depth,
:curr_binding, :constants, :enable_and, :enable_constants, :enable_nil
attr_reader :logger
def initialize
@max... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | lib/rbsyn/prog_wrapper.rb | Ruby | bsd-3-clause | 96 | master | 6,603 | class ProgWrapper
include AST
attr_reader :seed, :env, :exprs, :looking_for, :target
attr_accessor :passed_asserts
def initialize(ctx, seed, env, exprs=RDL.type_cast([], 'Array<TypedNode>', force: true))
@ctx = ctx
@seed = seed
@env = env
@exprs = exprs
@passed_asserts = 0
@looking_for... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | lib/rbsyn/ast.rb | Ruby | bsd-3-clause | 96 | master | 837 | module AST
def s(ttype, type, *children)
TypedNode.new(ttype, type, *children)
end
def eval_ast(ctx, ast, precond)
max_args = ctx.functype.args.size
args = max_args.times.map { |i| "arg#{i}".to_sym }
klass = Class.new
klass.instance_eval {
@count = 0
@passed_count = 0
@ctx =... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | lib/rbsyn/local_env.rb | Ruby | bsd-3-clause | 96 | master | 619 | class LocalEnvironment
@@ref = 0
attr_accessor :info
def initialize
@info = {}
end
def next_ref
ans = @@ref
@@ref += 1
ans
end
def bump_count(ref)
item = @info[ref]
item[:count] = item[:count] + 1
end
def get_expr(ref)
@info[ref]
end
def add_expr(expr)
ref = ne... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | lib/rbsyn/syn_helper.rb | Ruby | bsd-3-clause | 96 | master | 2,778 | module SynHelper
include TypeOperations
def generate(seed_hole, preconds, postconds, return_all=false)
correct_progs = []
work_list = [seed_hole]
until work_list.empty?
base = work_list.shift
effect_needed = []
generated = base.build_candidates
evaluable = generated.reject &:ha... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | lib/rbsyn/utils.rb | Ruby | bsd-3-clause | 96 | master | 1,093 | require 'rouge'
module Utils
def format(prog)
formatter = Rouge::Formatters::Terminal256.new
lexer = Rouge::Lexers::Ruby.new
formatter.format(lexer.lex(prog))
end
def format_ast(ast)
format(Unparser.unparse(ast))
end
def change_effect_precision(level)
RDL::Globals.info.info.each { |cls,... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | lib/rbsyn/dbutils.rb | Ruby | bsd-3-clause | 96 | master | 224 | class DBUtils
@@schema = {}
def self.set_schema(klass, schema)
@@schema[klass] = schema
end
def self.get_schema(klass)
@@schema[klass]
end
def self.reset
Rbsyn::ActiveRecord::Utils.reset
end
end |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | lib/rbsyn/elimination/elimination_strategy.rb | Ruby | bsd-3-clause | 96 | master | 336 | class EliminationStrategy
def self.eliminate(progs)
raise RbSynError, "Not implemented"
end
end
# Load all elimination strategies
Dir[File.join(File.dirname(__FILE__), "*.rb")]
.reject { |f| f == __FILE__ }
.each { |f| require f }
ELIMINATION_ORDER = [
DuplicateElimiation,
# MinSizeElimination,
Te... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | lib/rbsyn/elimination/test_elimination.rb | Ruby | bsd-3-clause | 96 | master | 475 | class TestElimination < EliminationStrategy
extend AST
def self.eliminate(progs)
progs.select { |prog|
ast = prog.to_ast
prog.preconds.zip(prog.postconds).all? { |precond, postcond|
begin
res, klass = eval_ast(prog.ctx, ast, precond)
klass.instance_eval { @params = postc... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | lib/rbsyn/elimination/minsize_elimination.rb | Ruby | bsd-3-clause | 96 | master | 240 | class MinSizeElimination < EliminationStrategy
def self.eliminate(progs)
least = progs.map { |prog| ProgSizePass.prog_size(prog.to_ast, nil) }.min
progs.reject { |prog| ProgSizePass.prog_size(prog.to_ast, nil) > least }
end
end |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | lib/rbsyn/ast/no_hole_pass.rb | Ruby | bsd-3-clause | 96 | master | 511 | class NoHolePass < ::AST::Processor
attr_reader :has_holes
def self.has_hole?(node, env)
visitor = NoHolePass.new(env)
visitor.process(node)
visitor.has_holes
end
def initialize(env)
@has_holes = false
@env = env
end
def on_envref(node)
process(@env.get_expr(node.children[0])[:exp... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | lib/rbsyn/ast/expand_hole_pass.rb | Ruby | bsd-3-clause | 96 | master | 8,997 | class ExpandHolePass < ::AST::Processor
include AST
include TypeOperations
attr_reader :expand_map, :read_effs
attr_writer :effect_methds
def initialize(ctx, env)
@expand_map = []
@read_effs = []
@visited_envrefs = Set.new
@ctx = ctx
raise RbSynError, "expected LocalEnvironment" unless e... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | lib/rbsyn/ast/refine_types_pass.rb | Ruby | bsd-3-clause | 96 | master | 679 | class RefineTypesPass < ::AST::Processor
include TypeOperations
def on_send(node)
node.updated(nil, node.children.map { |k|
k.is_a?(TypedNode) ? process(k) : k
})
trecv = node.children[0].ttype
mth = node.children[1]
mthds = methods_of(trecv)
info = mthds[mth]
tmeth = info[:type]... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | lib/rbsyn/ast/flatten_prog_pass.rb | Ruby | bsd-3-clause | 96 | master | 607 | VAR_PREFIX = "t"
class FlattenProgramPass < ::AST::Processor
include AST
attr_reader :var_expr
def initialize(ctx, env)
@ctx = ctx
@env = env
@var_expr = {}
end
def on_envref(node)
subexpr = @env.get_expr(node.children[0])
if subexpr[:count] == 1
subexpr[:expr]
else
ref... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | lib/rbsyn/ast/prog_size_pass.rb | Ruby | bsd-3-clause | 96 | master | 858 | class ProgSizePass < ::AST::Processor
attr_reader :size
def self.prog_size(node, env)
visitor = ProgSizePass.new(env)
visitor.process(node)
visitor.size
end
def initialize(env)
@size = 0
@env = env
end
def on_hole(node)
@size += node.children[0]
node
end
def on_send(node)... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | lib/rbsyn/ast/extract_ast_pass.rb | Ruby | bsd-3-clause | 96 | master | 848 | class ExtractASTPass < ::AST::Processor
def initialize(selection, old_env)
@selection = selection
@new_env = Marshal.load(Marshal.dump(old_env))
end
def on_envref(node)
subexpr = @new_env.get_expr(node.children[0])
subexpr[:expr] = process(subexpr[:expr])
nil
end
def on_filled_hole(node)... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | lib/rbsyn/ast/node.rb | Ruby | bsd-3-clause | 96 | master | 661 | class TypedNode < Parser::AST::Node
# ttype: term type
attr_reader :ttype
def initialize(ttype, type, *children)
@ttype = ttype
super(type, children)
end
# This is monkey patched. See original source in ast gem
def updated(type=nil, children=nil, properties=nil)
new_type = type || ... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | lib/rbsyn/active_record/utils.rb | Ruby | bsd-3-clause | 96 | master | 3,152 | module Rbsyn::ActiveRecord
RESERVED_NAMES = ["ApplicationRecord", "primary::SchemaMigration", "ActiveRecord::InternalMetadata", "ActiveRecord::SchemaMigration"]
class Utils
def self.models
ActiveRecord::Base.descendants.reject { |model|
Rbsyn::ActiveRecord::RESERVED_NAMES.include? model.name.to_s... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | lib/rbsyn/instrument/branch_count.rb | Ruby | bsd-3-clause | 96 | master | 778 | class BranchCount < ::AST::Processor
attr_reader :branches
def self.branches(node)
pass = BranchCount.new
pass.process(node)
pass.branches == 0 ? 1 : pass.branches
end
def initialize
@branches = 0
end
def on_if(node)
if node.children.size == 2
@branches += 1 unless node.children... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | lib/rbsyn/instrument/ast_node_count.rb | Ruby | bsd-3-clause | 96 | master | 321 | class ASTNodeCount < ::AST::Processor
attr_reader :size
def self.size(node)
pass = ASTNodeCount.new
pass.process(node)
pass.size
end
def initialize
@size = 0
end
def handler_missing(node)
@size += 1
node.children.map { |k|
k.is_a?(node.class) ? process(k) : k
}
end
end |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | lib/rbsyn/instrument/instrument.rb | Ruby | bsd-3-clause | 96 | master | 432 | require_relative "ast_node_count"
require_relative "branch_count"
class Instrumentation
class << self
attr_accessor :prog, :specs
def reset!
self.prog = nil
end
def size
return 0 unless self.prog
ASTNodeCount.size(Parser::CurrentRuby.parse(self.prog))
end
def branches
... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | lib/rbsyn/prune/inverse_branch_fold.rb | Ruby | bsd-3-clause | 96 | master | 3,746 | class SpeculativeInverseBranchFold < BranchPruneStrategy
extend AST
def self.prune(progcond)
return progcond unless progcond.prog.is_a? Array
return progcond unless progcond.prog.size == 2
lbranch = progcond.prog[0].branch
rbranch = progcond.prog[1].branch
guessed = nil
begin
if lb... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | lib/rbsyn/prune/prune_strategy.rb | Ruby | bsd-3-clause | 96 | master | 311 | class BranchPruneStrategy
def self.prune(progcond)
raise RbSynError, "Not implemented"
end
end
# Load all elimination strategies
Dir[File.join(File.dirname(__FILE__), "*.rb")]
.reject { |f| f == __FILE__ }
.each { |f| require f }
PRUNE_ORDER = [
SpeculativeInverseBranchFold,
BoolExprFold
] |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | lib/rbsyn/prune/boolexpr_fold.rb | Ruby | bsd-3-clause | 96 | master | 1,612 | class BoolExprFold < BranchPruneStrategy
extend AST
def self.prune(progcond)
# we know branches are always bool (enforced when ProgTuple is created)
# there is nothing to prune if there is no children
return progcond unless progcond.prog.is_a? Array
return progcond unless progcond.prog.all? { |pc| ... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | models/gitlab_discussion.rb | Ruby | bsd-3-clause | 96 | master | 562 | class GitlabNote < ApplicationRecord
has_one :noteable, class_name: 'GitlabMergeRequest'
has_one :in_reply_to, class_name: 'GitlabNote'
def discussion_class
GitlabDiscussion
end
end
class GitlabMergeRequest < ApplicationRecord
end
class GitlabDiscussion < ApplicationRecord
has_many :notes, class_name: ... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | models/gitlab_issue.rb | Ruby | bsd-3-clause | 96 | master | 248 | class GitlabIssue < ApplicationRecord
belongs_to :closed_by, class_name: 'GitlabUser'
def self.available_states
{ opened: 0, closed: 1 }
end
def state=(s)
s = s.to_sym
self.state_id = GitlabIssue.available_states[s]
end
end |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | models/diaspora.rb | Ruby | bsd-3-clause | 96 | master | 689 | require 'securerandom'
class InvitationCode < ApplicationRecord
belongs_to :diaspora_user
before_create :generate_token
def generate_token
begin
self.token = SecureRandom.hex(6)
end while InvitationCode.exists?(:token => self[:token])
end
def synth_use!
self.count=(self.count - 1)
tru... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | models/user.rb | Ruby | bsd-3-clause | 96 | master | 432 | class User < ApplicationRecord
has_many :emails, class_name: "UserEmail"
has_many :email_tokens, dependent: :destroy
def email
emails.find_by(primary: true).email
end
def email_confirmed?
!email_tokens.where(email: email, confirmed: true).empty?
end
def revoke_admin!
update! admin: false
... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | models/model_helper.rb | Ruby | bsd-3-clause | 96 | master | 2,514 | ActiveRecord::Schema.define do
create_table :users, force: true do |t|
t.string :name
t.string :username
t.string :password
t.boolean :staged
t.boolean :active
t.boolean :admin
t.boolean :moderator
end
create_table :user_emails, force: true do |t|
t.string :email
t.boolean :pri... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | models/email_token.rb | Ruby | bsd-3-clause | 96 | master | 378 | # frozen_string_literal: true
class EmailToken < ActiveRecord::Base
belongs_to :user
def self.confirm(token)
token = EmailToken.find_by(token: token)
if token.confirmed || token.expired
raise RuntimeError, "already confirmed"
end
token.confirmed = true
token.expired = false
token.sav... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | test/syn_stats_reporter.rb | Ruby | bsd-3-clause | 96 | master | 854 | require 'json'
class SynthesisStatsReporter < Minitest::StatisticsReporter
include Utils
def initialize(path)
super
@path = path
@results_agg = {}
end
def before_test(test)
Instrumentation.reset!
end
def after_test(test)
return unless test.passed?
putsyn Instrumentation.prog if EN... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | test/test_helper.rb | Ruby | bsd-3-clause | 96 | master | 813 | $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
require "warning"
Gem.path.each do |path|
Warning.ignore(//, path)
end
require "rbsyn"
require "fabrication"
require_relative "../models/model_helper"
require_relative "../components/component_helper"
require "minitest/autorun"
require "minitest/hooks/test"
re... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | test/unit/reachability_test.rb | Ruby | bsd-3-clause | 96 | master | 308 | require "test_helper"
describe "Reachability" do
before(:all) do
end
it "starts from the available environment" do
skip
end
it "ends at the target type" do
skip
end
it "all paths have correct depth" do
skip
end
it "verify a sample path to be correct" do
skip
end
end |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | test/unit/models_test.rb | Ruby | bsd-3-clause | 96 | master | 386 | require "test_helper"
describe "Models" do
before(:all) do
DBUtils.reset
end
it "basic operations" do
u = User.create(name: 'Bruce Wayne', username: 'bruce', password: 'coolcool')
u.emails.create(email: 'bruce@wayne.com')
q = User.find_by(username: 'bruce')
assert_equal q.name, 'Bruce Wayne... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | test/unit/types_test.rb | Ruby | bsd-3-clause | 96 | master | 851 | require "test_helper"
describe "TableTypes" do
it "type checks table methods" do
skip
class Foo
def bar1
User.exists?(username: "bar")
end
end
RDL.type Foo, :bar1, "() -> %bool", wrap: false, typecheck: :later1
RDL.do_typecheck :later1
end
it "type checks joins" do
sk... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | test/benchmark/diaspora/user_process_invite_acceptence_benchmark.rb | Ruby | bsd-3-clause | 96 | master | 872 | # augmented: true
require "test_helper"
describe "Diaspora" do
it "user#process_invite_acceptence" do
load_typedefs :stdlib, :active_record
RDL.type InvitationCode, :synth_use!, '() -> %bot', wrap: false, write: ['InvitationCode.count']
define :process_invite_acceptence, "(DiasporaUser, InvitationCode)... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | test/benchmark/diaspora/invitation_code_use_benchmark.rb | Ruby | bsd-3-clause | 96 | master | 598 | # augmented: true
require "test_helper"
describe "Diaspora" do
it "invitation_code#use!" do
load_typedefs :stdlib, :active_record
RDL.type Integer, :-, '(Integer) -> Integer', wrap: false
define :use!, "(InvitationCode) -> %bot", [InvitationCode], consts: true do
spec "decrements the count of the... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | test/benchmark/diaspora/pod_schedule_check_if_needed_benchmark.rb | Ruby | bsd-3-clause | 96 | master | 1,752 | # disabled last test because no way to test it
require "test_helper"
describe "Diaspora" do
it "pod#schedule_check_if_needed" do
load_typedefs :stdlib, :ar_update
RDL.type DiasporaPod, 'self.status_codes', '() -> { unchecked: Integer, no_errors: Integer, net_failed: Integer }', wrap: false
RDL.type Int... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | test/benchmark/diaspora/user_confirm_email_benchmark.rb | Ruby | bsd-3-clause | 96 | master | 3,763 | require "test_helper"
describe "Diaspora" do
it "user#confirm_email" do
load_typedefs :stdlib, :active_record
RDL.type String, :blank?, '() -> %bool', wrap: false
RDL.type String, :!=, '(String) -> %bool', wrap: false
define :confirm_email, "(DiasporaUser, String) -> %bool", [DiasporaUser], enable_... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | test/benchmark/synthetic/lvar_benchmark.rb | Ruby | bsd-3-clause | 96 | master | 385 | require "test_helper"
describe "Synthetic" do
it "lvar" do
load_typedefs :stdlib, :active_record
define :identity, "(String) -> String", [User, UserEmail] do
spec "returns same value" do
setup {
identity 'hello'
}
post { |result|
assert { result == 'hello'... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | test/benchmark/synthetic/odd_even_benchmark.rb | Ruby | bsd-3-clause | 96 | master | 827 | require "test_helper"
describe "Synthetic" do
it "checks numbers are odd/even" do
RDL.nowrap :Integer
RDL.nowrap :BasicObject
RDL.type :Integer, :%, "(Integer) -> Integer"
RDL.type :Integer, :!=, "(Integer) -> %bool"
RDL.type :Integer, :==, "(Integer) -> %bool"
RDL.type :BasicObject, :!, '() ... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | test/benchmark/synthetic/branch_benchmark.rb | Ruby | bsd-3-clause | 96 | master | 1,337 | require "test_helper"
describe "Synthetic" do
it "branching" do
load_typedefs :stdlib, :active_record
class SiteSettings
class << self
reserved_usernames = []
attr_accessor :reserved_usernames
end
def self.reserved_username?(username)
SiteSettings.reserved_username... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | test/benchmark/synthetic/merge_benchmark.rb | Ruby | bsd-3-clause | 96 | master | 1,063 | require "test_helper"
describe "Synthetic" do
it "fold branches" do
load_typedefs :stdlib, :active_record
define :username_exists?, "(String, String) -> %bool", [User, UserEmail] do
spec "returns true when user doesn't exist" do
setup {
username_exists? 'bruce1', nil
}
... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | test/benchmark/synthetic/method_chain_benchmark.rb | Ruby | bsd-3-clause | 96 | master | 659 | require "test_helper"
describe "Synthetic" do
it "method chains" do
load_typedefs :stdlib, :active_record
define :username_available?, "(String) -> %bool", [User, UserEmail] do
spec "returns true when user doesn't exist" do
setup {
username_available? 'bruce1'
}
pos... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | test/benchmark/synthetic/overview_example_benchmark.rb | Ruby | bsd-3-clause | 96 | master | 2,456 | # synthetic: true
require "test_helper"
describe "Synthetic" do
it "overview example" do
load_typedefs :stdlib, :active_record
define :update_post, "(String, String, {created_by: ?String, title: ?String, slug: ?String}) -> Post", [Post, DemoUser], prog_size: 30, max_hash_size: 2 do
class Shared
... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | test/benchmark/synthetic/user_exists_benchmark.rb | Ruby | bsd-3-clause | 96 | master | 648 | require "test_helper"
describe "Synthetic" do
it "user exists" do
load_typedefs :stdlib, :active_record
define :username_exists?, "(String) -> %bool", [User, UserEmail] do
spec "returns false when user doesn't exist" do
setup {
username_exists? 'bruce1'
}
post { |re... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | test/benchmark/synthetic/false_benchmark.rb | Ruby | bsd-3-clause | 96 | master | 382 | require "test_helper"
describe "Synthetic" do
it "false" do
load_typedefs :stdlib, :active_record
define :just_false, "(String) -> %bool", [User, UserEmail] do
spec "returns false" do
setup {
just_false 'hello'
}
post { |result|
assert { result == false }
... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | test/benchmark/gitlab/user_disable_2fa_benchmark.rb | Ruby | bsd-3-clause | 96 | master | 1,386 | # https://github.com/gitlabhq/gitlabhq/blob/13150a38e701080f6c64d4925c838214a3f5ef2c/spec/models/issue_spec.rb#L511-L529
require "test_helper"
describe 'Gitlab' do
it 'user#disable_two_factor!' do
load_typedefs :stdlib, :active_record
define :disable_two_factor!, '(GitlabUser) -> %bot', [GitlabUser], enabl... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | test/benchmark/gitlab/issue_close_benchmark.rb | Ruby | bsd-3-clause | 96 | master | 894 | # https://github.com/gitlabhq/gitlabhq/blob/13150a38e701080f6c64d4925c838214a3f5ef2c/spec/models/issue_spec.rb#L145-L158
require "test_helper"
describe "Gitlab" do
it 'issue#close' do
load_typedefs :stdlib, :active_record
RDL.type Time, 'self.now', '() -> Time'
RDL.type GitlabIssue, 'self.available_sta... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | test/benchmark/gitlab/discussion_build_benchmark.rb | Ruby | bsd-3-clause | 96 | master | 1,282 | # https://github.com/gitlabhq/gitlabhq/blob/13150a38e701080f6c64d4925c838214a3f5ef2c/spec/models/issue_spec.rb#L160-L175
require "test_helper"
describe "Gitlab" do
it 'discussion#build' do
load_typedefs :stdlib, :active_record
RDL.type Array, :first, '() -> t', wrap: false
RDL.type GitlabDiscussion, 'se... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | test/benchmark/gitlab/todo_update_state_benchmark.rb | Ruby | bsd-3-clause | 96 | master | 1,480 | # https://github.com/gitlabhq/gitlabhq/blob/13150a38e701080f6c64d4925c838214a3f5ef2c/spec/models/todo_spec.rb#L376-L392
require "test_helper"
describe 'Gitlab' do
it 'todo#update_state' do
skip
load_typedefs :stdlib, :ar_update
RDL.type Symbol, :to_s, '() -> String', wrap: false
RDL.type ActiveReco... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | test/benchmark/gitlab/issue_reopen_benchmark.rb | Ruby | bsd-3-clause | 96 | master | 1,139 | # https://github.com/gitlabhq/gitlabhq/blob/13150a38e701080f6c64d4925c838214a3f5ef2c/spec/models/issue_spec.rb#L160-L175
require "test_helper"
describe "Gitlab" do
it 'issue#reopen' do
load_typedefs :stdlib, :active_record
RDL.type Time, 'self.now', '() -> Time'
RDL.type GitlabIssue, 'self.available_st... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | test/benchmark/discourse/set_random_avatar_benchmark.rb | Ruby | bsd-3-clause | 96 | master | 723 | # benchmark: true
# source: https://github.com/discourse/discourse/blob/bd49d4af1a19feb303f0658ae51bfeba81687519/app/models/user.rb#L1139
require "test_helper"
describe "Discourse" do
it "set_random_avatar" do
skip
define :set_random_avatar, "TODO", [] do
assert_equal generate_program, %{
def set_ran... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | test/benchmark/discourse/unstage_user_benchmark.rb | Ruby | bsd-3-clause | 96 | master | 1,289 | require "test_helper"
describe "Discourse" do
it "unstage user" do
load_typedefs :stdlib, :active_record
define :unstage, "({ email: ?String, active: ?%bool, username: ?String, name: ?String}) -> AnotherUser", [AnotherUser], prog_size: 30, enable_nil: true do
spec "correctly unstages a user" do
... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | test/benchmark/discourse/update_last_seen_benchmark.rb | Ruby | bsd-3-clause | 96 | master | 846 | # benchmark: true
# source: https://github.com/discourse/discourse/blob/bd49d4af1a19feb303f0658ae51bfeba81687519/app/models/user.rb#L728
require "test_helper"
describe "Discourse" do
it "update_last_seen!" do
skip
define :update_last_seen!, "TODO", [] do
assert_equal generate_program, %{
def update_l... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | test/benchmark/discourse/check_site_contact_username_benchmark.rb | Ruby | bsd-3-clause | 96 | master | 3,978 | # benchmark: true
# source: https://github.com/discourse/discourse/blob/bd49d4af1a19feb303f0658ae51bfeba81687519/app/models/user.rb#L1532
require "test_helper"
describe "Discourse" do
it "check_site_contact_username" do
load_typedefs :stdlib, :active_record
class DiscourseSiteSetting
def self.set_and_... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | test/benchmark/discourse/activate_benchmark.rb | Ruby | bsd-3-clause | 96 | master | 2,252 | # benchmark: true
# source: https://github.com/discourse/discourse/blob/bd49d4af1a19feb303f0658ae51bfeba81687519/app/models/user.rb#L941
# This benchmark has two merged tests (T1 and T2)
require "test_helper"
describe "Discourse" do
it "activate" do
load_typedefs :stdlib, :active_record, :ar_update
define ... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | test/benchmark/discourse/clear_global_notice_if_needed_benchmark.rb | Ruby | bsd-3-clause | 96 | master | 2,658 | # benchmark: true
# source: https://github.com/discourse/discourse/blob/bd49d4af1a19feb303f0658ae51bfeba81687519/app/models/user.rb#L1304
# test ordering matters in this to get a successful synthesis
require "test_helper"
describe "Discourse" do
it "clear_global_notice_if_needed" do
load_typedefs :stdlib, :activ... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | test/fabricators/gitlab.rb | Ruby | bsd-3-clause | 96 | master | 733 | Fabricator(:issue, class_name: GitlabIssue) do
state { :opened }
closed_at { nil }
closed_by { nil }
end
Fabricator(:gitlab_user, class_name: GitlabUser) do
otp_required_for_login { false }
end
Fabricator(:two_factor_user, from: :gitlab_user) do
otp_required_for_login { true }
# rand(36**l).to_s(36) yield... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | test/fabricators/another_user_fabricator.rb | Ruby | bsd-3-clause | 96 | master | 477 | Fabricator(:another_user, class_name: AnotherUser) do
name { sequence(:name) { |i| "User #{i}" } }
username { sequence(:username) { |i| "user_#{i}" } }
password { sequence(:password) { |i| "password#{i}" } }
email { sequence(:email) { |i| "email#{i}@example.com" } }
staged { false }
active { true }
end
Fab... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | test/fabricators/overview_fabricator.rb | Ruby | bsd-3-clause | 96 | master | 317 | Fabricator(:demo_user, class_name: DemoUser) do
name { sequence(:name) { |i| "Demo User #{i}" } }
username { sequence(:username) { |i| "user_#{i}" } }
admin { false }
end
Fabricator(:post, class_name: Post) do
slug { sequence(:slug) { |i| "post-#{i}" } }
title { sequence(:title) { |i| "Post #{i}" } }
end |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | test/fabricators/diaspora.rb | Ruby | bsd-3-clause | 96 | master | 725 | Fabricator(:invitation_code, class_name: InvitationCode) do
count { 3 }
end
Fabricator(:diaspora_user, class_name: DiasporaUser) do
username { sequence(:user) { |i| "user_#{i}" } }
end
Fabricator(:diaspora_user_with_token, from: :diaspora_user) do
username { sequence(:user) { |i| "user_#{i}" } }
unconfirmed_e... |
github | ku-progsys/rbsyn | https://github.com/ku-progsys/rbsyn | test/fabricators/user_fabricator.rb | Ruby | bsd-3-clause | 96 | master | 1,017 | Fabricator(:user, class_name: User) do
name { sequence(:name) { |i| "User #{i}" } }
username { sequence(:username) { |i| "user_#{i}" } }
password { sequence(:password) { |i| "password#{i}" } }
emails(count: 1) { |attrs, i| Fabricate(:email) }
# staged { false }
end
Fabricator(:email, class_name: UserEmail) d... |
github | lfender6445/theme_bandit | https://github.com/lfender6445/theme_bandit | Gemfile | Ruby | mit | 96 | master | 246 | # ruby '1.9.3'
source 'https://rubygems.org'
# Specify your gem's dependencies in theme_bandit.gemspec
gemspec
r_version = RUBY_VERSION.to_f
group :development do
if r_version > 2
gem 'pry-byebug'
else
gem 'pry-debugger'
end
end |
github | lfender6445/theme_bandit | https://github.com/lfender6445/theme_bandit | theme_bandit.gemspec | Ruby | mit | 96 | master | 1,179 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'theme_bandit/util/version'
Gem::Specification.new do |spec|
spec.name = 'theme_bandit'
spec.version = ThemeBandit::VERSION
spec.email = ['lfender6445@gmail.com']
sp... |
github | lfender6445/theme_bandit | https://github.com/lfender6445/theme_bandit | Rakefile | Ruby | mit | 96 | master | 272 | require 'bundler/gem_tasks'
begin
require 'bundler'
Bundler::GemHelper.install_tasks
rescue => e
end
require 'rake/testtask'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib' << 'test'
t.pattern = 'test/**/test_*.rb'
t.verbose = true
end
task default: 'test' |
github | lfender6445/theme_bandit | https://github.com/lfender6445/theme_bandit | test/helper.rb | Ruby | mit | 96 | master | 365 | ENV['RACK_ENV'] = 'test'
require 'pry'
require 'rubygems'
require 'minitest/autorun'
require 'webmock/minitest'
require_relative '../lib/theme_bandit'
require_relative 'support/common'
MiniTest.autorun
# supress log output when running tests
module ThemeBandit
class Log
class << self
def colorize(_tex... |
github | lfender6445/theme_bandit | https://github.com/lfender6445/theme_bandit | test/sanity_check.rb | Ruby | mit | 96 | master | 726 | # Bulk check of random urls
require_relative '../lib/theme_bandit'
require 'rubygems'
urls = [
'https://wp-themes.com/crawford/',
'http://yootheme.com/demo/themes/joomla/2014/peak/index.php?style=default',
'http://ign.com',
'http://gamespot.com',
'http://news.ycombinator.com',
'http://reddit.com'
]
def g... |
github | lfender6445/theme_bandit | https://github.com/lfender6445/theme_bandit | test/test_downloader.rb | Ruby | mit | 96 | master | 1,224 | require_relative 'helper'
describe ThemeBandit::Downloader do
before do
@url = 'https://www.example.com/'
stub_request(:get, @url).to_return(body: load_html_fixture)
end
describe '.get_theme' do
before do
@subject = ThemeBandit::Downloader
end
it 'requires url configuration' do
... |
github | lfender6445/theme_bandit | https://github.com/lfender6445/theme_bandit | test/test_url_formatter.rb | Ruby | mit | 96 | master | 1,367 | require_relative 'helper'
describe ThemeBandit::URLFormatter do
include ThemeBandit::URLFormatter
it '#strip_query_string' do
url = 'http://www.example.com?foo=bar'
assert_equal(strip_query_string(url), 'http://www.example.com')
end
describe '#get_absolute_path' do
it 'it plays nicely with dot d... |
github | lfender6445/theme_bandit | https://github.com/lfender6445/theme_bandit | test/test_rack_generator.rb | Ruby | mit | 96 | master | 1,190 | require 'helper'
describe ThemeBandit::RackGenerator do
supported_engines = %w(slim haml erb)
supported_engines.each do |engine|
describe "#builds #{engine} recipe" do
before do
@engine = engine
configure_and_write_files
ThemeBandit::RackGenerator.build
end
after d... |
github | lfender6445/theme_bandit | https://github.com/lfender6445/theme_bandit | test/test_configure.rb | Ruby | mit | 96 | master | 264 | require_relative 'helper'
class TestConfigure < MiniTest::Test
def setup
@subject = ThemeBandit
end
def test_configuration
@subject.configure do |config|
config.foo = 'bar'
end
assert_equal @subject.configuration.foo, 'bar'
end
end |
github | lfender6445/theme_bandit | https://github.com/lfender6445/theme_bandit | test/test_document_writer.rb | Ruby | mit | 96 | master | 2,557 | require 'helper'
describe ThemeBandit::DocumentWriter do
before do
prep_config
stub_request_stack
@subject = ThemeBandit::DocumentWriter.new(load_html_fixture, test_url)
end
after do
`rm -rf theme`
end
describe 'attributes' do
it 'document' do
assert_kind_of(Nokogiri::HTML::Docum... |
github | lfender6445/theme_bandit | https://github.com/lfender6445/theme_bandit | test/support/common.rb | Ruby | mit | 96 | master | 1,419 | def load_html_fixture
@fixture ||= File.read(File.open("#{Dir.pwd}/test/fixtures/index.html", 'r'))
end
def load_css_fixture
File.read(File.open("#{Dir.pwd}/test/fixtures/css/style.css", 'r'))
end
def load_import_fixture
File.read(File.open("#{Dir.pwd}/test/fixtures/css/import.css", 'r'))
end
def load_style_wi... |
github | lfender6445/theme_bandit | https://github.com/lfender6445/theme_bandit | lib/theme_bandit/rack_generator.rb | Ruby | mit | 96 | master | 1,683 | require 'html2slim/command'
require 'html2haml'
module ThemeBandit
class RackGenerator
def self.build
new
end
THEME_DIR = "#{Dir.pwd}/theme/"
TEMPLATE_ERROR = 'Templating engine not supported'
def initialize
copy_template_to_dir(THEME_DIR)
generate_view
end
def get_r... |
github | lfender6445/theme_bandit | https://github.com/lfender6445/theme_bandit | lib/theme_bandit/document_writer.rb | Ruby | mit | 96 | master | 3,125 | module ThemeBandit
class DocumentWriter
include ThemeBandit::CSSParser
include ThemeBandit::JSParser
include ThemeBandit::HTMLParser
# TODO: image parser
# TODO: font parser
attr_accessor :document
attr_reader :url
CSS_FOLDER = './theme/public/css/'
JS_FOLDER = './theme/pu... |
github | lfender6445/theme_bandit | https://github.com/lfender6445/theme_bandit | lib/theme_bandit/url_formatter.rb | Ruby | mit | 96 | master | 969 | module ThemeBandit
module URLFormatter
def strip_query_string(str)
str.split('?').first
end
def default_to_http(url)
url[/(^http:\/\/|^https:\/\/)/] ? url : "http://#{url}"
end
module_function :default_to_http
def cdn_to_fqd(src)
src[/^\/\//] ? "http:#{src}" : src
end
... |
github | lfender6445/theme_bandit | https://github.com/lfender6445/theme_bandit | lib/theme_bandit/init.rb | Ruby | mit | 96 | master | 393 | require 'bundler'
require 'fileutils'
require 'uri'
require 'nokogiri'
require_relative 'util/log'
require_relative 'downloader'
require_relative 'url_formatter'
require_relative 'parser/css'
require_relative 'parser/js'
require_relative 'parser/html'
require_relative 'document_writer'
require_relative 'rack_gener... |
github | lfender6445/theme_bandit | https://github.com/lfender6445/theme_bandit | lib/theme_bandit/downloader.rb | Ruby | mit | 96 | master | 1,083 | require 'httparty'
module ThemeBandit
class Downloader
include HTTParty
def self.get_theme(url = ThemeBandit.configuration.url)
url ? fetch(url) : error
end
def self.fetch(url, options = {})
new(url, options).document
end
def self.error
Log.red 'Invalid configuration, ple... |
github | lfender6445/theme_bandit | https://github.com/lfender6445/theme_bandit | lib/theme_bandit/parser/js.rb | Ruby | mit | 96 | master | 724 | module ThemeBandit
module JSParser
include ThemeBandit::URLFormatter
def get_js_files
script_tag_values
end
def script_tags
document.css('script').select do |tag|
tag.attribute('src')
end
end
def script_tag_values
script_tags.map do |tag|
src = tag.at... |
github | lfender6445/theme_bandit | https://github.com/lfender6445/theme_bandit | lib/theme_bandit/parser/html.rb | Ruby | mit | 96 | master | 1,776 | module ThemeBandit
module HTMLParser
def revise_head_tags
remove_base_tags
remove_link_tags
remove_script_tags
inject_link_nodes
inject_script_nodes
end
def remove_base_tags
document.search('base').remove
end
def remove_link_tags
document.search('link').... |
github | lfender6445/theme_bandit | https://github.com/lfender6445/theme_bandit | lib/theme_bandit/parser/css.rb | Ruby | mit | 96 | master | 1,876 | module ThemeBandit
module CSSParser
include ThemeBandit::URLFormatter
RE_IMPORT = /\@import\s*(?:url\s*)?(?:\()?(?:\s*)["']?([^'"\s\)]*)["']?\)?([\w\s\,^\]\(\))]*)\)?[;\n]?/
def get_css_files
link_tag_values
end
def link_tags
document.css('link').select do |tag|
tag.attribut... |
github | lfender6445/theme_bandit | https://github.com/lfender6445/theme_bandit | lib/theme_bandit/recipes/sinatra/haml/config.ru | Ruby | mit | 96 | master | 478 | require 'rubygems'
def env
(ENV['RACK_ENV'] || 'development').to_sym
end
gemfile = File.expand_path('../../Gemfile', __FILE__)
ROOT = Dir.pwd
begin
ENV['BUNDLE_GEMFILE'] = gemfile
require 'bundler'
Bundler.setup
rescue Bundler::GemNotFound => e
STDERR.puts e.message
STDERR.puts 'Try running `bundle inst... |
github | lfender6445/theme_bandit | https://github.com/lfender6445/theme_bandit | lib/theme_bandit/recipes/sinatra/haml/app/application.rb | Ruby | mit | 96 | master | 228 | require 'haml'
class Application < Sinatra::Application
set :views, proc { File.join(ROOT, 'app/views/') }
set :public_folder, proc { File.join(ROOT, 'public/') }
get '/' do
haml :'templates/index'
end
end |
github | lfender6445/theme_bandit | https://github.com/lfender6445/theme_bandit | lib/theme_bandit/recipes/sinatra/erb/app/application.rb | Ruby | mit | 96 | master | 226 | require 'erb'
class Application < Sinatra::Application
set :views, proc { File.join(ROOT, 'app/views/') }
set :public_folder, proc { File.join(ROOT, 'public/') }
get '/' do
erb :'templates/index'
end
end |
github | lfender6445/theme_bandit | https://github.com/lfender6445/theme_bandit | lib/theme_bandit/recipes/sinatra/slim/app/application.rb | Ruby | mit | 96 | master | 228 | require 'slim'
class Application < Sinatra::Application
set :views, proc { File.join(ROOT, 'app/views/') }
set :public_folder, proc { File.join(ROOT, 'public/') }
get '/' do
slim :'templates/index'
end
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.