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
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/rspecs/sparkle_rspec.rb
Ruby
apache-2.0
221
main
4,637
require_relative "../rspecs" RSpec.describe SparkleFormation::Sparkle do before { SparkleFormation._cleanify! } let(:root_dir) { Dir.mktmpdir("sparkleformation-sparkle-rspec") } after { FileUtils.rm_rf(root_dir) } context "methods" do let(:instance) { described_class.new(:root => root_dir) } describ...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/rspecs/resources_rspec.rb
Ruby
apache-2.0
221
main
1,806
require "tempfile" require_relative "../rspecs" RSpec.describe SparkleFormation::Resources do before { SparkleFormation._cleanify! } before { described_class.registry.clear if described_class.registry } describe "#base_key" do it 'should return "resources" string' do expect(described_class.base_key).t...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/rspecs/sparkle_attribute/aws_rspec.rb
Ruby
apache-2.0
221
main
9,264
require_relative "../../rspecs" RSpec.describe SparkleFormation::SparkleAttribute::Aws do before { SparkleFormation._cleanify! } let(:instance) do klass = Class.new(SparkleFormation::SparkleStruct) klass.include(described_class) klass.new end describe "#_cf_join" do it "should create join fun...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/rspecs/sparkle_attribute/heat_rspec.rb
Ruby
apache-2.0
221
main
5,874
require_relative "../../rspecs" RSpec.describe SparkleFormation::SparkleAttribute::Heat do before { SparkleFormation._cleanify! } let(:instance) do klass = Class.new(SparkleFormation::SparkleStruct) klass.include described_class obj = klass.new obj._set_self(SparkleFormation.new("test")) obj._...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/rspecs/sparkle_attribute/azure_rspec.rb
Ruby
apache-2.0
221
main
4,021
require_relative "../../rspecs" RSpec.describe SparkleFormation::SparkleAttribute::Azure do before { SparkleFormation._cleanify! } let(:template) { SparkleFormation.new("test") } let(:instance) do klass = Class.new(SparkleFormation::SparkleStruct) klass.include described_class obj = klass.new o...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/rspecs/provider/aws_rspec.rb
Ruby
apache-2.0
221
main
5,688
require_relative "../../rspecs" RSpec.describe SparkleFormation::Provider::Aws do before { SparkleFormation._cleanify! } let(:instance) { SparkleFormation.new("test", :provider => :aws) } describe "#stack_resource_type" do it "should provide the proper resource type name" do expect(instance.stack_res...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/rspecs/acceptance/deep_nesting/aws/parameter_push_rspec.rb
Ruby
apache-2.0
221
main
3,176
require_relative "../../../../rspecs" RSpec.describe "Acceptance -> Deep Nesting -> Aws" do before { SparkleFormation._cleanify! } describe "-> Deep nesting parameter push" do let(:root) do SparkleFormation.new(:root) do parameters.test_param.type "String" end end let(:with_param)...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/rspecs/resources/azure_rspec.rb
Ruby
apache-2.0
221
main
3,441
require_relative "../../rspecs" RSpec.describe SparkleFormation::Resources::Azure do before { SparkleFormation._cleanify! } before do described_class.unmemoize(:azure_resources, :global) if described_class.registry described_class.registry.clear end end describe "#base_key" do it 'shoul...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/rspecs/resources/heat_rspec.rb
Ruby
apache-2.0
221
main
3,210
require_relative "../../rspecs" RSpec.describe SparkleFormation::Resources::Heat do before { SparkleFormation._cleanify! } before do described_class.unmemoize(:heat_resources, :global) if described_class.registry described_class.registry.clear end end describe "#base_key" do it 'should ...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/rspecs/resources/aws_rspec.rb
Ruby
apache-2.0
221
main
3,568
require_relative "../../rspecs" RSpec.describe SparkleFormation::Resources::Aws do before { SparkleFormation._cleanify! } before do described_class.unmemoize(:aws_resources, :global) if described_class.registry described_class.registry.clear end end describe "#base_key" do it 'should re...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/rspecs/resources/google_rspec.rb
Ruby
apache-2.0
221
main
3,257
require_relative "../../rspecs" RSpec.describe SparkleFormation::Resources::Google do before { SparkleFormation._cleanify! } before do described_class.unmemoize(:google_resources, :global) if described_class.registry described_class.registry.clear end end describe "#base_key" do it 'sho...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/specs/sparkle_struct_spec.rb
Ruby
apache-2.0
221
main
2,160
require_relative "../spec" describe SparkleFormation::SparkleStruct do before { SparkleFormation._cleanify! } before do @struct = SparkleFormation::SparkleStruct.new @struct._set_self( SparkleFormation.new(:stub, :parameters => { :foobar => { ...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/specs/basic_spec.rb
Ruby
apache-2.0
221
main
5,678
require_relative "../spec" describe SparkleFormation do before { SparkleFormation._cleanify! } before do SparkleFormation.sparkle_path = File.join(File.dirname(__FILE__), "sparkleformation") end describe "Basic Usage" do it "should dump hashes" do _( SparkleFormation.new(:dummy) do ...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/specs/composition_spec.rb
Ruby
apache-2.0
221
main
4,859
require_relative "../spec" describe SparkleFormation::Composition do before { SparkleFormation._cleanify! } it "should require `SparkleFormation` origin" do _{ SparkleFormation::Composition.new(:test) }.must_raise TypeError end describe "Basic usage" do before do @template = SparkleFormation.ne...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/specs/sparkle_attribute_spec.rb
Ruby
apache-2.0
221
main
793
require_relative "../spec" describe SparkleFormation::SparkleAttribute do before { SparkleFormation._cleanify! } before do @attr = Object.new @attr.extend(SparkleFormation::SparkleAttribute) @attr.extend(SparkleFormation::Utils::TypeCheckers) @sfn = SparkleFormation.new(:test) end it "should ...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/specs/sparkle_formation_spec.rb
Ruby
apache-2.0
221
main
1,817
require_relative "../spec" describe SparkleFormation do before { SparkleFormation._cleanify! } describe "Class Methods" do before do @template = SparkleFormation.new(:template) @struct = @template.compile end describe "Type checks" do it "should require string-ish type for registry ...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/specs/sparkle_spec.rb
Ruby
apache-2.0
221
main
1,986
require_relative "../spec" describe SparkleFormation::Sparkle do before { SparkleFormation._cleanify! } describe "valid sparkle pack" do before do SparkleFormation.sparkle_path = nil @pack = SparkleFormation::Sparkle.new( :root => File.join(File.dirname(__FILE__), "packs/valid_pack"), ...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/specs/sparkle_collection_spec.rb
Ruby
apache-2.0
221
main
5,684
require_relative "../spec" describe SparkleFormation::SparkleCollection do before { SparkleFormation._cleanify! } describe "Basic behavior" do before do @collection = SparkleFormation::SparkleCollection.new end let(:collection) { @collection } let(:root_pack) { SparkleFormation::Spark...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/specs/template_spec.rb
Ruby
apache-2.0
221
main
3,707
require_relative "../spec" describe SparkleFormation do before { SparkleFormation._cleanify! } before do SparkleFormation.sparkle_path = File.join(File.dirname(__FILE__), "sparkleformation") end describe "Dummy template" do it "should build the dummy template" do result = SparkleFormation.compi...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/specs/sparkle_layers_spec.rb
Ruby
apache-2.0
221
main
5,690
require_relative "../spec" describe SparkleFormation do before { SparkleFormation._cleanify! } describe "Basic template inheritance" do before do SparkleFormation.sparkle_path = nil @collection = SparkleFormation::SparkleCollection.new @collection.set_root( SparkleFormation::Sparkle....
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/specs/sparkle_attribute/aws_spec.rb
Ruby
apache-2.0
221
main
7,680
require_relative "../../spec" describe SparkleFormation::SparkleAttribute::Aws do before do klass = Class.new(AttributeStruct) klass.include(SparkleFormation::SparkleAttribute) klass.include(SparkleFormation::SparkleAttribute::Aws) klass.include(SparkleFormation::Utils::TypeCheckers) @attr = klas...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/specs/sparkle_attribute/heat_spec.rb
Ruby
apache-2.0
221
main
3,388
require_relative "../../spec" describe SparkleFormation::SparkleAttribute::Heat do before do klass = Class.new(AttributeStruct) klass.include(SparkleFormation::SparkleAttribute) klass.include(SparkleFormation::SparkleAttribute::Heat) klass.include(SparkleFormation::Utils::TypeCheckers) @attr = kl...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/specs/sparkle_attribute/azure_spec.rb
Ruby
apache-2.0
221
main
10,949
require_relative "../../spec" describe SparkleFormation::SparkleAttribute::Azure do before do klass = Class.new(AttributeStruct) klass.include(SparkleFormation::SparkleAttribute) klass.include(SparkleFormation::SparkleAttribute::Azure) klass.include(SparkleFormation::Utils::TypeCheckers) @attr = ...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/specs/translations/heat/elasticloadbalancing_load_balancer_spec.rb
Ruby
apache-2.0
221
main
745
require_relative "../../../spec" describe SparkleFormation::Translation::Heat do before { SparkleFormation.sparkle_path = $sparkle_path_spec } describe "ElasticLoadbalancing::LoadBalancer" do it "should translate to HOT format" do template = SparkleFormation.compile( File.join(SparkleFormation.s...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/specs/translations/heat/ec2_subnet_spec.rb
Ruby
apache-2.0
221
main
674
require_relative "../../../spec" describe SparkleFormation::Translation::Heat do before { SparkleFormation.sparkle_path = $sparkle_path_spec } describe "EC2::Subnet" do it "should translate to HOT format" do template = SparkleFormation.compile( File.join(SparkleFormation.sparkle_path, "translati...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/specs/translations/heat/ec2_vpc_spec.rb
Ruby
apache-2.0
221
main
665
require_relative "../../../spec" describe SparkleFormation::Translation::Heat do before { SparkleFormation.sparkle_path = $sparkle_path_spec } describe "EC2::VPC" do it "should translate to HOT format" do template = SparkleFormation.compile( File.join(SparkleFormation.sparkle_path, "translations...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/specs/sparkleformation/traversal.rb
Ruby
apache-2.0
221
main
225
SparkleFormation.new("traversal") do nest1.nest2.nest3.nest4.nest5.root!.test1 "test1" a1 do a2 do a3 do root!.test2 "test2" end end end nest1.nest2.nest3.nest4.parent!.test3 "test3" end
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/specs/sparkleformation/dynamics/node.rb
Ruby
apache-2.0
221
main
311
SparkleFormation.dynamic(:node) do |_name, _config| parameters do key_name do description "Name of an existing EC2 KeyPair to enable SSH access to the instance" type "String" end end dynamic!(:ec2_instance, _name) do properties do key_name ref!(:key_name) end end end
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/specs/sparkleformation/translations/elasticloadbalancing_load_balancer.rb
Ruby
apache-2.0
221
main
702
SparkleFormation.new("load_balancer").overrides do dynamic!(:elastic_loadbalancing_load_balancer, :test, :resource_name_suffix => :load_balancer) do properties do listeners array!( -> { protocol "HTTP" load_balancer_port 80 instance_port 80 instance_protocol "...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/specs/sparkleformation/translations/ec2_subnet.rb
Ruby
apache-2.0
221
main
351
SparkleFormation.new("ec2_subnet").overrides do parameters do subnet_id do type "String" end end dynamic!(:ec2_subnet, :test_az) do properties do availability_zone azs! cidr_block "10.0.0.0/24" end end dynamic!(:ec2_subnet, :test_vpc) do properties do cidr_block "...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/specs/sparkleformation/components/ami.rb
Ruby
apache-2.0
221
main
456
SparkleFormation.build do mappings.region_map do set!("us-east-1"._no_hump, :ami => "ami-7f418316") set!("us-west-1"._no_hump, :ami => "ami-951945d0") set!("us-west-2"._no_hump, :ami => "ami-16fd7026") set!("eu-west-1"._no_hump, :ami => "ami-24506250") set!("sa-east-1"._no_hump, :ami => "ami-3e3be...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/specs/providers/google/template_spec.rb
Ruby
apache-2.0
221
main
3,994
require_relative "../../../spec" describe "Google templates" do describe "Basic template structure" do it "should automatically reformat resources when sparkle dumped" do result = SparkleFormation.new(:dummy, :provider => :google) do resources.test_resource do value true end ...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/specs/providers/azure/template_spec.rb
Ruby
apache-2.0
221
main
1,072
require_relative "../../../spec" describe "Azure templates" do describe "Basic template structure" do it "should automatically reformat resources" do result = SparkleFormation.new(:dummy, :provider => :azure) do resources.test_resource do value true end end.dump _(resu...
github
sparkleformation/sparkle_formation
https://github.com/sparkleformation/sparkle_formation
test/specs/packs/base_pack/a.rb
Ruby
apache-2.0
221
main
291
::SparkleFormation::SparklePack.register!("external_sparkle_pack", File.join(File.dirname(__FILE__), "..", "external_sparkle_pack")) add_on_pack = ::SparkleFormation::SparklePack.new(:name => "external_sparkle_pack") SparkleFormation.new(:a, sparkle: add_on_pack) do dynamic!(:add_on) end
github
nullscreen/squid
https://github.com/nullscreen/squid
Rakefile
Ruby
mit
221
master
298
require 'bundler/gem_tasks' desc 'Generate the manual' task :manual do print 'Building manual... ' require_relative 'examples/manual' puts 'DONE!' end require "rspec/core/rake_task" require "rspec/core/version" desc "Run all examples" RSpec::Core::RakeTask.new :spec task default: [:spec]
github
nullscreen/squid
https://github.com/nullscreen/squid
squid.gemspec
Ruby
mit
221
master
1,143
lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'squid/version' Gem::Specification.new do |spec| spec.name = 'squid' spec.version = Squid::VERSION spec.authors = ['claudiob'] spec.email = ['claudiob@gmail.com'] spec.summ...
github
nullscreen/squid
https://github.com/nullscreen/squid
Gemfile
Ruby
mit
221
master
290
source 'https://rubygems.org' # Specify your gem's dependencies in squid.gemspec gemspec gem 'pdf-inspector' gem 'prawn-manual_builder' gem 'rake' gem 'rspec' gem 'pry-nav' gem 'simplecov' gem 'simplecov-cobertura' if ENV['RAILS_VERSION'] gem 'activesupport', ENV['RAILS_VERSION'] end
github
nullscreen/squid
https://github.com/nullscreen/squid
spec/spec_helper.rb
Ruby
mit
221
master
433
require 'simplecov' if ENV['CI'] require 'simplecov-cobertura' SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter end SimpleCov.start do enable_coverage :branch add_filter '/spec/' add_filter '/vendor/' end Dir['./spec/support/**/*.rb'].each {|f| require f} RSpec.configure do |config| config...
github
nullscreen/squid
https://github.com/nullscreen/squid
spec/gridline_spec.rb
Ruby
mit
221
master
663
require 'spec_helper' describe Squid::Gridline do let(:options) { {height: height, count: count, skip_baseline: skip_baseline} } let(:height) { 100 } let(:count) { 4 } let(:skip_baseline) { false } describe '.for' do subject(:gridlines) { Squid::Gridline.for **options } it 'returns +count+ instance...
github
nullscreen/squid
https://github.com/nullscreen/squid
spec/squid_spec.rb
Ruby
mit
221
master
11,867
require 'spec_helper' describe 'Prawn::Document#chart' do let(:pdf) { Prawn::Document.new } let(:chart) { pdf.chart(data, settings); pdf.render } let(:data) { {} } let(:options) { {legend: false, baseline: false, steps: 0, format: :currency} } let(:settings) { options } let(:blue_rgb) { [0.1804, 0.3412, 0....
github
nullscreen/squid
https://github.com/nullscreen/squid
spec/axis_label_spec.rb
Ruby
mit
221
master
712
require 'spec_helper' describe Squid::AxisLabel do let(:options) { {align: align, height: height} } let(:align) { :left } let(:height) { 100 } let(:axis) { OpenStruct.new labels: labels, width: width } let(:labels) { %w(110 70 30 -10 -50) } let(:width) { 50 } describe '.for' do subject(:axis_labels)...
github
nullscreen/squid
https://github.com/nullscreen/squid
spec/configuration_spec.rb
Ruby
mit
221
master
2,375
require 'spec_helper' RSpec.shared_examples 'a configurable setting' do |method:, env:, default:, sample_value:| it "#{method} is #{default} by default" do ENV[env] = nil expect(subject.public_send method).to eq default end it "#{method} can be set with the environment variable #{env}" do ENV[env] =...
github
nullscreen/squid
https://github.com/nullscreen/squid
spec/axis_spec.rb
Ruby
mit
221
master
3,017
require 'spec_helper' describe Squid::Axis do let(:options) { {steps: steps, stack: stack?, format: format} } let(:steps) { 4 } let(:stack?) { false } let(:format) { nil } let(:block) { nil } let(:series) { [[-1.0, 9.9, 3.0], [nil, 2.0, -50.0]] } describe '#labels' do subject(:axis) { Squid::Axis.ne...
github
nullscreen/squid
https://github.com/nullscreen/squid
spec/point_spec.rb
Ruby
mit
221
master
2,256
require 'spec_helper' describe Squid::Point do let(:options) { {minmax: minmax, height: height, labels: labels, stack: stack?, formats: formats} } let(:minmax) { [-50, 150] } let(:height) { 100 } let(:labels) { [false] } let(:stack?) { false } let(:formats) { [:percentage, :seconds] } let(:series) { [[-1...
github
nullscreen/squid
https://github.com/nullscreen/squid
examples/manual.rb
Ruby
mit
221
master
254
require 'squid' require 'prawn/manual_builder' Prawn::ManualBuilder.manual_dir = File.dirname(__FILE__) Prawn::Font::AFM.hide_m17n_warning = true Prawn::ManualBuilder::Example.generate 'manual.pdf', skip_page_creation: true do load_package 'squid' end
github
nullscreen/squid
https://github.com/nullscreen/squid
examples/squid/two_axis.rb
Ruby
mit
221
master
537
# By default, .. # # You can use .. filename = File.basename(__FILE__).gsub('.rb', '.pdf') Prawn::ManualBuilder::Example.generate(filename) do data = {'Earnings' => {'2011' => 52, '2012' => 71, '2013' => 93, '2014' => 74}, 'Views' => {'2011' => 0, '2012' => 4, '2013' => 3, '2014' => 5}, 'Uniqu...
github
nullscreen/squid
https://github.com/nullscreen/squid
examples/squid/labels.rb
Ruby
mit
221
master
398
# By default, <code>chart</code> does not write value labels on the chart. # # You can use the <code>:label</code> option to enable this behavior. # filename = File.basename(__FILE__).gsub('.rb', '.pdf') Prawn::ManualBuilder::Example.generate(filename) do data = {'A very long label to test padding with labels' => {20...
github
nullscreen/squid
https://github.com/nullscreen/squid
examples/squid/basic.rb
Ruby
mit
221
master
351
# Creating graphs with Squid is easy. Just use the <code>chart</code> method. # # Provide a hash containing the data of the series and plot it with <code>chart</code>. # filename = File.basename(__FILE__).gsub('.rb', '.pdf') Prawn::ManualBuilder::Example.generate(filename) do data = {views: {2013 => 182, 2014 => 46, ...
github
nullscreen/squid
https://github.com/nullscreen/squid
examples/squid/columns.rb
Ruby
mit
221
master
419
# By default, <code>chart</code> plots a graph for each series. # # Provide multiple key/value pairs to <code>:data</code> to plot multiple series. filename = File.basename(__FILE__).gsub('.rb', '.pdf') Prawn::ManualBuilder::Example.generate(filename) do data = {views: {2013 => 182, 2014 => 46, 2015 => 88}, u...
github
nullscreen/squid
https://github.com/nullscreen/squid
examples/squid/gridlines.rb
Ruby
mit
221
master
348
# By default, <code>chart</code> plots 5 equidistant horizontal gridlines. # # You can use the <code>:steps</code> option to change this number. # filename = File.basename(__FILE__).gsub('.rb', '.pdf') Prawn::ManualBuilder::Example.generate(filename) do data = {views: {2013 => 182000, 2014 => -46000, 2015 => 102000}}...
github
nullscreen/squid
https://github.com/nullscreen/squid
examples/squid/stacks.rb
Ruby
mit
221
master
538
# By default, <code>chart</code> plots multiple columns next to each other. # # You can use the <code>:type</code> option to plot stacked columns instead. filename = File.basename(__FILE__).gsub('.rb', '.pdf') Prawn::ManualBuilder::Example.generate(filename) do data = {views: {2013 => 196, 2014 => 66, 2015 => -282}, ...
github
nullscreen/squid
https://github.com/nullscreen/squid
examples/squid/format.rb
Ruby
mit
221
master
431
# You can specify the format of the axis values with the <code>:format</code> option. # # Valid options are: <code>:percentage</code>, <code>:currency</code>, <code>:seconds</code>, <code>:float</code>. # filename = File.basename(__FILE__).gsub('.rb', '.pdf') Prawn::ManualBuilder::Example.generate(filename) do data =...
github
nullscreen/squid
https://github.com/nullscreen/squid
examples/squid/legend.rb
Ruby
mit
221
master
366
# By default, <code>chart</code> adds a legend in the top-right corner. # # You can use the <code>:legend</code> option to disable this behavior. # filename = File.basename(__FILE__).gsub('.rb', '.pdf') Prawn::ManualBuilder::Example.generate(filename) do data = {views: {2013 => 182, 2014 => 46}, uniques: {2013 => 94,...
github
nullscreen/squid
https://github.com/nullscreen/squid
examples/squid/color.rb
Ruby
mit
221
master
348
# By default, <code>chart</code> generates charts with default colors. # # You can use the <code>:color</code> option to manually set the color. # filename = File.basename(__FILE__).gsub('.rb', '.pdf') Prawn::ManualBuilder::Example.generate(filename) do data = {views: {2013 => 18.2, 2014 => 4.6, 2015 => 10.2}} char...
github
nullscreen/squid
https://github.com/nullscreen/squid
examples/squid/baseline.rb
Ruby
mit
221
master
380
# By default, <code>chart</code> plots a baseline at the bottom of the graph. # # You can use the <code>:baseline</code> option to disable this behavior. # filename = File.basename(__FILE__).gsub('.rb', '.pdf') Prawn::ManualBuilder::Example.generate(filename) do data = {earnings: {2013 => 182, 2014 => 46, 2015 => 802...
github
nullscreen/squid
https://github.com/nullscreen/squid
examples/squid/points.rb
Ruby
mit
221
master
429
# By default, <code>chart</code> plots a column for each series. # # You can use the <code>:type</code> option to plot a point chart instead. filename = File.basename(__FILE__).gsub('.rb', '.pdf') Prawn::ManualBuilder::Example.generate(filename) do data = {views: {2013 => 182, 2014 => 46, 2015 => 88}, uniques...
github
nullscreen/squid
https://github.com/nullscreen/squid
examples/squid/squid.rb
Ruby
mit
221
master
1,141
Prawn::ManualBuilder::Example.generate 'squid.pdf' do package 'squid' do |p| p.name = 'Squid' p.intro do prose(' Prawn is a great library to generate PDF files from Ruby, but lacks high-level components to generate graphs. Squid integrates Prawn by providing methods to plot charts in PD...
github
nullscreen/squid
https://github.com/nullscreen/squid
examples/squid/point.rb
Ruby
mit
221
master
341
# By default, <code>chart</code> plots a column chart. # # You can use the <code>:type</code> option to plot a point chart instead. # filename = File.basename(__FILE__).gsub('.rb', '.pdf') Prawn::ManualBuilder::Example.generate(filename) do data = {views: {Safari: 45.20001, Firefox: 63.3999, Chrome: 21.4}} chart da...
github
nullscreen/squid
https://github.com/nullscreen/squid
examples/squid/legend_offset.rb
Ruby
mit
221
master
396
# By default, <code>chart</code> adds a legend in the top-right corner. # # You can use the <code>:legend</code> option to change the position of the legend. # filename = File.basename(__FILE__).gsub('.rb', '.pdf') Prawn::ManualBuilder::Example.generate(filename) do data = {views: {2013 => 182, 2014 => 46}, uniques: ...
github
nullscreen/squid
https://github.com/nullscreen/squid
examples/squid/lines.rb
Ruby
mit
221
master
472
# By default, <code>chart</code> plots a column for each series. # # You can use the <code>:type</code> option to plot a line chart instead. filename = File.basename(__FILE__).gsub('.rb', '.pdf') Prawn::ManualBuilder::Example.generate(filename) do data = {views: {2013 => 182, 2014 => -46, 2015 => 88}, uniques...
github
nullscreen/squid
https://github.com/nullscreen/squid
examples/squid/line_width.rb
Ruby
mit
221
master
380
# By default, <code>chart</code> uses a line width of 3 for line charts. # # You can use the <code>:line_width</code> option to customize this value. # filename = File.basename(__FILE__).gsub('.rb', '.pdf') Prawn::ManualBuilder::Example.generate(filename) do data = {views: {2013 => 182, 2014 => 46, 2015 => 8020000000...
github
nullscreen/squid
https://github.com/nullscreen/squid
examples/squid/border.rb
Ruby
mit
221
master
352
# By default, <code>chart</code> is not plotted with an outer border. # # You can use the <code>:border</code> option to enable this behavior. # filename = File.basename(__FILE__).gsub('.rb', '.pdf') Prawn::ManualBuilder::Example.generate(filename) do data = {views: {Safari: 45.20001, Firefox: 33.3999, Chrome: 21.4}}...
github
nullscreen/squid
https://github.com/nullscreen/squid
examples/squid/height.rb
Ruby
mit
221
master
347
# By default, <code>chart</code> generates charts with a height of 250. # # You can use the <code>:height</code> option to manually set the height. # filename = File.basename(__FILE__).gsub('.rb', '.pdf') Prawn::ManualBuilder::Example.generate(filename) do data = {views: {2013 => 18.2, 2014 => 4.6, 2015 => 10.2}} c...
github
nullscreen/squid
https://github.com/nullscreen/squid
examples/squid/every.rb
Ruby
mit
221
master
495
# By default, <code>chart</code> plots every category on the baseline. # # You can use the <code>:every</code> option to change this behavior. # filename = File.basename(__FILE__).gsub('.rb', '.pdf') Prawn::ManualBuilder::Example.generate(filename) do data = {views: {'Jan 1' => 12, 'Jan 2' => 13, 'Jan 3' => 21, 'Jan 4...
github
nullscreen/squid
https://github.com/nullscreen/squid
examples/squid/line.rb
Ruby
mit
221
master
357
# By default, <code>chart</code> plots a column chart. # # You can use the <code>:type</code> option to plot a line chart instead. # filename = File.basename(__FILE__).gsub('.rb', '.pdf') Prawn::ManualBuilder::Example.generate(filename) do data = {views: {Safari: 45.20001, Firefox: 63.3999, Chrome: 21.4}} chart dat...
github
nullscreen/squid
https://github.com/nullscreen/squid
examples/squid/ticks.rb
Ruby
mit
221
master
355
# By default, <code>chart</code> plots ticks above the categories. # # You can use the <code>:ticks</code> option to disable this behavior. # filename = File.basename(__FILE__).gsub('.rb', '.pdf') Prawn::ManualBuilder::Example.generate(filename) do data = {views: {2013 => 182, 2014 => 46, 2015 => 80200000000000000000...
github
nullscreen/squid
https://github.com/nullscreen/squid
lib/squid.rb
Ruby
mit
221
master
1,955
require 'prawn' require 'squid/graph' module Squid # Provides the `chart` method to use in Prawn::Document # @see http://prawnpdf.org/api-docs/2.0/Prawn/Document.html module Interface # Plots a graph the current document. # # @param [Hash<#to_s, [Hash<#to_s, Numeric>]>] data the series to plot in ...
github
nullscreen/squid
https://github.com/nullscreen/squid
lib/squid/graph.rb
Ruby
mit
221
master
3,495
require 'active_support' require 'active_support/core_ext/string/inflections' # for singularize require 'squid/axis' require 'squid/axis_label' require 'squid/gridline' require 'squid/plotter' require 'squid/point' require 'squid/settings' module Squid # @private class Graph extend Settings has_settings :...
github
nullscreen/squid
https://github.com/nullscreen/squid
lib/squid/format.rb
Ruby
mit
221
master
858
require 'active_support' require 'active_support/number_helper' # for number_to_rounded module Squid module Format include ActiveSupport::NumberHelper def format_for(value, format) case format when :percentage then number_to_percentage value, precision: 1 when :currency then number_to_...
github
nullscreen/squid
https://github.com/nullscreen/squid
lib/squid/plotter.rb
Ruby
mit
221
master
6,790
require 'active_support' require 'active_support/core_ext/array/wrap' # for Array#wrap module Squid # A Plotter wraps a Prawn::Document object in order to provide new methods # like `gridline` or `ticks` used by Squid::Graph to plot graph elements. class Plotter attr_accessor :paddings # @param [Prawn::D...
github
nullscreen/squid
https://github.com/nullscreen/squid
lib/squid/config.rb
Ruby
mit
221
master
1,352
require 'squid/configuration' module Squid # Provides methods to read and write global configuration settings. # # A typical usage is to set the default dimensions and colors for charts. # # @example Set the default height for Squid graphs: # Squid.configure do |config| # config.height = 150 # ...
github
nullscreen/squid
https://github.com/nullscreen/squid
lib/squid/axis.rb
Ruby
mit
221
master
1,611
require 'squid/format' require 'active_support/core_ext/enumerable' # for Array#sum module Squid # @private class Axis include Format attr_reader :data def initialize(data, steps:, stack:, format:, &block) @data, @steps, @stack, @format = data, steps, stack, format @width_proc = block if b...
github
nullscreen/squid
https://github.com/nullscreen/squid
lib/squid/configuration.rb
Ruby
mit
221
master
2,365
require 'ostruct' module Squid # Provides an object to store global configuration settings. # # This class is typically not used directly, but by calling # {Squid::Config#configure Squid.configure}, which creates and updates a # single instance of {Squid::Configuration}. # # @example Set the default heig...
github
nullscreen/squid
https://github.com/nullscreen/squid
lib/squid/settings.rb
Ruby
mit
221
master
911
require 'squid/config' module Squid # @private module Settings # For each key, create an attribute reader with a settings value. # First, check if an option with the key exists. # For example: {formats: [:currency]} ->> [:currency] # Then, check is an option with the singular version of the key exi...
github
nullscreen/squid
https://github.com/nullscreen/squid
lib/squid/gridline.rb
Ruby
mit
221
master
312
module Squid class Gridline def self.for(count:, skip_baseline:, height:) return [] if count.zero? height.step(0, -height/count.to_f).map do |y| new y: y unless skip_baseline && y.zero? end.compact end attr_reader :y def initialize(y:) @y = y end end end
github
nullscreen/squid
https://github.com/nullscreen/squid
lib/squid/axis_label.rb
Ruby
mit
221
master
411
module Squid class AxisLabel def self.for(axis, height:, align:) height.step(0, -height/(axis.labels.size-1).to_f).map.with_index do |y, i| new y: y, label: axis.labels[i], align: align, width: axis.width end end attr_reader :label, :y, :align, :width def initialize(label:, y:, a...
github
nullscreen/squid
https://github.com/nullscreen/squid
lib/squid/point.rb
Ruby
mit
221
master
1,160
require 'squid/format' module Squid class Point extend Format def self.for(series, minmax:, height:, labels:, stack:, formats:) @min = Hash.new 0 @max = Hash.new 0 min, max = minmax offset = -> (value) { value * height.to_f / (max-min) } series.map.with_index do |values, series...
github
tpope/gem-browse
https://github.com/tpope/gem-browse
gem-browse.gemspec
Ruby
mit
221
master
859
# -*- encoding: utf-8 -*- $:.push File.expand_path("../lib", __FILE__) Gem::Specification.new do |s| s.name = "gem-browse" s.version = "1.0.1" s.authors = ["Tim Pope"] s.email = ["code@tpop"+'e.net'] s.homepage = "https://github.com/tpope/gem-browse" s.summary = %q{gem edit, gem...
github
tpope/gem-browse
https://github.com/tpope/gem-browse
lib/rubygems_plugin.rb
Ruby
mit
221
master
247
require 'rubygems/command_manager' Gem::CommandManager.instance.register_command :edit Gem::CommandManager.instance.register_command :open Gem::CommandManager.instance.register_command :clone Gem::CommandManager.instance.register_command :browse
github
tpope/gem-browse
https://github.com/tpope/gem-browse
lib/rubygems/commands/clone_command.rb
Ruby
mit
221
master
1,750
require 'rubygems/browse/command' class Gem::Commands::CloneCommand < Gem::Browse::Command def description <<-EOF The clone command performs a Git clone of a gem's upstream repository. It looks for this repository by checking the homepage field of the gemspec and the source code URL field at rubygems.org. Curr...
github
tpope/gem-browse
https://github.com/tpope/gem-browse
lib/rubygems/commands/edit_command.rb
Ruby
mit
221
master
1,578
require 'rubygems/browse/command' class Gem::Commands::EditCommand < Gem::Browse::Command def description <<-EOF The edit command looks through the require paths of each gem for the specified library file and loads said file in your editor. If no file is found, $LOAD_PATH is searched before giving up. EOF ...
github
tpope/gem-browse
https://github.com/tpope/gem-browse
lib/rubygems/commands/open_command.rb
Ruby
mit
221
master
605
require 'rubygems/browse/command' require 'rubygems/version_option' class Gem::Commands::OpenCommand < Gem::Browse::Command include Gem::VersionOption def initialize super 'open', 'Open a gem in your editor', :version => '>= 0' add_editor_option add_version_option end def execute name = get_o...
github
tpope/gem-browse
https://github.com/tpope/gem-browse
lib/rubygems/commands/browse_command.rb
Ruby
mit
221
master
627
require 'rubygems/browse/command' class Gem::Commands::BrowseCommand < Gem::Browse::Command def initialize super 'open', "Open a gem's homepage in your web browser" end def execute name = get_one_gem_name homepage = begin find_by_name(name).homepage rescue Gem::LoadError ...
github
tpope/gem-browse
https://github.com/tpope/gem-browse
lib/rubygems/browse/command.rb
Ruby
mit
221
master
1,103
require 'rubygems/command' module Gem::Browse class Command < Gem::Command def add_editor_option add_option('-e', '--editor EDITOR', 'Specify editor to invoke') do |editor, options| options[:editor] = editor end end def editor options[:editor] || ENV['GEM_EDITOR'] || ...
github
capistrano/bundler
https://github.com/capistrano/bundler
Rakefile
Ruby
mit
221
master
224
require "bundler/gem_tasks" # Do nothing by default task :default Rake::Task["release"].enhance do puts "Don't forget to publish the release on GitHub!" system "open https://github.com/capistrano/bundler/releases" end
github
capistrano/bundler
https://github.com/capistrano/bundler
capistrano-bundler.gemspec
Ruby
mit
221
master
1,113
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) Gem::Specification.new do |spec| spec.name = 'capistrano-bundler' spec.version = '2.2.0' spec.license = 'MIT' spec.authors = ['Tom Clements', 'Lee Hambley', 'Kir Shatrov...
github
soveran/mote
https://github.com/soveran/mote
mote.gemspec
Ruby
mit
221
master
594
require "./lib/mote" Gem::Specification.new do |s| s.name = "mote" s.version = Mote::VERSION s.summary = "Minimum Operational Template." s.description = "Mote is a very simple and fast template engine." s.authors = ["Michel Martens"] s.email = ["...
github
soveran/mote
https://github.com/soveran/mote
test/mote_test.rb
Ruby
mit
221
master
3,705
require File.expand_path("../lib/mote", File.dirname(__FILE__)) scope do test "empty lines" do example = Mote.parse("\n\n \n") assert_equal "\n\n \n", example.call end test "empty lines with mixed code" do example = Mote.parse("\n% true\n\n% false\n\n") assert_equal "\n\n\n", example.call end ...
github
soveran/mote
https://github.com/soveran/mote
lib/mote.rb
Ruby
mit
221
master
2,416
# Copyright (c) 2011 Michel Martens # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, dist...
github
soveran/mote
https://github.com/soveran/mote
benchmarks/run.rb
Ruby
mit
221
master
4,528
#!/usr/bin/env ruby $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'), File.join(File.dirname(__FILE__), 'src')) require 'slim' require 'complex_view' require 'benchmark' require 'ostruct' require 'erubis' require 'erb' require 'haml' require 'tilt' require 'mote' class SlimBenchmarks def initialize(slow,...
github
soveran/mote
https://github.com/soveran/mote
benchmarks/src/complex_view.rb
Ruby
mit
221
master
370
require 'tilt' class ComplexView def header "Colors" end def item unless defined? @items @items ||= [] @items << { :name => 'red', :current => true, :url => '#red' } @items << { :name => 'green', :current => false, :url => '#green' } @items << { :name => 'blue', :current => false...
github
domitry/nyaplot
https://github.com/domitry/nyaplot
Rakefile
Ruby
mit
221
v2
317
require "bundler/gem_tasks" require "rspec/core/rake_task" RSpec::Core::RakeTask.new(:spec) def run *cmd sh(cmd.join(" ")) end task :console do |task| cmd = [ 'irb', "-r './lib/nyaplot.rb'" ] run *cmd end task :pry do |task| cmd = [ 'pry', "-r './lib/nyaplot.rb'" ] run *cmd end task :default => :spec
github
domitry/nyaplot
https://github.com/domitry/nyaplot
nyaplot.gemspec
Ruby
mit
221
v2
2,575
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'nyaplot/version' Gem::Specification.new do |spec| spec.name = "nyaplot" spec.version = Nyaplot::VERSION spec.authors = ["Naoki Nishida"] spec.email = ["domitr...
github
domitry/nyaplot
https://github.com/domitry/nyaplot
lib/nyaplot/chart_method.rb
Ruby
mit
221
v2
1,149
require_relative './charts/bar' require_relative './charts/line' require_relative './charts/scatter' module Nyaplot module ChartMethods [ ["bar", Charts::Bar], ["line", Charts::Line], ["scatter", Charts::Scatter] ].each do |pair| mname, constant = pair define_method(mname) do |*...
github
domitry/nyaplot
https://github.com/domitry/nyaplot
lib/nyaplot/exportable.rb
Ruby
mit
221
v2
1,777
module Nyaplot # Base class for Plot. Export methods are implemented here. # !! Classes to include PlotBase should have #to_json. !! # module Exportable PATH_NYAPLOT = "https://cdn.rawgit.com/domitry/Nyaplotjs/bb48705474f7878c0a83f267675e019658421b52/release/nyaplot" def raise_display_failed ...
github
domitry/nyaplot
https://github.com/domitry/nyaplot
lib/nyaplot/core.rb
Ruby
mit
221
v2
666
require 'erb' module Nyaplot # Create multi-column layout # @example # include Nyaplot # p1 = Plot.add(:scatter, x1, y1) # p2 = Plot.add(:line, x2, y2) # columns(p1, p2).draw # def columns(*plots) panes = plots.map{|p| p.pane} plot = Plot.new plot.pane = Pane.columns(*panes) plo...
github
domitry/nyaplot
https://github.com/domitry/nyaplot
lib/nyaplot/monkeys.rb
Ruby
mit
221
v2
1,239
class Array # Find the numeric mean. nils are ignored. def mean ary = self.to_a.compact if defined?(NMatrix) # Prefer the C version. ary.to_nm.mean[0] else # Fall back to Ruby. ary.inject(0) { |x,i| x + i } / ary.size.to_f end end # Find the single median or the mea...
github
domitry/nyaplot
https://github.com/domitry/nyaplot
lib/nyaplot/data.rb
Ruby
mit
221
v2
6,431
require 'nyaplot' require 'securerandom' require 'json' require 'csv' module Nyaplot if defined? Mikon class DataFrame include Nyaplot::Base type :data required_args :data def initialize(*args) super() if args.length == 1 && args.first.is_a?(Mikon::DataFrame) @d...
github
domitry/nyaplot
https://github.com/domitry/nyaplot
lib/nyaplot/plot.rb
Ruby
mit
221
v2
6,209
require_relative './exportable' require_relative './chart_method' require_relative './layers/layers' module Nyaplot class Plot # @example # Plot.from(df, x: :hoge, y: :nya).bar # Plot.from(df).scatter(x: hoge, y: nya) # Plot.add(:scatter, xarr, yarr) # include Exportable include ChartMeth...
github
domitry/nyaplot
https://github.com/domitry/nyaplot
lib/nyaplot/color.rb
Ruby
mit
221
v2
2,629
require 'nyaplot' require 'json' module Nyaplot # The interface to access Colorbrewer through Nyaplot::Color class Colors class << self path = File.expand_path("../colorbrewer/colorbrewer.json", __FILE__) color_set = JSON.parse(File.read(path)) color_set.each do |name, colors| nums =...