repo
stringlengths
5
92
file_url
stringlengths
80
287
file_path
stringlengths
5
197
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:37:27
2026-01-04 17:58:21
truncated
bool
2 classes
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/dragonfly/hash_with_css_style_keys_spec.rb
spec/dragonfly/hash_with_css_style_keys_spec.rb
require 'spec_helper' describe Dragonfly::HashWithCssStyleKeys do before(:each) do @hash = Dragonfly::HashWithCssStyleKeys[ :font_style => 'normal', :'font-weight' => 'bold', 'font_colour' => 'white', 'font-size' => 23, :hello => 'there' ] end describe "accessing using u...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/dragonfly/register_spec.rb
spec/dragonfly/register_spec.rb
require 'spec_helper' describe Dragonfly::Register do let (:register) { Dragonfly::Register.new } let (:thing) { proc{ "BOO" } } it "adds an item" do register.add(:thing, thing) register.get(:thing).should == thing end it "adds from a block" do register.add(:thing, &thing) register.get(:th...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/dragonfly/memory_data_store_spec.rb
spec/dragonfly/memory_data_store_spec.rb
require 'spec_helper' require 'dragonfly/spec/data_store_examples' describe Dragonfly::MemoryDataStore do before(:each) do @data_store = Dragonfly::MemoryDataStore.new end it_should_behave_like 'data_store' it "allows setting the uid" do uid = @data_store.write(Dragonfly::Content.new(test_app, "Hell...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/dragonfly/job_endpoint_spec.rb
spec/dragonfly/job_endpoint_spec.rb
# encoding: utf-8 require 'spec_helper' ## General tests for Response go here as it's a pretty simple wrapper around that describe "Dragonfly::JobEndpoint Rack::Lint tests" do before(:each) do @app = test_app @app.add_generator(:test_data){|content| content.update("Test Data") } @job = @app.generate(:te...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/dragonfly/serializer_spec.rb
spec/dragonfly/serializer_spec.rb
# encoding: utf-8 require 'spec_helper' describe Dragonfly::Serializer do include Dragonfly::Serializer describe "base 64 encoding/decoding" do [ 'a', 'sdhflasd', '/2010/03/01/hello.png', '//..', 'whats/up.egg.frog', '£ñçùí;', '~', '-umlaut_ö' ].each do |st...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/dragonfly/utils_spec.rb
spec/dragonfly/utils_spec.rb
require 'spec_helper' describe Dragonfly::Utils do describe "blank?" do [ nil, false, "", [], {} ].each do |obj| it "returns true for #{obj.inspect}" do obj.blank?.should be_truthy end end [ "a", [1], {1 => 2}, Object.new, ...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/dragonfly/has_filename_spec.rb
spec/dragonfly/has_filename_spec.rb
require 'spec_helper' describe Dragonfly::HasFilename do before(:each) do @obj = Object.new class << @obj include Dragonfly::HasFilename attr_accessor :name end end describe "basename" do it "should define basename" do @obj.name = 'meat.balls' @obj.basename.should == '...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/dragonfly/content_spec.rb
spec/dragonfly/content_spec.rb
require 'spec_helper' describe Dragonfly::Content do let(:app) { test_app } let(:content) { Dragonfly::Content.new(app) } describe "initializing" do it "allows initializing with content and meta" do content = Dragonfly::Content.new(app, "things", 'some' => 'meta') content.data.should == 'thing...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/dragonfly/param_validators_spec.rb
spec/dragonfly/param_validators_spec.rb
require "spec_helper" require "dragonfly/param_validators" describe Dragonfly::ParamValidators do include Dragonfly::ParamValidators describe "validate!" do it "does nothing if the parameter meets the condition" do validate!("thing") { |t| t === "thing" } end it "raises if the parameter doesn't...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/dragonfly/shell_spec.rb
spec/dragonfly/shell_spec.rb
require 'spec_helper' describe Dragonfly::Shell do let(:shell){ Dragonfly::Shell.new } it "returns the result of the command" do shell.run("echo 10").strip.should == '10' end it "should raise an error if the command isn't found" do lambda{ shell.run "non-existent-command" }.should raise_er...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/dragonfly/cookie_monster_spec.rb
spec/dragonfly/cookie_monster_spec.rb
require 'spec_helper' require 'rack' require 'dragonfly/cookie_monster' describe Dragonfly::CookieMonster do def app(extra_env={}) Rack::Builder.new do use Dragonfly::CookieMonster run proc{|env| env.merge!(extra_env); [200, {"Set-Cookie" => "blah=thing", "Something" => "else"}, ["body here"]] } ...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/dragonfly/server_spec.rb
spec/dragonfly/server_spec.rb
require 'spec_helper' require 'rack/mock' describe Dragonfly::Server do describe "responses" do before(:each) do @app = test_app @uid = @app.store('HELLO THERE') @server = Dragonfly::Server.new(@app) @server.url_format = '/media/:job' @job = @app.fetch(@uid) end after(:ea...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/dragonfly/app_spec.rb
spec/dragonfly/app_spec.rb
require 'spec_helper' require 'rack/mock' describe Dragonfly::App do describe ".instance" do it "should create a new instance if it didn't already exist" do app = Dragonfly::App.instance(:images) app.should be_a(Dragonfly::App) end it "should return an existing instance if called by name" ...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/dragonfly/job_spec.rb
spec/dragonfly/job_spec.rb
# encoding: UTF-8 require 'spec_helper' describe Dragonfly::Job do describe "Step types" do { Dragonfly::Job::Fetch => :fetch, Dragonfly::Job::Process => :process, Dragonfly::Job::Generate => :generate, Dragonfly::Job::FetchFile => :fetch_file, Dragonfly::Job::FetchUrl => :fetch_u...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/dragonfly/routed_endpoint_spec.rb
spec/dragonfly/routed_endpoint_spec.rb
require 'spec_helper' def response_for(array) Rack::MockResponse.new(*array) end describe Dragonfly::RoutedEndpoint do def env_for(url, opts={}) Rack::MockRequest.env_for(url, opts) end let (:app) { test_app } let (:uid) { app.store('wassup') } describe "endpoint returning a job" do let (:endpo...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/dragonfly/configurable_spec.rb
spec/dragonfly/configurable_spec.rb
require 'spec_helper' describe Dragonfly::Configurable do describe "Configurer" do let (:configurer) { Dragonfly::Configurable::Configurer.new do def colour(colour) obj.colour = colour end end } let (:obj) { Object.new } it "allows configuring" do obj.should_receive(:col...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/dragonfly/image_magick/commands_spec.rb
spec/dragonfly/image_magick/commands_spec.rb
require "spec_helper" require "dragonfly/image_magick/commands" describe Dragonfly::ImageMagick::Commands do include Dragonfly::ImageMagick::Commands let(:app) { test_app } def sample_content(name) Dragonfly::Content.new(app, SAMPLES_DIR.join(name)) end describe "convert" do let(:image) { sample_c...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/dragonfly/image_magick/plugin_spec.rb
spec/dragonfly/image_magick/plugin_spec.rb
require "spec_helper" describe "a configured imagemagick app" do let(:app) { test_app.configure_with(:imagemagick) } let(:image) { app.fetch_file(SAMPLES_DIR.join("beach.png")) } describe "env variables" do let(:app) { test_app } it "allows setting the convert command" do app.configure do ...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/dragonfly/image_magick/generators/text_spec.rb
spec/dragonfly/image_magick/generators/text_spec.rb
require "spec_helper" describe Dragonfly::ImageMagick::Generators::Text do let (:generator) { Dragonfly::ImageMagick::Generators::Text.new } let (:app) { test_imagemagick_app } let (:image) { Dragonfly::Content.new(app) } describe "creating a text image" do before(:each) do generator.call(image, "mm...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/dragonfly/image_magick/generators/plasma_spec.rb
spec/dragonfly/image_magick/generators/plasma_spec.rb
require "spec_helper" describe Dragonfly::ImageMagick::Generators::Plasma do let (:generator) { Dragonfly::ImageMagick::Generators::Plasma.new } let (:app) { test_imagemagick_app } let (:image) { Dragonfly::Content.new(app) } describe "call" do it "generates a png image" do generator.call(image, 5, ...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/dragonfly/image_magick/generators/plain_spec.rb
spec/dragonfly/image_magick/generators/plain_spec.rb
require "spec_helper" require "dragonfly/param_validators" describe Dragonfly::ImageMagick::Generators::Plain do let (:generator) { Dragonfly::ImageMagick::Generators::Plain.new } let (:app) { test_imagemagick_app } let (:image) { Dragonfly::Content.new(app) } describe "of given dimensions" do before(:eac...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/dragonfly/image_magick/analysers/image_properties_spec.rb
spec/dragonfly/image_magick/analysers/image_properties_spec.rb
require 'spec_helper' describe Dragonfly::ImageMagick::Analysers::ImageProperties do let(:app) { test_imagemagick_app } let(:analyser) { Dragonfly::ImageMagick::Analysers::ImageProperties.new } let(:content) { Dragonfly::Content.new(app, SAMPLES_DIR.join('beach.png')) } # 280x355 describe "call" do it "r...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/dragonfly/image_magick/processors/thumb_spec.rb
spec/dragonfly/image_magick/processors/thumb_spec.rb
require "spec_helper" require "ostruct" describe Dragonfly::ImageMagick::Processors::Thumb do let (:app) { test_imagemagick_app } let (:image) { Dragonfly::Content.new(app, SAMPLES_DIR.join("beach.png")) } # 280x355 let (:processor) { Dragonfly::ImageMagick::Processors::Thumb.new } it "raises an error if an u...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/dragonfly/image_magick/processors/encode_spec.rb
spec/dragonfly/image_magick/processors/encode_spec.rb
require "spec_helper" describe Dragonfly::ImageMagick::Processors::Encode do let (:app) { test_imagemagick_app } let (:image) { Dragonfly::Content.new(app, SAMPLES_DIR.join("beach.png")) } # 280x355 let (:processor) { Dragonfly::ImageMagick::Processors::Encode.new } it "encodes to a different format" do p...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/dragonfly/model/validations_spec.rb
spec/dragonfly/model/validations_spec.rb
require 'spec_helper' require 'dragonfly/model/validations' describe Dragonfly::Model::Validations do before(:each) do @app = test_app end describe "validates_presence_of" do before(:each) do @item_class = new_model_class('Item', :preview_image_uid) do dragonfly_accessor :preview_image ...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/dragonfly/model/active_record_spec.rb
spec/dragonfly/model/active_record_spec.rb
# jruby has problems with installing sqlite3 - don't bother with these tests for jruby unless RUBY_PLATFORM == "java" require "spec_helper" require "active_record" require "sqlite3" # ActiveRecord specific stuff goes here (there should be very little!) describe "ActiveRecord models" do let! :dragonfly_ap...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/dragonfly/model/model_spec.rb
spec/dragonfly/model/model_spec.rb
require 'spec_helper' # This spec is more of a functional spec for all of the model bits put together describe "models" do before do Dragonfly.app.use_datastore(:memory) end describe "using the module" do it "adds 'dragonfly_accessor'" do klass = Class.new do extend Dragonfly::Model ...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
true
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/dragonfly/core_ext/array_spec.rb
spec/dragonfly/core_ext/array_spec.rb
require 'spec_helper' describe Array do describe "to_dragonfly_unique_s" do it "should concatenate the to_s's of each of the elements" do [:a, true, 2, 5.2, "hello"].to_dragonfly_unique_s.should == 'atrue25.2hello' end it "should nest arrays" do [:a, [:b, :c], :d].to_dragonfly_unique_...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/dragonfly/core_ext/hash_spec.rb
spec/dragonfly/core_ext/hash_spec.rb
require 'spec_helper' describe Hash do describe "to_dragonfly_unique_s" do it "should concatenate the to_s's of each of the elements, sorted alphabetically" do {'z' => nil, :a => 4, false => 'ice', 5 => 6.2}.to_dragonfly_unique_s.should == '56.2a4falseicez' end it "should nest correctly" do ...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/dragonfly/job/fetch_file_spec.rb
spec/dragonfly/job/fetch_file_spec.rb
require 'spec_helper' describe Dragonfly::Job::FetchFile do let (:app) { test_app } let (:job) { Dragonfly::Job.new(app) } before(:each) do job.fetch_file!(SAMPLES_DIR.join('egg.png')) end it { job.steps.should match_steps([Dragonfly::Job::FetchFile]) } it "should fetch the specified file when appl...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/dragonfly/job/generate_spec.rb
spec/dragonfly/job/generate_spec.rb
require 'spec_helper' describe Dragonfly::Job::Generate do let (:app) { test_app } let (:job) { Dragonfly::Job.new(app) } before :each do app.add_generator(:plasma){} end it "adds a step" do job.generate!(:plasma, 20) job.steps.should match_steps([Dragonfly::Job::Generate]) end it "uses t...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/dragonfly/job/fetch_spec.rb
spec/dragonfly/job/fetch_spec.rb
require 'spec_helper' describe Dragonfly::Job::Fetch do let (:app) { test_app } let (:job) { Dragonfly::Job.new(app) } before(:each) do job.fetch!('some_uid') end it { job.steps.should match_steps([Dragonfly::Job::Fetch]) } it "should read from the app's datastore when applied" do app.datastore...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/dragonfly/job/fetch_url_spec.rb
spec/dragonfly/job/fetch_url_spec.rb
require 'spec_helper' require 'base64' describe Dragonfly::Job::FetchUrl do let (:app) { test_app } let (:job) { Dragonfly::Job.new(app) } before(:each) do stub_request(:get, %r{http://place\.com.*}).to_return(:body => 'result!') end it "adds a step" do job.fetch_url!('some.url') job.steps.sho...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/dragonfly/job/process_spec.rb
spec/dragonfly/job/process_spec.rb
require 'spec_helper' describe Dragonfly::Job::Process do let (:app) { test_app } let (:job) { Dragonfly::Job.new(app) } before :each do app.add_processor(:resize){} end it "adds a step" do job.process!(:resize, '20x30') job.steps.should match_steps([Dragonfly::Job::Process]) end it "shou...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/functional/urls_spec.rb
spec/functional/urls_spec.rb
require 'spec_helper' describe "urls" do def job_should_match(array) Dragonfly::Response.should_receive(:new).with( satisfy{|job| job.to_a == array }, instance_of(Hash) ).and_return(double('response', :to_response => [200, {'content-type' => 'text/plain'}, ["OK"]])) end let (:app) { tes...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/functional/to_response_spec.rb
spec/functional/to_response_spec.rb
require 'spec_helper' describe "getting rack response directly" do before(:each) do @app = test_app.configure do generator :test do |content| content.update("bunheads") end end end it "should give a rack response" do response = @app.generate(:test).to_response response.shoul...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/functional/configuration_spec.rb
spec/functional/configuration_spec.rb
require 'spec_helper' describe "configuration" do let (:app) { test_app } it "adds to fetch_file_whitelist" do app.configure do fetch_file_whitelist ['something'] end app.fetch_file_whitelist.should include 'something' end it "adds to fetch_url_whitelist" do app.configure do fetch...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/functional/remote_on_the_fly_spec.rb
spec/functional/remote_on_the_fly_spec.rb
require 'spec_helper' describe "remote on-the-fly urls" do before(:each) do @thumbs = thumbs = {} @app = test_app.configure do generator :test do |content| content.update("TEST") end before_serve do |job, env| uid = job.store(:path => 'yay.txt') thumbs[job.serialize...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/functional/model_urls_spec.rb
spec/functional/model_urls_spec.rb
require 'spec_helper' require 'tempfile' describe "model urls" do def new_tempfile(data='HELLO', filename='hello.txt') tempfile = Tempfile.new('test') tempfile.write(data) tempfile.rewind tempfile.stub(:original_filename).and_return(filename) tempfile end before(:each) do @app = test_ap...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/functional/shell_commands_spec.rb
spec/functional/shell_commands_spec.rb
require "spec_helper" describe "using the shell" do let (:app) { test_app } describe "shell injection" do it "should not allow it!" do app.configure_with(:imagemagick) begin app.generate(:plain, 10, 10, "white; touch tmp/stuff").apply rescue Dragonfly::Shell::CommandFailed end ...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/spec/functional/cleanup_spec.rb
spec/functional/cleanup_spec.rb
require 'spec_helper' describe "cleaning up tempfiles" do let (:app) { test_app.configure{ processor :copy do |content| content.shell_update do |old_path, new_path| "cp #{old_path} #{new_path}" end end } } it "unlinks tempfiles on each request" do expect { ...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly.rb
lib/dragonfly.rb
require 'rbconfig' require 'logger' require 'dragonfly/version' require 'dragonfly/core_ext/object' require 'dragonfly/core_ext/array' require 'dragonfly/core_ext/hash' require 'dragonfly/app' require 'dragonfly/image_magick/plugin' require 'dragonfly/file_data_store' require 'dragonfly/memory_data_store' require 'drag...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/rails/generators/dragonfly/dragonfly_generator.rb
lib/rails/generators/dragonfly/dragonfly_generator.rb
class DragonflyGenerator < Rails::Generators::Base source_root File.expand_path('../templates', __FILE__) def create_initializer template "initializer.rb.erb", "config/initializers/dragonfly.rb" end private def generate_secret SecureRandom.hex(32) end end
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/temp_object.rb
lib/dragonfly/temp_object.rb
require 'stringio' require 'tempfile' require 'pathname' require 'fileutils' module Dragonfly # A TempObject is used for HOLDING DATA. # It's the thing that is passed between the datastore and the processor, and is useful # for separating how the data was created and how it is later accessed. # # You can in...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/content.rb
lib/dragonfly/content.rb
require "base64" require "forwardable" require "dragonfly/has_filename" require "dragonfly/temp_object" require "dragonfly/utils" module Dragonfly # A Dragonfly::Content object is responsible for holding # 1. content (in the form of a data string, file, tempfile, or path) # 2. metadata about the content (i.e. n...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/file_data_store.rb
lib/dragonfly/file_data_store.rb
require 'pathname' require 'yaml' require 'fileutils' require 'dragonfly/utils' module Dragonfly class FileDataStore # Exceptions class BadUID < RuntimeError; end class UnableToFormUrl < RuntimeError; end class MetaStore def write(data_path, meta) File.open(meta_path(data_path), 'wb')...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/job_endpoint.rb
lib/dragonfly/job_endpoint.rb
require 'dragonfly/response' module Dragonfly class JobEndpoint def initialize(job) @job = job end def call(env={}) Response.new(job, env).to_response end attr_reader :job def inspect "<#{self.class.name} steps=#{job.steps} >" end end end
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/version.rb
lib/dragonfly/version.rb
module Dragonfly VERSION = "1.4.1" end
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/hash_with_css_style_keys.rb
lib/dragonfly/hash_with_css_style_keys.rb
module Dragonfly # HashWithCssStyleKeys is solely for being able to access a hash # which has css-style keys (e.g. 'font-size') with the underscore # symbol version # @example # opts = {'font-size' => '23px', :color => 'white'} # opts = HashWithCssStyleKeys[opts] # opts[:font_size] # ===> '23px...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/middleware.rb
lib/dragonfly/middleware.rb
require 'dragonfly' module Dragonfly class Middleware def initialize(app, dragonfly_app_name=nil) @app = app @dragonfly_app_name = dragonfly_app_name end def call(env) response = Dragonfly.app(@dragonfly_app_name).call(env) headers = response[1].transform_keys(&:downcase) ...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/utils.rb
lib/dragonfly/utils.rb
require 'tempfile' require 'uri' require 'rack' module Dragonfly module Utils module_function def blank?(obj) obj.respond_to?(:empty?) ? obj.empty? : !obj end def new_tempfile(ext=nil, content=nil) tempfile = ext ? Tempfile.new(['dragonfly', ".#{ext}"]) : Tempfile.new('dragonfly') ...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/response.rb
lib/dragonfly/response.rb
require 'cgi' require 'rack' module Dragonfly class Response def initialize(job, env) @job, @env = job, env @app = @job.app end def to_response response = begin if !(request.head? || request.get?) [405, method_not_allowed_headers, ["method not allowed"]] elsi...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/whitelist.rb
lib/dragonfly/whitelist.rb
require 'forwardable' module Dragonfly class Whitelist extend Forwardable def_delegators :patterns, :push def initialize(patterns=[]) @patterns = patterns end attr_reader :patterns def include?(string) patterns.any?{|pattern| pattern === string } end end end
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/url_mapper.rb
lib/dragonfly/url_mapper.rb
require 'rack' require 'dragonfly/utils' module Dragonfly class UrlMapper PATTERNS = { basename: '[^\/]', name: '[^\/]', ext: '[^\.]', format: '[^\.]', job: '[^\/\.]' } DEFAULT_PATTERN = '[^\/\-\.]' # Exceptions class BadUrlFormat < StandardError; end class Se...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/has_filename.rb
lib/dragonfly/has_filename.rb
module Dragonfly # Convenience methods for setting basename and extension # Including class needs to define a 'name' accessor # which is assumed to hold a filename-style string module HasFilename def basename File.basename(name, '.*') if name end def basename=(basename) self.na...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/railtie.rb
lib/dragonfly/railtie.rb
require 'dragonfly/cookie_monster' if defined?(Rails::Railtie) module Dragonfly class Railtie < ::Rails::Railtie initializer "dragonfly.railtie.initializer" do |app| app.middleware.insert 3, Dragonfly::CookieMonster end end end end
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/routed_endpoint.rb
lib/dragonfly/routed_endpoint.rb
require 'rack' require 'dragonfly/utils' require 'dragonfly/response' module Dragonfly class RoutedEndpoint class NoRoutingParams < RuntimeError; end def initialize(app, &block) @app = app @block = block end def call(env) params = Utils.symbolize_keys Rack::Request.new(env).param...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/memory_data_store.rb
lib/dragonfly/memory_data_store.rb
module Dragonfly class MemoryDataStore def initialize @content_store = {} end def write(content, opts={}) uid = opts[:uid] || generate_uid content_store[uid] = {:content => content.data, :meta => content.meta.dup} uid end def read(uid) data = content_store[uid] ...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/app.rb
lib/dragonfly/app.rb
require 'forwardable' require 'rack' require 'dragonfly/register' require 'dragonfly/server' require 'dragonfly/shell' require 'dragonfly/configurable' require 'dragonfly/file_data_store' require 'dragonfly/routed_endpoint' require 'dragonfly/job_endpoint' require 'dragonfly/job' module Dragonfly class App # Ex...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/serializer.rb
lib/dragonfly/serializer.rb
# encoding: utf-8 require 'base64' require 'multi_json' require 'dragonfly/utils' module Dragonfly module Serializer # Exceptions class BadString < RuntimeError; end class MaliciousString < RuntimeError; end extend self # So we can do Serializer.b64_encode, etc. def b64_encode(string) Ba...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/url_attributes.rb
lib/dragonfly/url_attributes.rb
require 'ostruct' require 'dragonfly/has_filename' require 'dragonfly/utils' module Dragonfly class UrlAttributes < OpenStruct include HasFilename # Updating ext / basename also updates the name def empty? @table.reject{|k, v| v.nil? }.empty? end # Hack so we can use .send('format') and it no...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/shell.rb
lib/dragonfly/shell.rb
require 'shellwords' require 'open3' require 'dragonfly' module Dragonfly class Shell # Exceptions class CommandFailed < RuntimeError; end def run(command, opts={}) command = escape_args(command) unless opts[:escape] == false Dragonfly.debug("shell command: #{command}") run_command(co...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/server.rb
lib/dragonfly/server.rb
require 'forwardable' require 'dragonfly/whitelist' require 'dragonfly/url_mapper' require 'dragonfly/job' require 'dragonfly/response' require 'dragonfly/serializer' module Dragonfly class Server # Exceptions class JobNotAllowed < RuntimeError; end extend Forwardable def_delegator :url_mapper, :pa...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/cookie_monster.rb
lib/dragonfly/cookie_monster.rb
module Dragonfly class CookieMonster def initialize(app) @app = app end def call(env) status, headers, body = @app.call(env) headers.delete('Set-Cookie') if env['dragonfly.job'] [status, headers, body] end end end
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/job.rb
lib/dragonfly/job.rb
require 'forwardable' require 'digest/sha1' require 'dragonfly/serializer' require 'dragonfly/content' require 'dragonfly/url_attributes' require 'dragonfly/job_endpoint' module Dragonfly class Job # Exceptions class AppDoesNotMatch < StandardError; end class JobAlreadyApplied < StandardError; end c...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/configurable.rb
lib/dragonfly/configurable.rb
module Dragonfly module Configurable # Exceptions class UnregisteredPlugin < RuntimeError; end class Configurer class << self private def writer(*args) names, opts = extract_options(args) names.each do |name| define_method name do |value| ...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/model.rb
lib/dragonfly/model.rb
require 'dragonfly/model/instance_methods' require 'dragonfly/model/class_methods' module Dragonfly module Model def self.extended(klass) unless klass.include?(InstanceMethods) klass.extend(ClassMethods) klass.class_eval{ include InstanceMethods } end end end end
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/param_validators.rb
lib/dragonfly/param_validators.rb
module Dragonfly module ParamValidators class InvalidParameter < RuntimeError; end module_function IS_NUMBER = ->(param) { param.is_a?(Numeric) || /\A[\d\.]+\z/ === param } IS_WORD = ->(param) { /\A\w+\z/ === param } IS_WORDS = ->(param) { /\A[\w ]+\z/ === param }...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/register.rb
lib/dragonfly/register.rb
module Dragonfly class Register # Exceptions class NotFound < RuntimeError; end def initialize @items = {} end attr_reader :items def add(name, item=nil, &block) items[name.to_sym] = item || block || raise(ArgumentError, "you must give either an argument or a block") end ...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/image_magick/plugin.rb
lib/dragonfly/image_magick/plugin.rb
require "dragonfly/image_magick/analysers/image_properties" require "dragonfly/image_magick/generators/plain" require "dragonfly/image_magick/generators/plasma" require "dragonfly/image_magick/generators/text" require "dragonfly/image_magick/processors/encode" require "dragonfly/image_magick/processors/thumb" require "...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/image_magick/commands.rb
lib/dragonfly/image_magick/commands.rb
module Dragonfly module ImageMagick module Commands module_function def convert(content, args = "", opts = {}) convert_command = content.env[:convert_command] || "convert" format = opts["format"] input_args = opts["input_args"] if opts["input_args"] delegate_string = ...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/image_magick/generators/plain.rb
lib/dragonfly/image_magick/generators/plain.rb
require "dragonfly/image_magick/commands" require "dragonfly/param_validators" module Dragonfly module ImageMagick module Generators class Plain include ParamValidators def call(content, width, height, opts = {}) validate_all!([width, height], &is_number) validate_all_k...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/image_magick/generators/text.rb
lib/dragonfly/image_magick/generators/text.rb
require "dragonfly/hash_with_css_style_keys" require "dragonfly/image_magick/commands" require "dragonfly/param_validators" module Dragonfly module ImageMagick module Generators class Text include ParamValidators FONT_STYLES = { "normal" => "normal", "italic" => "italic...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/image_magick/generators/plasma.rb
lib/dragonfly/image_magick/generators/plasma.rb
require "dragonfly/image_magick/commands" module Dragonfly module ImageMagick module Generators class Plasma include ParamValidators def call(content, width, height, opts = {}) validate_all!([width, height], &is_number) validate!(opts["format"], &is_word) form...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/image_magick/analysers/image_properties.rb
lib/dragonfly/image_magick/analysers/image_properties.rb
module Dragonfly module ImageMagick module Analysers class ImageProperties def call(content) identify_command = content.env[:identify_command] || 'identify' details = content.shell_eval do |path| "#{identify_command} -ping -format '%m %w %h' #{path}" end ...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/image_magick/processors/thumb.rb
lib/dragonfly/image_magick/processors/thumb.rb
require "dragonfly/image_magick/commands" module Dragonfly module ImageMagick module Processors class Thumb include ParamValidators GRAVITIES = { "nw" => "NorthWest", "n" => "North", "ne" => "NorthEast", "w" => "West", "c" => "Center", ...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/image_magick/processors/encode.rb
lib/dragonfly/image_magick/processors/encode.rb
require "dragonfly/image_magick/commands" module Dragonfly module ImageMagick module Processors class Encode include ParamValidators WHITELISTED_ARGS = %w(quality) IS_IN_WHITELISTED_ARGS = ->(args_string) { args_string.scan(/-\w+/).all? { |arg| WHITELISTED_AR...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/model/attachment_class_methods.rb
lib/dragonfly/model/attachment_class_methods.rb
module Dragonfly module Model class Attachment class << self class ConfigProxy def initialize(spec, block) @spec = spec instance_eval(&block) end private attr_reader :spec def after_assign(*callbacks, &block) ...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/model/class_methods.rb
lib/dragonfly/model/class_methods.rb
require 'dragonfly' require 'dragonfly/serializer' require 'dragonfly/utils' require 'dragonfly/model/attachment' module Dragonfly module Model module ClassMethods def dragonfly_attachment_classes @dragonfly_attachment_classes ||= begin parent_class = ancestors.select{|a| a.is_a?(Class) ...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/model/validations.rb
lib/dragonfly/model/validations.rb
require 'active_model/validator' module Dragonfly module Model module Validations class PropertyValidator < ActiveModel::EachValidator def validate_each(model, attribute, attachment) if attachment property = attachment.send(property_name) model.errors.add(attribu...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/model/instance_methods.rb
lib/dragonfly/model/instance_methods.rb
module Dragonfly module Model module InstanceMethods def dragonfly_attachments @dragonfly_attachments ||= self.class.dragonfly_attachment_classes.inject({}) do |hash, klass| hash[klass.attribute] = klass.new(self) hash end end private def ...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/model/attachment.rb
lib/dragonfly/model/attachment.rb
require 'forwardable' require 'dragonfly/has_filename' require 'dragonfly/job' require 'dragonfly/model/attachment_class_methods' module Dragonfly module Model class Attachment # Exceptions class BadAssignmentKey < RuntimeError; end extend Forwardable def_delegators :job, :to_fi...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/rails/images.rb
lib/dragonfly/rails/images.rb
raise LoadError, "\n*****\ndragonfly/rails/images no longer exists! Please use the rails generator instead\n\n\trails generate dragonfly\n\nsee the documentation at http://markevans.github.io/dragonfly/rails for more details\n*****\n"
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/core_ext/array.rb
lib/dragonfly/core_ext/array.rb
class Array def to_dragonfly_unique_s map{|item| item.to_dragonfly_unique_s }.join end end
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/core_ext/object.rb
lib/dragonfly/core_ext/object.rb
class Object def to_dragonfly_unique_s to_s end end
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/core_ext/hash.rb
lib/dragonfly/core_ext/hash.rb
class Hash def to_dragonfly_unique_s sort_by{|k, v| k.to_dragonfly_unique_s }.to_dragonfly_unique_s end end
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/spec/data_store_examples.rb
lib/dragonfly/spec/data_store_examples.rb
require 'dragonfly/content' shared_examples_for "data_store" do # Using these shared spec requires you to set the inst var @data_store let (:app) { Dragonfly.app } let (:content) { Dragonfly::Content.new(app, "gollum") } let (:content2) { Dragonfly::Content.new(app, "gollum") } describe "write" do it ...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/job/generate.rb
lib/dragonfly/job/generate.rb
require 'dragonfly/job/step' module Dragonfly class Job class Generate < Step def init generator.update_url(job.url_attributes, *arguments) if generator.respond_to?(:update_url) end def name args.first end def generator @generator ||= app.get_generator(name...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/job/fetch_file.rb
lib/dragonfly/job/fetch_file.rb
require 'pathname' require 'dragonfly/job/step' module Dragonfly class Job class FetchFile < Step def initialize(job, path) super(job, path.to_s) end def init job.url_attributes.name = filename end def path @path ||= File.expand_path(args.first) end ...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/job/step.rb
lib/dragonfly/job/step.rb
module Dragonfly class Job class Step class << self # Dragonfly::Job::Fetch -> 'Fetch' def basename @basename ||= name.split('::').last end # Dragonfly::Job::Fetch -> :fetch def step_name @step_name ||= basename.gsub(/[A-Z]/){ "_#{$&.downcase}" }....
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/job/process.rb
lib/dragonfly/job/process.rb
require 'dragonfly/job/step' module Dragonfly class Job class Process < Step def init processor.update_url(job.url_attributes, *arguments) if processor.respond_to?(:update_url) end def name args.first.to_sym end def arguments args[1..-1] end de...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/job/fetch.rb
lib/dragonfly/job/fetch.rb
require 'dragonfly/job/step' module Dragonfly class Job class Fetch < Step class NotFound < RuntimeError; end def uid args.first end def apply content, meta = app.datastore.read(uid) raise NotFound, "uid #{uid} not found" if content.nil? job.content.updat...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
markevans/dragonfly
https://github.com/markevans/dragonfly/blob/ddede200b093ebe09467128bff071b40ad85e382/lib/dragonfly/job/fetch_url.rb
lib/dragonfly/job/fetch_url.rb
require 'uri' require 'net/http' require 'base64' require 'dragonfly/job/step' require 'addressable/uri' module Dragonfly class Job class FetchUrl < Step class ErrorResponse < RuntimeError def initialize(status, body) @status, @body = status, body end attr_reader :status,...
ruby
MIT
ddede200b093ebe09467128bff071b40ad85e382
2026-01-04T15:58:00.805242Z
false
david942j/one_gadget
https://github.com/david942j/one_gadget/blob/52090b903b83497e07b26b02c82850770647bbb9/spec/helper_spec.rb
spec/helper_spec.rb
# frozen_string_literal: true require 'one_gadget/helper' describe OneGadget::Helper do before(:all) do @libcpath = data_path('libc-2.23-60131540dadc6796cab33388349e6e4e68692053.so') end it 'abspath' do expect(described_class.abspath('./spec/data/libc-2.23-60131540dadc6796cab33388349e6e4e68692053.so'))...
ruby
MIT
52090b903b83497e07b26b02c82850770647bbb9
2026-01-04T15:56:48.526779Z
false
david942j/one_gadget
https://github.com/david942j/one_gadget/blob/52090b903b83497e07b26b02c82850770647bbb9/spec/update_spec.rb
spec/update_spec.rb
# frozen_string_literal: true require 'logger' require 'tmpdir' require 'one_gadget/update' require 'one_gadget/version' describe OneGadget::Update do before(:all) do @tmpdir = File.join(Dir.tmpdir, 'one_gadget') FileUtils.mkdir_p(@tmpdir) # prevent failing on CI @hook_cache_file = lambda do |&bloc...
ruby
MIT
52090b903b83497e07b26b02c82850770647bbb9
2026-01-04T15:56:48.526779Z
false
david942j/one_gadget
https://github.com/david942j/one_gadget/blob/52090b903b83497e07b26b02c82850770647bbb9/spec/gadget_spec.rb
spec/gadget_spec.rb
# frozen_string_literal: true require 'tempfile' require 'one_gadget/gadget' require 'one_gadget/helper' describe OneGadget::Gadget do context 'inspect' do it 'simple' do gadget = OneGadget::Gadget::Gadget.new(0x1234, constraints: ['[rsp+0x30] == NULL', 'rax == 0'], ...
ruby
MIT
52090b903b83497e07b26b02c82850770647bbb9
2026-01-04T15:56:48.526779Z
false
david942j/one_gadget
https://github.com/david942j/one_gadget/blob/52090b903b83497e07b26b02c82850770647bbb9/spec/cli_spec.rb
spec/cli_spec.rb
# frozen_string_literal: true require 'one_gadget/cli' require 'one_gadget/version' describe OneGadget::CLI do let(:b_param) { %w[-b b417c0ba7cc5cf06d1d1bed6652cedb9253c60d0] } let(:libc_file) { data_path('libc-2.27-b417c0ba7cc5cf06d1d1bed6652cedb9253c60d0.so') } it 'version' do expect { described_class.wo...
ruby
MIT
52090b903b83497e07b26b02c82850770647bbb9
2026-01-04T15:56:48.526779Z
false
david942j/one_gadget
https://github.com/david942j/one_gadget/blob/52090b903b83497e07b26b02c82850770647bbb9/spec/one_gadget_amd64_spec.rb
spec/one_gadget_amd64_spec.rb
# frozen_string_literal: true require 'one_gadget' require 'one_gadget/error' describe 'one_gadget_amd64' do describe 'from file' do before(:each) do skip_unless_objdump end it 'libc-2.19' do path = data_path('libc-2.19-cf699a15caae64f50311fc4655b86dc39a479789.so') expect(OneGadget.ga...
ruby
MIT
52090b903b83497e07b26b02c82850770647bbb9
2026-01-04T15:56:48.526779Z
false
david942j/one_gadget
https://github.com/david942j/one_gadget/blob/52090b903b83497e07b26b02c82850770647bbb9/spec/bin_spec.rb
spec/bin_spec.rb
# frozen_string_literal: true describe 'Binary' do before(:all) do @bin = File.join(__dir__, '..', 'bin', 'one_gadget') @lib = File.join(__dir__, '..', 'lib') end it 'help' do expect(`env ruby -I#{@lib} #{@bin}`).to eq <<-EOS Usage: one_gadget <FILE|-b BuildID> [options] -b, --build-id BuildID ...
ruby
MIT
52090b903b83497e07b26b02c82850770647bbb9
2026-01-04T15:56:48.526779Z
false
david942j/one_gadget
https://github.com/david942j/one_gadget/blob/52090b903b83497e07b26b02c82850770647bbb9/spec/one_gadget_i386_spec.rb
spec/one_gadget_i386_spec.rb
# frozen_string_literal: true require 'one_gadget' describe 'one_gadget_i386' do describe 'from file' do before(:each) do skip_unless_objdump end it 'libc-2.19' do path = data_path('libc-2.19-fd51b20e670e9a9f60dc3b06dc9761fb08c9358b.so') expect(OneGadget.gadgets(file: path, ...
ruby
MIT
52090b903b83497e07b26b02c82850770647bbb9
2026-01-04T15:56:48.526779Z
false