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
pyromaniac/hotcell
https://github.com/pyromaniac/hotcell
lib/hotcell/lexer.rb
Ruby
mit
19
master
4,266
module Hotcell class Lexer OPERATIONS = { '+' => :PLUS, '-' => :MINUS, '*' => :MULTIPLY, '**' => :POWER, '/' => :DIVIDE, '%' => :MODULO, '&&' => :AND, '||' => :OR, '!' => :NOT, '==' => :EQUAL, '!=' => :INEQUAL, '>' => :GT, '>=' => :GTE, '<' => :LT, '<=' => :LTE, '=' => :ASSIGN, ',' => :C...
github
pyromaniac/hotcell
https://github.com/pyromaniac/hotcell
lib/hotcell/context.rb
Ruby
mit
19
master
1,694
require 'hotcell/scope' module Hotcell class Context attr_reader :options delegate :[], :[]=, :key?, :scoped, to: :scope DEFAULT_RESCUER = ->(e){ "#{e.class}: #{e.message}" } def initialize options = {} @options = normalize_options options end def normalize_options options opti...
github
pyromaniac/hotcell
https://github.com/pyromaniac/hotcell
lib/hotcell/template.rb
Ruby
mit
19
master
930
module Hotcell class Template attr_reader :source, :options def self.parse source new source, commands: Hotcell.commands, blocks: Hotcell.blocks, escape_tags: Hotcell.escape_tags end def initialize source, options = {} @source = Source.wrap(source, options.delete(...
github
pyromaniac/hotcell
https://github.com/pyromaniac/hotcell
lib/hotcell/node.rb
Ruby
mit
19
master
1,404
module Hotcell class Node attr_accessor :name, :children, :options attr_reader :position, :source def self.build *args new(*args).optimize end def initialize name, *args @name = name @options = args.extract_options! @source = @options.delete(:source) @position = @op...
github
pyromaniac/hotcell
https://github.com/pyromaniac/hotcell
lib/hotcell/extensions.rb
Ruby
mit
19
master
935
NilClass.class_eval do include Hotcell::Tong::Mixin end TrueClass.class_eval do include Hotcell::Tong::Mixin end FalseClass.class_eval do include Hotcell::Tong::Mixin end Numeric.class_eval do include Hotcell::Tong::Mixin end String.class_eval do include Hotcell::Tong::Mixin manipulate :size, :length e...
github
pyromaniac/hotcell
https://github.com/pyromaniac/hotcell
lib/hotcell/parser.rb
Ruby
mit
19
master
46,694
# # DO NOT MODIFY!!!! # This file is automatically generated by Racc 1.4.9 # from Racc grammer file "". # require 'racc/parser.rb' module Hotcell class Parser < Racc::Parser module_eval(<<'...end parser.y/module_eval...', 'parser.y', 224) OPERATIONS = { '+' => :PLUS, '-' => :MINUS, '*' => :MULTIPLY, '**' => :...
github
pyromaniac/hotcell
https://github.com/pyromaniac/hotcell
lib/hotcell/scope.rb
Ruby
mit
19
master
778
module Hotcell class Scope def initialize scope = {} @scope = [scope] end def [] key cache[key] end def []= key, value clear_cache hash = scope.reverse_each.detect { |hash| hash.key? key } hash ||= scope.last hash[key] = value end def key? key c...
github
pyromaniac/hotcell
https://github.com/pyromaniac/hotcell
lib/hotcell/config.rb
Ruby
mit
19
master
1,729
require 'singleton' module Hotcell class Config include Singleton attr_reader :commands, :blocks, :helpers attr_accessor :resolver, :escape_tags def initialize @commands = {} @blocks = {} @helpers = [] @resolver = Hotcell::Resolver.new @escape_tags = false end ...
github
pyromaniac/hotcell
https://github.com/pyromaniac/hotcell
lib/hotcell/commands.rb
Ruby
mit
19
master
273
module Hotcell module Commands end end require 'hotcell/commands/if' require 'hotcell/commands/unless' require 'hotcell/commands/for' require 'hotcell/commands/scope' require 'hotcell/commands/cycle' require 'hotcell/commands/case' require 'hotcell/commands/include'
github
pyromaniac/hotcell
https://github.com/pyromaniac/hotcell
lib/hotcell/commands/if.rb
Ruby
mit
19
master
1,510
module Hotcell module Commands class If < Hotcell::Block class Else < Hotcell::Command validate_arguments_count 0 end class Elsif < Hotcell::Command validate_arguments_count 1 end subcommand else: Else, elsif: Elsif validate_arguments_count 1 def subcom...
github
pyromaniac/hotcell
https://github.com/pyromaniac/hotcell
lib/hotcell/commands/cycle.rb
Ruby
mit
19
master
1,006
module Hotcell module Commands class Cycle < Hotcell::Command def process context, *arguments targets, group = normalize_arguments arguments context.shared[:cycle] ||= {} index = context.shared[:cycle][group] || 0 result = targets[index] index += 1 index = 0...
github
pyromaniac/hotcell
https://github.com/pyromaniac/hotcell
lib/hotcell/commands/for.rb
Ruby
mit
19
master
1,741
module Hotcell module Commands class For < Hotcell::Block validate_arguments_count 2 def validate! super raise Hotcell::SyntaxError.new( "Expected IDENTIFER as first argument in `#{name}` command", *position_info ) unless children[0].is_a?(Hotcell::Summoner) ...
github
pyromaniac/hotcell
https://github.com/pyromaniac/hotcell
lib/hotcell/commands/include.rb
Ruby
mit
19
master
519
module Hotcell module Commands class Include < Hotcell::Command def process context, *arguments locals = arguments.extract_options! path = arguments.first context.scoped locals do template(path, context).render(context) end end def template path, conte...
github
pyromaniac/hotcell
https://github.com/pyromaniac/hotcell
lib/hotcell/commands/unless.rb
Ruby
mit
19
master
591
module Hotcell module Commands class Unless < Hotcell::Block subcommand else: Hotcell::Commands::If::Else validate_arguments_count 1 def validate! raise Hotcell::BlockError.new( "Unexpected `#{subcommands[1].name}` for `#{name}` command", *subcommands[1].position_inf...
github
pyromaniac/hotcell
https://github.com/pyromaniac/hotcell
lib/hotcell/commands/scope.rb
Ruby
mit
19
master
281
module Hotcell module Commands class Scope < Hotcell::Block def process context, scope = {} context.scoped scope do subnodes.first.try(:render, context) end end end end end Hotcell.register_command scope: Hotcell::Commands::Scope
github
pyromaniac/hotcell
https://github.com/pyromaniac/hotcell
lib/hotcell/commands/case.rb
Ruby
mit
19
master
1,873
module Hotcell module Commands class Case < Hotcell::Block class When < Hotcell::Command validate_arguments_count min: 1 end subcommand else: Hotcell::Commands::If::Else, when: When validate_arguments_count 1 def subcommand_error subcommand, *allowed_names raise Hot...
github
pyromaniac/hotcell
https://github.com/pyromaniac/hotcell
lib/hotcell/node/block.rb
Ruby
mit
19
master
908
module Hotcell class Block < Hotcell::Command class_attribute :subcommands, instance_writter: false, instance_reader: false self.subcommands = {} def self.subcommand name_or_hash, &block if name_or_hash.is_a? Hash self.subcommands = subcommands.merge(name_or_hash.stringify_keys) else ...
github
pyromaniac/hotcell
https://github.com/pyromaniac/hotcell
lib/hotcell/node/tag.rb
Ruby
mit
19
master
540
module Hotcell class Tag < Hotcell::Node attr_reader :mode def initialize *_ super @mode = options[:mode] || :normal end def process context, *values values.last end def render context context.safe do concat context, process(context, *render_children(context)...
github
pyromaniac/hotcell
https://github.com/pyromaniac/hotcell
lib/hotcell/node/expression.rb
Ruby
mit
19
master
1,539
module Hotcell class Expression < Hotcell::Node HANDLERS = { PLUS: ->(value1, value2) { value1 + value2 }, MINUS: ->(value1, value2) { value1 - value2 }, UMINUS: ->(value) { -value }, UPLUS: ->(value) { value }, MULTIPLY: ->(value1, value2) { value1 * value2 }, POWER: ->(value1...
github
pyromaniac/hotcell
https://github.com/pyromaniac/hotcell
lib/hotcell/node/command.rb
Ruby
mit
19
master
1,201
module Hotcell class Command < Hotcell::Node class_attribute :_validations self._validations = {} def self.validate_arguments_count options arguments_count = case options when Hash Range.new(options[:min].to_i, options[:max].present? ? options[:max].to_i : Float::INFINITY) ...
github
reedlaw/rails-clean-architecture
https://github.com/reedlaw/rails-clean-architecture
rails-clean-architecture.rb
Ruby
mit
19
master
2,118
gem 'hashie' gem 'pg' gem 'tilt' gem 'tilt-handlebars' gem 'unicorn' gem_group :development, :test do gem 'byebug' gem 'rspec-rails' end gsub_file 'Gemfile', /^gem\s+["']sqlite3["'].*\n/, '' gsub_file 'Gemfile', /^gem\s+["']jbuilder["'].*\n/, '' gsub_file 'Gemfile', /^gem\s+["']sdoc["'].*\n/, '' gsub_file 'Gemfil...
github
reedlaw/rails-clean-architecture
https://github.com/reedlaw/rails-clean-architecture
rails_root/spec/support/interactor_shared_examples.rb
Ruby
mit
19
master
233
require 'spec_helper' shared_examples 'an interactor' do context "#initialize" do it "takes request data" do interactor = described_class.new(data: 1) expect(interactor.request).to eql(data: 1) end end end
github
reedlaw/rails-clean-architecture
https://github.com/reedlaw/rails-clean-architecture
rails_root/spec/support/entity_shared_examples.rb
Ruby
mit
19
master
336
shared_examples 'an entity' do context "#initialize" do it "can have id assigned" do entity = described_class.new(id: 1) expect(entity.id).to eql(1) end it "can't have non-accessible attributes assigned" do expect { described_class.new(non_attrib: true) }.to raise_error(NoMethodError) ...
github
reedlaw/rails-clean-architecture
https://github.com/reedlaw/rails-clean-architecture
rails_root/lib/interactors/interactor.rb
Ruby
mit
19
master
240
require 'response' class Interactor attr_reader :request, :response def initialize(request = {}) @request = request @response = Response.new @response.interactor = self.class.to_s end def call @response end end
github
reedlaw/rails-clean-architecture
https://github.com/reedlaw/rails-clean-architecture
rails_root/lib/generators/interactor/interactor_generator.rb
Ruby
mit
19
master
735
class InteractorGenerator < Rails::Generators::NamedBase desc "This generator creates an interactor file in lib/interactors" source_root File.expand_path('../templates', __FILE__) def create_interactor_file create_file "lib/interactors/#{file_name}.rb", <<-FILE class #{class_name} < Interactor def call ...
github
reedlaw/rails-clean-architecture
https://github.com/reedlaw/rails-clean-architecture
rails_root/lib/generators/entity/entity_generator.rb
Ruby
mit
19
master
531
class EntityGenerator < Rails::Generators::NamedBase desc "This generator creates an entity file in lib/entities" source_root File.expand_path('../templates', __FILE__) def create_entity_file create_file "lib/entities/#{file_name}.rb", <<-FILE class #{class_name} < Entity end FILE create_file "spec/...
github
reedlaw/rails-clean-architecture
https://github.com/reedlaw/rails-clean-architecture
rails_root/lib/templates/rails/controller/controller.rb
Ruby
mit
19
master
452
require 'tilt/handlebars' <% if namespaced? -%> require_dependency "<%= namespaced_path %>/application_controller" <% end -%> <% module_namespacing do -%> class <%= class_name %>Controller < ApplicationController <% actions.each do |action| -%> def <%= action %> template = Tilt.new('app/views/<%= file_name %>/<...
github
reedlaw/rails-clean-architecture
https://github.com/reedlaw/rails-clean-architecture
rails_root/lib/entities/entity.rb
Ruby
mit
19
master
200
require 'active_model' class Entity include ActiveModel::Validations attr_accessor :id def initialize(attr = {}) attr.each do |name, value| send("#{name}=", value) end end end
github
algorithmiaio/algorithmia-ruby
https://github.com/algorithmiaio/algorithmia-ruby
algorithmia.gemspec
Ruby
mit
19
master
1,171
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'algorithmia/version' Gem::Specification.new do |spec| spec.name = "algorithmia" spec.version = Algorithmia::VERSION spec.authors = ["Algorithmia"] spec.email ...
github
algorithmiaio/algorithmia-ruby
https://github.com/algorithmiaio/algorithmia-ruby
spec/algorithmia_spec.rb
Ruby
mit
19
master
315
require 'spec_helper' describe Algorithmia do it 'has a version number' do expect(Algorithmia::VERSION).not_to be nil end end describe Algorithmia::Client do it 'sets the base url set to Algorithmia API endpoint' do expect(Algorithmia::Requester.base_uri).to end_with("algorithmia.com") end end
github
algorithmiaio/algorithmia-ruby
https://github.com/algorithmiaio/algorithmia-ruby
spec/data_file_spec.rb
Ruby
mit
19
master
1,297
require 'spec_helper' require 'digest' describe Algorithmia::DataFile do def empty_dir dir = test_client.dir("data://.my/rubytest") dir.delete(true) if dir.exists? expect(dir.exists?).to be false dir.create expect(dir.exists?).to be true dir end it 'can resolve parent uri' do dir = ...
github
algorithmiaio/algorithmia-ruby
https://github.com/algorithmiaio/algorithmia-ruby
spec/algorithm_spec.rb
Ruby
mit
19
master
5,206
require 'spec_helper' require 'digest' require 'json' describe Algorithmia::Algorithm do it 'can make json api call' do input = ["transformer", "terraforms", "retransform"] response = test_client.algo("WebPredict/ListAnagrams/0.1.0").pipe(input) expect(response.content_type).to eq('json') expect(resp...
github
algorithmiaio/algorithmia-ruby
https://github.com/algorithmiaio/algorithmia-ruby
spec/data_dir_spec.rb
Ruby
mit
19
master
1,875
require 'spec_helper' require 'digest' describe Algorithmia::DataDirectory do def nonexistent_dir dir = test_client.dir("data://.my/rubytest") dir.delete(true) if dir.exists? expect(dir.exists?).to be false dir end it 'can resolve parent uri' do dir = Algorithmia.dir("data://.my/rubytest") ...
github
algorithmiaio/algorithmia-ruby
https://github.com/algorithmiaio/algorithmia-ruby
spec/spec_helper.rb
Ruby
mit
19
master
1,654
require 'bundler/setup' Bundler.setup require_relative '../lib/algorithmia.rb' def test_client expect(ENV['ALGORITHMIA_API_KEY']).to_not be_nil Algorithmia.client(ENV['ALGORITHMIA_API_KEY']) end def test_admin expect(ENV['ALGORITHMIA_ADMIN_API_KEY']).to_not be_nil Algorithmia.client(ENV['ALGORITHMIA_ADMIN_AP...
github
algorithmiaio/algorithmia-ruby
https://github.com/algorithmiaio/algorithmia-ruby
lib/algorithmia.rb
Ruby
mit
19
master
841
require_relative 'algorithmia/algorithm' require_relative 'algorithmia/client' require_relative 'algorithmia/unauthenticated_client' require_relative 'algorithmia/errors' require_relative 'algorithmia/requester' require_relative 'algorithmia/response' require_relative 'algorithmia/version' require_relative 'algorithmia...
github
algorithmiaio/algorithmia-ruby
https://github.com/algorithmiaio/algorithmia-ruby
lib/algorithmia/requester.rb
Ruby
mit
19
master
3,447
require 'httparty' module Algorithmia class Requester include HTTParty def initialize(client) self.class.base_uri client.api_address @client = client @default_headers = { 'User-Agent' => 'Algorithmia Ruby Client' } unless @client.api_key.nil? @default_headers['A...
github
algorithmiaio/algorithmia-ruby
https://github.com/algorithmiaio/algorithmia-ruby
lib/algorithmia/errors.rb
Ruby
mit
19
master
691
module Algorithmia module Errors class Error < StandardError attr_reader :response def initialize(message, response) super(message) @response = response end end class AlgorithmError < Error; attr_reader :stacktrace def initialize(message, response, stacktrac...
github
algorithmiaio/algorithmia-ruby
https://github.com/algorithmiaio/algorithmia-ruby
lib/algorithmia/data_object.rb
Ruby
mit
19
master
460
module Algorithmia class DataObject attr_reader :data_uri def initialize(client, data_uri) @client = client @data_uri = data_uri sanitize_data_uri end def basename File.basename(@url) end def parent @client.dir(File.split(@data_uri).first) end private ...
github
algorithmiaio/algorithmia-ruby
https://github.com/algorithmiaio/algorithmia-ruby
lib/algorithmia/data_file.rb
Ruby
mit
19
master
786
require 'tempfile' module Algorithmia class DataFile < DataObject def exists? Algorithmia::Requester.new(@client).head(@url) true rescue Errors::NotFoundError false end def get_file response = get tempfile = Tempfile.open(File.basename(@url)) do |f| f.write re...
github
algorithmiaio/algorithmia-ruby
https://github.com/algorithmiaio/algorithmia-ruby
lib/algorithmia/client.rb
Ruby
mit
19
master
2,740
module Algorithmia class Client attr_reader :api_key attr_reader :api_address def initialize(api_key, api_address=nil) @api_key = api_key @api_address = api_address || ENV['ALGORITHMIA_API'] || "https://api.algorithmia.com" end def algo(endpoint, path = '/v1/algo/') Algorithmia...
github
algorithmiaio/algorithmia-ruby
https://github.com/algorithmiaio/algorithmia-ruby
lib/algorithmia/algorithm.rb
Ruby
mit
19
master
5,088
module Algorithmia class Algorithm def initialize(client, endpoint) @client = client @endpoint = endpoint @query = {} end def set(options_hash) @query.update(options_hash) self end def pipe(input) client_timeout = (@query[:timeout] || 300) + 10 response...
github
algorithmiaio/algorithmia-ruby
https://github.com/algorithmiaio/algorithmia-ruby
lib/algorithmia/data_directory.rb
Ruby
mit
19
master
1,905
require 'uri' module Algorithmia class DataDirectory < DataObject def exists? Algorithmia::Requester.new(@client).get(@url) true rescue Errors::NotFoundError false end def create parent, name = File.split(@url) Algorithmia::Requester.new(@client).post(parent, name: nam...
github
algorithmiaio/algorithmia-ruby
https://github.com/algorithmiaio/algorithmia-ruby
lib/algorithmia/response.rb
Ruby
mit
19
master
1,001
require "base64" module Algorithmia class Response attr_reader :response def initialize(response, output_type) @response = response @output_type = output_type end def result if @output_type == 'raw' @response elsif content_type == 'binary' Base64.decode64(@re...
github
tibastral/web_motion
https://github.com/tibastral/web_motion
web_motion.gemspec
Ruby
mit
19
master
1,233
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'web_motion/version' Gem::Specification.new do |spec| spec.name = "web_motion" spec.version = WebMotion::VERSION spec.authors = ["Thibaut Assus", "Chloé Roger"] spec.e...
github
tibastral/web_motion
https://github.com/tibastral/web_motion
lib/web_motion.rb
Ruby
mit
19
master
396
unless defined?(Motion::Project::Config) raise "This file must be required within a RubyMotion project Rakefile." end Motion::Project::App.setup do |app| ["web_motion/*.rb", "web_motion/concerns/*.rb"].each do |path| Dir.glob(File.join(File.dirname(__FILE__), path)).each do |file| app.files.unshift(file)...
github
tibastral/web_motion
https://github.com/tibastral/web_motion
lib/web_motion/web_motion_controller.rb
Ruby
mit
19
master
571
class WebMotion::WebMotionController < UIViewController include WebMotion::UrlHelpers include WebMotion::WKConfigInitializer include WebMotion::ViewRefresher include WebMotion::WebMotionPreferences def initialize(config) @mainUrl = config[:url] end def loadView self.view = WKWebView.alloc.initWi...
github
tibastral/web_motion
https://github.com/tibastral/web_motion
lib/web_motion/concerns/web_motion_js_handler.rb
Ruby
mit
19
master
865
class WebMotion::WebMotionJsHandler def initialize(wm_controller) @wm_controller = wm_controller end # This method is used to get all the methods called by javascript in an array def self.message_handlers instance_methods(false).map(&:to_s).map{|e| e.gsub(':', '')} end # Methods called by Javascri...
github
tibastral/web_motion
https://github.com/tibastral/web_motion
lib/web_motion/concerns/wk_config_initializer.rb
Ruby
mit
19
master
846
module WebMotion::WKConfigInitializer def initWKConfig configuration = WKWebViewConfiguration.new configuration.userContentController = initWKController; configuration end # handler called directly by client side javascript def userContentController(_ , didReceiveScriptMessage: message) if WebM...
github
tibastral/web_motion
https://github.com/tibastral/web_motion
lib/web_motion/concerns/url_helpers.rb
Ruby
mit
19
master
278
# helpers methods module WebMotion::UrlHelpers private def mainUrl @mainUrl end def rootUrl "https://#{mainUrl}" end def fullUrl "#{rootUrl}/?hybrid=1&ios=1" end def request(url) NSURLRequest.requestWithURL(NSURL.URLWithString(url)) end end
github
tibastral/web_motion
https://github.com/tibastral/web_motion
lib/web_motion/concerns/view_refresher.rb
Ruby
mit
19
master
530
module WebMotion::ViewRefresher def refreshView view.reload end def refreshViewOnlyIfIndex if currentUrl.absoluteString.split('?').first.split('/').last == mainUrl refreshView end end # handlers def handleRefresh(refresh) refreshView refresh.endRefreshing end private def ...
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
spree-point-of-sale.gemspec
Ruby
bsd-3-clause
19
master
1,396
# -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = "spree-point-of-sale" s.version = "3.2.0.alpha" s.email = 'info@vinsol.com' s.homepage = 'http://vinsol.com' s.author = ["Torsten R, Nishant Tuteja, Manish Kangia"] s.summary = "Point of sale screen for...
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
Rakefile
Ruby
bsd-3-clause
19
master
485
require 'bundler' Bundler::GemHelper.install_tasks require 'rspec/core/rake_task' require 'spree/testing_support/extension_rake' RSpec::Core::RakeTask.new task default: [:spec] desc "Release to gemcutter" task release: :package do require 'rake/gemcutter' Rake::Gemcutter::Tasks.new(spec).define Rake::Task['ge...
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
Gemfile
Ruby
bsd-3-clause
19
master
359
source "https://rubygems.org" gem 'spree', github: 'spree/spree', branch: 'master' gem 'spree_html_invoice' , git: 'git@github.com:vinsol-spree-contrib/spree-html-invoice.git', branch: 'master' # Provides basic authentication functionality for testing parts of your engine gem 'spree_auth_devise', github: 'spree/spree_...
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
spec/constants_spec.rb
Ruby
bsd-3-clause
19
master
328
require 'spec_helper' describe "Constants" do it { expect(CARD_TYPE).to eq(['Visa', 'MasterCard', 'Verve', 'AmericanExpress', 'China UnionPay']) } it { expect(VALID_DISCOUNT_REGEX).to eq(/^\d*\.?\d+$/) } it { expect(RANDOM_PASS_REGEX).to eq([*('A'..'Z'),*(1..9)]) } it { expect(PRODUCTS_PER_SEARCH_PAGE).to eq(2...
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
spec/spec_helper.rb
Ruby
bsd-3-clause
19
master
2,119
# Run Coverage report require 'simplecov' SimpleCov.start do add_group 'Controllers', 'app/controllers' add_group 'Helpers', 'app/helpers' add_group 'Mailers', 'app/mailers' add_group 'Models', 'app/models' add_group 'Views', 'app/views' add_group 'Libraries', 'lib' end # Configure Rails Environment ENV['R...
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
spec/controllers/spree/admin/pos_controller_spec.rb
Ruby
bsd-3-clause
19
master
40,944
require 'spec_helper' describe Spree::Admin::PosController do let(:user) { mock_model(Spree::User) } let(:order) { mock_model(Spree::Order, number: 'R123456') } let(:line_item) { mock_model(Spree::LineItem) } let(:product) { mock_model(Spree::Product, name: 'test-product') } let(:variant) { mock_model(Spree:...
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
spec/controllers/spree/admin/barcode_controller_spec.rb
Ruby
bsd-3-clause
19
master
4,379
require 'spec_helper' describe Spree::Admin::BarcodeController do let(:product) { mock_model(Spree::Product, name: 'test-product') } let(:variant) { mock_model(Spree::Variant, name: 'test-variant', price: '12') } let(:user) { mock_model(Spree::User) } let(:role) { mock_model(Spree::Role) } let(:roles) { [rol...
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
spec/models/spree/payment_decorator_spec.rb
Ruby
bsd-3-clause
19
master
3,904
require 'spec_helper' describe Spree::Payment do let(:payment_method) { Spree::PaymentMethod.create!(name: 'test-method') } let(:card_payment_method) { Spree::PaymentMethod.create!(name: 'card-payment')} let(:order) { Spree::Order.create! } context 'validations' do describe 'payment_method' do contex...
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
spec/models/spree/variant_decorator_spec.rb
Ruby
bsd-3-clause
19
master
1,880
require 'spec_helper' describe Spree::Variant do let(:shipping_category) { Spree::ShippingCategory.create!(name: 'test-shipping') } let(:product) { Spree::Product.create!( name: 'new_product', price: 10, available_on: 'Fri, 19 Jul 2013 08:11:06 UTC +00:00', shipping_category_id: shipping_category.id ) } let(:opt...
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
spec/models/spree/shipment_decorator_spec.rb
Ruby
bsd-3-clause
19
master
5,769
require 'spec_helper' describe Spree::Shipment do let(:order) { Spree::Order.create! } let(:flat_rate_calculator) { Spree::Calculator::Shipping::FlatRate.create! } let(:country) { Spree::Country.create!(name: 'mk_country', iso_name: "mk") } let(:state) { country.states.create!(name: 'mk_state') } let(:store)...
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
spec/models/spree/line_item_decorator_spec.rb
Ruby
bsd-3-clause
19
master
273
require 'spec_helper' describe Spree::LineItem do describe 'validations' do it 'validates through Spree::Stock::PosAvailabilityValidator for pos orders' do subject.class.validators.map(&:class).include? Spree::Stock::PosAvailabilityValidator end end end
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
spec/models/spree/stock_location_decorator_spec.rb
Ruby
bsd-3-clause
19
master
2,545
require 'spec_helper' describe Spree::StockLocation do it { is_expected.to belong_to :address } let(:country) { Spree::Country.create!(name: 'mk_country', iso_name: "mk") } let(:state) { country.states.create!(name: 'mk_state') } let(:store) { Spree::StockLocation.create!(name: 'store', store: true, address1:...
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
spec/models/spree/order_decorator_spec.rb
Ruby
bsd-3-clause
19
master
8,199
require 'spec_helper' describe Spree::Order do let(:user) { mock_model(Spree::User, email: 'test-user@pos.com') } let(:flat_rate_calculator) { Spree::Calculator::Shipping::FlatRate.create! } let(:country) { Spree::Country.create!(name: 'mk_country', iso_name: "mk") } let(:state) { country.states.create!(name: ...
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
spec/models/spree/user_decorator_spec.rb
Ruby
bsd-3-clause
19
master
1,008
require 'spec_helper' describe Spree::User do let(:user) { Spree::User.create!(email: 'test-user@pos.com', password: 'testuser') } describe 'unpaid_pos_orders' do before do @paid_order = user.orders.create! @paid_order.update_column(:total,100) @paid_order.update_column(:payment_state,'paid')...
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
spec/models/spree/stock/coordinator_spec.rb
Ruby
bsd-3-clause
19
master
1,962
require 'spec_helper' describe Spree::Stock::Coordinator do let(:order) { Spree::Order.create! } let(:country) { Spree::Country.create!(name: 'mk_country', iso_name: "mk") } let(:state) { country.states.create!(name: 'mk_state') } describe 'build_packages' do before do @stock_location = Spree::Stock...
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
spec/models/spree/stock/pos_availability_validator_spec.rb
Ruby
bsd-3-clause
19
master
2,753
require 'spec_helper' describe Spree::Stock::PosAvailabilityValidator do let(:country) { Spree::Country.create!(name: 'mk_country', iso_name: "mk") } let(:state) { country.states.create!(name: 'mk_state') } let(:store) { Spree::StockLocation.create!(name: 'store', store: true, address1: "home", address2: "town",...
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
spec/models/spree/payment_method/point_of_sale_spec.rb
Ruby
bsd-3-clause
19
master
1,256
require 'spec_helper' describe Spree::PaymentMethod::PointOfSale do let(:pending_payment) { mock_model(Spree::Payment, state: 'pending') } let(:complete_payment) { mock_model(Spree::Payment, state: 'complete') } let(:void_payment) { mock_model(Spree::Payment, state: 'void') } before { @point_of_sale_payment = ...
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
db/migrate/20130723140316_add_delivered_at_and_canceled_at_to_spree_shipments.rb
Ruby
bsd-3-clause
19
master
214
class AddDeliveredAtAndCanceledAtToSpreeShipments < ActiveRecord::Migration def change add_column :spree_shipments, :delivered_at, :datetime add_column :spree_shipments, :canceled_at, :datetime end end
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
db/migrate/20130730102503_add_store_and_address_id_in_spree_stock_locations.rb
Ruby
bsd-3-clause
19
master
431
class AddStoreAndAddressIdInSpreeStockLocations < ActiveRecord::Migration def change add_column :spree_stock_locations, :store, :boolean, :default => false add_column :spree_stock_locations, :address_id, :integer add_index :spree_stock_locations, :store, :name => "index_spree_stock_locations_on_store" ...
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
config/application.rb
Ruby
bsd-3-clause
19
master
904
require File.expand_path('../boot', __FILE__) require 'rails/all' Bundler.require(*Rails.groups) require "spree-point-of-sale" module SpreePointOfSale class Application < Rails::Application # Settings in config/environments/* take precedence over those specified here. # Application configuration should go ...
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
config/routes.rb
Ruby
bsd-3-clause
19
master
1,493
Spree::Core::Engine.routes.draw do get "admin/barcode/print_variants_barcodes/:id", to: "admin/barcode#print_variants_barcodes", as: :admin_barcode_print_variants_barcodes get "admin/barcode/print/:id", to: "admin/barcode#print", as: :admin_barcode_print get "admin/barcode/code/:id", to: "admin/barcode#code", as:...
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
app/services/spree/barcode_generator_service.rb
Ruby
bsd-3-clause
19
master
1,369
module Spree class BarcodeGeneratorService require 'barby' require 'barby/barcode/code_128' require 'barby/barcode/ean_13' require 'barby/outputter/png_outputter' require 'prawn' require 'prawn/measurement_extensions' def append_barcode_to_pdf_for_variants_of_product(variants) varia...
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
app/overrides/pos_tab.rb
Ruby
bsd-3-clause
19
master
248
Deface::Override.new( virtual_path: "spree/layouts/admin", name: "Add Pos tab to menu", insert_bottom: "[data-hook='admin_tabs']", partial: 'spree/admin/shared/add_pos_button', sequence: { after: "promo_admin_tabs" }, disabled: false )
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
app/overrides/add_store_to_spree_stock_locations.rb
Ruby
bsd-3-clause
19
master
332
Deface::Override.new( virtual_path: 'spree/admin/stock_locations/_form', name: 'add_store_to_spree_stock_locations', insert_bottom: "[data-hook='admin_stock_locations_form_fields']", text: %q{ <div class='form-group'> <%= f.label :store, Spree.t(:store) + ':' %> <%= f.check_box :store %> </d...
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
app/overrides/add_is_pos_filter_to_admin_orders.rb
Ruby
bsd-3-clause
19
master
317
Deface::Override.new( virtual_path: 'spree/admin/orders/index', name: 'add_is_pos_filter_to_admin_orders', insert_after: ".checkbox:first-child", text: %q{ <div class='checkbox'> <label> <%= f.check_box :is_pos_eq, {}, '1', '' %> show only pos orders </label> </div> } )
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
app/overrides/admin_adds_pos_config.rb
Ruby
bsd-3-clause
19
master
203
Deface::Override.new( virtual_path: "spree/admin/general_settings/edit", name: "add_adds_pos_config", insert_after: "div.security", partial: "spree/admin/orders/admin_pos_config", disabled: false )
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
app/overrides/add_barcode_link_for_products_and_variants.rb
Ruby
bsd-3-clause
19
master
863
Deface::Override.new( virtual_path: 'spree/admin/products/index', name: 'add print barcodes link to products for admin', insert_bottom: "[data-hook='admin_products_index_row_actions']", original: 'b918c38c9d3d9213d08b992cfc2c52dd0952ccf7', text: %q{ <%= link_to admin_barcode_print_variants_barcodes_path(p...
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
app/overrides/codes.rb
Ruby
bsd-3-clause
19
master
480
Deface::Override.new( virtual_path: 'spree/admin/variants/_form', name: "Add product label button", insert_bottom: "[data-hook='admin_variant_form_fields']", partial: "spree/admin/products/barcode_variant_link", disabled: false ) Deface::Override.new( virtual_path: 'spree/admin/products/_form', name: "Add...
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
app/models/spree/order_decorator.rb
Ruby
bsd-3-clause
19
master
1,519
Spree::Order.class_eval do scope :pos, -> { where(is_pos: true) } scope :unpaid, -> { where.not(payment_state: :paid) } scope :unpaid_pos_order, -> { pos.unpaid } self.whitelisted_ransackable_associations << 'product' self.whitelisted_ransackable_attributes << 'is_pos' def clean! payments.delete_all ...
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
app/models/spree/user_decorator.rb
Ruby
bsd-3-clause
19
master
210
Spree::User.class_eval do def unpaid_pos_orders orders.unpaid_pos_order end def self.create_with_random_password(email) create(email: email, password: RANDOM_PASS_REGEX.sample(8).join) end end
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
app/models/spree/shipment_decorator.rb
Ruby
bsd-3-clause
19
master
988
Spree::Shipment.class_eval do before_save :udpate_order_addresses_from_stock_location, if: :stock_location_changed? validate :empty_inventory def finalize_pos self.state = 'shipped' inventory_units.each &:ship! self.save touch :delivered_at end def self.create_shipment_for_pos_order ship...
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
app/models/spree/payment_decorator.rb
Ruby
bsd-3-clause
19
master
600
Spree::Payment.class_eval do validates :payment_method, presence: true, if: -> { order.is_pos? } validates :card_name, presence: true, if: :check_for_card_name? validate :no_card_name private def no_card_name if payment_method.present? && !payment_method_with_card_present? && card_name.present? ...
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
app/models/spree/stock_location_decorator.rb
Ruby
bsd-3-clause
19
master
802
module Spree StockLocation.class_eval do belongs_to :address before_validation :associate_address scope :stores, -> { where(store: true) } scope :not_store, -> { where.not(store: true) } validates_associated :address def can_supply?(quantity, variant) quantity <= stock_items.find_by(...
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
app/models/spree/variant_decorator.rb
Ruby
bsd-3-clause
19
master
231
Spree::Variant.class_eval do scope :available_at_stock_location, ->(stock_location_id) { active.joins(:stock_items).where('spree_stock_items.count_on_hand > 0 AND spree_stock_items.stock_location_id = ?', stock_location_id)} end
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
app/models/spree/payment_method/point_of_sale.rb
Ruby
bsd-3-clause
19
master
879
module Spree class PaymentMethod::PointOfSale < PaymentMethod def actions %w{capture void} end # Indicates whether its possible to capture the payment def can_capture?(payment) ['checkout', 'pending'].include?(payment.state) end # Indicates whether its possible to void the payme...
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
app/models/spree/stock/coordinator_decorator.rb
Ruby
bsd-3-clause
19
master
344
Spree::Stock::Coordinator.class_eval do #overwrite the spree method to not use stores to build packages def build_packages(packages = Array.new) ::Spree::StockLocation.active.not_store.each do |stock_location| packer = build_packer(stock_location, inventory_units) packages += packer.packages end...
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
app/models/spree/stock/pos_availability_validator.rb
Ruby
bsd-3-clause
19
master
589
module Spree module Stock class PosAvailabilityValidator < ActiveModel::Validator def validate(line_item) stock_location = line_item.order.pos_shipment.try(:stock_location) quantity_required = line_item.quantity - line_item.quantity_was.to_i if !stock_location.try(:active_store?) ...
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
app/controllers/spree/admin/barcode_controller.rb
Ruby
bsd-3-clause
19
master
1,541
class Spree::Admin::BarcodeController < Spree::Admin::BaseController include Admin::BarcodeHelper before_action :load_variant, only: :print before_action :load_product_and_variants, only: :print_variants_barcodes layout :false rescue_from ActiveRecord::RecordNotFound, with: :resource_not_found def print_v...
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
app/controllers/spree/admin/pos_controller.rb
Ruby
bsd-3-clause
19
master
7,394
class Spree::Admin::PosController < Spree::Admin::BaseController before_action :load_order, :ensure_pos_order, :ensure_unpaid_order, except: :new helper_method :user_stock_locations before_action :load_variant, only: [:add, :remove] before_action :ensure_active_store before_action :ensure_pos_shipping_method ...
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
lib/spree_pos/engine.rb
Ruby
bsd-3-clause
19
master
948
module SpreePos class Engine < Rails::Engine engine_name 'spree_pos' config.autoload_paths += %W(#{config.root}/lib) initializer "spree.spree_pos.preferences", :after => "spree.environment" do |app| SpreePos::Config = SpreePos::Configuration.new ::CARD_TYPE = ['Visa', 'MasterCard', 'Verve',...
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
lib/spree_pos/configuration.rb
Ruby
bsd-3-clause
19
master
226
require "spree/core" module SpreePos class Configuration < Spree::Preferences::Configuration preference :pos_shipping, :string preference :pos_printing, :string , :default => "/admin/invoice/number/receipt" end end
github
vinsol-spree-contrib/spree-point-of-sale
https://github.com/vinsol-spree-contrib/spree-point-of-sale
lib/generators/spree_pos/install/install_generator.rb
Ruby
bsd-3-clause
19
master
833
module SpreePos module Generators class InstallGenerator < Rails::Generators::Base def add_javascripts append_file 'vendor/assets/javascripts/spree/backend/all.js', "//= require admin/spree_pos\n" end def add_stylesheets inject_into_file 'vendor/assets/stylesheets/spree/b...
github
mnarayan01/bootstrap-tab-history
https://github.com/mnarayan01/bootstrap-tab-history
bootstrap-tab-history-rails.gemspec
Ruby
apache-2.0
19
master
779
$:.push File.expand_path("../lib", __FILE__) # Maintain your gem's version: require 'bootstrap-tab-history-rails/version' # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = "bootstrap-tab-history-rails" s.version = BootstrapTabHistoryRails::VERSION s.authors ...
github
mnarayan01/bootstrap-tab-history
https://github.com/mnarayan01/bootstrap-tab-history
Gemfile
Ruby
apache-2.0
19
master
256
source 'https://rubygems.org' # Declare your gem's dependencies in bootstrap-tab-history.gemspec. # Bundler will treat runtime dependencies like base dependencies, and # development dependencies will be added by default to the :development group. gemspec
github
mnarayan01/bootstrap-tab-history
https://github.com/mnarayan01/bootstrap-tab-history
Rakefile
Ruby
apache-2.0
19
master
212
#!/usr/bin/env rake begin require 'bundler/setup' rescue LoadError puts 'You must `gem install bundler` and `bundle install` to run rake tasks' end Bundler::GemHelper.install_tasks task :default => :build
github
avmnu-sng/rspec-tap-formatters
https://github.com/avmnu-sng/rspec-tap-formatters
rspec-tap-formatters.gemspec
Ruby
mit
19
master
1,667
# frozen_string_literal: true $LOAD_PATH.unshift File.expand_path('lib', __dir__) require 'rspec/tap/formatters/version' require 'English' Gem::Specification.new do |spec| HOMEPAGE = 'https://www.github.com/avmnu-sng/rspec-tap-formatters' spec.name = 'rspec-tap-formatters' spec.version = RSpec::TAP::Formatter...
github
avmnu-sng/rspec-tap-formatters
https://github.com/avmnu-sng/rspec-tap-formatters
Gemfile
Ruby
mit
19
master
641
# frozen_string_literal: true source 'https://rubygems.org' gemspec group :code_analysis do gem 'rubocop', '~> 0.76.0' gem 'rubocop-performance', '~> 1.5.0' gem 'rubocop-rspec', '~> 1.36.0' end group :documentation do gem 'github-markup', '~> 3.0.4' gem 'redcarpet', '~> 3.5.0' gem 'yard', '~> 0.9' end ...
github
avmnu-sng/rspec-tap-formatters
https://github.com/avmnu-sng/rspec-tap-formatters
Rakefile
Ruby
mit
19
master
961
# frozen_string_literal: true require 'bundler/setup' require 'bundler/gem_tasks' require 'rspec/core/rake_task' desc 'Generate doc' task :doc do sh 'yardoc' end desc 'Verify doc coverage' task :verify_doc do sh <<-SCRIPT.gsub(/^\s+\|/, '').chomp |yard stats --list-undoc | ruby -e " | while (line = gets...
github
avmnu-sng/rspec-tap-formatters
https://github.com/avmnu-sng/rspec-tap-formatters
spec/spec_helper.rb
Ruby
mit
19
master
776
# frozen_string_literal: true require 'pry' require 'simplecov' require 'rspec/tap/formatters' Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each do |file| require file end RSpec.configure do |config| rspec_version = Gem::Version.new(RSpec::Core::Version::STRING) if rspec_version >= Gem::Version.new('3.3.0...
github
avmnu-sng/rspec-tap-formatters
https://github.com/avmnu-sng/rspec-tap-formatters
spec/rspec/tap/formatters/test_stats_spec.rb
Ruby
mit
19
master
2,411
# frozen_string_literal: true RSpec.describe RSpec::TAP::Formatters::TestStats do subject(:test_stats) { described_class.new } let(:index) { (1..3).to_a.sample } let(:example) { OpenStruct.new(metadata: metadata) } let(:notification) { OpenStruct.new(example: example) } before do test_stats.instance_va...