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
kernow/shortcode
https://github.com/kernow/shortcode
spec/support/presenters/multiple_presenter.rb
Ruby
mit
214
master
320
class MultiplePresenter def self.for %i[quote item] end def initialize(_attributes, content, additional_attributes) @content = content @additional_attributes = additional_attributes end attr_reader :content def attributes @additional_attributes || { title: "my custom title" } end end
github
kernow/shortcode
https://github.com/kernow/shortcode
spec/support/presenters/my_presenter.rb
Ruby
mit
214
master
306
class MyPresenter def self.for :quote end def initialize(_attributes, content, additional_attributes) @content = content @additional_attributes = additional_attributes end attr_reader :content def attributes @additional_attributes || { title: "my custom title" } end end
github
kernow/shortcode
https://github.com/kernow/shortcode
spec/support/presenters/other_presenter.rb
Ruby
mit
214
master
309
class OtherPresenter def self.for :other end def initialize(_attributes, content, additional_attributes) @content = content @additional_attributes = additional_attributes end attr_reader :content def attributes @additional_attributes || { title: "my custom title" } end end
github
kernow/shortcode
https://github.com/kernow/shortcode
spec/support/presenters/child_missing_initialize_presenter.rb
Ruby
mit
214
master
208
require "support/presenters/parent_missing_initialize_presenter" class ChildMissingInitializePresenter < ParentMissingInitializePresenter def self.for; end def content; end def attributes; end end
github
kernow/shortcode
https://github.com/kernow/shortcode
spec/shortcode/parser_spec.rb
Ruby
mit
214
master
11,438
# rubocop:disable Lint/MissingCopEnableDirective, RSpec/ExampleLength require "spec_helper" require "parslet/rig/rspec" require "pp" describe Shortcode::Parser do let(:configuration) { Shortcode.new.configuration } let(:parser) { described_class.new(configuration) } let(:simple_quote) { load_fixture :simp...
github
kernow/shortcode
https://github.com/kernow/shortcode
spec/shortcode/presenter_spec.rb
Ruby
mit
214
master
4,872
require "spec_helper" require "parslet/rig/rspec" require "pp" require "support/presenters/my_presenter" require "support/presenters/other_presenter" require "support/presenters/multiple_presenter" require "support/presenters/missing_for_presenter" require "support/presenters/missing_initialize_presenter" require "sup...
github
kernow/shortcode
https://github.com/kernow/shortcode
spec/shortcode/tag_spec.rb
Ruby
mit
214
master
2,287
require "spec_helper" describe Shortcode::Tag do let(:configuration) { Shortcode.new.tap { |s| s.setup do |config| config.template_path = File.join File.dirname(__FILE__), "../support/templates/erb" end }.configuration } context "when the template file is missing" do let(:tag) { ...
github
kernow/shortcode
https://github.com/kernow/shortcode
lib/shortcode.rb
Ruby
mit
214
master
963
require "parslet" require "erb" # rubocop:disable Lint/HandleExceptions begin require "haml" rescue LoadError; end begin require "slim" rescue LoadError; end # rubocop:enable Lint/HandleExceptions class Shortcode def process(string, additional_attributes=nil) Shortcode::Processor.new.process(string, config...
github
kernow/shortcode
https://github.com/kernow/shortcode
lib/shortcode/transformer.rb
Ruby
mit
214
master
1,084
class Shortcode::Transformer def initialize(configuration) @configuration = configuration setup_rules end def apply(str, options={}) klass_instance.apply(str, options) end private def klass @klass ||= Class.new(Parslet::Transform) end def klass_instance @klass_instance ||= klass...
github
kernow/shortcode
https://github.com/kernow/shortcode
lib/shortcode/tag.rb
Ruby
mit
214
master
1,962
class Shortcode::Tag def initialize(name, configuration, attributes=[], content="", additional_attributes=nil) @name = name.downcase @configuration = configuration @binding = Shortcode::TemplateBinding.new(@name, @configuration, ...
github
kernow/shortcode
https://github.com/kernow/shortcode
lib/shortcode/configuration.rb
Ruby
mit
214
master
1,867
class Shortcode::Configuration # Sets the template parser to use, supports :erb, :haml, and :slim, default is :haml attr_accessor :template_parser # Sets the path to search for template files attr_accessor :template_path # Allows templates to be set from strings rather than read from the filesystem attr_...
github
kernow/shortcode
https://github.com/kernow/shortcode
lib/shortcode/presenter.rb
Ruby
mit
214
master
1,478
class Shortcode::Presenter def self.register(configuration, presenter) validate presenter [*presenter.for].each { |k| configuration.presenters[k.to_sym] = presenter } end def self.validate(presenter) raise ArgumentError, "The presenter must define the class method #for" unless presenter.respond_to?(...
github
kernow/shortcode
https://github.com/kernow/shortcode
lib/shortcode/template_binding.rb
Ruby
mit
214
master
1,014
class Shortcode::TemplateBinding def initialize(name, configuration, attributes=[], content="", additional_attributes=nil) @configuration = configuration include_helper_modules presenter = Shortcode::Presenter.new name, configuration, ...
github
kernow/shortcode
https://github.com/kernow/shortcode
lib/shortcode/parser.rb
Ruby
mit
214
master
2,666
class Shortcode::Parser def initialize(configuration) @configuration = configuration setup_rules end def parse(string) klass_instance.parse(string) end def open(*args) klass_instance.open(*args) end private # This allows us to create a new class with the rules for the specific confi...
github
kernow/shortcode
https://github.com/kernow/shortcode
lib/shortcode/exceptions.rb
Ruby
mit
214
master
241
class Shortcode # Raised when the template file can not be found class TemplateNotFound < StandardError; end # Raised when the template renderer specified is not supported class TemplateParserNotSupported < StandardError; end end
github
kernow/shortcode
https://github.com/kernow/shortcode
lib/shortcode/processor.rb
Ruby
mit
214
master
461
class Shortcode::Processor def process(string, configuration, additional_attributes=nil) transformer(configuration).apply parser(configuration).parse(string), additional_attributes: additional_attributes end private def parser(configuration) @parser ||= Shortcode:...
github
hybridgroup/taskmapper
https://github.com/hybridgroup/taskmapper
taskmapper.gemspec
Ruby
mit
214
master
1,159
# -*- encoding: utf-8 -*- require File.expand_path '../lib/taskmapper/version', __FILE__ Gem::Specification.new do |spec| spec.name = "taskmapper" spec.version = TaskMapper::VERSION spec.authors = ["www.hybridgroup.com"] spec.email = ["info@hybridgroup.com"] spec.description = ...
github
hybridgroup/taskmapper
https://github.com/hybridgroup/taskmapper
Rakefile
Ruby
mit
214
master
399
require 'bundler' require 'rspec/core/rake_task' require 'rdoc/task' task :default => :spec RSpec::Core::RakeTask.new :spec Bundler::GemHelper.install_tasks Rake::RDocTask.new do |rdoc| version = File.exist?('VERSION') ? File.read('VERSION') : "" rdoc.rdoc_dir = 'rdoc' rdoc.title = "taskmapper#{version}" r...
github
hybridgroup/taskmapper
https://github.com/hybridgroup/taskmapper
examples/tm_example_4.rb
Ruby
mit
214
master
436
require 'rubygems' require 'taskmapper' require 'taskmapper-pivotal' require 'taskmapper-lighthouse' # copy all tickets and comments from pivotal tracker to new lighthouse project (the easy way) pivotal = TaskMapper.new :pivotal lighthouse = TaskMapper.new :lighthouse from = pivotal.project 97107 to = lighthouse.proj...
github
hybridgroup/taskmapper
https://github.com/hybridgroup/taskmapper
examples/tm_example.rb
Ruby
mit
214
master
208
require 'rubygems' require 'taskmapper' require 'taskmapper-lighthouse' # display list of projects tm = TaskMapper.new :lighthouse tm.projects.each do |project| puts "#{project.id} - #{project.name}" end
github
hybridgroup/taskmapper
https://github.com/hybridgroup/taskmapper
examples/tm_example_3.rb
Ruby
mit
214
master
648
require 'rubygems' require 'taskmapper' require 'taskmapper-pivotal' require 'taskmapper-lighthouse' # copy all tickets and comments from pivotal tracker to new lighthouse project (the hard way) pivotal = TaskMapper.new :pivotal lighthouse = TaskMapper.new :lighthouse from = pivotal.project 97107 to = lighthouse.pro...
github
hybridgroup/taskmapper
https://github.com/hybridgroup/taskmapper
examples/tm_example_2.rb
Ruby
mit
214
master
248
require 'rubygems' require 'taskmapper' require 'taskmapper-pivotal' # display list of tickets for last project tm = TaskMapper.new :pivotal project = tm.projects.last project.tickets.each do |ticket| puts "#{ticket.id} - #{ticket.title}" end
github
hybridgroup/taskmapper
https://github.com/hybridgroup/taskmapper
spec/taskmapper-exception_spec.rb
Ruby
mit
214
master
7,833
$LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require File.expand_path(File.dirname(__FILE__) + '/spec_helper') require 'rubygems' require 'taskmapper' describe "TaskMapper Exception Messages" do let(:exception) { TaskMapper::Exception } let(:tm) { Ta...
github
hybridgroup/taskmapper
https://github.com/hybridgroup/taskmapper
spec/spec_helper.rb
Ruby
mit
214
master
249
$LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require 'taskmapper.rb' require 'taskmapper/dummy/dummy.rb' require 'rspec' RSpec.configure do |config| config.color_enabled = true end
github
hybridgroup/taskmapper
https://github.com/hybridgroup/taskmapper
spec/ticket_spec.rb
Ruby
mit
214
master
2,008
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') # This can also act as an example test or test skeleton for your provider. # Just replace the Dummy in @project_class and @ticket_class # Also, remember to mock or stub any API calls describe "Tickets" do let(:tm) { TaskMapper.new(:dummy, {}) } let(...
github
hybridgroup/taskmapper
https://github.com/hybridgroup/taskmapper
spec/project_spec.rb
Ruby
mit
214
master
3,784
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') # This can also act as an example test or test skeleton for your provider. # Just replace the Dummy in @project_class and @ticket_class # Also, remember to mock or stub any API calls describe "Projects" do let(:tm) { TaskMapper.new(:dummy, {}) } let...
github
hybridgroup/taskmapper
https://github.com/hybridgroup/taskmapper
spec/taskmapper_spec.rb
Ruby
mit
214
master
506
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') # This can also act as an example test or test skeleton for your provider. # Just replace the Dummy in @project_class and @ticket_class # Also, remember to mock or stub any API calls describe TaskMapper do describe "#new" do it "returns a TaskMapp...
github
hybridgroup/taskmapper
https://github.com/hybridgroup/taskmapper
lib/taskmapper.rb
Ruby
mit
214
master
1,553
%w{ rubygems hashie active_resource }.each {|lib| require lib } %w{ common helper project ticket comment authenticator provider exception dummy/dummy.rb tester/tester.rb version }.each {|lib| require File.dirname(__FILE__) + '/taskmapper/' + lib } # This is the TaskMapper class class TaskM...
github
hybridgroup/taskmapper
https://github.com/hybridgroup/taskmapper
lib/taskmapper/comment.rb
Ruby
mit
214
master
4,517
module TaskMapper::Provider module Base # The comment class # # This will probably one of the most troublesome parts of creating a provider for taskmapper # since there are so many different ways comments are handled by different APIs. # Keep in mind that if you do need to change/overwrite the met...
github
hybridgroup/taskmapper
https://github.com/hybridgroup/taskmapper
lib/taskmapper/project.rb
Ruby
mit
214
master
5,415
module TaskMapper::Provider module Base # This is the base Project class for providers # # Providers should inherit this class and redefine the methods # # Each provider should have their own @system defined. # For example, taskmapper-unfuddle's @system is :unfuddle and taskmapper-lighthouse's...
github
hybridgroup/taskmapper
https://github.com/hybridgroup/taskmapper
lib/taskmapper/ticket.rb
Ruby
mit
214
master
6,033
module TaskMapper::Provider module Base # The base ticket class for taskmapper # All providers should inherit this class # # The difference between the class methods and instance methods are that the instance # methods should be treated as though they are called on a known ticket and the class ...
github
hybridgroup/taskmapper
https://github.com/hybridgroup/taskmapper
lib/taskmapper/provider.rb
Ruby
mit
214
master
3,177
# This is the TaskMapper::Provider Module # # All provider classes will extend into this module. # See the Dummy provider's code for some specifics on implementing a provider # # Currently, only Projects and Tickets are standardized in ticket master. Therefore, # if your provider has other types--such as People/Members...
github
hybridgroup/taskmapper
https://github.com/hybridgroup/taskmapper
lib/taskmapper/common.rb
Ruby
mit
214
master
2,784
module TaskMapper::Provider # Common module # contains method definitions common to all or most of the models module Common module ClassMethods # Create a something. # Basically, a .new and .save in the same call. The default method assumes it is passed a # single hash with attribute...
github
hybridgroup/taskmapper
https://github.com/hybridgroup/taskmapper
lib/taskmapper/helper.rb
Ruby
mit
214
master
2,318
module TaskMapper::Provider # Contains a series of helper methods module Helper # Current method name reflection # http://www.ruby-forum.com/topic/75258#895630 # Call when raising 'implemented by the provider' exceptions def this_method caller[0][/`([^']*)'/, 1] end # A helper method...
github
hybridgroup/taskmapper
https://github.com/hybridgroup/taskmapper
lib/taskmapper/tester/project.rb
Ruby
mit
214
master
789
module TaskMapper::Provider module Tester # This is the Project class for the Tester provider class Project < TaskMapper::Provider::Base::Project # You should define @system and @system_data here. # The data stuff is just to initialize fake data. In a real provider, you would use the API # t...
github
hybridgroup/taskmapper
https://github.com/hybridgroup/taskmapper
lib/taskmapper/tester/tester.rb
Ruby
mit
214
master
1,062
module TaskMapper::Provider # This is the Tester Provider # # It doesn't really do anything, it exists in order to test the basic functionality of taskmapper # and to provide an example the basics of what is to be expected from the providers. # # Note that the initial provider name is a module rather than a...
github
hybridgroup/taskmapper
https://github.com/hybridgroup/taskmapper
lib/taskmapper/tester/ticket.rb
Ruby
mit
214
master
860
module TaskMapper::Provider module Tester # The Tester Provider's Ticket class class Ticket < TaskMapper::Provider::Base::Ticket @system = :tester # You don't need to define an initializer, this is only here to initialize tester data def initialize(project_id, *options) data = { ...
github
hybridgroup/taskmapper
https://github.com/hybridgroup/taskmapper
lib/taskmapper/tester/comment.rb
Ruby
mit
214
master
826
module TaskMapper::Provider module Tester # This is the Comment class for the Tester provider class Comment < TaskMapper::Provider::Base::Comment # You don't need to define an initializer, this is only here to initialize tester data def initialize(project_id, ticket_id, *options) data = { ...
github
hybridgroup/taskmapper
https://github.com/hybridgroup/taskmapper
lib/taskmapper/dummy/dummy.rb
Ruby
mit
214
master
1,056
module TaskMapper::Provider # This is the Dummy Provider # # It doesn't really do anything, it exists in order to test the basic functionality of taskmapper # and to provide an example the basics of what is to be expected from the providers. # # Note that the initial provider name is a module rather than a ...
github
hybridgroup/taskmapper
https://github.com/hybridgroup/taskmapper
lib/taskmapper/dummy/comment.rb
Ruby
mit
214
master
977
module TaskMapper::Provider module Dummy # This is the Comment class for the Dummy provider class Comment < TaskMapper::Provider::Base::Comment def self.find_by_id(id) self.new({:id => id}) end def self.find_by_attributes(*options) [self.new(*options)] end # You...
github
hybridgroup/taskmapper
https://github.com/hybridgroup/taskmapper
lib/taskmapper/dummy/project.rb
Ruby
mit
214
master
1,368
module TaskMapper::Provider module Dummy # This is the Project class for the Dummy provider class Project < TaskMapper::Provider::Base::Project def self.find_by_id(id) self.new({:id => id}) end def self.find_by_attributes(*options) [self.new(*options)] end def s...
github
hybridgroup/taskmapper
https://github.com/hybridgroup/taskmapper
lib/taskmapper/dummy/ticket.rb
Ruby
mit
214
master
1,507
module TaskMapper::Provider module Dummy # The Dummy Provider's Ticket class class Ticket < TaskMapper::Provider::Base::Ticket @system = :dummy def self.find_by_id(project_id, ticket_id) self.new(project_id, {:id => ticket_id}) end def self.find_by_attributes(*ticket_attribut...
github
fcoury/octopi
https://github.com/fcoury/octopi
Rakefile
Ruby
mit
213
master
304
require 'rubygems' require 'rake' require 'bundler' Bundler::GemHelper.install_tasks require 'rake/testtask' Rake::TestTask.new(:test) do |test| test.libs << 'lib' << 'test' test.libs << File.dirname(__FILE__) test.pattern = 'test/**/*_test.rb' test.verbose = false end task :default => :test
github
fcoury/octopi
https://github.com/fcoury/octopi
octopi.gemspec
Ruby
mit
213
master
1,013
# -*- encoding: utf-8 -*- $:.push File.expand_path("../lib", __FILE__) require "octopi/version" Gem::Specification.new do |s| s.name = "octopi" s.version = Octopi::VERSION s.platform = Gem::Platform::RUBY s.authors = ["Felipe Coury", "Ryan Bigg"] s.email = ["felipe.coury@gmail.com", "...
github
fcoury/octopi
https://github.com/fcoury/octopi
examples/issues.rb
Ruby
mit
213
master
573
require File.join(File.dirname(__FILE__), '..', 'lib', 'octopi') include Octopi user = User.find("fcoury") puts user.name repo = user.repository("octopi") puts repo.description issue = Issue.find_all(user.login, repo.name).first puts "First open issue: #{issue.number} - #{issue.title} - Created at: #{issue.created_...
github
fcoury/octopi
https://github.com/fcoury/octopi
examples/authenticated.rb
Ruby
mit
213
master
615
require File.join(File.dirname(__FILE__), '..', 'lib', 'octopi') include Octopi authenticated :trace => "curl" do |g| repo = g.repository("api-labrat") issue = repo.open_issue :title => "Sample issue", :body => "This issue was opened using GitHub API and Octopi" puts "Successfully opened issue \##{issue...
github
fcoury/octopi
https://github.com/fcoury/octopi
examples/overall.rb
Ruby
mit
213
master
1,572
require File.join(File.dirname(__FILE__), '..', 'lib', 'octopi') include Octopi # user information user = User.find("fcoury") puts "#{user.name} is being followed by #{user.followers.join(", ")} and following #{user.following.join(", ")}" # the bang version of followers and following # fetches user object for each ...
github
fcoury/octopi
https://github.com/fcoury/octopi
test/branch_test.rb
Ruby
mit
213
master
463
require File.join(File.dirname(__FILE__), 'test_helper') class BranchTest < Test::Unit::TestCase include Octopi def setup fake_everything end context Branch do should "Find all branches for a repository" do assert_not_nil Branch.all(:user => "fcoury", :name => "octopi") end shoul...
github
fcoury/octopi
https://github.com/fcoury/octopi
test/repository_test.rb
Ruby
mit
213
master
4,778
require File.join(File.dirname(__FILE__), 'test_helper') class RepositoryTest < Test::Unit::TestCase include Octopi def setup fake_everything @user = User.find("fcoury") @private_repos = auth do @private = @user.repositories.find("rboard") @user.repositories end @repository = @us...
github
fcoury/octopi
https://github.com/fcoury/octopi
test/tag_test.rb
Ruby
mit
213
master
438
# Tests for octopi core functionality go here. require File.join(File.dirname(__FILE__), 'test_helper') class TagTest < Test::Unit::TestCase include Octopi def setup fake_everything end context Tag do should "be able to find all tags" do tags = Tag.all(:user => "fcoury", :repository => "oct...
github
fcoury/octopi
https://github.com/fcoury/octopi
test/blob_test.rb
Ruby
mit
213
master
674
require File.join(File.dirname(__FILE__), 'test_helper') class BlobTest < Test::Unit::TestCase include Octopi def setup fake_everything end context Blob do should "find a blob" do blob = Blob.find(:user => "fcoury", :repo => "octopi", :sha => "f6609209c3ac0badd004512d318bfaa508ea10ae") ...
github
fcoury/octopi
https://github.com/fcoury/octopi
test/gist_test.rb
Ruby
mit
213
master
266
require File.join(File.dirname(__FILE__), 'test_helper') class GistTest < Test::Unit::TestCase include Octopi def setup fake_everything end context Gist do should "Find a single gist" do assert_not_nil Gist.find(159579) end end end
github
fcoury/octopi
https://github.com/fcoury/octopi
test/issue_comment.rb
Ruby
mit
213
master
460
require File.join(File.dirname(__FILE__), 'test_helper') class IssueTest < Test::Unit::TestCase include Octopi def setup fake_everything @user = User.find("fcoury") @repo = @user.repository("octopi") end context IssueComment do should "be valid" do comment = IssueComment.new({ :comm...
github
fcoury/octopi
https://github.com/fcoury/octopi
test/commit_test.rb
Ruby
mit
213
master
3,073
require File.join(File.dirname(__FILE__), 'test_helper') class CommitTest < Test::Unit::TestCase include Octopi def setup fake_everything @user = User.find("fcoury") @repo = @user.repository(:name => "octopi") end context Commit do context "finding all commits" do should "by strings" ...
github
fcoury/octopi
https://github.com/fcoury/octopi
test/repository_set_test.rb
Ruby
mit
213
master
454
require File.join(File.dirname(__FILE__), 'test_helper') class RepositorySetTest < Test::Unit::TestCase include Octopi def setup fake_everything @user = User.find("fcoury") end context RepositorySet do should "return a repository set" do assert @user.repositories.is_a?(RepositorySet...
github
fcoury/octopi
https://github.com/fcoury/octopi
test/issue_test.rb
Ruby
mit
213
master
4,284
require File.join(File.dirname(__FILE__), 'test_helper') class IssueTest < Test::Unit::TestCase include Octopi def setup fake_everything @user = User.find("fcoury") @repo = @user.repository("octopi") @issue = Issue.find(:user => @user, :repo => @repo, :number => 28) @closed = Issue.find(:use...
github
fcoury/octopi
https://github.com/fcoury/octopi
test/api_test.rb
Ruby
mit
213
master
1,307
require File.join(File.dirname(__FILE__), 'test_helper') class AuthenticatedTest < Test::Unit::TestCase include Octopi def setup fake_everything @user = User.find("fcoury") end context "following" do should "not be able to follow anyone if not authenticated" do exception = assert_rai...
github
fcoury/octopi
https://github.com/fcoury/octopi
test/key_set_test.rb
Ruby
mit
213
master
669
require File.join(File.dirname(__FILE__), 'test_helper') class KeySetTest < Test::Unit::TestCase include Octopi def setup fake_everything @user = User.find("fcoury") end context KeySet do should "be able to find a key" do auth do assert_not_nil Api.me.keys.find("macbook") ...
github
fcoury/octopi
https://github.com/fcoury/octopi
test/base_test.rb
Ruby
mit
213
master
486
require File.join(File.dirname(__FILE__), 'test_helper') class BaseTest < Test::Unit::TestCase class SparseUser < Octopi::Base include Octopi::Resource attr_accessor :some_attribute find_path "/user/search/:query" resource_path "/user/show/:id" end def setup fake_everything end...
github
fcoury/octopi
https://github.com/fcoury/octopi
test/authenticated_test.rb
Ruby
mit
213
master
1,479
require File.join(File.dirname(__FILE__), 'test_helper') class AuthenticatedTest < Test::Unit::TestCase include Octopi def setup fake_everything end context "Authenticating" do should "be able to login with github.yml" do authenticated :config => File.join(File.dirname(__FILE__), "github.yml")...
github
fcoury/octopi
https://github.com/fcoury/octopi
test/file_object_test.rb
Ruby
mit
213
master
1,072
require File.join(File.dirname(__FILE__), 'test_helper') class FileObjectTest < Test::Unit::TestCase include Octopi def setup fake_everything @user = User.find("fcoury") @repo = @user.repositories.find("octopi") end context "finding" do context "with strings" do should "work" do ...
github
fcoury/octopi
https://github.com/fcoury/octopi
test/user_test.rb
Ruby
mit
213
master
2,662
require File.join(File.dirname(__FILE__), 'test_helper') class UserTest < Test::Unit::TestCase include Octopi def setup fake_everything @user = User.find("fcoury") end should "be able to find a user" do assert_not_nil User.find("fcoury") end should "not be able to find a user that do...
github
fcoury/octopi
https://github.com/fcoury/octopi
test/issue_set_test.rb
Ruby
mit
213
master
841
require File.join(File.dirname(__FILE__), 'test_helper') class IssueSetTest < Test::Unit::TestCase include Octopi def setup fake_everything @user = User.find("fcoury") @repo = @user.repository("octopi") end context IssueSet do should "be able to find a specific issue" do assert_not...
github
fcoury/octopi
https://github.com/fcoury/octopi
test/test_helper.rb
Ruby
mit
213
master
9,006
require 'rubygems' require 'test/unit' require 'shoulda' require 'fakeweb' $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'octopi' ENV['HOME'] = File.dirname(__FILE__) FakeWeb.allow_net_connect = false @the_repo = ["fcoury", "octopi"] def stub_f...
github
fcoury/octopi
https://github.com/fcoury/octopi
test/tree_test.rb
Ruby
mit
213
master
438
require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper')) class TreeTest < Test::Unit::TestCase include Octopi def setup fake_everything end should "be able to find a tree set" do shared_options = { :user => "fcoury", :repo => "octopi"} branch = Branch.all(shared_options).detec...
github
fcoury/octopi
https://github.com/fcoury/octopi
test/key_test.rb
Ruby
mit
213
master
1,142
require File.join(File.dirname(__FILE__), 'test_helper') class KeyTest < Test::Unit::TestCase include Octopi def setup fake_everything @user = User.find("fcoury") auth do @key = Api.me.keys.first end end context Key do should "be able to add a key" do auth do ...
github
fcoury/octopi
https://github.com/fcoury/octopi
test/stubs/commits/fcoury/octopi/octopi.rb
Ruby
mit
213
master
32,948
HTTP/1.1 200 OK Server: nginx/0.6.31 Date: Thu, 06 Aug 2009 05:18:56 GMT Content-Type: application/x-yaml; charset=utf-8 Connection: keep-alive Set-Cookie: _github_ses=BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA%3D%3D--884981fc5aa85daf318eeff084d98e2cff92578f; path=/; expires=Wed,...
github
fcoury/octopi
https://github.com/fcoury/octopi
real_world_test/repository_test.rb
Ruby
mit
213
master
423
# IF TEST FAILS PLEASE SEE TEST_HELPER FOR REASON require File.join(File.dirname(__FILE__), 'test_helper') class RepositoryTest < Test::Unit::TestCase include Octopi def setup @user = User.find("radar") end context Repository do should "return a private repository when authed" do authentic...
github
fcoury/octopi
https://github.com/fcoury/octopi
real_world_test/test_helper.rb
Ruby
mit
213
master
462
# These are the real world tests using real world data. # Whilst the tests are good for ensuring Nothing Goes Wrong, # It isn't good to always use fake data because you're fooling yourself. # This test data uses my own personal ~/.gitconfig and will probably not work for you. require 'rubygems' require 'test/unit' requ...
github
fcoury/octopi
https://github.com/fcoury/octopi
real_world_test/commit_test.rb
Ruby
mit
213
master
468
# IF TEST FAILS PLEASE SEE TEST_HELPER FOR REASON require File.join(File.dirname(__FILE__), 'test_helper') class CommitTest < Test::Unit::TestCase include Octopi def setup @user = User.find("radar") end context Commit do should "return a commit for a private repository when authed" do auth...
github
fcoury/octopi
https://github.com/fcoury/octopi
contrib/backup.rb
Ruby
mit
213
master
2,770
require File.join(File.dirname(__FILE__), '..', 'lib', 'octopi') USAGE_MSG = <<EOF Usage: #{$0} <user> [<directory>] Performs a backup of the named user's GitHub.com data. This script will fetch the repositories, along with their metadata and associated issues, for the named user. It will also retrieve the user's pr...
github
fcoury/octopi
https://github.com/fcoury/octopi
lib/octopi.rb
Ruby
mit
213
master
3,649
require 'rubygems' require 'open-uri' require 'httparty' require 'mechanize' require 'nokogiri' require 'api_cache' require 'yaml' require 'pp' # Core extension stuff Dir[File.join(File.dirname(__FILE__), "ext/*.rb")].each { |f| require f } # Octopi stuff # By sorting them we ensure that api and base are loaded f...
github
fcoury/octopi
https://github.com/fcoury/octopi
lib/octopi/blob.rb
Ruby
mit
213
master
644
require File.join(File.dirname(__FILE__), "resource") module Octopi class Blob < Base attr_accessor :text, :data, :name, :sha, :size, :mode, :mime_type include Resource set_resource_name "blob" resource_path "/blob/show/:id" def self.find(options={}) ensure_hash(options) user, repo =...
github
fcoury/octopi
https://github.com/fcoury/octopi
lib/octopi/user.rb
Ruby
mit
213
master
4,097
module Octopi class User < Base include Resource attr_accessor :company, :name, :following_count, :gravatar_id, :blog, :public_repo_count, :public_gist_count, :id, :login, :followers_count, :created_at, :email, :location, :disk_usage, :private_repo_count...
github
fcoury/octopi
https://github.com/fcoury/octopi
lib/octopi/base.rb
Ruby
mit
213
master
3,593
module Octopi class Base VALID = { :repo => { # FIXME: API currently chokes on repository names containing periods, # but presumably this will be fixed. :pat => /^[A-Za-z0-9_\.-]+$/, :msg => "%s is an invalid repository name"}, :user => { :pat => /^[A-Za-z0-9_\....
github
fcoury/octopi
https://github.com/fcoury/octopi
lib/octopi/file_object.rb
Ruby
mit
213
master
407
module Octopi class FileObject < Base attr_accessor :name, :sha, :mode, :type include Resource set_resource_name "tree" resource_path "/tree/show/:id" def self.find(options={}) ensure_hash(options) user, repo, branch, sha = gather_details(options) self.validate_args(sha => ...
github
fcoury/octopi
https://github.com/fcoury/octopi
lib/octopi/issue.rb
Ruby
mit
213
master
3,405
module Octopi class Issue < Base include Resource STATES = %w{open closed} find_path "/issues/list/:query" resource_path "/issues/show/:id" attr_accessor :repository, :user, :updated_at, :votes, :number, :title, :body, :closed_at, :labels, :state, :created_at def self.search(op...
github
fcoury/octopi
https://github.com/fcoury/octopi
lib/octopi/key.rb
Ruby
mit
213
master
584
module Octopi class Key < Base include Resource attr_accessor :title, :id, :key find_path "/user/keys" attr_reader :user def self.find_all Api.api.get("user/keys") end def self.add(options={}) ensure_hash(options) Api.api.post("/user/key/add", { :title...
github
fcoury/octopi
https://github.com/fcoury/octopi
lib/octopi/tree.rb
Ruby
mit
213
master
452
module Octopi class Tree < Base attr_accessor :name, :size, :sha, :mode, :mime_type, :type, :user, :repository def self.find(options) ensure_hash(options) user, repo = gather_details(options) route = "/tree/show/#{user}/#{repo}/#{options[:sha]}" trees = Api.api.get(route)["tree"]....
github
fcoury/octopi
https://github.com/fcoury/octopi
lib/octopi/self.rb
Ruby
mit
213
master
1,335
module Octopi module Self # Returns a list of Key objects containing all SSH Public Keys this user # currently has. Requires authentication. def keys raise AuthenticationRequired, "To view keys, you must be authenticated" if Api.api.read_only? result = Api.api.get("/user/keys", { :cache => fal...
github
fcoury/octopi
https://github.com/fcoury/octopi
lib/octopi/tag.rb
Ruby
mit
213
master
523
module Octopi class Tag < Base include Resource attr_accessor :name, :sha set_resource_name "tag" resource_path "/repos/show/:id" def initialize(*args) args = args.flatten! self.name = args.first self.sha = args.last end def self.all(options={}) ensu...
github
fcoury/octopi
https://github.com/fcoury/octopi
lib/octopi/commit.rb
Ruby
mit
213
master
2,452
module Octopi class Commit < Base include Resource find_path "/commits/list/:query" resource_path "/commits/show/:id" attr_accessor :repository, :message, :parents, :author, :url, :id, :committed_date, :authored_date, :tree, :committer, :added, :removed, :modified # Finds all commit...
github
fcoury/octopi
https://github.com/fcoury/octopi
lib/octopi/repository_set.rb
Ruby
mit
213
master
229
require File.join(File.dirname(__FILE__), "repository") class Octopi::RepositorySet < Array include Octopi attr_accessor :user def find(name) Octopi::Repository.find(:user => self.user, :repository => name) end end
github
fcoury/octopi
https://github.com/fcoury/octopi
lib/octopi/branch_set.rb
Ruby
mit
213
master
306
require File.join(File.dirname(__FILE__), "branch") class Octopi::BranchSet < Array include Octopi attr_accessor :user, :repository # Takes a name, returns a branch if it exists def find(name) branch = detect { |b| b.name == name } raise NotFound, Branch if branch.nil? branch end end
github
fcoury/octopi
https://github.com/fcoury/octopi
lib/octopi/key_set.rb
Ruby
mit
213
master
281
require File.join(File.dirname(__FILE__), "key") class KeySet < Array include Octopi def find(title) key = detect { |key| key.title == title } raise NotFound, Key if key.nil? key end def add(options={}) ensure_hash(options) Key.add(options) end end
github
fcoury/octopi
https://github.com/fcoury/octopi
lib/octopi/repository.rb
Ruby
mit
213
master
4,634
module Octopi class Repository < Base include Resource attr_accessor :description, :url, :forks, :name, :homepage, :watchers, :owner, :private, :fork, :open_issues, :pledgie, :size, # And now for the stuff returned by search results :actions, :score, :lan...
github
fcoury/octopi
https://github.com/fcoury/octopi
lib/octopi/issue_set.rb
Ruby
mit
213
master
499
require File.join(File.dirname(__FILE__), "issue") class Octopi::IssueSet < Array include Octopi attr_accessor :user, :repository def initialize(array) self.user = array.first.user self.repository = array.first.repository super(array) end def find(number) issue = detect { |issue| issue.n...
github
fcoury/octopi
https://github.com/fcoury/octopi
lib/octopi/gist.rb
Ruby
mit
213
master
724
module Octopi # Gist API is... lacking at the moment. # This class serves only as a reminder to implement it later class Gist < Base include HTTParty attr_accessor :description, :repo, :public, :created_at include Resource set_resource_name "tree" resource_path ":id" def self.bas...
github
fcoury/octopi
https://github.com/fcoury/octopi
lib/octopi/tree_set.rb
Ruby
mit
213
master
263
require File.join(File.dirname(__FILE__), "tree") class Octopi::TreeSet < Array include Octopi attr_accessor :user, :repository def initialize(array) self.user = array.first.user self.repository = array.first.repository super(array) end end
github
fcoury/octopi
https://github.com/fcoury/octopi
lib/octopi/resource.rb
Ruby
mit
213
master
1,759
module Octopi module Resource def self.included(base) base.extend ClassMethods base.set_resource_name(base.name) (@@resources||={})[base.resource_name(:singular)] = base (@@resources||={})[base.resource_name(:plural)] = base end def self.for(name) @@resources[name] e...
github
fcoury/octopi
https://github.com/fcoury/octopi
lib/octopi/error.rb
Ruby
mit
213
master
764
module Octopi class FormatError < StandardError def initialize(f) super("Got unexpected format (got #{f.first} for #{f.last})") end end class AuthenticationRequired < StandardError end class APIError < StandardError end class InvalidLogin < StandardError end class RetryableAPIError...
github
fcoury/octopi
https://github.com/fcoury/octopi
lib/octopi/branch.rb
Ruby
mit
213
master
776
module Octopi class Branch < Base attr_accessor :name, :sha include Resource set_resource_name "branch", "branches" resource_path "/repos/show/:id" # Called when we ask for a resource. # Arguments are passed in like [<name>, <sha>] # TODO: Find out why args are doubly nested def ...
github
fcoury/octopi
https://github.com/fcoury/octopi
lib/octopi/api.rb
Ruby
mit
213
master
6,274
require 'singleton' require File.join(File.dirname(__FILE__), "self") module Octopi # Dummy class, so AnonymousApi and AuthApi have somewhere to inherit from class Api include Self attr_accessor :format, :login, :token, :trace_level, :read_only end # Used for accessing the Github API anonymously cl...
github
fcoury/octopi
https://github.com/fcoury/octopi
lib/octopi/comment.rb
Ruby
mit
213
master
581
module Octopi class Comment < Base attr_accessor :content, :author, :title, :updated, :link, :published, :id, :repository include Resource set_resource_name "tree" resource_path "/tree/show/:id" def self.find(options={}) ensure_hash(options) user, repo, branch, sha = gather_details(o...
github
Sutto/api_smith
https://github.com/Sutto/api_smith
Rakefile
Ruby
mit
214
master
222
require 'rubygems' require 'rspec/core' require 'rspec/core/rake_task' require 'bundler/gem_tasks' task :default => :spec desc "Run all specs in spec directory (excluding plugin specs)" RSpec::Core::RakeTask.new(:spec)
github
Sutto/api_smith
https://github.com/Sutto/api_smith
Gemfile
Ruby
mit
214
master
250
source "https://rubygems.org/" gemspec gem 'hashie', ENV.fetch('HASHIE_VERSION', '~> 1.0') gem 'json' group :development do gem 'rake' gem 'awesome_print' end group :test do gem 'rspec' gem 'sham_rack' gem 'sinatra' # for sham_rack end
github
Sutto/api_smith
https://github.com/Sutto/api_smith
api_smith.gemspec
Ruby
mit
214
master
892
# -*- encoding: utf-8 -*- lib = File.expand_path('../lib/', __FILE__) $:.unshift lib unless $:.include?(lib) require 'api_smith/version' Gem::Specification.new do |s| s.name = "api_smith" s.version = APISmith::VERSION.dup s.platform = Gem::Platform::RUBY s.authors = ["Darcy Laycock", "Steve W...
github
Sutto/api_smith
https://github.com/Sutto/api_smith
spec/spec_helper.rb
Ruby
mit
214
master
321
ENV["RAILS_ENV"] ||= 'test' require 'rspec' require 'pathname' require 'bundler/setup' Bundler.setup Bundler.require :default, :test require 'api_smith' require 'rr' require 'json' Dir[Pathname(__FILE__).dirname.join("support/**/*.rb")].each { |f| require f } RSpec.configure do |config| config.mock_with :rr end
github
Sutto/api_smith
https://github.com/Sutto/api_smith
spec/support/fake_endpoints.rb
Ruby
mit
214
master
958
require 'sham_rack' ShamRack.at("sham.local").sinatra do def json!(response) content_type "application/json" JSON.dump response end get '/simple' do json! :name => "Darcy" end get '/nested' do json! :response => { :name => "Steve" } end get '/collection' do json! :respon...
github
Sutto/api_smith
https://github.com/Sutto/api_smith
spec/api_smith/smash_spec.rb
Ruby
mit
214
master
6,890
require 'spec_helper' describe APISmith::Smash do let(:my_smash) { Class.new(APISmith::Smash) } describe 'transformers' do it 'should let you define a transformer via transformer_for' do my_smash.property :name my_smash.transformers['name'].should be_nil my_smash.transformer_for :name, lam...