repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
nfo/gmail_xoauth | https://github.com/nfo/gmail_xoauth/blob/51da2ac78863cdff232521479a21d5be64d1ed25/lib/gmail_xoauth/smtp_xoauth_authenticator.rb | lib/gmail_xoauth/smtp_xoauth_authenticator.rb | require 'net/smtp'
require 'oauth'
module GmailXoauth
module SmtpXoauthAuthenticator
def auth_xoauth(user, secret)
check_auth_args user, secret
request_url = "https://mail.google.com/mail/b/#{user}/smtp/"
if secret[:two_legged]
request_url += "?xoauth_requestor_id=#{CGI.es... | ruby | Unlicense | 51da2ac78863cdff232521479a21d5be64d1ed25 | 2026-01-04T17:34:35.817576Z | false |
nfo/gmail_xoauth | https://github.com/nfo/gmail_xoauth/blob/51da2ac78863cdff232521479a21d5be64d1ed25/lib/gmail_xoauth/imap_xoauth_authenticator.rb | lib/gmail_xoauth/imap_xoauth_authenticator.rb | require 'net/imap'
require 'oauth'
module GmailXoauth
class ImapXoauthAuthenticator
def process(data)
build_sasl_client_request(@request_url, @oauth_string)
end
private
# +user+ is an email address: roger@gmail.com
# +password+ is a hash of oauth parameters, see +build_oauth_st... | ruby | Unlicense | 51da2ac78863cdff232521479a21d5be64d1ed25 | 2026-01-04T17:34:35.817576Z | false |
nfo/gmail_xoauth | https://github.com/nfo/gmail_xoauth/blob/51da2ac78863cdff232521479a21d5be64d1ed25/lib/gmail_xoauth/smtp_xoauth2_authenticator.rb | lib/gmail_xoauth/smtp_xoauth2_authenticator.rb | require 'net/smtp'
require 'base64'
module GmailXoauth
module SmtpXoauth2Authenticator
def send_xoauth2(auth_token)
critical {
get_response("AUTH XOAUTH2 #{auth_token}")
}
end
private :send_xoauth2
def get_final_status
critical {
get_response("")
}
end
... | ruby | Unlicense | 51da2ac78863cdff232521479a21d5be64d1ed25 | 2026-01-04T17:34:35.817576Z | false |
mudge/re2 | https://github.com/mudge/re2/blob/06221e36c7ee16752c11bb54a4c490c4efa1550a/ext/re2/recipes.rb | ext/re2/recipes.rb | # frozen_string_literal: true
# re2 (https://github.com/mudge/re2)
# Ruby bindings to RE2, a "fast, safe, thread-friendly alternative to
# backtracking regular expression engines like those used in PCRE, Perl, and
# Python".
#
# Copyright (c) 2010, Paul Mucur (https://mudge.name)
# Released under the BSD Licence, plea... | ruby | BSD-3-Clause | 06221e36c7ee16752c11bb54a4c490c4efa1550a | 2026-01-04T17:34:36.005276Z | false |
mudge/re2 | https://github.com/mudge/re2/blob/06221e36c7ee16752c11bb54a4c490c4efa1550a/ext/re2/extconf.rb | ext/re2/extconf.rb | # frozen_string_literal: true
# re2 (https://github.com/mudge/re2)
# Ruby bindings to RE2, a "fast, safe, thread-friendly alternative to
# backtracking regular expression engines like those used in PCRE, Perl, and
# Python".
#
# Copyright (c) 2010, Paul Mucur (https://mudge.name)
# Released under the BSD Licence, plea... | ruby | BSD-3-Clause | 06221e36c7ee16752c11bb54a4c490c4efa1550a | 2026-01-04T17:34:36.005276Z | false |
mudge/re2 | https://github.com/mudge/re2/blob/06221e36c7ee16752c11bb54a4c490c4efa1550a/spec/re2_spec.rb | spec/re2_spec.rb | # frozen_string_literal: true
RSpec.describe RE2 do
describe ".Replace" do
it "only replaces the first occurrence of the pattern" do
expect(RE2.Replace("woo", "o", "a")).to eq("wao")
end
it "supports inputs with null bytes" do
expect(RE2.Replace("w\0oo", "o", "a")).to eq("w\0ao")
end
... | ruby | BSD-3-Clause | 06221e36c7ee16752c11bb54a4c490c4efa1550a | 2026-01-04T17:34:36.005276Z | false |
mudge/re2 | https://github.com/mudge/re2/blob/06221e36c7ee16752c11bb54a4c490c4efa1550a/spec/kernel_spec.rb | spec/kernel_spec.rb | # frozen_string_literal: true
RSpec.describe Kernel do
describe ".RE2" do
it "returns an RE2::Regexp instance given a pattern" do
expect(RE2('w(o)(o)')).to be_a(RE2::Regexp)
end
it "returns an RE2::Regexp instance given a pattern and options" do
re = RE2('w(o)(o)', case_sensitive: false)
... | ruby | BSD-3-Clause | 06221e36c7ee16752c11bb54a4c490c4efa1550a | 2026-01-04T17:34:36.005276Z | false |
mudge/re2 | https://github.com/mudge/re2/blob/06221e36c7ee16752c11bb54a4c490c4efa1550a/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
require "re2"
# To test passing objects that can be coerced to a String.
class StringLike
attr_reader :str
alias_method :to_str, :str
def initialize(str)
@str = str
end
end
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.include_ch... | ruby | BSD-3-Clause | 06221e36c7ee16752c11bb54a4c490c4efa1550a | 2026-01-04T17:34:36.005276Z | false |
mudge/re2 | https://github.com/mudge/re2/blob/06221e36c7ee16752c11bb54a4c490c4efa1550a/spec/re2/string_spec.rb | spec/re2/string_spec.rb | # frozen_string_literal: true
require "re2/string"
class String
include RE2::String
end
RSpec.describe RE2::String do
describe "#re2_sub" do
it "delegates to RE2.Replace to perform replacement" do
expect("My name is Robert Paulson".re2_sub('Robert', 'Crobert')).to eq("My name is Crobert Paulson")
e... | ruby | BSD-3-Clause | 06221e36c7ee16752c11bb54a4c490c4efa1550a | 2026-01-04T17:34:36.005276Z | false |
mudge/re2 | https://github.com/mudge/re2/blob/06221e36c7ee16752c11bb54a4c490c4efa1550a/spec/re2/scanner_spec.rb | spec/re2/scanner_spec.rb | # frozen_string_literal: true
RSpec.describe RE2::Scanner do
describe "#regexp" do
it "returns the original pattern for the scanner" do
re = RE2::Regexp.new('(\w+)')
scanner = re.scan("It is a truth")
expect(scanner.regexp).to equal(re)
end
end
describe "#string" do
it "returns th... | ruby | BSD-3-Clause | 06221e36c7ee16752c11bb54a4c490c4efa1550a | 2026-01-04T17:34:36.005276Z | false |
mudge/re2 | https://github.com/mudge/re2/blob/06221e36c7ee16752c11bb54a4c490c4efa1550a/spec/re2/match_data_spec.rb | spec/re2/match_data_spec.rb | # frozen_string_literal: true
require 'objspace'
RSpec.describe RE2::MatchData do
it "reports a larger consuming memory size when it has more matches" do
matches1 = RE2::Regexp.new('w(o)').match('woo')
matches2 = RE2::Regexp.new('w(o)(o)').match('woo')
expect(ObjectSpace.memsize_of(matches1)).to be < O... | ruby | BSD-3-Clause | 06221e36c7ee16752c11bb54a4c490c4efa1550a | 2026-01-04T17:34:36.005276Z | false |
mudge/re2 | https://github.com/mudge/re2/blob/06221e36c7ee16752c11bb54a4c490c4efa1550a/spec/re2/set_spec.rb | spec/re2/set_spec.rb | # frozen_string_literal: true
RSpec.describe RE2::Set do
describe "#initialize" do
it "returns an instance given no args" do
set = RE2::Set.new
expect(set).to be_a(RE2::Set)
end
it "returns an instance given only an anchor of :unanchored" do
set = RE2::Set.new(:unanchored)
expe... | ruby | BSD-3-Clause | 06221e36c7ee16752c11bb54a4c490c4efa1550a | 2026-01-04T17:34:36.005276Z | false |
mudge/re2 | https://github.com/mudge/re2/blob/06221e36c7ee16752c11bb54a4c490c4efa1550a/spec/re2/regexp_spec.rb | spec/re2/regexp_spec.rb | # frozen_string_literal: true
require "rbconfig/sizeof"
RSpec.describe RE2::Regexp do
INT_MAX = 2**(RbConfig::SIZEOF.fetch("int") * 8 - 1) - 1
describe "#initialize" do
it "returns an instance given only a pattern" do
re = RE2::Regexp.new('woo')
expect(re).to be_a(RE2::Regexp)
end
it "r... | ruby | BSD-3-Clause | 06221e36c7ee16752c11bb54a4c490c4efa1550a | 2026-01-04T17:34:36.005276Z | false |
mudge/re2 | https://github.com/mudge/re2/blob/06221e36c7ee16752c11bb54a4c490c4efa1550a/lib/re2.rb | lib/re2.rb | # frozen_string_literal: true
# re2 (https://github.com/mudge/re2)
# Ruby bindings to RE2, a "fast, safe, thread-friendly alternative to
# backtracking regular expression engines like those used in PCRE, Perl, and
# Python".
#
# Copyright (c) 2010, Paul Mucur (https://mudge.name)
# Released under the BSD Licence, plea... | ruby | BSD-3-Clause | 06221e36c7ee16752c11bb54a4c490c4efa1550a | 2026-01-04T17:34:36.005276Z | false |
mudge/re2 | https://github.com/mudge/re2/blob/06221e36c7ee16752c11bb54a4c490c4efa1550a/lib/re2/version.rb | lib/re2/version.rb | # frozen_string_literal: true
# re2 (https://github.com/mudge/re2)
# Ruby bindings to RE2, a "fast, safe, thread-friendly alternative to
# backtracking regular expression engines like those used in PCRE, Perl, and
# Python".
#
# Copyright (c) 2010, Paul Mucur (https://mudge.name)
# Released under the BSD Licence, plea... | ruby | BSD-3-Clause | 06221e36c7ee16752c11bb54a4c490c4efa1550a | 2026-01-04T17:34:36.005276Z | false |
mudge/re2 | https://github.com/mudge/re2/blob/06221e36c7ee16752c11bb54a4c490c4efa1550a/lib/re2/scanner.rb | lib/re2/scanner.rb | # frozen_string_literal: true
# re2 (https://github.com/mudge/re2)
# Ruby bindings to RE2, a "fast, safe, thread-friendly alternative to
# backtracking regular expression engines like those used in PCRE, Perl, and
# Python".
#
# Copyright (c) 2010, Paul Mucur (https://mudge.name)
# Released under the BSD Licence, plea... | ruby | BSD-3-Clause | 06221e36c7ee16752c11bb54a4c490c4efa1550a | 2026-01-04T17:34:36.005276Z | false |
mudge/re2 | https://github.com/mudge/re2/blob/06221e36c7ee16752c11bb54a4c490c4efa1550a/lib/re2/string.rb | lib/re2/string.rb | # frozen_string_literal: true
# re2 (https://github.com/mudge/re2)
# Ruby bindings to RE2, a "fast, safe, thread-friendly alternative to
# backtracking regular expression engines like those used in PCRE, Perl, and
# Python".
#
# Copyright (c) 2010, Paul Mucur (https://mudge.name)
# Released under the BSD Licence, plea... | ruby | BSD-3-Clause | 06221e36c7ee16752c11bb54a4c490c4efa1550a | 2026-01-04T17:34:36.005276Z | false |
mudge/re2 | https://github.com/mudge/re2/blob/06221e36c7ee16752c11bb54a4c490c4efa1550a/lib/re2/regexp.rb | lib/re2/regexp.rb | # frozen_string_literal: true
# re2 (https://github.com/mudge/re2)
# Ruby bindings to RE2, a "fast, safe, thread-friendly alternative to
# backtracking regular expression engines like those used in PCRE, Perl, and
# Python".
#
# Copyright (c) 2010, Paul Mucur (https://mudge.name)
# Released under the BSD Licence, plea... | ruby | BSD-3-Clause | 06221e36c7ee16752c11bb54a4c490c4efa1550a | 2026-01-04T17:34:36.005276Z | false |
mudbugmedia/critical-path-css-rails | https://github.com/mudbugmedia/critical-path-css-rails/blob/909dfc53ce1b262741a94b06d600352de5587881/ext/npm/extconf.rb | ext/npm/extconf.rb | File.write 'Makefile',
"make:\n\t\ninstall:\n\truby install.rb\nclean:\n\t\n"
| ruby | MIT | 909dfc53ce1b262741a94b06d600352de5587881 | 2026-01-04T17:34:42.264657Z | false |
mudbugmedia/critical-path-css-rails | https://github.com/mudbugmedia/critical-path-css-rails/blob/909dfc53ce1b262741a94b06d600352de5587881/ext/npm/install.rb | ext/npm/install.rb | require_relative '../../lib/npm_commands'
NpmCommands.new.install('--production', '.') ||
raise('Error while installing npm dependencies')
| ruby | MIT | 909dfc53ce1b262741a94b06d600352de5587881 | 2026-01-04T17:34:42.264657Z | false |
mudbugmedia/critical-path-css-rails | https://github.com/mudbugmedia/critical-path-css-rails/blob/909dfc53ce1b262741a94b06d600352de5587881/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
require 'bundler'
Bundler.require :default, :development
Combustion.initialize! :action_controller, :action_view
require 'rspec/rails'
require 'capybara/rails'
RSpec.configure do |config|
config.include Capybara::DSL
config.use_transactional_fixtures = true
# Enable flags like... | ruby | MIT | 909dfc53ce1b262741a94b06d600352de5587881 | 2026-01-04T17:34:42.264657Z | false |
mudbugmedia/critical-path-css-rails | https://github.com/mudbugmedia/critical-path-css-rails/blob/909dfc53ce1b262741a94b06d600352de5587881/spec/features/generate_and_fetch_critical_css_spec.rb | spec/features/generate_and_fetch_critical_css_spec.rb | require 'spec_helper.rb'
RSpec.describe 'generate and fetch the critical css' do
before do
CriticalPathCss.generate_all
end
context 'on the root page' do
let(:route) { '/' }
it 'displays the correct critical CSS' do
visit route
expect(page).to have_content 'p{color:red}'
end
end
e... | ruby | MIT | 909dfc53ce1b262741a94b06d600352de5587881 | 2026-01-04T17:34:42.264657Z | false |
mudbugmedia/critical-path-css-rails | https://github.com/mudbugmedia/critical-path-css-rails/blob/909dfc53ce1b262741a94b06d600352de5587881/spec/internal/app/controllers/root_controller.rb | spec/internal/app/controllers/root_controller.rb | class RootController < ActionController::Base
def index; end
end
| ruby | MIT | 909dfc53ce1b262741a94b06d600352de5587881 | 2026-01-04T17:34:42.264657Z | false |
mudbugmedia/critical-path-css-rails | https://github.com/mudbugmedia/critical-path-css-rails/blob/909dfc53ce1b262741a94b06d600352de5587881/spec/internal/db/schema.rb | spec/internal/db/schema.rb | ActiveRecord::Schema.define do
#
end
| ruby | MIT | 909dfc53ce1b262741a94b06d600352de5587881 | 2026-01-04T17:34:42.264657Z | false |
mudbugmedia/critical-path-css-rails | https://github.com/mudbugmedia/critical-path-css-rails/blob/909dfc53ce1b262741a94b06d600352de5587881/spec/internal/config/routes.rb | spec/internal/config/routes.rb | Rails.application.routes.draw do
root 'root#index'
end
| ruby | MIT | 909dfc53ce1b262741a94b06d600352de5587881 | 2026-01-04T17:34:42.264657Z | false |
mudbugmedia/critical-path-css-rails | https://github.com/mudbugmedia/critical-path-css-rails/blob/909dfc53ce1b262741a94b06d600352de5587881/spec/lib/critical_path_css/css_fetcher_spec.rb | spec/lib/critical_path_css/css_fetcher_spec.rb | require 'spec_helper'
RSpec.describe 'CssFetcher' do
subject { CriticalPathCss::CssFetcher.new(config) }
let(:base_url) { 'http://0.0.0.0:9292' }
let(:response) { ['foo','', OpenStruct.new(exitstatus: 0)] }
let(:routes) { ['/', '/new_route'] }
let(:config) do
CriticalPathCss::Configuration.new(
... | ruby | MIT | 909dfc53ce1b262741a94b06d600352de5587881 | 2026-01-04T17:34:42.264657Z | false |
mudbugmedia/critical-path-css-rails | https://github.com/mudbugmedia/critical-path-css-rails/blob/909dfc53ce1b262741a94b06d600352de5587881/spec/lib/critical_path_css/rails/config_loader_spec.rb | spec/lib/critical_path_css/rails/config_loader_spec.rb | require 'spec_helper'
RSpec.describe 'ConfigLoader' do
subject { CriticalPathCss::Rails::ConfigLoader.new }
describe '#load' do
before do
allow(File).to receive(:read).and_return(config_file)
end
context 'when single css_path is specified' do
let(:config_file) { file_fixture('config/singl... | ruby | MIT | 909dfc53ce1b262741a94b06d600352de5587881 | 2026-01-04T17:34:42.264657Z | false |
mudbugmedia/critical-path-css-rails | https://github.com/mudbugmedia/critical-path-css-rails/blob/909dfc53ce1b262741a94b06d600352de5587881/lib/npm_commands.rb | lib/npm_commands.rb | # frozen_string_literal: true
# NPM wrapper with helpful error messages
class NpmCommands
# @return [Boolean] whether the installation succeeded
def install(*args)
return false unless check_nodejs_installed
STDERR.puts 'Installing npm dependencies...'
install_status = Dir.chdir File.expand_path('..', F... | ruby | MIT | 909dfc53ce1b262741a94b06d600352de5587881 | 2026-01-04T17:34:42.264657Z | false |
mudbugmedia/critical-path-css-rails | https://github.com/mudbugmedia/critical-path-css-rails/blob/909dfc53ce1b262741a94b06d600352de5587881/lib/critical-path-css-rails.rb | lib/critical-path-css-rails.rb | require 'critical_path_css/configuration'
require 'critical_path_css/css_fetcher'
require 'critical_path_css/rails/config_loader'
module CriticalPathCss
CACHE_NAMESPACE = 'critical-path-css'.freeze
def self.generate(route)
::Rails.cache.write(route, fetcher.fetch_route(route), namespace: CACHE_NAMESPACE, expi... | ruby | MIT | 909dfc53ce1b262741a94b06d600352de5587881 | 2026-01-04T17:34:42.264657Z | false |
mudbugmedia/critical-path-css-rails | https://github.com/mudbugmedia/critical-path-css-rails/blob/909dfc53ce1b262741a94b06d600352de5587881/lib/generators/critical_path_css/install_generator.rb | lib/generators/critical_path_css/install_generator.rb | require 'rails/generators'
module CriticalPathCss
class InstallGenerator < ::Rails::Generators::Base
source_root File.expand_path('..', __FILE__)
# Copy the needed rake task for generating critical CSS
def copy_rake_task
task_filename = 'critical_path_css.rake'
copy_file "../../tasks/#{task_... | ruby | MIT | 909dfc53ce1b262741a94b06d600352de5587881 | 2026-01-04T17:34:42.264657Z | false |
mudbugmedia/critical-path-css-rails | https://github.com/mudbugmedia/critical-path-css-rails/blob/909dfc53ce1b262741a94b06d600352de5587881/lib/critical_path_css/configuration.rb | lib/critical_path_css/configuration.rb | require 'erb'
module CriticalPathCss
class Configuration
def initialize(config)
@config = config
end
def base_url
@config['base_url']
end
def css_paths
@config['css_paths']
end
def manifest_name
@config['manifest_name']
end
def routes
@config['rout... | ruby | MIT | 909dfc53ce1b262741a94b06d600352de5587881 | 2026-01-04T17:34:42.264657Z | false |
mudbugmedia/critical-path-css-rails | https://github.com/mudbugmedia/critical-path-css-rails/blob/909dfc53ce1b262741a94b06d600352de5587881/lib/critical_path_css/css_fetcher.rb | lib/critical_path_css/css_fetcher.rb | require 'json'
require 'open3'
module CriticalPathCss
class CssFetcher
GEM_ROOT = File.expand_path(File.join('..', '..'), File.dirname(__FILE__))
def initialize(config)
@config = config
end
def fetch
@config.routes.map { |route| [route, fetch_route(route)] }.to_h
end
def fetch_... | ruby | MIT | 909dfc53ce1b262741a94b06d600352de5587881 | 2026-01-04T17:34:42.264657Z | false |
mudbugmedia/critical-path-css-rails | https://github.com/mudbugmedia/critical-path-css-rails/blob/909dfc53ce1b262741a94b06d600352de5587881/lib/critical_path_css/rails/version.rb | lib/critical_path_css/rails/version.rb | module CriticalPathCSS
module Rails
VERSION = '4.1.1'.freeze
end
end
| ruby | MIT | 909dfc53ce1b262741a94b06d600352de5587881 | 2026-01-04T17:34:42.264657Z | false |
mudbugmedia/critical-path-css-rails | https://github.com/mudbugmedia/critical-path-css-rails/blob/909dfc53ce1b262741a94b06d600352de5587881/lib/critical_path_css/rails/config_loader.rb | lib/critical_path_css/rails/config_loader.rb | module CriticalPathCss
module Rails
class ConfigLoader
CONFIGURATION_FILENAME = 'critical_path_css.yml'.freeze
def initialize
validate_css_paths
format_css_paths
end
def config
@config ||= YAML.safe_load(ERB.new(File.read(configuration_file_path)).result, [], [], ... | ruby | MIT | 909dfc53ce1b262741a94b06d600352de5587881 | 2026-01-04T17:34:42.264657Z | false |
mudbugmedia/critical-path-css-rails | https://github.com/mudbugmedia/critical-path-css-rails/blob/909dfc53ce1b262741a94b06d600352de5587881/lib/critical_path_css/rails/engine.rb | lib/critical_path_css/rails/engine.rb | module CriticalPathCss
module Rails
class Engine < ::Rails::Engine
end
end
end
| ruby | MIT | 909dfc53ce1b262741a94b06d600352de5587881 | 2026-01-04T17:34:42.264657Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/spec/integration_spec_helper.rb | spec/integration_spec_helper.rb | require 'spec_helper'
def account_file_path
File.join(File.dirname(__FILE__), "account.yaml")
end
def account?
account
end
def account
if ENV["MEGA_EMAIL"] and ENV["MEGA_PASSWORD"]
{'email' => ENV["MEGA_EMAIL"], 'password' => ENV["MEGA_PASSWORD"]}
elsif File.exist?(account_file_path)
YAML.load_file(a... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/spec/spec_helper.rb | spec/spec_helper.rb | require 'rmega'
require 'pry'
| ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/spec/integration/file_integrity_spec.rb | spec/integration/file_integrity_spec.rb | require 'integration_spec_helper'
describe 'File integrity' do
if account?
before(:all) do
@storage = login
end
context "when a file is renamed" do
let(:path) { "#{temp_folder}/testfile_#{SecureRandom.hex(6)}" }
let(:new_name) { "testfile_#{SecureRandom.hex(6)}" }
it 'it doe... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/spec/integration/folder_download_spec.rb | spec/integration/folder_download_spec.rb | require 'integration_spec_helper'
describe 'Folder download' do
context 'given a public mega url (folder)' do
let(:url) { 'https://mega.nz/folder/GvgkUIIK#v2hd_5GSvciGKazNeWSa6A' }
it 'downloads the related file' do
Rmega.download(url, temp_folder)
list = Dir["#{temp_folder}/another_test_folde... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/spec/integration/file_download_spec.rb | spec/integration/file_download_spec.rb | require 'integration_spec_helper'
describe 'File download' do
context 'given a public mega url (a small file)' do
let(:url) { 'https://mega.nz/file/muAVRRbb#zp9dvPvoVck8-4IwTazqsUqol6yiUK7kwLWOwrD8Jqo' }
it 'downloads the related file' do
Rmega.download(url, temp_folder)
related_file = File.jo... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/spec/integration/file_upload_spec.rb | spec/integration/file_upload_spec.rb | require 'integration_spec_helper'
describe 'File upload' do
if account?
before(:all) do
@storage = login
end
[12, 6_000, 2_000_000].each do |size|
context "when a file (#{size} bytes) is uploaded" do
let(:path) { "#{temp_folder}/testfile_#{SecureRandom.hex(6)}" }
let(:co... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/spec/integration/resume_download_spec.rb | spec/integration/resume_download_spec.rb | require 'integration_spec_helper'
module Rmega
describe 'Resumable download' do
let(:download_url) { 'https://mega.nz/file/3zpE1ToL#B1L4o8POE4tER4h1tyVoGNxaXFhbjwfxhe3Eyp9nrN8' }
let(:destination_file) { "#{temp_folder}/temp.txt" }
before do
Thread.abort_on_exception = false if Thread.respond_to... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/spec/integration/folder_upload_spec.rb | spec/integration/folder_upload_spec.rb | require 'integration_spec_helper'
describe 'Folder upload' do
if account?
before(:all) do
@storage = login
end
context "when a folder is uploaded" do
let(:folder) { SecureRandom.hex(6) }
let(:subfolder_empty) { SecureRandom.hex(6) }
let(:subfolder_with_content) { SecureRandom.... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/spec/integration/folder_operations_spec.rb | spec/integration/folder_operations_spec.rb | require 'integration_spec_helper'
describe 'Folders operations' do
if account?
before(:all) do
@storage = login
end
context 'when #create_folder is called on a node' do
let(:name) { "testfolder_#{SecureRandom.hex(5)}" }
before do
@folder = @storage.root.create_folder(name)
... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/spec/integration/login_spec.rb | spec/integration/login_spec.rb | require 'integration_spec_helper'
describe 'Login' do
if account?
context 'when email and password are correct' do
it 'does not raise erorrs' do
expect { login }.not_to raise_error
end
end
context 'when email and password are invalid' do
it 'raises an error' do
expect... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/spec/integration/rmega-up_spec.rb | spec/integration/rmega-up_spec.rb | require 'integration_spec_helper'
require 'open3'
describe "rmega-up" do
def call(*args)
Open3.capture2e("bundle exec ./bin/rmega-up #{args.join(' ')}").join("\n")
end
let(:file_content) { SecureRandom.hex(10) }
let(:filename) { "testfile_"+SecureRandom.hex(5)+".txt" }
let(:filepath) { "#{temp_folder}... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/spec/integration/rmega-dl_spec.rb | spec/integration/rmega-dl_spec.rb | require 'integration_spec_helper'
describe "rmega-dl" do
let(:url) { 'https://mega.nz/file/muAVRRbb#zp9dvPvoVck8-4IwTazqsUqol6yiUK7kwLWOwrD8Jqo' }
def call(*args)
`bundle exec ./bin/rmega-dl #{args.join(' ')}`
end
context "without args" do
it "shows the help" do
expect(call).to match(/usage/i... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/spec/rmega/lib/session_spec.rb | spec/rmega/lib/session_spec.rb | require 'spec_helper'
module Rmega
describe Session do
describe '#hash_password' do
{ 1 => "m\xD9\xF7\xEC\xB2F\x89\xC45\xA1O|Q\xDACM",
16 => "\x02\xBDXOzW.\x95xB\xF7O]\\\r\xD5",
20 => "\x17\x99x\xAF\e\xE3&\xE6\xF7\x8B\f\x92\x1AY\xF9,",
}.each do |n, r|
context "when the passw... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/spec/rmega/lib/utils_spec.rb | spec/rmega/lib/utils_spec.rb | require 'spec_helper'
module Rmega
describe Utils do
describe '#base64urlencode' do
it 'returns the expected value' do
string = 'ice_lord'
result = 'aWNlX2xvcmQ'
expect(described_class.base64urlencode(string)).to eq(result)
end
end
describe '#base64urldecode' do
... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/spec/rmega/lib/cli_spec.rb | spec/rmega/lib/cli_spec.rb | require 'spec_helper'
require 'rmega/cli'
describe Rmega::CLI::Helpers do
let(:subject) do
Class.new { include(Rmega::CLI::Helpers) }.new
end
# todo
end
| ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/spec/rmega/lib/storage_spec.rb | spec/rmega/lib/storage_spec.rb | require 'spec_helper'
module Rmega
describe Storage do
describe '#stats' do
let(:session) { Session.new }
let(:subject) { Storage.new(session) }
let(:nodes) do
[{'s' => 10, 't' => 0}, {'t' => 1}, {'s' => 5, 't' => 0}].map do |data|
Nodes::Factory.build(session, data)
... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/lib/rmega.rb | lib/rmega.rb | require 'thread'
require 'ostruct'
require 'logger'
require 'uri'
require 'net/http'
require 'base64'
require 'openssl'
require 'digest/md5'
require 'json'
require 'securerandom'
require 'pbkdf2'
# Used only in specs
require 'yaml'
require 'tmpdir'
require 'fileutils'
require 'rmega/version'
require 'rmega/loggable'
... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/lib/rmega/storage.rb | lib/rmega/storage.rb | module Rmega
class Storage
include NotInspectable
include Loggable
include Crypto
attr_reader :session
# Delegate to :session
[:master_key, :shared_keys].each do |name|
__send__(:define_method, name) { |*args| session.__send__(name, *args) }
end
def initialize(session)
@... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/lib/rmega/session.rb | lib/rmega/session.rb | module Rmega
class Session
include NotInspectable
include Loggable
include Net
include Options
include Crypto
extend Crypto
attr_reader :request_id, :sid, :shared_keys, :rsa_privk
attr_accessor :master_key
def initialize
@request_id = random_request_id
@shared_keys = ... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/lib/rmega/version.rb | lib/rmega/version.rb | module Rmega
VERSION = "0.3.2"
HOMEPAGE = "https://github.com/topac/rmega"
end
| ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/lib/rmega/loggable.rb | lib/rmega/loggable.rb | module Rmega
def self.logger
@logger ||= begin
logger = Logger.new($stdout)
logger.level = Logger::ERROR
logger
end
end
module Loggable
def self.included(base)
base.__send__(:extend, ClassMethods)
end
def logger
Rmega.logger
end
module ClassMethods
... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/lib/rmega/errors.rb | lib/rmega/errors.rb | module Rmega
class ServerError < StandardError
end
class TemporaryServerError < StandardError
end
class BandwidthLimitExceeded < StandardError
def initialize(*args)
if args.any?
super
else
super("Transfer quota exceeded")
end
end
end
end
| ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/lib/rmega/pool.rb | lib/rmega/pool.rb | module Rmega
class Pool
include Options
def initialize
threads_raises_exceptions
@queue = Queue.new
@queue_closed = false
@threads = []
@cv = ConditionVariable.new
@working_threads = 0
options.thread_pool_size.times do
@threads << Thread.new do
... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/lib/rmega/options.rb | lib/rmega/options.rb | module Rmega
def self.default_options
{
thread_pool_size: 4,
max_retries: 10,
retry_interval: 3,
http_open_timeout: 180,
http_read_timeout: 180,
# http_proxy_address: '127.0.0.1',
# http_proxy_port: 8080,
show_progress: false,
... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/lib/rmega/utils.rb | lib/rmega/utils.rb | module Rmega
module Utils
extend self
def base64urlencode(string)
r = string.size % 3
encoded = Base64.urlsafe_encode64(string)
return (r != 0) ? encoded[0..r - 4] : encoded
end
def base64urldecode(data)
fix_for_decoding = '=='[((2-data.length*3)&3)..-1]
return Base64.u... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/lib/rmega/conn_pool.rb | lib/rmega/conn_pool.rb | module Rmega
module ConnPool
include Loggable
include Options
extend MonitorMixin
# url: URI / String
# options: any options that Net::HTTP.new accepts
def self.get(url, options = {})
uri = url.is_a?(URI) ? url : URI(url)
connection_manager.get_client(uri, options)
end
... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/lib/rmega/crypto.rb | lib/rmega/crypto.rb | require 'rmega/crypto/aes_ecb'
require 'rmega/crypto/aes_cbc'
require 'rmega/crypto/aes_ctr'
require 'rmega/crypto/rsa'
module Rmega
module Crypto
include AesCbc
include AesEcb
include AesCtr
include Rsa
# Check if all the used ciphers are supported
ciphers = OpenSSL::Cipher.ciphers.map(&:up... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/lib/rmega/cli.rb | lib/rmega/cli.rb | require 'optparse'
require 'io/console'
require 'yaml'
module Rmega
module CLI
module Helpers
def cli_options
$cli_options ||= read_configuration_file
end
def cli_prompt_password
print("Enter password: ")
password = STDIN.noecho(&:gets)
password = password[0..-2... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/lib/rmega/api_response.rb | lib/rmega/api_response.rb | module Rmega
class APIResponse
attr_reader :body, :code
# Check out the error codes list at https://mega.nz/#doc (section 11)
ERRORS = {
-1 => 'An internal error has occurred. Please submit a bug report, detailing the exact circumstances in which this error occurred.',
-2 => 'You have passe... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/lib/rmega/not_inspectable.rb | lib/rmega/not_inspectable.rb | module Rmega
module NotInspectable
def inspect(attributes = {})
memaddr = (__send__(:object_id) << 1).to_s(16)
string = "#<#{self.class.name}:#{memaddr}"
attributes.each { |k, v| string << " #{k}=#{v}" }
string << ">"
end
end
end
| ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/lib/rmega/net.rb | lib/rmega/net.rb | module Rmega
module Net
include Loggable
include Options
def survive(retries = options.max_retries, &block)
yield
rescue ServerError
raise
rescue Exception => error
retries -= 1
raise(error) if retries < 0
logger.debug("[#{error.class}] #{error.message}. #{retries} a... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/lib/rmega/progress.rb | lib/rmega/progress.rb | module Rmega
class Progress
include Options
def initialize(total, options = {})
@total = total
@caption = options[:caption]
@bytes = 0
@real_bytes = 0
@mutex = Mutex.new
@start_time = Time.now
if show? and options[:filename]
puts options[:filename]
end... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/lib/rmega/nodes/inbox.rb | lib/rmega/nodes/inbox.rb | module Rmega
module Nodes
class Inbox < Node
end
end
end
| ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/lib/rmega/nodes/node_key.rb | lib/rmega/nodes/node_key.rb | module Rmega
module Nodes
# The key associated to a node. It can be 128 or 256 bits long,
# when is 256 bits long is composed by:
# * A 128 bit AES-128 key
# * The upper 64 bit of the counter start value (the lower 64 bit
# are starting at 0 and incrementing by 1 for each AES block of 16
# ... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/lib/rmega/nodes/expandable.rb | lib/rmega/nodes/expandable.rb | module Rmega
module Nodes
module Expandable
include Uploadable
def create_folder(name)
node_key = NodeKey.random
# encrypt attributes
_attr = serialize_attributes(:n => Utils.utf8(name).strip)
_attr = aes_cbc_encrypt(node_key.aes_key, _attr)
# Encrypt node ke... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/lib/rmega/nodes/traversable.rb | lib/rmega/nodes/traversable.rb | module Rmega
module Nodes
module Traversable
def children
storage.nodes.select { |node| node.parent_handle == handle }
end
def folders
children.select { |node| node.type == :folder }
end
def files
children.select { |node| node.type == :file }
end
... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/lib/rmega/nodes/deletable.rb | lib/rmega/nodes/deletable.rb | module Rmega
module Nodes
module Deletable
def delete
request(a: 'd', n: handle)
end
def trash
request(a: 'm', n: handle, t: storage.trash.handle)
end
end
end
end
| ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/lib/rmega/nodes/node.rb | lib/rmega/nodes/node.rb | module Rmega
module Nodes
class Node
include NotInspectable
include Loggable
include Traversable
include Crypto
attr_reader :data, :session
# Delegate to :session
[:request, :shared_keys, :rsa_privk, :master_key, :storage].each do |name|
__send__(:define_method,... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/lib/rmega/nodes/file.rb | lib/rmega/nodes/file.rb | module Rmega
module Nodes
class File < Node
include Deletable
include Downloadable
def storage_url
@storage_url ||= begin
query_params = data["__n"] ? {n: data["__n"]} : {}
data['g'] || request({a: 'g', g: 1, n: handle}, query_params)['g']
end
end
... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/lib/rmega/nodes/uploadable.rb | lib/rmega/nodes/uploadable.rb | module Rmega
module Nodes
module Uploadable
include Net
def upload_chunk(base_url, start, buffer)
size = buffer.length
stop = start + size - 1
url = "#{base_url}/#{start}-#{stop}"
survive do
response = http_post(url, buffer)
raise("Upload failed") ... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/lib/rmega/nodes/trash.rb | lib/rmega/nodes/trash.rb | module Rmega
module Nodes
class Trash < Node
include Traversable
def empty!
children.each do |node|
node.delete if node.respond_to?(:delete)
end
empty?
end
end
end
end
| ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/lib/rmega/nodes/root.rb | lib/rmega/nodes/root.rb | module Rmega
module Nodes
class Root < Node
include Expandable
include Traversable
def download(path)
children.each do |node|
node.download(path)
end
end
end
end
end
| ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/lib/rmega/nodes/downloadable.rb | lib/rmega/nodes/downloadable.rb | module Rmega
module Nodes
module Downloadable
include Net
include Options
# Creates the local file allocating filesize-n bytes (of /dev/zero) for it.
# Opens the local file to start writing from the beginning of it.
def allocate(path)
unless allocated?(path)
`dd if... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/lib/rmega/nodes/folder.rb | lib/rmega/nodes/folder.rb | module Rmega
module Nodes
class Folder < Node
include Expandable
include Traversable
include Deletable
def download(path)
path = ::File.join(path, self.name)
FileUtils.mkdir_p(path)
children.each do |node|
node.download(path)
end
nil
... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/lib/rmega/nodes/factory.rb | lib/rmega/nodes/factory.rb | require 'rmega/nodes/uploadable'
require 'rmega/nodes/expandable'
require 'rmega/nodes/downloadable'
require 'rmega/nodes/deletable'
require 'rmega/nodes/traversable'
require 'rmega/nodes/node_key'
require 'rmega/nodes/node'
require 'rmega/nodes/file'
require 'rmega/nodes/folder'
require 'rmega/nodes/inbox'
require 'rm... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/lib/rmega/crypto/aes_ctr.rb | lib/rmega/crypto/aes_ctr.rb | module Rmega
module Crypto
module AesCtr
def aes_ctr_cipher
OpenSSL::Cipher::AES.new(128, :CTR)
end
def aes_ctr_decrypt(key, data, iv)
cipher = aes_ctr_cipher
cipher.decrypt
cipher.iv = iv
cipher.key = key
return cipher.update(data) + cipher.final... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/lib/rmega/crypto/rsa.rb | lib/rmega/crypto/rsa.rb | module Rmega
module Crypto
module Rsa
def powm(b, p, m)
if p == 1
b % m
elsif (p & 0x1) == 0
t = powm(b, p >> 1, m)
(t * t) % m
else
(b * powm(b, p-1, m)) % m
end
end
def rsa_decrypt(m, pqdu)
p, q, d, u = pqdu
... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/lib/rmega/crypto/aes_ecb.rb | lib/rmega/crypto/aes_ecb.rb | module Rmega
module Crypto
module AesEcb
def aes_ecb_cipher
OpenSSL::Cipher::AES.new(128, :ECB)
end
def aes_ecb_encrypt(key, data)
cipher = aes_ecb_cipher
cipher.encrypt
cipher.padding = 0
cipher.key = key
return cipher.update(data) + cipher.final... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
topac/rmega | https://github.com/topac/rmega/blob/e82d48b027b6cc2a90fd2f9e081892d3172bcf51/lib/rmega/crypto/aes_cbc.rb | lib/rmega/crypto/aes_cbc.rb | module Rmega
module Crypto
module AesCbc
def aes_cbc_cipher
OpenSSL::Cipher::AES.new(128, :CBC)
end
def aes_cbc_encrypt(key, data)
cipher = aes_cbc_cipher
cipher.encrypt
cipher.padding = 0
cipher.key = key
return cipher.update(data) + cipher.final... | ruby | MIT | e82d48b027b6cc2a90fd2f9e081892d3172bcf51 | 2026-01-04T17:34:48.481487Z | false |
NullVoxPopuli/drawers | https://github.com/NullVoxPopuli/drawers/blob/75936a180b6b9c670144338584b1296af264f377/spec/rails_helper.rb | spec/rails_helper.rb | # frozen_string_literal: true
require 'spec_helper'
require 'rails/all'
require 'factory_girl'
require 'factory_girl_rails'
require 'rspec/rails'
require 'support/rails_app/config/environment'
ActiveRecord::Migration.maintain_test_schema!
require 'support/rails_app/db/create'
require 'support/rails_app/factory_gi... | ruby | MIT | 75936a180b6b9c670144338584b1296af264f377 | 2026-01-04T17:34:52.468542Z | false |
NullVoxPopuli/drawers | https://github.com/NullVoxPopuli/drawers/blob/75936a180b6b9c670144338584b1296af264f377/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
require 'simplecov'
SimpleCov.start
| ruby | MIT | 75936a180b6b9c670144338584b1296af264f377 | 2026-01-04T17:34:52.468542Z | false |
NullVoxPopuli/drawers | https://github.com/NullVoxPopuli/drawers/blob/75936a180b6b9c670144338584b1296af264f377/spec/support/rails_app/factory_girl.rb | spec/support/rails_app/factory_girl.rb | # frozen_string_literal: true
RSpec.configure do |config|
config.include FactoryGirl::Syntax::Methods
config.before(:suite) do
FactoryGirl.lint
end
end
| ruby | MIT | 75936a180b6b9c670144338584b1296af264f377 | 2026-01-04T17:34:52.468542Z | false |
NullVoxPopuli/drawers | https://github.com/NullVoxPopuli/drawers/blob/75936a180b6b9c670144338584b1296af264f377/spec/support/rails_app/app/jobs/application_job.rb | spec/support/rails_app/app/jobs/application_job.rb | # frozen_string_literal: true
class ApplicationJob < ActiveJob::Base
end
| ruby | MIT | 75936a180b6b9c670144338584b1296af264f377 | 2026-01-04T17:34:52.468542Z | false |
NullVoxPopuli/drawers | https://github.com/NullVoxPopuli/drawers/blob/75936a180b6b9c670144338584b1296af264f377/spec/support/rails_app/app/models/data/author.rb | spec/support/rails_app/app/models/data/author.rb | # frozen_string_literal: true
class Author < ApplicationRecord
has_many :posts, class_name: Post.name
end
| ruby | MIT | 75936a180b6b9c670144338584b1296af264f377 | 2026-01-04T17:34:52.468542Z | false |
NullVoxPopuli/drawers | https://github.com/NullVoxPopuli/drawers/blob/75936a180b6b9c670144338584b1296af264f377/spec/support/rails_app/app/models/data/post.rb | spec/support/rails_app/app/models/data/post.rb | # frozen_string_literal: true
class Post < ApplicationRecord
end
| ruby | MIT | 75936a180b6b9c670144338584b1296af264f377 | 2026-01-04T17:34:52.468542Z | false |
NullVoxPopuli/drawers | https://github.com/NullVoxPopuli/drawers/blob/75936a180b6b9c670144338584b1296af264f377/spec/support/rails_app/app/models/data/application_record.rb | spec/support/rails_app/app/models/data/application_record.rb | # frozen_string_literal: true
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
| ruby | MIT | 75936a180b6b9c670144338584b1296af264f377 | 2026-01-04T17:34:52.468542Z | false |
NullVoxPopuli/drawers | https://github.com/NullVoxPopuli/drawers/blob/75936a180b6b9c670144338584b1296af264f377/spec/support/rails_app/app/resources/application_controller.rb | spec/support/rails_app/app/resources/application_controller.rb | # frozen_string_literal: true
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
rescue_from StandardError do |exception|
puts exception.backtrace
raise exception
end
end
| ruby | MIT | 75936a180b6b9c670144338584b1296af264f377 | 2026-01-04T17:34:52.468542Z | false |
NullVoxPopuli/drawers | https://github.com/NullVoxPopuli/drawers/blob/75936a180b6b9c670144338584b1296af264f377/spec/support/rails_app/app/resources/api/base_controller.rb | spec/support/rails_app/app/resources/api/base_controller.rb | # frozen_string_literal: true
module Api
class BaseController < ApplicationController
end
end
| ruby | MIT | 75936a180b6b9c670144338584b1296af264f377 | 2026-01-04T17:34:52.468542Z | false |
NullVoxPopuli/drawers | https://github.com/NullVoxPopuli/drawers/blob/75936a180b6b9c670144338584b1296af264f377/spec/support/rails_app/app/resources/api/authors/operations.rb | spec/support/rails_app/app/resources/api/authors/operations.rb | # frozen_string_literal: true
module Api
module AuthorOperations
end
end
| ruby | MIT | 75936a180b6b9c670144338584b1296af264f377 | 2026-01-04T17:34:52.468542Z | false |
NullVoxPopuli/drawers | https://github.com/NullVoxPopuli/drawers/blob/75936a180b6b9c670144338584b1296af264f377/spec/support/rails_app/app/resources/api/authors/serializer.rb | spec/support/rails_app/app/resources/api/authors/serializer.rb | # frozen_string_literal: true
module Api
class AuthorSerializer < ActiveModel::Serializer
end
end
| ruby | MIT | 75936a180b6b9c670144338584b1296af264f377 | 2026-01-04T17:34:52.468542Z | false |
NullVoxPopuli/drawers | https://github.com/NullVoxPopuli/drawers/blob/75936a180b6b9c670144338584b1296af264f377/spec/support/rails_app/app/resources/api/authors/controller.rb | spec/support/rails_app/app/resources/api/authors/controller.rb | # frozen_string_literal: true
module Api
class AuthorsController < Api::BaseController
end
end
| ruby | MIT | 75936a180b6b9c670144338584b1296af264f377 | 2026-01-04T17:34:52.468542Z | false |
NullVoxPopuli/drawers | https://github.com/NullVoxPopuli/drawers/blob/75936a180b6b9c670144338584b1296af264f377/spec/support/rails_app/app/resources/api/authors/operations/helpers.rb | spec/support/rails_app/app/resources/api/authors/operations/helpers.rb | # frozen_string_literal: true
module Api
module AuthorOperations
module Helpers
end
end
end
| ruby | MIT | 75936a180b6b9c670144338584b1296af264f377 | 2026-01-04T17:34:52.468542Z | false |
NullVoxPopuli/drawers | https://github.com/NullVoxPopuli/drawers/blob/75936a180b6b9c670144338584b1296af264f377/spec/support/rails_app/app/resources/api/authors/operations/create.rb | spec/support/rails_app/app/resources/api/authors/operations/create.rb | # frozen_string_literal: true
module Api
module AuthorOperations
class Create
include AuthorOperations::Helpers
end
end
end
| ruby | MIT | 75936a180b6b9c670144338584b1296af264f377 | 2026-01-04T17:34:52.468542Z | false |
NullVoxPopuli/drawers | https://github.com/NullVoxPopuli/drawers/blob/75936a180b6b9c670144338584b1296af264f377/spec/support/rails_app/app/resources/api/posts/posts_controller.rb | spec/support/rails_app/app/resources/api/posts/posts_controller.rb | # frozen_string_literal: true
module Api
class PostsController < Api::BaseController
end
end
| ruby | MIT | 75936a180b6b9c670144338584b1296af264f377 | 2026-01-04T17:34:52.468542Z | false |
NullVoxPopuli/drawers | https://github.com/NullVoxPopuli/drawers/blob/75936a180b6b9c670144338584b1296af264f377/spec/support/rails_app/app/resources/api/posts/post_serializer.rb | spec/support/rails_app/app/resources/api/posts/post_serializer.rb | # frozen_string_literal: true
module Api
class PostSerializer < ActiveModel::Serializer
end
end
| ruby | MIT | 75936a180b6b9c670144338584b1296af264f377 | 2026-01-04T17:34:52.468542Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.