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 | raileurope/lolsoap | https://github.com/raileurope/lolsoap | lib/lolsoap/envelope.rb | Ruby | mit | 93 | master | 3,198 | require 'nokogiri'
require 'lolsoap/builder'
module LolSoap
class Envelope
attr_reader :wsdl, :operation, :doc
# @private
SOAP_1_1 = 'http://schemas.xmlsoap.org/soap/envelope/'
# @private
SOAP_1_2 = 'http://www.w3.org/2003/05/soap-envelope'
def initialize(wsdl, operation, doc = Nokogiri::X... |
github | raileurope/lolsoap | https://github.com/raileurope/lolsoap | lib/lolsoap/wsdl/null_type.rb | Ruby | mit | 93 | master | 222 | class LolSoap::WSDL
class NullType
def prefix
nil
end
def elements
{}
end
def element(name)
NullElement.new
end
def ==(other)
self.class === other
end
end
end |
github | raileurope/lolsoap | https://github.com/raileurope/lolsoap | lib/lolsoap/wsdl/type.rb | Ruby | mit | 93 | master | 881 | require 'set'
class LolSoap::WSDL
class Type
attr_reader :name, :prefix
def initialize(name, prefix, elements, attributes)
@name = name
@prefix = prefix
@elements = elements
@attributes = Set.new(attributes)
end
def elements
@elements.dup
end
def e... |
github | raileurope/lolsoap | https://github.com/raileurope/lolsoap | lib/lolsoap/wsdl/named_type_reference.rb | Ruby | mit | 93 | master | 281 | class LolSoap::WSDL
class NamedTypeReference
attr_reader :namespace, :name, :wsdl
def initialize(namespace, name, wsdl)
@namespace = namespace
@name = name
@wsdl = wsdl
end
def type
wsdl.type(namespace, name)
end
end
end |
github | raileurope/lolsoap | https://github.com/raileurope/lolsoap | lib/lolsoap/wsdl/operation_io_part.rb | Ruby | mit | 93 | master | 433 | class LolSoap::WSDL
class OperationIOPart < Element
def initialize(wsdl, name, type_reference)
super(wsdl, name, 'soap', type_reference)
end
def single_part?
type.elements.size == 1
end
def content
if single_part?
type.element(type.elements.keys.first)
end
end... |
github | raileurope/lolsoap | https://github.com/raileurope/lolsoap | lib/lolsoap/wsdl/operation.rb | Ruby | mit | 93 | master | 427 | class LolSoap::WSDL
class Operation
attr_reader :wsdl, :name, :action, :input, :output
def initialize(wsdl, name, action, input, output)
@wsdl = wsdl
@name = name
@action = action
@input = input
@output = output
end
def inspect
"<#{self.class} " \
"name... |
github | raileurope/lolsoap | https://github.com/raileurope/lolsoap | lib/lolsoap/wsdl/operation_io.rb | Ruby | mit | 93 | master | 284 | class LolSoap::WSDL
class OperationIO
attr_reader :header, :body
def initialize(header, body)
@header = header
@body = body
end
def inspect
"<#{self.class} " \
"header=#{header.inspect} " \
"body=#{body.inspect}>"
end
end
end |
github | raileurope/lolsoap | https://github.com/raileurope/lolsoap | lib/lolsoap/wsdl/element.rb | Ruby | mit | 93 | master | 640 | class LolSoap::WSDL
class Element
attr_reader :name, :prefix, :type_reference
def initialize(wsdl, name, prefix, type_reference, singular = true)
@wsdl = wsdl
@name = name
@prefix = prefix
@type_reference = type_reference
@singular = singular
... |
github | raileurope/lolsoap | https://github.com/raileurope/lolsoap | test/helper.rb | Ruby | mit | 93 | master | 305 | require 'rubygems'
require 'bundler/setup'
require 'minitest/spec'
require 'minitest/autorun'
require 'ostruct'
TEST_ROOT = File.expand_path('..', __FILE__)
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
if RUBY_VERSION == '1.8.7'
class OpenStruct
undef_method :type
end
end |
github | raileurope/lolsoap | https://github.com/raileurope/lolsoap | test/unit/test_wsdl.rb | Ruby | mit | 93 | master | 7,346 | require 'helper'
require 'lolsoap/wsdl'
module LolSoap
describe WSDL do
describe 'with a doc that can be parsed' do
let(:namespace) { 'http://lolsoap.api/bla' }
let(:xs) { "http://www.w3.org/2001/XMLSchema" }
let(:parser) do
OpenStruct.new(
:namespaces => { 'bla' => na... |
github | raileurope/lolsoap | https://github.com/raileurope/lolsoap | test/unit/test_wsdl_parser.rb | Ruby | mit | 93 | master | 9,142 | require 'helper'
require 'lolsoap/wsdl_parser'
module LolSoap
describe WSDLParser do
def raw_doc
File.read(TEST_ROOT + '/fixtures/stock_quote.wsdl')
end
let(:doc) { Nokogiri::XML(raw_doc) }
let(:namespace) { "http://example.com/stockquote.xsd" }
let(:namespace2) { "http://example.c... |
github | raileurope/lolsoap | https://github.com/raileurope/lolsoap | test/unit/test_envelope.rb | Ruby | mit | 93 | master | 3,654 | require 'helper'
require 'lolsoap/envelope'
module LolSoap
describe Envelope do
let(:wsdl) do
OpenStruct.new(
:namespaces => { 'ns0' => 'http://example.com/foo' },
:soap_version => '1.2'
)
end
let(:operation) do
OpenStruct.new(
:input => OpenStruct.new(
... |
github | raileurope/lolsoap | https://github.com/raileurope/lolsoap | test/unit/test_request.rb | Ruby | mit | 93 | master | 1,487 | require 'helper'
require 'lolsoap/request'
module LolSoap
describe Request do
let(:envelope) { OpenStruct.new }
subject { Request.new(envelope) }
describe '#url' do
it 'returns the envelope endpoint' do
envelope.endpoint = 'lol'
subject.url.must_equal 'lol'
end
end
d... |
github | raileurope/lolsoap | https://github.com/raileurope/lolsoap | test/unit/test_client.rb | Ruby | mit | 93 | master | 254 | require 'helper'
require 'lolsoap/client'
module LolSoap
describe Client do
it 'can be instantiated with an already-parsed WSDL object' do
wsdl = Object.new
client = Client.new(wsdl)
client.wsdl.must_equal wsdl
end
end
end |
github | raileurope/lolsoap | https://github.com/raileurope/lolsoap | test/unit/test_response.rb | Ruby | mit | 93 | master | 1,523 | require 'helper'
require 'lolsoap/envelope'
require 'lolsoap/response'
module LolSoap
describe Response do
let(:request) {
OpenStruct.new(
:soap_namespace => Envelope::SOAP_1_2,
:soap_version => '1.2',
:output_type => Object.new
)
}
let(:doc) { Nokogiri::XML(File... |
github | raileurope/lolsoap | https://github.com/raileurope/lolsoap | test/unit/test_fault.rb | Ruby | mit | 93 | master | 1,365 | require 'helper'
require 'lolsoap/envelope'
require 'lolsoap/fault'
module LolSoap
describe Fault do
examples = proc do
describe '#code' do
it 'returns the code' do
subject.code.must_equal 'soap:Sender'
end
end
describe '#reason' do
it 'returns the reason' do
... |
github | raileurope/lolsoap | https://github.com/raileurope/lolsoap | test/unit/test_builder.rb | Ruby | mit | 93 | master | 3,058 | require 'helper'
require 'lolsoap/builder'
require 'pp'
module LolSoap
describe Builder do
let(:doc) { MiniTest::Mock.new }
let(:node) do
n = OpenStruct.new(
:document => doc,
:namespace_scopes => [OpenStruct.new(:prefix => 'b'), OpenStruct.new(:prefix => 'a')],
:childre... |
github | raileurope/lolsoap | https://github.com/raileurope/lolsoap | test/unit/test_hash_builder.rb | Ruby | mit | 93 | master | 4,020 | require 'helper'
require 'lolsoap/wsdl'
require 'lolsoap/hash_builder'
require 'nokogiri'
module LolTypes
class Type
def element(name)
elements.fetch(name) { LolSoap::WSDL::NullElement.new }
end
end
class Person < Type
def elements
@elements ||= {
'name' => OpenStruct.new(:typ... |
github | raileurope/lolsoap | https://github.com/raileurope/lolsoap | test/unit/wsdl/test_type.rb | Ruby | mit | 93 | master | 1,046 | require 'helper'
require 'lolsoap/wsdl'
class LolSoap::WSDL
describe Type do
let(:elements) { { 'soapColor' => OpenStruct.new(:type => Object.new) } }
subject { Type.new('WashHandsRequest', 'prfx', elements, {}) }
describe '#prefix' do
it 'returns the prefix' do
subject.prefix.must_equal ... |
github | raileurope/lolsoap | https://github.com/raileurope/lolsoap | test/unit/wsdl/test_element.rb | Ruby | mit | 93 | master | 714 | require 'helper'
require 'lolsoap/wsdl'
class LolSoap::WSDL
describe Element do
let(:wsdl) { MiniTest::Mock.new }
let(:type_reference) { MiniTest::Mock.new }
let(:type) { Object.new }
subject { Element.new(wsdl, 'bar', 'foo', type_reference, true) }
before do
type_refe... |
github | raileurope/lolsoap | https://github.com/raileurope/lolsoap | test/integration/test_wsdl.rb | Ruby | mit | 93 | master | 1,620 | require 'helper'
require 'lolsoap/wsdl'
module LolSoap
describe WSDL do
subject { WSDL.parse(File.read(TEST_ROOT + '/fixtures/stock_quote.wsdl')) }
it 'should successfully parse a WSDL document' do
subject.operations.length.must_equal 2
subject.operations.fetch('GetLastTradePrice').tap do |o|
... |
github | raileurope/lolsoap | https://github.com/raileurope/lolsoap | test/integration/test_envelope.rb | Ruby | mit | 93 | master | 1,445 | require 'helper'
require 'lolsoap/envelope'
require 'lolsoap/wsdl'
module LolSoap
describe Envelope do
let(:wsdl) { WSDL.parse(File.read(TEST_ROOT + '/fixtures/stock_quote.wsdl')) }
subject { Envelope.new(wsdl, wsdl.operations['GetLastTradePrice']) }
let(:doc) { subject.doc }
it 'creates an empty e... |
github | raileurope/lolsoap | https://github.com/raileurope/lolsoap | test/integration/test_request.rb | Ruby | mit | 93 | master | 792 | require 'helper'
require 'lolsoap/envelope'
require 'lolsoap/request'
module LolSoap
describe Request do
let(:wsdl) { WSDL.parse(File.read(TEST_ROOT + '/fixtures/stock_quote.wsdl')) }
let(:operation) { wsdl.operation('GetLastTradePrice') }
let(:envelope) { Envelope.new(wsdl, operation) }
subject { R... |
github | raileurope/lolsoap | https://github.com/raileurope/lolsoap | test/integration/test_client.rb | Ruby | mit | 93 | master | 574 | require 'helper'
require 'lolsoap/client'
module LolSoap
describe Client do
subject { Client.new(File.read(TEST_ROOT + '/fixtures/stock_quote.wsdl')) }
it 'builds a request' do
request = subject.request('GetLastTradePrice')
request.body { |foo| foo.bar }
request.content.empty?.must_equal f... |
github | raileurope/lolsoap | https://github.com/raileurope/lolsoap | test/integration/test_response.rb | Ruby | mit | 93 | master | 457 | require 'helper'
require 'lolsoap/client'
module LolSoap
describe Response do
let(:client) { LolSoap::Client.new File.read(TEST_ROOT + '/fixtures/stock_quote.wsdl') }
let(:request) { client.request('GetLastTradePrice') }
subject { Response.parse(request, File.read(TEST_ROOT + '/fixtures/stock_quote_resp... |
github | aseldawy/rasem | https://github.com/aseldawy/rasem | Gemfile | Ruby | mit | 93 | master | 346 | source "http://rubygems.org"
# Add dependencies required to use your gem here.
# Example:
# gem "activesupport", ">= 2.3.5"
# Add dependencies to develop your gem here.
# Include everything needed to run rake, tests, features, etc.
group :development do
gem "rspec", "~> 2.10.0"
gem "jeweler", "~> 1.8.2"
gem "s... |
github | aseldawy/rasem | https://github.com/aseldawy/rasem | Rakefile | Ruby | mit | 93 | master | 1,624 | require 'rubygems'
require 'bundler'
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems"
exit e.status_code
end
require 'rake'
require 'jeweler'
Jeweler::Tasks.new do |gem|
# gem is a Gem::Specificati... |
github | aseldawy/rasem | https://github.com/aseldawy/rasem | spec/transform_spec.rb | Ruby | mit | 93 | master | 2,801 | require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe Rasem::SVGTag do
it "should maintain compatibility with transformations given in attributes" do
tag = Rasem::SVGTag.new("g", :translate => [5, 5], :scale => 2)
tag.translate(10, 10)
tag.to_s.should =~ %r{.*transform=\"translate\... |
github | aseldawy/rasem | https://github.com/aseldawy/rasem | spec/gradient_spec.rb | Ruby | mit | 93 | master | 1,597 | require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe Rasem::SVGLinearGradient do
it "should create a linear gradient in the defs section" do
img = Rasem::SVGImage.new(:width => 100, :height => 100) do
linearGradient("lgrad1") {}
end
img.to_s.should =~ %r{.*<svg[^>]*>.*<defs>... |
github | aseldawy/rasem | https://github.com/aseldawy/rasem | spec/spec_helper.rb | Ruby | mit | 93 | master | 527 | $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'rspec'
require 'rasem'
require 'simplecov'
SimpleCov.start
# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir["#{File.dirname(__FILE__)}/supp... |
github | aseldawy/rasem | https://github.com/aseldawy/rasem | spec/rasem_spec.rb | Ruby | mit | 93 | master | 13,511 | require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe Rasem::SVGTag do
it "should create an empty tag" do
tag = Rasem::SVGTag.new("svg")
str = ""
tag.write(str)
str.should =~ %r{<svg/>}
end
it "should create a tag with parameters" do
tag = Rasem::SVGTag.new("svg", :width... |
github | aseldawy/rasem | https://github.com/aseldawy/rasem | spec/path_spec.rb | Ruby | mit | 93 | master | 4,598 | require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe Rasem::SVGPath do
it "should be an instance of SVGTag" do
tag = Rasem::SVGPath.new
(class_hierarchy(tag).include? Rasem::SVGTag).should == true
end
it "should create an empty path" do
tag = Rasem::SVGPath.new
tag.to_s.s... |
github | aseldawy/rasem | https://github.com/aseldawy/rasem | spec/defs_spec.rb | Ruby | mit | 93 | master | 2,514 | require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe Rasem::SVGTagWithParent do
it "should get a reference to the main image object" do
img = Rasem::SVGImage.new(:width => 100, :height => 100)
l = img.line(0, 0, 100, 100)
(l.img == img).should == true
end
it "should propagat... |
github | aseldawy/rasem | https://github.com/aseldawy/rasem | lib/rasem/svg_documentation.rb | Ruby | mit | 93 | master | 106,435 | ###############################################################################
# Please do not modify this file manually, it is regenerated from w3 website. #
###############################################################################
Rasem::SVG_ELEMENTS =
[:a,
:altGlyph,
:altGlyphDef,
:altGlyphItem,
:animat... |
github | aseldawy/rasem | https://github.com/aseldawy/rasem | lib/rasem/application.rb | Ruby | mit | 93 | master | 937 | class Rasem::Application
def self.run!(*argv)
if argv.empty?
source_files = Dir.glob(File.expand_path("*.rasem"))
else
source_files = argv
end
if source_files.empty?
puts "No input files"
return 1
end
for source_file in source_files
if source_file =~ /\.rasem$/
... |
github | aseldawy/rasem | https://github.com/aseldawy/rasem | lib/rasem/svg_image.rb | Ruby | mit | 93 | master | 17,258 | Rasem::SVG_ALIAS = {
:group => :g,
:rectangle => :rect,
}
Rasem::SVG_EXPANSION = {
:line => [:x1,:y1,:x2,:y2],
:circle => [:cx,:cy,:r],
:image => [:x,:y,:width,:height,:"xlink:href"],
:ellipse => [:cx,:cy,:rx,:ry],
:text => [:x,:y],
:rect => lambda do |args|
raise "Wrong unnamed argument cou... |
github | aseldawy/rasem | https://github.com/aseldawy/rasem | lib/rasem/download_documentation.rb | Ruby | mit | 93 | master | 1,776 | #!/usr/bin/env ruby
require 'rubygems'
require 'nokogiri'
require 'open-uri'
require 'pp'
version_url = "http://www.w3.org/TR/SVG11/"
#obtain all elements in this version:
page = Nokogiri::HTML(open(version_url + 'eltindex.html'))
elements = []
structure = {}
page.css("li").each do
|li|
link = li.css("a"... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | circleci-cli.gemspec | Ruby | mit | 93 | master | 1,560 | # frozen_string_literal: true
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'circleci/cli/version'
def production_dependency(spec)
spec.add_dependency 'circleci', '>= 2.1.0'
spec.add_dependency 'highline', '>= 1.7.8', '< 3.2.0'
spec.add_dependency 'launc... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | Gemfile | Ruby | mit | 93 | master | 247 | # frozen_string_literal: true
source 'https://rubygems.org'
gemspec
gem 'abbrev'
gem 'base64'
gem 'bundler'
gem 'github_changelog_generator'
gem 'guard'
gem 'guard-rspec'
gem 'guard-rubocop'
gem 'rake'
gem 'rspec'
gem 'rubocop'
gem 'simplecov' |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | Rakefile | Ruby | mit | 93 | master | 385 | # frozen_string_literal: true
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'github_changelog_generator/task'
RSpec::Core::RakeTask.new(:spec)
task default: :spec
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
config.user = 'unhappychoice'
config.project = 'circleci-cli'
co... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | Guardfile | Ruby | mit | 93 | master | 1,641 | # frozen_string_literal: true
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
## Uncomment and set this to only include directories you want to watch
# directories %w(app lib config test spec features) \
# .select{|d| Dir.exist?(d) ? d : UI.warning("Directory #{d} does not exist")}
## Note... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | spec/spec_helper.rb | Ruby | mit | 93 | master | 302 | # frozen_string_literal: true
if ENV['COVERAGE']
require 'simplecov'
SimpleCov.add_filter ['spec']
SimpleCov.start
end
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
require 'circleci_cli'
Dir[File.join(File.expand_path('./', __dir__), 'support', '**', '*.rb')].each { |f| require f } |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | spec/circleci/cli/cli_spec.rb | Ruby | mit | 93 | master | 1,696 | # frozen_string_literal: true
require 'spec_helper'
describe CircleCI::CLI::Runner do
describe '#project' do
subject { described_class.project }
context 'when git repository has a https github remote' do
let(:rugged_response_remote_url) { 'https://github.com/user/repository.git' }
it 'extracts ... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | spec/circleci/cli/command/cancel_command_spec.rb | Ruby | mit | 93 | master | 1,143 | # frozen_string_literal: true
require 'spec_helper'
describe CircleCI::CLI::Command::CancelCommand, type: :command do
shared_examples_for 'a command cancels build' do
let(:expected_output) { 'build user/project_name_from_api 1234 is canceled.' }
it 'should cancel build' do
allow(CircleCI::CLI::Comman... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | spec/circleci/cli/command/builds_command_spec.rb | Ruby | mit | 93 | master | 1,975 | # frozen_string_literal: true
require 'spec_helper'
describe CircleCI::CLI::Command::BuildsCommand, type: :command do
shared_examples_for 'a command show builds information' do
let(:expected_output) do
<<~EXPECTED
+--------------------------------------------------------------------+
| ... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | spec/circleci/cli/command/base_command_spec.rb | Ruby | mit | 93 | master | 927 | # frozen_string_literal: true
require 'spec_helper'
describe CircleCI::CLI::Command::BaseCommand do
describe '#branch_name' do
subject { described_class.branch_name(options) }
let(:options) { OpenStruct.new }
context 'with all option' do
let(:options) { OpenStruct.new(all: true) }
let(:rugg... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | spec/circleci/cli/command/projects_command_spec.rb | Ruby | mit | 93 | master | 966 | # frozen_string_literal: true
require 'spec_helper'
describe CircleCI::CLI::Command::ProjectsCommand, type: :command do
context 'with no input' do
let(:options) { OpenStruct.new(token: nil, pretty: true) }
let(:expected_output) do
<<~EXPECTED
+-------------------------------------------+
... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | spec/circleci/cli/command/build_command_spec.rb | Ruby | mit | 93 | master | 1,778 | # frozen_string_literal: true
require 'spec_helper'
describe CircleCI::CLI::Command::BuildCommand, type: :command do
shared_examples_for 'a command show build information' do
let(:expected_output) do
<<~EXPECTED
+---------------+
+---------------+
| \e[0;32;49mbuild\e[0m |
... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | spec/circleci/cli/command/retry_command_spec.rb | Ruby | mit | 93 | master | 1,543 | # frozen_string_literal: true
require 'spec_helper'
describe CircleCI::CLI::Command::RetryCommand, type: :command do
shared_examples_for 'a command retries build' do
it 'should retry build' do
allow(CircleCI::CLI::Command::RetryCommand).to receive(:say) { nil }
expect(CircleCI::CLI::Command::RetryCo... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | spec/circleci/cli/command/browse_command_spec.rb | Ruby | mit | 93 | master | 1,274 | # frozen_string_literal: true
require 'spec_helper'
describe CircleCI::CLI::Command::BrowseCommand, type: :command do
shared_examples_for 'a command opens browser' do
it 'should open browser' do
allow(CircleCI::CLI::Command::BrowseCommand).to receive(:say)
expect(Launchy).to receive(:open).with(expe... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | spec/circleci/cli/command/watch_command/build_repository_spec.rb | Ruby | mit | 93 | master | 1,832 | # frozen_string_literal: true
require 'spec_helper'
describe CircleCI::CLI::Command::BuildRepository do
let(:build) do
CircleCI::CLI::Response::Build.new(
{
'username' => 'unhappychoice',
'reponame' => 'default_reponame_from_api',
'status' => 'running',
'build_num' => 1234,... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | spec/circleci/cli/command/watch_command/build_watcher_spec.rb | Ruby | mit | 93 | master | 7,602 | # frozen_string_literal: true
require 'spec_helper'
describe CircleCI::CLI::Command::BuildWatcher do
let(:build) do
CircleCI::CLI::Response::Build.new(
{
'username' => 'unhappychoice',
'reponame' => 'default_reponame_from_api',
'status' => 'success',
'build_num' => 1234,
... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | spec/circleci/cli/printer/step_printer_spec.rb | Ruby | mit | 93 | master | 2,491 | # frozen_string_literal: true
require 'spec_helper'
describe CircleCI::CLI::Printer::StepPrinter, type: :printer do
describe '#to_s' do
subject { described_class.new(steps, pretty: pretty).to_s }
before do
allow_any_instance_of(CircleCI::CLI::Response::Action).to receive(:log) { 'action log' }
en... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | spec/circleci/cli/printer/project_printer_spec.rb | Ruby | mit | 93 | master | 1,806 | # frozen_string_literal: true
require 'spec_helper'
describe CircleCI::CLI::Printer::ProjectPrinter, type: :printer do
describe '#to_s' do
subject { described_class.new(projects, pretty: pretty).to_s }
let(:projects) do
[
CircleCI::CLI::Response::Project.new({ 'username' => 'user1', 'reponame... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | spec/circleci/cli/printer/build_printer_spec.rb | Ruby | mit | 93 | master | 3,247 | # frozen_string_literal: true
require 'spec_helper'
describe CircleCI::CLI::Printer::BuildPrinter, type: :printer do
describe '#to_s' do
subject { described_class.new(builds, builds.first.project_name, pretty: pretty).to_s }
let(:builds) do
[
CircleCI::CLI::Response::Build.new(
{
... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | spec/circleci/cli/networking/pusher_client_spec.rb | Ruby | mit | 93 | master | 2,196 | # frozen_string_literal: true
require 'spec_helper'
describe CircleCI::CLI::Networking::CircleCIPusherClient, type: :networking do
describe '#connect' do
subject { described_class.new.connect }
let(:mock_socket) { double('socket') }
it 'connects to socket' do
allow(PusherClient).to receive_messa... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | spec/support/mock_rugged.rb | Ruby | mit | 93 | master | 872 | # frozen_string_literal: true
shared_context 'mock rugged response' do
let(:mock_rugged_repository) { double('Rugged::Repository', remotes: mock_rugged_remotes, head: mock_rugged_head) }
let(:mock_rugged_remotes) { [double('Rugged::Remote', name: 'origin', url: rugged_response_remote_url)] }
let(:mock_rugged_he... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | spec/support/mock_env.rb | Ruby | mit | 93 | master | 263 | # frozen_string_literal: true
shared_context 'mock env' do
before do
allow(ENV).to receive(:[]).and_call_original
allow(ENV).to receive(:[]).with('CIRCLE_CI_TOKEN') { nil }
end
end
RSpec.configure do |config|
config.include_context 'mock env'
end |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | spec/support/mock_io.rb | Ruby | mit | 93 | master | 794 | # frozen_string_literal: true
shared_context 'mock io' do
let(:io_response_circle_ci_token) { 'circle-ci-token' }
let(:io_response_project_name) { 'user/project_name_from_io' }
let(:io_response_build_number) { 1234 }
before do
ObjectSpace.each_object(Class).select { |klass| klass < CircleCI::CLI::Command:... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | spec/support/command.rb | Ruby | mit | 93 | master | 785 | # frozen_string_literal: true
shared_examples_for 'a command asks project name' do
let(:expected_project_name_output) do
<<~EXPECTED
+-------------------------------------------+
| \e[0;32;49mProjects\e[0m |
+---------------+---------------------------+
| ... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | spec/support/mock_circle_ci.rb | Ruby | mit | 93 | master | 1,906 | # frozen_string_literal: true
shared_context 'mock circle ci response' do
let(:circleci_response_project_name) { 'user/project_name_from_api' }
let(:account_hash) { { 'name' => 'account name' } }
let(:build_hash) do
{
'username' => circleci_response_project_name.split('/').first,
'reponame' => ci... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | lib/circleci/cli.rb | Ruby | mit | 93 | master | 5,840 | # frozen_string_literal: true
require 'circleci'
require 'highline/import'
require 'launchy'
require 'ostruct'
require 'rugged'
require 'terminal-notifier'
require 'terminal-table'
require 'thor'
require 'circleci/cli/version'
require 'circleci/cli/command'
require 'circleci/cli/response'
require 'circleci/cli/print... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | lib/circleci/cli/command.rb | Ruby | mit | 93 | master | 460 | # frozen_string_literal: true
require 'circleci/cli/command/base_command'
require 'circleci/cli/command/projects_command'
require 'circleci/cli/command/builds_command'
require 'circleci/cli/command/build_command'
require 'circleci/cli/command/browse_command'
require 'circleci/cli/command/watch_command'
require 'circle... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | lib/circleci/cli/printer.rb | Ruby | mit | 93 | master | 727 | # frozen_string_literal: true
require 'circleci/cli/printer/project_printer'
require 'circleci/cli/printer/build_printer'
require 'circleci/cli/printer/step_printer'
module CircleCI
module CLI
module Printer
class << self
def colorize_red(string)
colorize(string, '0;31;49')
end
... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | lib/circleci/cli/response.rb | Ruby | mit | 93 | master | 290 | # frozen_string_literal: true
require 'circleci/cli/response/account'
require 'circleci/cli/response/project'
require 'circleci/cli/response/build'
require 'circleci/cli/response/step'
require 'circleci/cli/response/action'
module CircleCI
module CLI
module Response; end
end
end |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | lib/circleci/cli/networking/http_client.rb | Ruby | mit | 93 | master | 679 | # frozen_string_literal: true
require 'net/http'
require 'json'
module CircleCI
module CLI
module Networking
module HTTPClient
def self.get(url, headers = {})
uri = URI(url)
req = Net::HTTP::Get.new(uri)
headers.each { |key, value| req[key] = value }
res = N... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | lib/circleci/cli/networking/pusher_client.rb | Ruby | mit | 93 | master | 1,227 | # frozen_string_literal: true
require 'pusher-client'
module CircleCI
module CLI
module Networking
class CircleCIPusherClient
def connect
PusherClient.logger.level = Logger::ERROR
socket.connect(true)
end
def bind(channel, event, &)
socket.subscribe(c... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | lib/circleci/cli/printer/build_printer.rb | Ruby | mit | 93 | master | 1,972 | # frozen_string_literal: true
module CircleCI
module CLI
module Printer
class BuildPrinter
class << self
def header_for(build, title)
texts = [
["Project: #{build.project_name}"],
["Build: #{build.build_number}"],
["Author: #{bui... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | lib/circleci/cli/printer/project_printer.rb | Ruby | mit | 93 | master | 806 | # frozen_string_literal: true
module CircleCI
module CLI
module Printer
class ProjectPrinter
attr_accessor :compact
def initialize(projects, pretty: true)
@projects = projects
@pretty = pretty
end
def to_s
@pretty ? print_pretty : print_compac... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | lib/circleci/cli/printer/step_printer.rb | Ruby | mit | 93 | master | 2,128 | # frozen_string_literal: true
module CircleCI
module CLI
module Printer
class StepPrinter
def initialize(steps, pretty: true)
@steps = steps
@pretty = pretty
end
def to_s # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity, Metr... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | lib/circleci/cli/command/retry_command.rb | Ruby | mit | 93 | master | 1,068 | # frozen_string_literal: true
module CircleCI
module CLI
module Command
class RetryCommand < BaseCommand
class << self
def run(options)
setup_token
username, reponame = project_name(options).split('/')
number = build_number_for(username, reponame, optio... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | lib/circleci/cli/command/base_command.rb | Ruby | mit | 93 | master | 891 | # frozen_string_literal: true
module CircleCI
module CLI
module Command
class BaseCommand
class << self
def setup_token
CircleCi.configure do |config|
config.token = ENV.fetch('CIRCLE_CI_TOKEN', nil) || ask('Circle CI token ? :')
end
end
... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | lib/circleci/cli/command/projects_command.rb | Ruby | mit | 93 | master | 344 | # frozen_string_literal: true
module CircleCI
module CLI
module Command
class ProjectsCommand < BaseCommand
class << self
def run(options)
setup_token
say Printer::ProjectPrinter.new(Response::Project.all, pretty: options.pretty).to_s
end
end
... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | lib/circleci/cli/command/build_command.rb | Ruby | mit | 93 | master | 989 | # frozen_string_literal: true
module CircleCI
module CLI
module Command
class BuildCommand < BaseCommand
class << self
def run(options)
setup_token
username, reponame = project_name(options).split('/')
build =
if options.last
... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | lib/circleci/cli/command/watch_command.rb | Ruby | mit | 93 | master | 2,694 | # frozen_string_literal: true
require 'circleci/cli/command/watch_command/build_repository'
require 'circleci/cli/command/watch_command/build_watcher'
module CircleCI
module CLI
module Command
class WatchCommand < BaseCommand
class << self
def run(options) # rubocop:disable Metrics/Metho... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | lib/circleci/cli/command/browse_command.rb | Ruby | mit | 93 | master | 551 | # frozen_string_literal: true
module CircleCI
module CLI
module Command
class BrowseCommand < BaseCommand
class << self
def run(options)
setup_token
project = project_name(options)
number = options.build
Launchy.open url(project, number)
... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | lib/circleci/cli/command/builds_command.rb | Ruby | mit | 93 | master | 707 | # frozen_string_literal: true
module CircleCI
module CLI
module Command
class BuildsCommand < BaseCommand
class << self
def run(options)
setup_token
project_name = project_name(options)
username, reponame = project_name.split('/')
branch = b... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | lib/circleci/cli/command/cancel_command.rb | Ruby | mit | 93 | master | 644 | # frozen_string_literal: true
module CircleCI
module CLI
module Command
class CancelCommand < BaseCommand
class << self
def run(options)
setup_token
username, reponame = project_name(options).split('/')
number = build_number(options)
build =... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | lib/circleci/cli/command/watch_command/build_watcher.rb | Ruby | mit | 93 | master | 4,213 | # frozen_string_literal: true
module CircleCI
module CLI
module Command
class BuildWatcher
attr_reader :build
def initialize(build, verbose: false)
@build = build
@verbose = verbose
@messages = Hash.new { |h, k| h[k] = [] }
@build_thread = nil
... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | lib/circleci/cli/command/watch_command/build_repository.rb | Ruby | mit | 93 | master | 1,354 | # frozen_string_literal: true
module CircleCI
module CLI
module Command
class BuildRepository
def initialize(username, reponame, branch: nil, user: nil)
@username = username
@user = user
@reponame = reponame
@branch = branch
@builds = Response::Buil... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | lib/circleci/cli/response/account.rb | Ruby | mit | 93 | master | 374 | # frozen_string_literal: true
module CircleCI
module CLI
module Response
class Account
def initialize(hash)
@hash = hash
end
def pusher_id
@hash['pusher_id']
end
class << self
def me
Account.new(CircleCi::User.new.me.body)
... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | lib/circleci/cli/response/step.rb | Ruby | mit | 93 | master | 552 | # frozen_string_literal: true
module CircleCI
module CLI
module Response
class Step
attr_reader :type, :name
def initialize(type, hash)
@type = type
@name = hash['name']
@hash = hash
end
def actions
@hash['actions'].map { |a| Action.... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | lib/circleci/cli/response/build.rb | Ruby | mit | 93 | master | 3,596 | # frozen_string_literal: true
module CircleCI
module CLI
module Response
class Build
class << self
def all(username, reponame)
CircleCi::Project.new(username, reponame, 'github').recent_builds
.body
.map { |b| Build.new... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | lib/circleci/cli/response/action.rb | Ruby | mit | 93 | master | 882 | # frozen_string_literal: true
module CircleCI
module CLI
module Response
class Action
attr_reader :name, :status, :index, :step, :end_time, :run_time_millis
def initialize(hash)
@hash = hash
@name = hash['name']
@status = hash['status']
@index = hash... |
github | circleci-tools/circleci-cli | https://github.com/circleci-tools/circleci-cli | lib/circleci/cli/response/project.rb | Ruby | mit | 93 | master | 381 | # frozen_string_literal: true
module CircleCI
module CLI
module Response
class Project
def initialize(hash)
@hash = hash
end
def information
[@hash['username'], @hash['reponame']]
end
def self.all
CircleCi::Projects.new.get.body.map { ... |
github | pond/omniauth-entra-id | https://github.com/pond/omniauth-entra-id | omniauth-entra-id.gemspec | Ruby | mit | 93 | master | 1,729 | # -*- encoding: utf-8 -*-
# frozen_string_literal: true
$:.push File.expand_path( '../lib', __FILE__ )
require 'omniauth/entra_id/version'
# https://guides.rubygems.org/specification-reference/
#
Gem::Specification.new do |s|
s.name = 'omniauth-entra-id'
s.version = OmniAuth::Entra:... |
github | pond/omniauth-entra-id | https://github.com/pond/omniauth-entra-id | spec/spec_helper.rb | Ruby | mit | 93 | master | 361 | require 'bundler/setup'
require 'debug'
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!
config.expect_with :rspec... |
github | pond/omniauth-entra-id | https://github.com/pond/omniauth-entra-id | spec/omniauth/strategies/entra_id_spec.rb | Ruby | mit | 93 | master | 30,509 | require 'spec_helper'
require 'omniauth/entra_id'
RSpec.describe OmniAuth::Strategies::EntraId do
let(:request) { double('Request', :params => {}, :cookies => {}, :env => {}) }
let(:app) {
lambda do
[200, {}, ["Hello."]]
end
}
before do
OmniAuth.config.test_mode = true
end
after do
... |
github | pond/omniauth-entra-id | https://github.com/pond/omniauth-entra-id | lib/omniauth/strategies/entra_id.rb | Ruby | mit | 93 | master | 9,019 | # frozen_string_literal: true
require 'omniauth-oauth2'
module OmniAuth
module Strategies
class EntraId < OmniAuth::Strategies::OAuth2
BASE_URL = 'https://login.microsoftonline.com'
option :name, 'entra_id'
option :tenant_provider, nil
option :ignore_tid, false
opt... |
github | railslink/railslink | https://github.com/railslink/railslink | Gemfile | Ruby | mit | 93 | master | 4,675 | source 'https://rubygems.org'
ruby '3.4.7'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
gem 'rails', '~> 8.0.0'
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', require: false
... |
github | railslink/railslink | https://github.com/railslink/railslink | lib/tasks/slack/sync.rake | Ruby | mit | 93 | master | 1,297 | namespace :slack do
desc "Sync everything"
task sync: ["sync:channels", "sync:users"] do
end
namespace :sync do
desc "Sync channels"
task channels: [:environment] do
puts "Syncing slack channels..."
begin
client = Slack::Web::Client.new
client.conversations_list do |respons... |
github | railslink/railslink | https://github.com/railslink/railslink | lib/tasks/slack/admin.rake | Ruby | mit | 93 | master | 1,356 | namespace :slack do
namespace :admin do
namespace :files do
desc "Prune files"
task prune: [:environment] do
puts "Pruning files..."
client = Slack::Web::Client.new
page = 1
pages = 1
count = 200
files = []
while page <= pages do
pu... |
github | railslink/railslink | https://github.com/railslink/railslink | lib/tasks/slack/test.rake | Ruby | mit | 93 | master | 252 | namespace :slack do
namespace :test do
desc "Test Slack API"
task api: [:environment] do
puts "Testing slack api..."
client = Slack::Web::Client.new
response = client.auth_test
puts response.to_json
end
end
end |
github | railslink/railslink | https://github.com/railslink/railslink | db/seeds.rb | Ruby | mit | 93 | master | 10,617 | return unless Rails.env.development?
[
{uid: "CCEFW4DMW", name: "random", is_archived: false, is_general: false, is_private: false, purpose: "A place for non-work-related flimflam, faffing, hodge-podge or jibber-jabber you'd prefer to keep out of more focused work-related channels.", members_count: 8593, data: {"id"... |
github | railslink/railslink | https://github.com/railslink/railslink | db/schema.rb | Ruby | mit | 93 | master | 3,027 | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# This file is the source Rails uses to define your schema when running `bin/rai... |
github | railslink/railslink | https://github.com/railslink/railslink | db/migrate/20180415004052_create_slack_channels.rb | Ruby | mit | 93 | master | 413 | class CreateSlackChannels < ActiveRecord::Migration[5.1]
def change
create_table :slack_channels do |t|
t.string :uid, index: true
t.string :name
t.boolean :is_archived
t.boolean :is_general, default: false, index: true
t.boolean :is_private
t.text :purpose
t.integer :mem... |
github | railslink/railslink | https://github.com/railslink/railslink | db/migrate/20180415010738_create_slack_users.rb | Ruby | mit | 93 | master | 506 | class CreateSlackUsers < ActiveRecord::Migration[5.1]
def change
create_table :slack_users do |t|
t.string :uid, index: true
t.string :email, index: true
t.string :username, index: true
t.string :first_name
t.string :last_name
t.string :tz
t.integer :tz_offset
t.str... |
github | railslink/railslink | https://github.com/railslink/railslink | db/migrate/20180419022138_create_slack_membership_submissions.rb | Ruby | mit | 93 | master | 556 | class CreateSlackMembershipSubmissions < ActiveRecord::Migration[5.1]
def change
create_table :slack_membership_submissions do |t|
t.references :slack_user
t.integer :status, default: 0, index: true
t.string :first_name
t.string :last_name
t.string :email
t.string :location
... |
github | railslink/railslink | https://github.com/railslink/railslink | app/helpers/application_helper.rb | Ruby | mit | 93 | master | 643 | module ApplicationHelper
include Pagy::Frontend
def link_to_login_or_logout
if current_user
link_to "Logout", logout_path, class: "navbar-item"
else
# TODO: abstract the hardcoded url
link_to "Login", "/auth/slack", class: "navbar-item"
end
end
def link_to_open_slack
id = Slack... |
github | railslink/railslink | https://github.com/railslink/railslink | app/models/ip_info.rb | Ruby | mit | 93 | master | 504 | #
# See http://ip-api.com/docs/api:json
#
class IpInfo
def initialize(ip_address)
@ip_address = ip_address
Timeout::timeout(3) do
@info = JSON.parse(Net::HTTP.get("ip-api.com", "/json/#{@ip_address}"))
end
rescue Net::OpenTimeout, JSON::ParserError, Timeout::Error
@info = {}
end
def succ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.