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 | aspose-words-cloud/Aspose.Words-Cloud-SDK-for-Ruby | https://github.com/aspose-words-cloud/Aspose.Words-Cloud-SDK-for-Ruby | lib/aspose_words_cloud/models/responses/replace_text_online_response.rb | Ruby | mit | 19 | master | 1,841 | # ------------------------------------------------------------------------------------
# <copyright company="Aspose" file="replace_text_online_response.rb">
# Copyright (c) 2026 Aspose.Words for Cloud
# </copyright>
# <summary>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this... |
github | aspose-words-cloud/Aspose.Words-Cloud-SDK-for-Ruby | https://github.com/aspose-words-cloud/Aspose.Words-Cloud-SDK-for-Ruby | lib/aspose_words_cloud/models/responses/update_drawing_object_online_response.rb | Ruby | mit | 19 | master | 1,822 | # ------------------------------------------------------------------------------------
# <copyright company="Aspose" file="update_drawing_object_online_response.rb">
# Copyright (c) 2026 Aspose.Words for Cloud
# </copyright>
# <summary>
# Permission is hereby granted, free of charge, to any person obtaining a copy
#... |
github | aspose-words-cloud/Aspose.Words-Cloud-SDK-for-Ruby | https://github.com/aspose-words-cloud/Aspose.Words-Cloud-SDK-for-Ruby | lib/aspose_words_cloud/models/responses/insert_watermark_online_response.rb | Ruby | mit | 19 | master | 1,815 | # ------------------------------------------------------------------------------------
# <copyright company="Aspose" file="insert_watermark_online_response.rb">
# Copyright (c) 2026 Aspose.Words for Cloud
# </copyright>
# <summary>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of ... |
github | aspose-words-cloud/Aspose.Words-Cloud-SDK-for-Ruby | https://github.com/aspose-words-cloud/Aspose.Words-Cloud-SDK-for-Ruby | lib/aspose_words_cloud/models/responses/reject_all_revisions_online_response.rb | Ruby | mit | 19 | master | 1,912 | # ------------------------------------------------------------------------------------
# <copyright company="Aspose" file="reject_all_revisions_online_response.rb">
# Copyright (c) 2026 Aspose.Words for Cloud
# </copyright>
# <summary>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# ... |
github | aspose-words-cloud/Aspose.Words-Cloud-SDK-for-Ruby | https://github.com/aspose-words-cloud/Aspose.Words-Cloud-SDK-for-Ruby | lib/aspose_words_cloud/models/responses/remove_all_signatures_online_response.rb | Ruby | mit | 19 | master | 1,980 | # ------------------------------------------------------------------------------------
# <copyright company="Aspose" file="remove_all_signatures_online_response.rb">
# Copyright (c) 2026 Aspose.Words for Cloud
# </copyright>
# <summary>
# Permission is hereby granted, free of charge, to any person obtaining a copy
#... |
github | alec-c4/e2e | https://github.com/alec-c4/e2e | e2e.gemspec | Ruby | mit | 19 | master | 1,932 | # frozen_string_literal: true
require_relative "lib/e2e/version"
Gem::Specification.new do |spec|
spec.name = "e2e"
spec.version = E2E::VERSION
spec.authors = ["Alexey Poimtsev"]
spec.email = ["alexey.poimtsev@gmail.com"]
spec.summary = "Unified E2E testing framework for Ruby."
spec.description = "A flex... |
github | alec-c4/e2e | https://github.com/alec-c4/e2e | Appraisals | Ruby | mit | 19 | master | 274 | appraise "rails-7.0" do
gem "rails", "~> 7.0.0"
end
appraise "rails-7.1" do
gem "rails", "~> 7.1.0"
end
appraise "rails-7.2" do
gem "rails", "~> 7.2.0"
end
appraise "rails-8.0" do
gem "rails", "~> 8.0.0"
end
appraise "rails-8.1" do
gem "rails", "~> 8.1.0"
end |
github | alec-c4/e2e | https://github.com/alec-c4/e2e | Rakefile | Ruby | mit | 19 | master | 377 | # frozen_string_literal: true
require "bundler/gem_tasks"
require "rspec/core/rake_task"
require "rake/testtask"
require "rubocop/rake_task"
RSpec::Core::RakeTask.new(:spec)
Rake::TestTask.new(:test) do |t|
t.libs << "lib"
t.libs << "spec"
t.test_files = FileList["spec/**/*_test.rb"]
t.verbose = true
end
Ru... |
github | alec-c4/e2e | https://github.com/alec-c4/e2e | Gemfile | Ruby | mit | 19 | master | 287 | # frozen_string_literal: true
source "https://rubygems.org"
# Specify your gem's dependencies in e2e.gemspec
gemspec
gem "irb"
gem "rake", "~> 13.0"
gem "rspec", "~> 3.0"
# Development tools
gem "appraisal"
gem "lefthook"
gem "standard"
gem "rubocop-rspec"
gem "rubocop-performance" |
github | alec-c4/e2e | https://github.com/alec-c4/e2e | lib/e2e.rb | Ruby | mit | 19 | master | 1,879 | # frozen_string_literal: true
require_relative "e2e/version"
require_relative "e2e/driver"
require_relative "e2e/server"
require_relative "e2e/session"
require_relative "e2e/dsl"
require_relative "e2e/element"
require_relative "e2e/rails"
require_relative "e2e/drivers/playwright"
module E2E
class Error < StandardEr... |
github | alec-c4/e2e | https://github.com/alec-c4/e2e | lib/generators/e2e/test_generator.rb | Ruby | mit | 19 | master | 1,191 | # frozen_string_literal: true
require "rails/generators"
module E2e
module Generators
class TestGenerator < ::Rails::Generators::NamedBase
source_root File.expand_path("templates", __dir__)
class_option :test_framework, type: :string, desc: "Test framework to be invoked"
def create_test_file
... |
github | alec-c4/e2e | https://github.com/alec-c4/e2e | lib/generators/e2e/install_generator.rb | Ruby | mit | 19 | master | 2,944 | # frozen_string_literal: true
require "rails/generators"
module E2e
module Generators
class InstallGenerator < ::Rails::Generators::Base
source_root File.expand_path("templates", __dir__)
class_option :test_framework, type: :string, desc: "Test framework to be invoked"
def create_helper_file
... |
github | alec-c4/e2e | https://github.com/alec-c4/e2e | lib/e2e/minitest.rb | Ruby | mit | 19 | master | 1,127 | # frozen_string_literal: true
require "minitest"
require "e2e"
require_relative "assertions"
module E2E
module Minitest
class TestCase < ::Minitest::Test
include E2E::DSL
include E2E::Assertions
def teardown
take_failed_screenshot if !passed? && !skipped?
# Reset session but ... |
github | alec-c4/e2e | https://github.com/alec-c4/e2e | lib/e2e/rails.rb | Ruby | mit | 19 | master | 803 | # frozen_string_literal: true
module E2E
module Rails
# This module allows the test thread and the server thread to share the same
# ActiveRecord connection. This is crucial for running tests in transactions
# which is much faster than using truncation.
module ActiveRecordSharedConnection
def c... |
github | alec-c4/e2e | https://github.com/alec-c4/e2e | lib/e2e/dsl.rb | Ruby | mit | 19 | master | 4,724 | # frozen_string_literal: true
require "forwardable"
require "uri"
module E2E
module DSL
extend Forwardable
def_delegators "E2E.session", :visit, :current_url, :find, :all, :click, :click_button, :click_link, :fill_in, :check, :uncheck, :attach_file, :body, :evaluate, :save_screenshot, :native, :pause, :res... |
github | alec-c4/e2e | https://github.com/alec-c4/e2e | lib/e2e/element.rb | Ruby | mit | 19 | master | 835 | # frozen_string_literal: true
module E2E
class Element
def initialize(locator)
@locator = locator
end
def click
@locator.click
end
def fill(value)
@locator.fill(value)
end
def text
@locator.inner_text
end
def visible?
@locator.visible?
end
... |
github | alec-c4/e2e | https://github.com/alec-c4/e2e | lib/e2e/assertions.rb | Ruby | mit | 19 | master | 2,388 | # frozen_string_literal: true
module E2E
module Assertions
def assert_text(text)
actual_text = nil
found = E2E.wait_until do
actual_text = page.text
if text.is_a?(Regexp)
actual_text.match?(text)
else
actual_text.include?(text)
end
end
... |
github | alec-c4/e2e | https://github.com/alec-c4/e2e | lib/e2e/driver.rb | Ruby | mit | 19 | master | 1,265 | # frozen_string_literal: true
module E2E
class Driver
def visit(url)
raise NotImplementedError
end
def current_url
raise NotImplementedError
end
def find(selector, **options)
raise NotImplementedError
end
def all(selector, **options)
raise NotImplementedError
... |
github | alec-c4/e2e | https://github.com/alec-c4/e2e | lib/e2e/rspec.rb | Ruby | mit | 19 | master | 1,005 | # frozen_string_literal: true
require "e2e"
begin
require "rspec/expectations"
rescue LoadError
end
require_relative "matchers"
RSpec.configure do |config|
config.include E2E::DSL, type: :e2e
config.after(:each, type: :e2e) do |example|
if example.exception
# Create tmp/screenshots directory if it do... |
github | alec-c4/e2e | https://github.com/alec-c4/e2e | lib/e2e/server.rb | Ruby | mit | 19 | master | 1,129 | # frozen_string_literal: true
require "rack"
require "rackup"
require "webrick"
require "socket"
module E2E
class Server
attr_reader :app, :host, :port
def initialize(app, port: nil)
@app = app
@host = "127.0.0.1"
@port = port || find_available_port
end
def start
@thread = ... |
github | alec-c4/e2e | https://github.com/alec-c4/e2e | lib/e2e/session.rb | Ruby | mit | 19 | master | 897 | # frozen_string_literal: true
require "forwardable"
module E2E
class Session
extend Forwardable
attr_reader :driver
def_delegators :@driver, :current_url, :click, :click_button, :click_link, :fill_in, :check, :uncheck, :attach_file, :body, :text, :evaluate, :save_screenshot, :native, :pause, :reset!, ... |
github | alec-c4/e2e | https://github.com/alec-c4/e2e | lib/e2e/matchers.rb | Ruby | mit | 19 | master | 6,339 | # frozen_string_literal: true
if defined?(RSpec::Matchers)
RSpec::Matchers.define :have_class do |expected_class|
match do |element|
element.has_class?(expected_class)
end
failure_message do |element|
"expected element to have class '#{expected_class}', but it had '#{element.classes.join(" "... |
github | alec-c4/e2e | https://github.com/alec-c4/e2e | lib/e2e/drivers/playwright.rb | Ruby | mit | 19 | master | 3,313 | # frozen_string_literal: true
require "playwright"
module E2E
module Drivers
class Playwright < Driver
def initialize
@playwright_execution = ::Playwright.create(playwright_cli_executable_path: "npx playwright")
@playwright = @playwright_execution.playwright
browser_type_name = E2... |
github | alec-c4/e2e | https://github.com/alec-c4/e2e | spec/spec_helper.rb | Ruby | mit | 19 | master | 473 | # frozen_string_literal: true
require "simplecov"
SimpleCov.start do
add_filter "/spec/"
add_filter "/bin/"
end
require "e2e"
require "e2e/rspec"
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
# Disable RSpec... |
github | alec-c4/e2e | https://github.com/alec-c4/e2e | spec/e2e/rack_spec.rb | Ruby | mit | 19 | master | 2,917 | # frozen_string_literal: true
RSpec.describe "Rack", type: :e2e do
# Simple Rack App
let(:app) do
proc do |env|
case env["PATH_INFO"]
when "/"
[
200,
{"content-type" => "text/html"},
[
<<~HTML
<h1>Hello Rack!</h1>
<button... |
github | alec-c4/e2e | https://github.com/alec-c4/e2e | spec/e2e/basic_spec.rb | Ruby | mit | 19 | master | 883 | # frozen_string_literal: true
RSpec.describe "Basic", type: :e2e do
it "can visit a page and check content using DSL" do
visit("https://example.com")
expect(current_url).to eq("https://example.com/")
expect(page.body).to include("Example Domain")
h1 = find("h1")
expect(h1).to have_text("Example... |
github | alec-c4/e2e | https://github.com/alec-c4/e2e | spec/e2e/matchers_spec.rb | Ruby | mit | 19 | master | 2,900 | # frozen_string_literal: true
RSpec.describe "Matchers", type: :e2e do
it "supports have_class matcher" do
visit "data:text/html,<div class='foo bar'></div>"
div = find("div")
expect(div).to have_class("foo")
expect(div).to have_class("bar")
expect(div).not_to have_class("baz")
end
it "suppo... |
github | alec-c4/e2e | https://github.com/alec-c4/e2e | spec/e2e/minitest_assertions_test.rb | Ruby | mit | 19 | master | 2,137 | # frozen_string_literal: true
require "minitest/autorun"
require "e2e"
require "e2e/minitest"
class MinitestAssertionsTest < E2E::Minitest::TestCase
def test_assert_text
visit "data:text/html,<div>Hello World</div>"
assert_text "Hello"
assert_text "World"
assert_text(/Hello/)
end
def test_refut... |
github | cookpad/cp8_cli | https://github.com/cookpad/cp8_cli | cp8_cli.gemspec | Ruby | mit | 19 | main | 1,427 | # coding: utf-8
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "cp8_cli/version"
Gem::Specification.new do |spec|
spec.name = "cp8_cli"
spec.version = Cp8Cli::VERSION
spec.authors = ["Jens Balvig"]
spec.email = ["jens@balv... |
github | cookpad/cp8_cli | https://github.com/cookpad/cp8_cli | test/main_test.rb | Ruby | mit | 19 | main | 5,750 | require "test_helper"
module Cp8Cli
class MainTest < Minitest::Test
def setup
stub_shell
stub_request(:get, /rubygems\.org/).to_return_json({})
stub_request(:get, /pulls/).to_return_json([])
end
def test_start_adhoc_story
stub_github(:get, "/repos/balvig/cp8_cli").to_return_json(... |
github | cookpad/cp8_cli | https://github.com/cookpad/cp8_cli | test/test_helper.rb | Ruby | mit | 19 | main | 330 | $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
require "cp8_cli"
require "minitest/autorun"
require "minitest/reporters"
require "pry"
# Require support files
Dir[File.expand_path("../support/**/*.rb", __FILE__)].each { |f| require f }
# Pretty colors
Minitest::Reporters.use! Minitest::Reporters::SpecRep... |
github | cookpad/cp8_cli | https://github.com/cookpad/cp8_cli | test/branch_name_test.rb | Ruby | mit | 19 | main | 404 | require "test_helper"
module Cp8Cli
class BranchNameTest < Minitest::Test
def setup
stub_shell
end
def test_to_s
stub_github_user("Doug Adams")
user = CurrentUser.new
story = Minitest::Mock.new
story.expect :title, "Fix Bug"
expect_question "Branch name: da/", defaul... |
github | cookpad/cp8_cli | https://github.com/cookpad/cp8_cli | test/support/webmock.rb | Ruby | mit | 19 | main | 257 | require "multi_json"
require "webmock/minitest"
class WebMock::RequestStub
def to_return_json(hash, options = {})
options[:body] = MultiJson.dump(hash)
options[:headers] = { "Content-Type" => "application/json" }
to_return(options)
end
end |
github | cookpad/cp8_cli | https://github.com/cookpad/cp8_cli | test/support/command.rb | Ruby | mit | 19 | main | 1,622 | require "active_support/core_ext/hash"
def stub_shell
Cp8Cli::Command.client = Minitest::Mock.new
end
def shell
Cp8Cli::Command.client
end
def stub_github_user(name)
shell.expect :read, name, ["git config user.name"]
end
def stub_repo(repo, count: 1)
count.times { shell.expect(:read, repo, ["git config --ge... |
github | cookpad/cp8_cli | https://github.com/cookpad/cp8_cli | test/github/parsed_url_test.rb | Ruby | mit | 19 | main | 371 | require "test_helper"
module Cp8Cli
module Github
class ParsedUrlTest < Minitest::Test
def test_github_issue_with_anchor
url = ParsedUrl.new("https://github.com/balvig/cp8_cli/issues/ISSUE_NUMBER#pullrequestreview-62945399")
assert_equal "ISSUE_NUMBER", url.number
assert_equal "bal... |
github | cookpad/cp8_cli | https://github.com/cookpad/cp8_cli | lib/cp8_cli/pull_request_title.rb | Ruby | mit | 19 | main | 474 | module Cp8Cli
class PullRequestTitle
def initialize(title, prefixes: [])
@title = title
@prefixes = Array(prefixes)
end
def run
title_with_prefixes.presence
end
private
attr_reader :title, :prefixes
def title_with_prefixes
"#{prefixes_to_text} #{title}".st... |
github | cookpad/cp8_cli | https://github.com/cookpad/cp8_cli | lib/cp8_cli/branch_name.rb | Ruby | mit | 19 | main | 481 | module Cp8Cli
class BranchName
SEPARATOR = "/"
def initialize(user:, story:)
@user = user
@story = story
end
def to_s
"#{prefix}#{user_input}"
end
private
attr_reader :user, :story
def user_input
Command.ask("Branch name: #{prefix}", default: default)... |
github | cookpad/cp8_cli | https://github.com/cookpad/cp8_cli | lib/cp8_cli/story.rb | Ruby | mit | 19 | main | 1,094 | module Cp8Cli
class Story
require "shellwords"
def start
checkout_branch
create_empty_commit
push_branch
create_draft_pull_request
assign
Command.title "Created draft PR, run `cp8 open` to view."
end
private
def checkout_branch
branch.checkout
... |
github | cookpad/cp8_cli | https://github.com/cookpad/cp8_cli | lib/cp8_cli/config_store.rb | Ruby | mit | 19 | main | 642 | require "yaml"
module Cp8Cli
class ConfigStore
def initialize(path)
@path = path
end
def [](key)
data[key]
end
def exist?
File.exist?(path)
end
def move_to(new_path)
File.rename(path, new_path)
@path = new_path
end
def save(key, value)
data[... |
github | cookpad/cp8_cli | https://github.com/cookpad/cp8_cli | lib/cp8_cli/repo.rb | Ruby | mit | 19 | main | 497 | module Cp8Cli
class Repo
def self.current
path = Command.read("git config --get remote.origin.url").match(/github.com[:\/](\S+\/\S+)\.git/)[1]
new(path)
end
def initialize(path)
@path = path
end
def shorthand
"#{user}/#{name}"
end
def url
"https://github.co... |
github | cookpad/cp8_cli | https://github.com/cookpad/cp8_cli | lib/cp8_cli/version.rb | Ruby | mit | 19 | main | 484 | module Cp8Cli
VERSION = "9.1.1"
class Version
def self.latest?
new.latest?
end
def latest?
latest_version <= current_version
end
private
def latest_version
@_latest_version ||= Gem.latest_version_for("cp8_cli") || first_version
end
def current_version
... |
github | cookpad/cp8_cli | https://github.com/cookpad/cp8_cli | lib/cp8_cli/main.rb | Ruby | mit | 19 | main | 682 | require "cp8_cli/version"
require "cp8_cli/global_config"
require "cp8_cli/commands/ci"
require "cp8_cli/commands/open"
require "cp8_cli/commands/start"
require "cp8_cli/commands/submit"
require "cp8_cli/commands/suggest"
module Cp8Cli
class Main
def initialize(global_config = GlobalConfig.new)
Github::Api... |
github | cookpad/cp8_cli | https://github.com/cookpad/cp8_cli | lib/cp8_cli/branch.rb | Ruby | mit | 19 | main | 1,538 | require "active_support/core_ext/string/inflections"
require "cp8_cli/ci"
require "cp8_cli/github/pull_request"
require "cp8_cli/branch_name"
require "cp8_cli/current_user"
require "cp8_cli/pull_request_title"
require "cp8_cli/pull_request_body"
module Cp8Cli
class Branch
attr_reader :name
def initialize(n... |
github | cookpad/cp8_cli | https://github.com/cookpad/cp8_cli | lib/cp8_cli/global_config.rb | Ruby | mit | 19 | main | 1,194 | require "cp8_cli/config_store"
module Cp8Cli
class GlobalConfig
LEGACY_PATH = ENV["HOME"] + "/.trello_flow"
PATH = ENV["HOME"] + "/.cp8_cli"
def initialize(store = nil)
@store = store || initialize_store
end
def github_token
@_github_token ||= store[:github_token] || env_github_toke... |
github | cookpad/cp8_cli | https://github.com/cookpad/cp8_cli | lib/cp8_cli/command.rb | Ruby | mit | 19 | main | 1,199 | require "colored"
require "active_support/core_ext/module/delegation"
require "highline"
require "tty-prompt"
require "os"
module Cp8Cli
class Command
class << self
delegate :open_url, :say, :success, :ask, :title, :error, :run, :read, to: :client
attr_accessor :client
end
self.client = new
... |
github | cookpad/cp8_cli | https://github.com/cookpad/cp8_cli | lib/cp8_cli/ci.rb | Ruby | mit | 19 | main | 399 | module Cp8Cli
class Ci
def initialize(branch_name:, repo:)
@branch_name = branch_name
@repo = repo
end
def open
Command.open_url url
end
private
attr_reader :branch_name, :repo
def url
"https://circleci.com/gh/#{repo.shorthand}/tree/#{escape branch_name}"
... |
github | cookpad/cp8_cli | https://github.com/cookpad/cp8_cli | lib/cp8_cli/current_user.rb | Ruby | mit | 19 | main | 571 | require "active_support/core_ext/string"
module Cp8Cli
class CurrentUser
include Github::Api::Client
def initials
Command.error("Please configure your git user.name using git config user.name Jane Doe") unless git_user_name
git_user_name.parameterize(separator: " ").split.map(&:first).join
e... |
github | cookpad/cp8_cli | https://github.com/cookpad/cp8_cli | lib/cp8_cli/adhoc_story.rb | Ruby | mit | 19 | main | 321 | require "cp8_cli/story"
module Cp8Cli
class AdhocStory < Story
attr_reader :title
def initialize(title)
@title = title
end
def summary
# noop
end
def url
"#{Repo.current.url}/tree/#{Branch.current}"
end
private
def assign
# noop
end
end
end |
github | cookpad/cp8_cli | https://github.com/cookpad/cp8_cli | lib/cp8_cli/pull_request_body.rb | Ruby | mit | 19 | main | 396 | module Cp8Cli
class PullRequestBody
def initialize(story)
@story = story
end
def run
return if story.summary.blank?
summary_with_release_note
end
private
attr_reader :story
def summary_with_release_note
story.summary + release_note
end
def re... |
github | cookpad/cp8_cli | https://github.com/cookpad/cp8_cli | lib/cp8_cli/github/parsed_url.rb | Ruby | mit | 19 | main | 342 | module Cp8Cli
module Github
class ParsedUrl
def initialize(url)
@url = url
end
def number
parts.last.split("#").first
end
def repo
parts[3, 2].join("/")
end
private
attr_accessor :url
def parts
url.split("/")
... |
github | cookpad/cp8_cli | https://github.com/cookpad/cp8_cli | lib/cp8_cli/github/api.rb | Ruby | mit | 19 | main | 500 | require "active_support"
require "active_support/concern"
require "octokit"
module Cp8Cli
module Github
class Api
cattr_accessor :client
def self.configure(token:)
self.client = Octokit::Client.new(access_token: token)
end
module Client
extend ActiveSupport::Concern
... |
github | cookpad/cp8_cli | https://github.com/cookpad/cp8_cli | lib/cp8_cli/github/issue.rb | Ruby | mit | 19 | main | 921 | require "cp8_cli/github/api"
require "cp8_cli/github/parsed_url"
require "cp8_cli/story"
module Cp8Cli
module Github
class Issue < Story
include Api::Client
def initialize(number:, repo:, **attributes)
@number = number
@repo = repo
@attributes = attributes
end
de... |
github | cookpad/cp8_cli | https://github.com/cookpad/cp8_cli | lib/cp8_cli/github/pull_request.rb | Ruby | mit | 19 | main | 1,745 | require "cp8_cli/github/api"
require "cp8_cli/repo"
module Cp8Cli
module Github
class PullRequest
include Api::Client
def self.create(attributes = {})
new(**attributes).save
end
def self.find_by(repo:, branch:)
client.pull_requests(repo.shorthand, head: "#{repo.user}:#{b... |
github | cookpad/cp8_cli | https://github.com/cookpad/cp8_cli | lib/cp8_cli/commands/start.rb | Ruby | mit | 19 | main | 870 | require "cp8_cli/adhoc_story"
require "cp8_cli/github/issue"
module Cp8Cli
module Commands
class Start
def initialize(name)
@name = name
end
def run
check_version
if story
story.start
else
Command.error "No name/url provided"
end
... |
github | cookpad/cp8_cli | https://github.com/cookpad/cp8_cli | lib/cp8_cli/commands/submit.rb | Ruby | mit | 19 | main | 322 | module Cp8Cli
module Commands
class Submit
def initialize(options = {})
@options = options
end
def run
branch.push
branch.open_pr
end
private
attr_reader :options
def branch
@_branch ||= Branch.current
end
end
end
en... |
github | cookpad/cp8_cli | https://github.com/cookpad/cp8_cli | lib/cp8_cli/commands/suggest.rb | Ruby | mit | 19 | main | 758 | module Cp8Cli
module Commands
class Suggest
def run
cache_original_branch
suggestion_branch.checkout
suggestion_branch.push
pull_request.open
original_branch.checkout
original_branch.reset
end
private
def cache_original_branch
... |
github | devsecops/assumer | https://github.com/devsecops/assumer | source/assumer.gemspec | Ruby | apache-2.0 | 19 | master | 1,225 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'assumer/version'
Gem::Specification.new do |spec|
spec.name = 'assumer'
spec.version = Assumer::VERSION
spec.authors = ['Brandon Sherman']
spec.email = ['mech... |
github | devsecops/assumer | https://github.com/devsecops/assumer | source/lib/mfa.rb | Ruby | apache-2.0 | 19 | master | 563 | module Assumer
##
# A class to manage methods of obtaining OTP codes for MFA
class MFA
attr_reader :otp
##
# A method to prompt for the user's OTP MFA code on the CLI
# @return [String] The MFA code entered by the user
def request_one_time_code
until @otp =~ /\d{6}/
print 'Enter ... |
github | devsecops/assumer | https://github.com/devsecops/assumer | source/lib/assumer.rb | Ruby | apache-2.0 | 19 | master | 4,834 | require 'assumer/version'
require 'aws-sdk-core'
require 'mfa'
module Assumer
# The regex that AWS uses to verify if a role's ARN is valid
AWS_ROLE_REGEX = %r{arn:aws:iam::\d{12}:role/?[a-zA-Z_0-9+=,.@\-_/]+}
class AssumerError < StandardError; end
# This class provides the main functionallity to the Assumer g... |
github | steveklabnik/bring_back_snowman | https://github.com/steveklabnik/bring_back_snowman | bring_back_snowman.gemspec | Ruby | mit | 19 | master | 805 | # -*- encoding: utf-8 -*-
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'bring_back_snowman/version'
Gem::Specification.new do |gem|
gem.name = "bring_back_snowman"
gem.version = BringBackSnowman::VERSION
gem.authors = ["Steve Klab... |
github | steveklabnik/bring_back_snowman | https://github.com/steveklabnik/bring_back_snowman | lib/bring_back_snowman.rb | Ruby | mit | 19 | master | 634 | # encoding: UTF-8
require "bring_back_snowman/version"
module BringBackSnowman
class Railtie < Rails::Railtie
config.snowman = {}
config.after_initialize do |app|
app.config.snowman = {:_snowman => "☃"} if app.config.snowman == {}
end
end
end
module ActionView
module Helpers
module FormTagHe... |
github | alex-phillips/clouddrive | https://github.com/alex-phillips/clouddrive | clouddrive.gemspec | Ruby | mit | 19 | master | 1,625 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'clouddrive/version'
Gem::Specification.new do |spec|
spec.name = "clouddrive"
spec.version = CloudDrive::VERSION
spec.authors = ["Alex Phillips"]
spec.email =... |
github | alex-phillips/clouddrive | https://github.com/alex-phillips/clouddrive | lib/clouddrive.rb | Ruby | mit | 19 | master | 1,252 | require "clouddrive/version"
require "clouddrive/account"
require "clouddrive/node"
require "clouddrive/cache"
require "clouddrive/cache/sql"
require "clouddrive/cache/sqlite"
require "clouddrive/cache/mysql"
require "clouddrive/commands/command"
require "clouddrive/commands/config_command"
require "clouddrive/commands... |
github | alex-phillips/clouddrive | https://github.com/alex-phillips/clouddrive | lib/clouddrive/node.rb | Ruby | mit | 19 | master | 15,530 | require 'rest-client'
require 'pathname'
require 'find'
require 'digest/md5'
require 'json'
module CloudDrive
class Node
attr_reader :data
def self.init(account, cache)
if defined?(@@initialized) && @@initialized == true
raise "`Node` class already initialized"
end
@@initialized... |
github | alex-phillips/clouddrive | https://github.com/alex-phillips/clouddrive | lib/clouddrive/account.rb | Ruby | mit | 19 | master | 6,997 | require 'json'
require 'cgi'
require 'rest-client'
require 'sqlite3'
module CloudDrive
class Account
attr_reader :cache, :access_token, :metadata_url, :content_url, :email, :token_store, :checkpoint
def initialize(email, client_id, client_secret, cache)
@email = email
@cache_file = File.expand... |
github | alex-phillips/clouddrive | https://github.com/alex-phillips/clouddrive | lib/clouddrive/cache/sqlite.rb | Ruby | mit | 19 | master | 1,812 | require 'fileutils'
require 'sequel'
module CloudDrive
class Sqlite < Sql
def initialize(email, cache_dir)
# Strip of trailing slashes
cache_dir = File.expand_path(cache_dir)
if !File.exist?(cache_dir)
FileUtils.mkdir_p(cache_dir)
end
if File.exist?("#{cache_dir}/#{email... |
github | alex-phillips/clouddrive | https://github.com/alex-phillips/clouddrive | lib/clouddrive/cache/mysql.rb | Ruby | mit | 19 | master | 1,436 | require 'fileutils'
require 'sequel'
module CloudDrive
class Mysql < Sql
def initialize(host, database, username, password)
@db = Sequel.connect("mysql://#{username}:#{password}@#{host}/#{database}")
@db.run(<<-SQL
CREATE TABLE IF NOT EXISTS configs (
id INT(11) NOT NULL auto_incr... |
github | alex-phillips/clouddrive | https://github.com/alex-phillips/clouddrive | lib/clouddrive/cache/sql.rb | Ruby | mit | 19 | master | 4,747 | module CloudDrive
class Sql < Cache
def delete_all_nodes
@db.run("DELETE FROM nodes WHERE 1=1;")
end
def delete_node_by_id(id)
@db.from(:nodes).where(:id => id).delete
@db.from(:nodes_nodes).where(:id_node => id).delete
end
def find_node_by_id(id)
retval = []
resu... |
github | alex-phillips/clouddrive | https://github.com/alex-phillips/clouddrive | lib/clouddrive/commands/upload_command.rb | Ruby | mit | 19 | master | 1,257 | require 'colorize'
module CloudDrive
class UploadCommand < Command
parameter "local_path", "Local path to file/folder to upload"
parameter "[remote_path]", "Remote path to upload the file(s) to"
option ["-o", "--overwrite"], :flag, "Overwrite the remote node if it exists but has a different checksum"
... |
github | alex-phillips/clouddrive | https://github.com/alex-phillips/clouddrive | lib/clouddrive/commands/move_command.rb | Ruby | mit | 19 | master | 753 | module CloudDrive
class MoveCommand < Command
parameter "node_path", "The remote node path to move"
parameter "[new_path]", "Path to new parent node"
def execute
@offline = false
init
node = Node.load_by_path(node_path)
unless node
error("No node found at path '#{node_p... |
github | alex-phillips/clouddrive | https://github.com/alex-phillips/clouddrive | lib/clouddrive/commands/init_command.rb | Ruby | mit | 19 | master | 722 | module CloudDrive
class InitCommand < Command
def execute
read_config
cache = generate_cache
account = Account.new(@config['email'], @config['client-id'], @config['client-secret'], cache)
response = account.authorize
unless response[:sucess]
puts response[:data]["message"... |
github | alex-phillips/clouddrive | https://github.com/alex-phillips/clouddrive | lib/clouddrive/commands/usage_command.rb | Ruby | mit | 19 | master | 314 | module CloudDrive
class UsageCommand < Command
def execute
@offline = false
init
result = @account.get_usage
if result[:success]
puts result[:data].to_json
else
error("Failed to retrieve account usage: #{retval[:data].to_json}")
end
end
end
end |
github | alex-phillips/clouddrive | https://github.com/alex-phillips/clouddrive | lib/clouddrive/commands/list_command.rb | Ruby | mit | 19 | master | 621 | module CloudDrive
class ListCommand < Command
parameter "[path]", "Config option to read, write, or reset"
option ["-i", "--id"], :flag, "Designate remote node by ID"
def execute
@offline = true
init
if id?
node = Node.load_by_id(path)
unless node
error("No ... |
github | alex-phillips/clouddrive | https://github.com/alex-phillips/clouddrive | lib/clouddrive/commands/mkdir_command.rb | Ruby | mit | 19 | master | 537 | module CloudDrive
class MkdirCommand < Command
parameter "remote_path", "Path of node"
def execute
@offline = false
init
if Node.exists?(remote_path)[:success]
error("Node already exists at '#{remote_path}'")
end
result = Node.create_directory_path(remote_path)
... |
github | alex-phillips/clouddrive | https://github.com/alex-phillips/clouddrive | lib/clouddrive/commands/config_command.rb | Ruby | mit | 19 | master | 820 | require 'colorize'
module CloudDrive
class ConfigCommand < Command
parameter "[option]", "Config option to read, write, or reset"
parameter "[value]", "Value to set option to"
def execute
read_config
if option
unless @config.has_key?(option)
error("Invalid option '#{optio... |
github | alex-phillips/clouddrive | https://github.com/alex-phillips/clouddrive | lib/clouddrive/commands/find_command.rb | Ruby | mit | 19 | master | 229 | module CloudDrive
class FindCommand < Command
parameter "name", "Config option to read, write, or reset"
def execute
init
results = Node.search_by_name(name)
list_nodes(results)
end
end
end |
github | alex-phillips/clouddrive | https://github.com/alex-phillips/clouddrive | lib/clouddrive/commands/download_command.rb | Ruby | mit | 19 | master | 819 | module CloudDrive
class DownloadCommand < Command
parameter "[remote_path]", "The remote node path to download"
parameter "[local_path]", "Local path to save the file / folder to"
option ["-i", "--id"], :flag, "Designate remote node by ID"
def execute
@offline = false
init
if id?... |
github | alex-phillips/clouddrive | https://github.com/alex-phillips/clouddrive | lib/clouddrive/commands/command.rb | Ruby | mit | 19 | master | 4,829 | require 'clamp'
require 'colorize'
module CloudDrive
class Command < Clamp::Command
def read_config
@default_config = {
'email' => {
'type' => 'string',
'default' => '',
},
'client-id' => {
'type' => 'string',
'default'... |
github | alex-phillips/clouddrive | https://github.com/alex-phillips/clouddrive | lib/clouddrive/commands/quota_command.rb | Ruby | mit | 19 | master | 314 | module CloudDrive
class QuotaCommand < Command
def execute
@offline = false
init
result = @account.get_quota
if result[:success]
puts result[:data].to_json
else
error("Failed to retrieve account quota: #{retval[:data].to_json}")
end
end
end
end |
github | alex-phillips/clouddrive | https://github.com/alex-phillips/clouddrive | lib/clouddrive/commands/rename_command.rb | Ruby | mit | 19 | master | 814 | module CloudDrive
class RenameCommand < Command
parameter "remote_path", "Remote path of node to rename"
parameter "new_name", "New name for the node"
option ["-i", "--id"], :flag, "Designate remote node by ID"
def execute
@offline = false
init
if id?
node = Node.load_by_... |
github | alex-phillips/clouddrive | https://github.com/alex-phillips/clouddrive | lib/clouddrive/commands/tree_command.rb | Ruby | mit | 19 | master | 1,627 | module CloudDrive
class TreeCommand < Command
parameter "[path]", "Path of node"
option ["-i", "--id"], :flag, "Designate remote node by ID"
def execute
@offline = true
init
if id?
node = Node.load_by_id(path)
unless node
error("No node exists with ID '#{pa... |
github | alex-phillips/clouddrive | https://github.com/alex-phillips/clouddrive | lib/clouddrive/commands/disk_usage_command.rb | Ruby | mit | 19 | master | 1,001 | module CloudDrive
class DiskUsageCommand < Command
parameter "[path]", "Config option to read, write, or reset"
option ["-i", "--id"], :flag, "Designate remote node by ID"
def execute
@offline = true
init
if id?
node = Node.load_by_id(path)
unless node
erro... |
github | alex-phillips/clouddrive | https://github.com/alex-phillips/clouddrive | lib/clouddrive/commands/clear_cache_command.rb | Ruby | mit | 19 | master | 219 | module CloudDrive
class ClearCacheCommand < Command
parameter "[path]", "Config option to read, write, or reset"
def execute
@offline = true
init
@account.clear_cache
end
end
end |
github | alex-phillips/clouddrive | https://github.com/alex-phillips/clouddrive | lib/clouddrive/commands/remove_command.rb | Ruby | mit | 19 | master | 754 | module CloudDrive
class RemoveCommand < Command
parameter "remote_path", "Remote path of node to move to trash"
option ["-i", "--id"], :flag, "Designate remote node by ID"
def execute
@offline = false
init
if id?
node = Node.load_by_id(remote_path)
unless node
... |
github | alex-phillips/clouddrive | https://github.com/alex-phillips/clouddrive | lib/clouddrive/commands/resolve_command.rb | Ruby | mit | 19 | master | 311 | module CloudDrive
class ResolveCommand < Command
parameter "id", "The ID of the node to resolve"
def execute
@offline = true
init
node = Node.load_by_id(id)
unless node
error("No node exists with ID '#{id}'")
end
puts node.get_path
end
end
end |
github | alex-phillips/clouddrive | https://github.com/alex-phillips/clouddrive | lib/clouddrive/commands/metadata_command.rb | Ruby | mit | 19 | master | 540 | module CloudDrive
class MetadataCommand < Command
parameter "[path]", "Config option to read, write, or reset"
option ["-i", "--id"], :flag, "Designate remote node by ID"
def execute
init
if id?
node = Node.load_by_id(path)
unless node
error("No node exists with I... |
github | alex-phillips/clouddrive | https://github.com/alex-phillips/clouddrive | lib/clouddrive/commands/restore_command.rb | Ruby | mit | 19 | master | 762 | module CloudDrive
class RestoreCommand < Command
parameter "remote_path", "Remote path of node to move to restore"
option ["-i", "--id"], :flag, "Designate remote node by ID"
def execute
@offline = false
init
if id?
node = Node.load_by_id(remote_path)
unless node
... |
github | alex-phillips/clouddrive | https://github.com/alex-phillips/clouddrive | spec/clouddrive/node_spec.rb | Ruby | mit | 19 | master | 7,290 | require 'spec_helper'
describe CloudDrive::Node do
describe '.upload_dir' do
let(:filename) { 'filename' }
let(:src_path) { '/root/srcpath' }
let(:src_file_path) { "#{src_path}/#{filename}" }
let(:dest_path) { 'dest/path' }
context 'without passing options' do
before { CloudDrive::Node.clas... |
github | alex-phillips/clouddrive | https://github.com/alex-phillips/clouddrive | spec/clouddrive/commands/command_spec.rb | Ruby | mit | 19 | master | 925 | require 'spec_helper'
describe CloudDrive::Command do
describe '#read_config' do
let(:config_file_location) { %r{/\.cache/clouddrive-ruby/config\.json\z} }
let(:command) { CloudDrive::Command.new nil }
subject(:read_config) { command.read_config }
context 'when the config file exists' do
it do
... |
github | alex-phillips/clouddrive | https://github.com/alex-phillips/clouddrive | spec/clouddrive/commands/upload_command_spec.rb | Ruby | mit | 19 | master | 3,461 | require 'spec_helper'
require 'json'
describe CloudDrive::UploadCommand do
describe '#execute' do
let(:command) { CloudDrive::UploadCommand.new '.' }
let(:config_file_location) { %r{/\.cache/clouddrive-ruby/config\.json\z} }
let(:config) { {} }
let(:src_path) { '/src/path' }
let(:remote_path) { '... |
github | iw/mirage-jekyll | https://github.com/iw/mirage-jekyll | recipes/default.rb | Ruby | mit | 19 | master | 482 | # Support for adding PPAs
# https://help.ubuntu.com/community/Repositories/Ubuntu#Adding_PPAs
package 'python-software-properties'
apt_repository 'avsm-ppa-precise' do
uri 'http://ppa.launchpad.net/avsm/ppa/ubuntu'
distribution 'precise'
components ['main']
deb_src true
end
package 'ocaml' do
version '4.01.... |
github | spajus/gosu-tiled | https://github.com/spajus/gosu-tiled | Guardfile | Ruby | mit | 19 | master | 273 | # A sample Guardfile
# More info at https://github.com/guard/guard#readme
guard :rspec, cmd: 'rspec --color --format doc' do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
end |
github | spajus/gosu-tiled | https://github.com/spajus/gosu-tiled | gosu_tiled.gemspec | Ruby | mit | 19 | master | 1,164 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'gosu_tiled/version'
Gem::Specification.new do |spec|
spec.name = 'gosu_tiled'
spec.version = Gosu::Tiled::VERSION
spec.authors = ['Tomas Varaneckas']
spec.email ... |
github | spajus/gosu-tiled | https://github.com/spajus/gosu-tiled | lib/gosu_tiled.rb | Ruby | mit | 19 | master | 377 | require 'gosu'
require 'json'
require 'gosu_tiled/version'
require 'gosu_tiled/empty_tile'
require 'gosu_tiled/tilesets'
require 'gosu_tiled/layer'
require 'gosu_tiled/layers'
require 'gosu_tiled/map'
module Gosu
module Tiled
def self.load_json(window, json, options = {})
Map.new(window, JSON.load(File.ope... |
github | spajus/gosu-tiled | https://github.com/spajus/gosu-tiled | lib/gosu_tiled/map.rb | Ruby | mit | 19 | master | 868 | module Gosu
module Tiled
class Map
attr_reader :tilesets, :layers, :width, :height
def initialize(window, data, data_dir, options = {})
@window = window
@data = data
@data_dir = data_dir
@width = data['width'] * data['tilewidth']
@height = data['height'] * data... |
github | spajus/gosu-tiled | https://github.com/spajus/gosu-tiled | lib/gosu_tiled/layer.rb | Ruby | mit | 19 | master | 2,520 | module Gosu
module Tiled
class Layer
def initialize(window, data, options)
@window = window
@data = data
@options = options
end
def visible?
@data['visible']
end
def type
@data['type']
end
def draw(x, y, tilesets)
if type... |
github | spajus/gosu-tiled | https://github.com/spajus/gosu-tiled | lib/gosu_tiled/tilesets.rb | Ruby | mit | 19 | master | 1,139 | module Gosu
module Tiled
class Tilesets
def initialize(data, data_dir, retro: false, tileable: true)
@root_dir = data_dir
@data = data
@tilesets = {}
@data.each do |t|
tileset = Gosu::Image.load_tiles(
File.join(data_dir, t['image']), t['tilewidth'], t['... |
github | spajus/gosu-tiled | https://github.com/spajus/gosu-tiled | lib/gosu_tiled/layers.rb | Ruby | mit | 19 | master | 694 | module Gosu
module Tiled
class Layers
include Enumerable
def initialize(window, data, options)
@window = window
@layers = data.map do |layer|
Layer.new(window, layer, options)
end
end
def tile
@layers.select { |l| l.type == 'tilelayer' }.select(&:... |
github | spajus/gosu-tiled | https://github.com/spajus/gosu-tiled | spec/utils/test_game_window.rb | Ruby | mit | 19 | master | 617 | require 'singleton'
class TestGameWindow < Gosu::Window
include Singleton
def initialize
super(1200, 800, false)
self.caption = "Esc = quit"
end
def update
unless ENV['NO_CLOSE']
close if @start && Gosu.milliseconds - @start > 500
end
end
def draw
@draw_block.call
rescue => e... |
github | spajus/gosu-tiled | https://github.com/spajus/gosu-tiled | spec/gosu_tiled/layer_spec.rb | Ruby | mit | 19 | master | 1,740 | require 'spec_helper'
RSpec.describe Gosu::Tiled::Layer do
let(:files_dir) { File.join(File.dirname(File.dirname(__FILE__)), 'files') }
let(:target_class) { Gosu::Tiled::Layer }
let(:map_json) { JSON.load(File.open(File.join(files_dir, 'tiled_map.json'))) }
let(:game_window) { TestGameWindow.instance }
let(:... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.