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 | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/metasploitable/recipes/vm_tools.rb | Ruby | bsd-3-clause | 193 | main | 416 | #
# Cookbook:: metasploitable
# Recipe:: vm_tools
#
# Copyright:: 2017, Rapid7, All Rights Reserved.
if node['virtualization']['system'].match /vbox/
# This assumes the VBoxGuestAdditions.iso was added to the user's home folder in Packer
bash "Install VirtualBox Guest Tools" do
code <<-EOH
mount /home/va... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/metasploitable/recipes/iptables.rb | Ruby | bsd-3-clause | 193 | main | 609 | #
# Cookbook:: metasploitable
# Recipe:: iptables
#
# Copyright:: 2017, Rapid7, All Rights Reserved.
include_recipe 'iptables::default'
iptables_rule '00_established' do
lines '-A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT'
end
iptables_rule '00_lo_allow_in' do
lines '-I INPUT -i lo -j ACCEPT'
en... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/metasploitable/recipes/cups.rb | Ruby | bsd-3-clause | 193 | main | 391 | #
# Cookbook:: metasploitable
# Recipe:: cups
#
# Copyright:: 2017, Rapid7, All Rights Reserved.
include_recipe 'iptables::default'
package 'cups' do
action :install
end
cookbook_file '/etc/cups/cupsd.conf' do
source 'cups/cupsd.conf'
mode '0644'
end
iptables_rule '1_cups' do
lines "-A INPUT -p tcp --dport ... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/metasploitable/recipes/nodejs.rb | Ruby | bsd-3-clause | 193 | main | 312 | #
# Cookbook:: metasploitable
# Recipe:: nodejs
#
# Copyright:: 2017, Rapid7, All Rights Reserved.
#
#
execute 'add nodejs 4 repository' do
command 'curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -'
not_if { ::File.exist?('/usr/bin/node') }
end
package 'nodejs' do
options '--force-yes'
end |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/metasploitable/recipes/unrealircd.rb | Ruby | bsd-3-clause | 193 | main | 2,500 | #
# Cookbook:: metasploitable
# Recipe:: unrealircd.rb
#
# Copyright:: 2017, Rapid7, All Rights Reserved.
# Downloaded from https://www.exploit-db.com/exploits/13853/
# Install steps taken from https://wiki.swiftirc.net/wiki/Installing_and_Configuring_UnrealIRCd_on_Linux
include_recipe 'iptables::default'
iptables_r... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/metasploitable/recipes/clear_cache.rb | Ruby | bsd-3-clause | 193 | main | 238 | #
# Cookbook:: metasploitable
# Recipe:: clear_cache
#
# Copyright:: 2017, Rapid7, All Rights Reserved.
# 'clear cache and backup that might contain sensitive information' do
directory '/var/chef' do
action :delete
recursive true
end |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/metasploitable/recipes/apache_continuum.rb | Ruby | bsd-3-clause | 193 | main | 1,595 | #
# Cookbook:: metasploitable
# Recipe:: apache_continuum
#
# Copyright:: 2017, Rapid7, All Rights Reserved.
include_recipe 'iptables::default'
iptables_rule '01_apache_continuum' do
lines "-A INPUT -p tcp --dport 8080 -j ACCEPT"
end
package 'openjdk-6-jre'
package 'openjdk-6-jdk'
directory node[:apache_continuum... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/metasploitable/recipes/sinatra.rb | Ruby | bsd-3-clause | 193 | main | 852 | #
# Cookbook:: metasploitable
# Recipe:: sinatra
#
# Copyright:: 2017, Rapid7, All Rights Reserved.
#
#
include_recipe 'metasploitable::sinatra'
include_recipe 'metasploitable::ruby23'
include_recipe 'iptables::default'
iptables_rule '1_sinatra' do
lines "-A INPUT -p tcp --dport 8181 -j ACCEPT"
end
server_path = n... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/metasploitable/recipes/flags.rb | Ruby | bsd-3-clause | 193 | main | 3,613 | #
# Cookbook:: metasploitable
# Recipe:: flags
#
# Copyright:: 2017, Rapid7, All Rights Reserved.
# 10 of Clubs
directory '/home/artoo_detoo/music' do
owner 'artoo_detoo'
group 'users'
mode '0770'
end
cookbook_file '/home/artoo_detoo/music/10_of_clubs.wav' do
source 'flags/10_of_clubs.wav'
owner 'artoo_deto... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/metasploitable/recipes/knockd.rb | Ruby | bsd-3-clause | 193 | main | 590 | #
# Cookbook:: metasploitable
# Recipe:: knockd
#
# Copyright:: 2017, Rapid7, All Rights Reserved.
package 'knockd' do
action :install
end
template '/etc/knockd.conf' do
source 'knockd/knockd.conf.erb'
mode '0600'
end
cookbook_file '/etc/default/knockd' do
source 'knockd/knockd'
mode '0600'
end
execute 'r... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/metasploitable/recipes/samba.rb | Ruby | bsd-3-clause | 193 | main | 447 | #
# Cookbook:: samba
# Recipe:: samba
#
# Copyright:: 2017, Rapid7, All Rights Reserved.
#
#
include_recipe 'iptables::default'
iptables_rule '1_samba' do
lines "-A INPUT -p tcp --dport 445 -j ACCEPT"
end
package 'samba'
cookbook_file '/etc/samba/smb.conf' do
source 'samba/smb.conf'
end
cookbook_file '/var/lib/... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/metasploitable/recipes/ruby23.rb | Ruby | bsd-3-clause | 193 | main | 221 | #
# Cookbook:: metasploitable
# Recipe:: ruby23
#
# Copyright:: 2017, Rapid7, All Rights Reserved.
#
#
apt_repository 'rvm' do
uri 'ppa:brightbox/ruby-ng'
end
package 'ruby2.3'
package 'ruby2.3-dev'
package 'bundler' |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/metasploitable/recipes/apache.rb | Ruby | bsd-3-clause | 193 | main | 1,221 | #
# Cookbook:: metasploitable
# Recipe:: apache
#
# Copyright:: 2017, Rapid7, All Rights Reserved.
include_recipe 'iptables::default'
iptables_rule '1_apache' do
lines "-A INPUT -p tcp --dport 80 -j ACCEPT"
end
package 'apache2' do
action :install
end
directory '/var/www/cgi-bin' do
mode '0755'
recursive tr... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/metasploitable/recipes/mysql.rb | Ruby | bsd-3-clause | 193 | main | 421 | #
# Cookbook:: metasploitable
# Recipe:: mysql
#
# Copyright:: 2017, Rapid7, All Rights Reserved.
include_recipe 'iptables::default'
iptables_rule '1_mysql' do
lines "-A INPUT -p tcp --dport 3306 -j ACCEPT"
end
mysql_service 'default' do
initial_root_password "#{node[:mysql][:root_password]}"
bind_address '0.0... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/metasploitable/recipes/php_545.rb | Ruby | bsd-3-clause | 193 | main | 2,400 | #
# Cookbook:: metasploitable
# Recipe:: php_545
#
# Copyright:: 2017, Rapid7, All Rights Reserved.
# General steps pulled from here: http://askubuntu.com/questions/597462/how-to-install-php-5-2-x-on-ubuntu-14-04
include_recipe 'metasploitable::apache'
php_tar = "php-5.4.5.tar.gz"
execute "install prereqs" do
com... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/metasploitable/recipes/chatbot.rb | Ruby | bsd-3-clause | 193 | main | 1,276 | #
# Cookbook:: metasploitable
# Recipe:: chatbot
#
# Copyright:: 2017, Rapid7, All Rights Reserved.
#
#
include_recipe 'metasploitable::ruby23'
include_recipe 'metasploitable::nodejs'
include_recipe 'iptables::default'
iptables_rule '1_chatbot_ui' do
lines "-A INPUT -p tcp --dport 80 -j ACCEPT"
end
iptables_rule '... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/metasploitable/recipes/proftpd.rb | Ruby | bsd-3-clause | 193 | main | 2,300 | #
# Cookbook:: metasploitable
# Recipe:: proftpd
#
# Copyright:: 2017, Rapid7, All Rights Reserved.
# Install steps taken from https://github.com/rapid7/metasploit-framework/pull/5224
include_recipe 'iptables::default'
iptables_rule '1_proftpd' do
lines "-A INPUT -p tcp --dport 21 -j ACCEPT"
end
include_recipe 'm... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/metasploitable/recipes/ifnames.rb | Ruby | bsd-3-clause | 193 | main | 215 | #
# Cookbook:: metasploitable
# Recipe:: ifnames
#
# block udev persistent net rules for consistent interface naming after cloning
link '/etc/udev/rules.d/75-persistent-net-generator.rules' do
to '/dev/null'
end |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/metasploitable/recipes/users.rb | Ruby | bsd-3-clause | 193 | main | 573 | #
# Cookbook:: metasploitable
# Recipe:: users
#
# Copyright:: 2017, Rapid7, All Rights Reserved.
uid = 1111
node[:users].each do |u, attributes|
user attributes[:username] do
manage_home true
password attributes[:password_hash]
uid uid
gid 100
home "/home/#{attributes[:username]}"
shell '/b... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/metasploitable/recipes/docker.rb | Ruby | bsd-3-clause | 193 | main | 286 | #
# Cookbook:: metasploitable
# Recipe:: docker
#
docker_service 'default' do
install_method 'package'
version '18.06.1'
action [:create, :start]
group 'docker'
end
group 'docker' do
action [:create, :modify]
append true
members node[:metasploitable][:docker_users]
end |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/metasploitable/recipes/sshd.rb | Ruby | bsd-3-clause | 193 | main | 224 | #
# Cookbook:: metasploitable
# Recipe:: sshd
#
# Copyright:: 2017, Rapid7, All Rights Reserved.
cookbook_file '/etc/ssh/sshd_config' do
source 'sshd/sshd_config'
mode '0644'
end
service 'ssh' do
action :restart
end |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/metasploitable/recipes/drupal.rb | Ruby | bsd-3-clause | 193 | main | 2,808 | #
# Cookbook:: metasploitable
# Recipe:: drupal
#
# Copyright:: 2017, Rapid7, All Rights Reserved.
include_recipe 'metasploitable::apache'
include_recipe 'metasploitable::mysql'
include_recipe 'metasploitable::php_545'
drupal_tar = "drupal-#{node[:drupal][:version]}.tar.gz"
coder_tar = "coder-7.x-2.5.tar.gz"
f... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/metasploitable/recipes/payroll_app.rb | Ruby | bsd-3-clause | 193 | main | 1,091 | #
# Cookbook:: metasploitable
# Recipe:: payroll_app
# Copyright:: 2017, Rapid7, All Rights Reserved.
include_recipe 'metasploitable::mysql'
include_recipe 'metasploitable::apache'
include_recipe 'metasploitable::php_545'
poc_dir = "/home/#{node[:users][node[:users].keys.last][:username]}/poc/payroll_app/"
cookbook_... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/metasploitable/recipes/phpmyadmin.rb | Ruby | bsd-3-clause | 193 | main | 813 | #
# Cookbook:: metasploitable
# Recipe:: phpmyadmin
#
# Copyright:: 2017, Rapid7, All Rights Reserved.
include_recipe 'metasploitable::mysql'
include_recipe 'metasploitable::apache'
include_recipe 'metasploitable::php_545'
bash "download and extract phpmyadmin" do
code <<-EOH
wget --no-check-certificate -c -t 3... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/docker/metadata.rb | Ruby | bsd-3-clause | 193 | main | 525 | name 'docker'
maintainer 'Chef Software, Inc.'
maintainer_email 'cookbooks@chef.io'
license 'Apache-2.0'
description 'Provides docker_service, docker_image, and docker_container resources'
version '4.9.3'
source_url 'https://github.com/chef-cookbooks/docker'
issues_url 'https://github.com/chef-cookbooks/docker/issues'... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/docker/libraries/docker_image.rb | Ruby | bsd-3-clause | 193 | main | 5,429 | module DockerCookbook
class DockerImage < DockerBase
resource_name :docker_image
# Modify the default of read_timeout from 60 to 120
property :read_timeout, default: 120, desired_state: false
# https://docs.docker.com/engine/api/v1.35/#tag/Image
property :destination, String
property :force,... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/docker/libraries/helpers_service.rb | Ruby | bsd-3-clause | 193 | main | 9,720 | # Constants
IPV6_ADDR ||= /(
([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|
([0-9a-fA-F]{1,4}:){1,7}:|
([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|
([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|
([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|
([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|
([0-9a-fA-F]{1,4}:){1,2}(:[0-... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/docker/libraries/docker_installation_script.rb | Ruby | bsd-3-clause | 193 | main | 1,050 | module DockerCookbook
class DockerInstallationScript < DockerBase
resource_name :docker_installation_script
provides :docker_installation, os: 'linux'
property :repo, %w(main test experimental), default: 'main', desired_state: false
property :script_url, String, default: lazy { default_script_url },... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/docker/libraries/docker_exec.rb | Ruby | bsd-3-clause | 193 | main | 747 | module DockerCookbook
class DockerExec < DockerBase
resource_name :docker_exec
property :host, [String, nil], default: lazy { ENV['DOCKER_HOST'] }, desired_state: false
property :command, Array
property :container, String
property :timeout, Numeric, default: 60, desired_state: false
property ... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/docker/libraries/docker_container.rb | Ruby | bsd-3-clause | 193 | main | 29,430 | module DockerCookbook
class DockerContainer < DockerBase
resource_name :docker_container
property :container_name, String, name_property: true
property :repo, String, default: lazy { container_name }
property :tag, String, default: 'latest'
property :command, [Array, String, nil], coerce: proc { ... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/docker/libraries/docker_service_manager_systemd.rb | Ruby | bsd-3-clause | 193 | main | 3,661 | module DockerCookbook
class DockerServiceManagerSystemd < DockerServiceBase
resource_name :docker_service_manager_systemd
provides :docker_service_manager, os: 'linux' do |_node|
Chef::Platform::ServiceHelpers.service_resource_providers.include?(:systemd)
end
action :start do
create_dock... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/docker/libraries/docker_installation_tarball.rb | Ruby | bsd-3-clause | 193 | main | 2,764 | module DockerCookbook
class DockerInstallationTarball < DockerBase
resource_name :docker_installation_tarball
property :checksum, String, default: lazy { default_checksum }, desired_state: false
property :source, String, default: lazy { default_source }, desired_state: false
property :channel, String... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/docker/libraries/docker_service_manager_execute.rb | Ruby | bsd-3-clause | 193 | main | 1,719 | module DockerCookbook
class DockerServiceManagerExecute < DockerServiceBase
resource_name :docker_service_manager_execute
# Start the service
action :start do
# enable ipv4 forwarding
execute 'enable net.ipv4.conf.all.forwarding' do
command '/sbin/sysctl net.ipv4.conf.all.forwarding=1... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/docker/libraries/docker_plugin.rb | Ruby | bsd-3-clause | 193 | main | 3,748 | module DockerCookbook
class DockerPlugin < DockerBase
resource_name :docker_plugin
property :local_alias, String, name_property: true
property :remote_tag, String, default: 'latest'
property :remote, [String, nil], default: nil
property :grant_privileges, [Array, TrueClass], default: []
prope... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/docker/libraries/docker_base.rb | Ruby | bsd-3-clause | 193 | main | 4,197 | module DockerCookbook
class DockerBase < Chef::Resource
require 'docker'
require 'shellwords'
################
# Helper methods
################
def connection
@connection ||= begin
opts = {}
opts[:read_timeout] = read_timeout if read_tim... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/docker/libraries/docker_tag.rb | Ruby | bsd-3-clause | 193 | main | 939 | module DockerCookbook
class DockerTag < DockerBase
resource_name :docker_tag
property :target_repo, String, name_property: true
property :target_tag, String
property :to_repo, String
property :to_tag, String
property :force, [TrueClass, FalseClass], default: false, desired_state: false
#... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/docker/libraries/docker_installation_package.rb | Ruby | bsd-3-clause | 193 | main | 5,393 | module DockerCookbook
class DockerInstallationPackage < DockerBase
# Resource properties
resource_name :docker_installation_package
provides :docker_installation, platform: 'amazon'
property :setup_docker_repo, [TrueClass, FalseClass], default: lazy { platform?('amazon') ? false : true }, desired_st... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/docker/libraries/docker_service_manager_sysvinit_debian.rb | Ruby | bsd-3-clause | 193 | main | 1,921 | module DockerCookbook
class DockerServiceManagerSysvinitDebian < DockerServiceBase
resource_name :docker_service_manager_sysvinit_debian
provides :docker_service_manager, platform: 'debian' do |node| # ~FC005
node['platform_version'].to_f < 8.0
end
provides :docker_service_manager_sysvinit, pl... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/docker/libraries/docker_network.rb | Ruby | bsd-3-clause | 193 | main | 7,633 | module DockerCookbook
class DockerNetwork < DockerBase
resource_name :docker_network
property :auxiliary_addresses, [String, Array, nil], coerce: proc { |v| coerce_auxiliary_addresses(v) }
property :container, String, desired_state: false
property :driver, String
property :driver_opts, PartialHas... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/docker/libraries/docker_image_prune.rb | Ruby | bsd-3-clause | 193 | main | 1,447 | module DockerCookbook
class DockerImagePrune < DockerBase
resource_name :docker_image_prune
# Requires docker API v1.25
# Modify the default of read_timeout from 60 to 120
property :read_timeout, default: 120, desired_state: false
property :host, [String, nil], default: lazy { ENV['DOCKER_HOST'] }... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/docker/libraries/docker_service_manager_upstart.rb | Ruby | bsd-3-clause | 193 | main | 1,818 | module DockerCookbook
class DockerServiceManagerUpstart < DockerServiceBase
resource_name :docker_service_manager_upstart
provides :docker_service_manager, platform_family: 'debian' do |_node|
Chef::Platform::ServiceHelpers.service_resource_providers.include?(:upstart) &&
!Chef::Platform::Servi... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/docker/libraries/docker_service.rb | Ruby | bsd-3-clause | 193 | main | 3,822 | module DockerCookbook
require_relative 'docker_service_base'
class DockerService < DockerServiceBase
resource_name :docker_service
# register with the resource resolution system
provides :docker_service
# installation type and service_manager
property :install_method, %w(script package tarbal... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/docker/libraries/docker_service_base.rb | Ruby | bsd-3-clause | 193 | main | 4,825 | module DockerCookbook
class DockerServiceBase < DockerBase
################
# Helper Methods
################
require_relative 'helpers_service'
include DockerHelpers::Service
#####################
# resource properties
#####################
resource_name :docker_service_base
... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/docker/libraries/docker_volume.rb | Ruby | bsd-3-clause | 193 | main | 1,168 | module DockerCookbook
class DockerVolume < DockerBase
resource_name :docker_volume
property :driver, String, desired_state: false
property :host, [String, nil], default: lazy { ENV['DOCKER_HOST'] }, desired_state: false
property :opts, Hash, desired_state: false
property :volume, Docker::Volume, ... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/docker/libraries/docker_registry.rb | Ruby | bsd-3-clause | 193 | main | 1,189 | module DockerCookbook
class DockerRegistry < DockerBase
resource_name :docker_registry
property :email, String
property :password, String,
sensitive: true
property :serveraddress, String,
name_property: true
property :username, String
property :host, [String, nil... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/docker/libraries/docker_service_manager_sysvinit_rhel.rb | Ruby | bsd-3-clause | 193 | main | 2,176 | module DockerCookbook
class DockerServiceManagerSysvinitRhel < DockerServiceBase
resource_name :docker_service_manager_sysvinit_rhel
provides :docker_service_manager, platform: 'amazon'
provides :docker_service_manager, platform: 'suse'
provides :docker_service_manager, platform_family: 'rhel' do |no... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/compat_resource/libraries/autoload.rb | Ruby | bsd-3-clause | 193 | main | 2,123 | unless Gem::Requirement.new(">= 12.0").satisfied_by?(Gem::Version.new(Chef::VERSION))
raise "This resource is written with Chef 12.5 custom resources, and requires at least Chef 12.0 used with the compat_resource cookbook, it will not work with Chef 11.x clients, and those users must pin their cookbooks to older vers... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource/yum_repository.rb | Ruby | bsd-3-clause | 193 | main | 4,101 | #
# NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE
#
# THIS IS A FILE AUTOGENERATED BY 'rake update' DO NOT EDIT!!!!
#
# NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE
#
begin
require 'chef/resource/yum_repository'
rescue LoadError; end
require 'chef_compat/copied_from_chef'
class Ch... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource/apt_update.rb | Ruby | bsd-3-clause | 193 | main | 1,559 | #
# NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE
#
# THIS IS A FILE AUTOGENERATED BY 'rake update' DO NOT EDIT!!!!
#
# NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE
#
begin
require 'chef/resource/apt_update'
rescue LoadError; end
require 'chef_compat/copied_from_chef'
class Chef
m... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource/apt_repository.rb | Ruby | bsd-3-clause | 193 | main | 2,752 | #
# NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE
#
# THIS IS A FILE AUTOGENERATED BY 'rake update' DO NOT EDIT!!!!
#
# NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE
#
begin
require 'chef/resource/apt_repository'
rescue LoadError; end
require 'chef_compat/copied_from_chef'
class Ch... |
github | juanjoSanz/aws-pentesting-lab | https://github.com/juanjoSanz/aws-pentesting-lab | metasploitable3/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider/yum_repository.rb | Ruby | bsd-3-clause | 193 | main | 5,015 | #
# NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE
#
# THIS IS A FILE AUTOGENERATED BY 'rake update' DO NOT EDIT!!!!
#
# NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE
#
begin
require 'chef/provider/yum_repository'
rescue LoadError; end
require 'chef_compat/copied_from_chef'
class Ch... |
github | usetrmnl/trmnlp | https://github.com/usetrmnl/trmnlp | trmnl_preview.gemspec | Ruby | mit | 193 | main | 2,117 | # frozen_string_literal: true
require_relative "lib/trmnlp/version"
Gem::Specification.new do |spec|
spec.name = "trmnl_preview"
spec.version = TRMNLP::VERSION
spec.authors = ["Rockwell Schrock"]
spec.email = ["rockwell@schrock.me"]
spec.summary = "Local web server to preview TRMNL plugins"
spec.descript... |
github | usetrmnl/trmnlp | https://github.com/usetrmnl/trmnlp | lib/trmnlp.rb | Ruby | mit | 193 | main | 293 | # frozen_string_literal: true
module TRMNLP; end
require 'oj'
Oj.mimic_JSON()
require_relative "trmnlp/config"
require_relative "trmnlp/context"
require_relative "trmnlp/version"
module TRMNLP
VIEWS = %w{full half_horizontal half_vertical quadrant}
class Error < StandardError; end
end |
github | usetrmnl/trmnlp | https://github.com/usetrmnl/trmnlp | lib/trmnlp/config.rb | Ruby | mit | 193 | main | 315 | require_relative 'config/app'
require_relative 'config/plugin'
require_relative 'config/project'
module TRMNLP
class Config
attr_reader :app, :project, :plugin
def initialize(path)
@app = App.new(path)
@project = Project.new(path)
@plugin = Plugin.new(path, @project)
end
end
end |
github | usetrmnl/trmnlp | https://github.com/usetrmnl/trmnlp | lib/trmnlp/app.rb | Ruby | mit | 193 | main | 2,462 | require 'faye/websocket'
require 'sinatra'
require 'sinatra/base'
require_relative 'context'
require_relative 'screen_generator'
module TRMNLP
class App < Sinatra::Base
# Sinatra settings
set :views, File.join(File.dirname(__FILE__), '..', '..', 'web', 'views')
set :public_folder, File.join(File.dirname... |
github | usetrmnl/trmnlp | https://github.com/usetrmnl/trmnlp | lib/trmnlp/context.rb | Ruby | mit | 193 | main | 6,893 | require 'active_support/time'
require 'active_support/core_ext/hash/conversions'
require 'erb'
require 'faraday'
require 'filewatcher'
require 'json'
require 'trmnl/liquid'
require_relative 'config'
require_relative 'paths'
module TRMNLP
class Context
attr_reader :config, :paths
def initialize(root_dir... |
github | usetrmnl/trmnlp | https://github.com/usetrmnl/trmnlp | lib/trmnlp/cli.rb | Ruby | mit | 193 | main | 2,258 | require 'thor'
require_relative '../trmnlp'
require_relative '../trmnlp/commands'
module TRMNLP
class CLI < Thor
package_name 'trmnlp'
class_option :dir, type: :string, default: Dir.pwd, aliases: '-d',
desc: 'Plugin project directory'
class_option :quiet, type: :boolean, default: fal... |
github | usetrmnl/trmnlp | https://github.com/usetrmnl/trmnlp | lib/trmnlp/api_client.rb | Ruby | mit | 193 | main | 2,547 | require 'faraday'
require 'faraday/multipart'
require_relative 'config'
module TRMNLP
class APIClient
def initialize(config)
@config = config
end
def get_me
response = conn.get("me")
if response.status == 200
JSON.parse(response.body).dig('data')
else
raise Erro... |
github | usetrmnl/trmnlp | https://github.com/usetrmnl/trmnlp | lib/trmnlp/paths.rb | Ruby | mit | 193 | main | 1,325 | require 'xdg'
module TRMNLP
class Paths
attr_reader :root_dir
def initialize(root_dir)
@root_dir = Pathname.new(root_dir)
@xdg = XDG.new
end
# --- trmnlp library ---
def gem_dir = Pathname.new(__dir__).join('..', '..').expand_path
def templates_dir = gem_dir.join('... |
github | usetrmnl/trmnlp | https://github.com/usetrmnl/trmnlp | lib/trmnlp/screen_generator.rb | Ruby | mit | 193 | main | 5,675 | require 'mini_magick'
require 'selenium-webdriver'
require 'base64'
require 'thread'
require 'tempfile'
require 'fileutils'
require 'uri'
module TRMNLP
class ScreenGenerator
# Browser pool management for efficient resource usage
class BrowserPool
def initialize(max_size: 2)
@drivers = []
... |
github | usetrmnl/trmnlp | https://github.com/usetrmnl/trmnlp | lib/trmnlp/commands/login.rb | Ruby | mit | 193 | main | 1,262 | require_relative 'base'
require_relative '../api_client'
module TRMNLP
module Commands
class Login < Base
def call
if config.app.logged_in?
anonymous_key = config.app.api_key[0..10] + '*' * (config.app.api_key.length - 11)
output "Currently authenticated as: #{anonymous_key}"
... |
github | usetrmnl/trmnlp | https://github.com/usetrmnl/trmnlp | lib/trmnlp/commands/pull.rb | Ruby | mit | 193 | main | 1,151 | require 'zip'
require_relative 'base'
require_relative '../api_client'
module TRMNLP
module Commands
class Pull < Base
def call
context.validate!
authenticate!
plugin_settings_id = options.id || config.plugin.id
raise Error, 'plugin ID must be specified' if plugin_settings... |
github | usetrmnl/trmnlp | https://github.com/usetrmnl/trmnlp | lib/trmnlp/commands/build.rb | Ruby | mit | 193 | main | 455 | require_relative 'base'
module TRMNLP
module Commands
class Build < Base
def call
context.validate!
context.poll_data
context.paths.create_build_dir
VIEWS.each do |view|
output_path = context.paths.build_dir.join("#{view}.html")
output "Writing #{output_... |
github | usetrmnl/trmnlp | https://github.com/usetrmnl/trmnlp | lib/trmnlp/commands/serve.rb | Ruby | mit | 193 | main | 481 | require 'zip'
require_relative 'base'
require_relative '../api_client'
module TRMNLP
module Commands
class Serve < Base
def call
context.validate!
# Must come AFTER parsing options
require_relative '../app'
# Now we can configure things
App.set(:context, c... |
github | usetrmnl/trmnlp | https://github.com/usetrmnl/trmnlp | lib/trmnlp/commands/list.rb | Ruby | mit | 193 | main | 844 | require_relative 'base'
require_relative '../api_client'
module TRMNLP
module Commands
class List < Base
PRIVATE_PLUGIN_ID = 37
def call
authenticate!
api = APIClient.new(config)
response = api.get_plugin_settings
plugins = (response || [])
.select { |p| p[... |
github | usetrmnl/trmnlp | https://github.com/usetrmnl/trmnlp | lib/trmnlp/commands/push.rb | Ruby | mit | 193 | main | 1,918 | require 'zip'
require_relative 'base'
require_relative '../api_client'
module TRMNLP
module Commands
class Push < Base
def call
context.validate!
authenticate!
is_new = false
zip_path = 'upload.zip'
api = APIClient.new(config)
plugin_settings_id = options... |
github | usetrmnl/trmnlp | https://github.com/usetrmnl/trmnlp | lib/trmnlp/commands/base.rb | Ruby | mit | 193 | main | 816 | require 'thor/core_ext/hash_with_indifferent_access'
require_relative '../context'
module TRMNLP
module Commands
class Base
include Thor::CoreExt
def initialize(options = HashWithIndifferentAccess.new)
@options = HashWithIndifferentAccess.new(options)
@context = Context.new(@options... |
github | usetrmnl/trmnlp | https://github.com/usetrmnl/trmnlp | lib/trmnlp/commands/clone.rb | Ruby | mit | 193 | main | 776 | require_relative 'base'
require_relative 'pull'
module TRMNLP
module Commands
class Clone < Base
def call(directory_name, id)
authenticate!
destination_path = Pathname.new(options.dir).join(directory_name)
raise Error, "directory #{destination_path} already exists, aborting" if des... |
github | usetrmnl/trmnlp | https://github.com/usetrmnl/trmnlp | lib/trmnlp/commands/init.rb | Ruby | mit | 193 | main | 1,481 | require 'fileutils'
require_relative 'base'
module TRMNLP
module Commands
class Init < Base
def call(name)
destination_dir = Pathname.new(options.dir).join(name)
unless destination_dir.exist?
output "Creating #{destination_dir}"
destination_dir.mkpath
end
... |
github | usetrmnl/trmnlp | https://github.com/usetrmnl/trmnlp | lib/trmnlp/config/app.rb | Ruby | mit | 193 | main | 1,147 | require 'yaml'
module TRMNLP
class Config
# Stores trmnlp-wide configuration (irrespective of the current plugin)
class App
def initialize(paths)
@paths = paths
@config = read_config
end
def save
paths.app_config_dir.mkpath
paths.app_config.write(YAML.dump(@... |
github | usetrmnl/trmnlp | https://github.com/usetrmnl/trmnlp | lib/trmnlp/config/plugin.rb | Ruby | mit | 193 | main | 2,059 | require 'yaml'
module TRMNLP
class Config
class Plugin
def initialize(paths, project_config)
@paths = paths
@project_config = project_config
reload!
end
def reload!
if paths.plugin_config.exist?
@config = YAML.load_file(paths.plugin_config)
els... |
github | usetrmnl/trmnlp | https://github.com/usetrmnl/trmnlp | lib/trmnlp/config/project.rb | Ruby | mit | 193 | main | 1,347 | require 'trmnl/liquid'
require 'yaml'
module TRMNLP
class Config
class Project
attr_reader :paths
def initialize(paths)
@paths = paths
reload!
end
def reload!
if paths.trmnlp_config.exist?
@config = YAML.load_file(paths.trmnlp_config)
else
... |
github | usetrmnl/trmnlp | https://github.com/usetrmnl/trmnlp | spec/spec_helper.rb | Ruby | mit | 193 | main | 4,777 | # This file was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
# this file to always be loaded, without a need to explicitly require it in any
# file... |
github | usetrmnl/trmnlp | https://github.com/usetrmnl/trmnlp | spec/lib/trmnlp/context_spec.rb | Ruby | mit | 193 | main | 5,875 | require 'spec_helper'
RSpec.describe TRMNLP::Context do
let(:root_dir) { File.join(__dir__, '../../fixtures') }
subject(:context) { described_class.new(root_dir) }
TEST_RESPONSES = [
{
header: 'application/json; charset=utf-8',
response_body: '{"key": "value", "number": 42}',
parsed: { 'ke... |
github | usetrmnl/trmnlp | https://github.com/usetrmnl/trmnlp | spec/lib/trmnlp/config/project_spec.rb | Ruby | mit | 193 | main | 753 | require 'spec_helper'
RSpec.describe TRMNLP::Config::Project do
let(:root_dir) { File.join(__dir__, '../../../fixtures') }
let(:paths) { TRMNLP::Paths.new(root_dir) }
subject { TRMNLP::Config::Project.new(paths) }
describe '#custom_fields' do
context 'when there is a .trmnlp yaml file in the path' do
... |
github | thumblemonks/smurf | https://github.com/thumblemonks/smurf | Rakefile | Ruby | mit | 193 | master | 270 | require 'bundler'
Bundler::GemHelper.install_tasks
require 'rake/testtask'
task :default => ["test"]
desc 'Test the smurf plugin'
Rake::TestTask.new("test") do |t|
t.libs += ['test']
t.pattern = 'test/**/*_test.rb'
t.verbose = false # Verbose is just dumb
end |
github | thumblemonks/smurf | https://github.com/thumblemonks/smurf | smurf.gemspec | Ruby | mit | 193 | master | 904 | # -*- encoding: utf-8 -*-
$:.unshift(File.expand_path("../lib", __FILE__))
require "smurf/version"
Gem::Specification.new do |s|
s.name = %q{smurf}
s.version = Smurf::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["Justin 'Gus' Knowlden"]
s.summary = %q{Rails plugin to ... |
github | thumblemonks/smurf | https://github.com/thumblemonks/smurf | test/test_helper.rb | Ruby | mit | 193 | master | 1,187 | ENV["RAILS_ENV"] = "test"
require ::File.expand_path('../rails/config/environment', __FILE__)
# Rails.public_path = Rails.root + "test" + "rails" + "public"
require 'riot'
require 'ostruct'
# require 'smurf'
require ::File.expand_path('../../lib/smurf', __FILE__)
class AssetFile
def self.base_path
@path ||= ... |
github | thumblemonks/smurf | https://github.com/thumblemonks/smurf | test/javascript_test.rb | Ruby | mit | 193 | master | 1,767 | require 'test_helper'
context "Javascript minifier" do
should "want to minify files in the javascripts directory" do
Smurf::Javascript.minifies?(["a/b/javascripts/bar.js", "c/d/javascripts/baz.js"])
end
should "want to minify files in the stylesheets directory" do
Smurf::Javascript.minifies?(["a/b/styl... |
github | thumblemonks/smurf | https://github.com/thumblemonks/smurf | test/stylesheet_test.rb | Ruby | mit | 193 | master | 1,512 | require 'test_helper'
context "Stylesheet minifier" do
setup { Smurf::Stylesheet }
helper(:minify) { |content| topic.new(content).minified }
should "want to minify files in the stylesheets directory" do
topic.minifies?(["a/b/stylesheets/bar.css", "c/d/stylesheets/baz.css?12344"])
end
should "want to mi... |
github | thumblemonks/smurf | https://github.com/thumblemonks/smurf | test/integration_test.rb | Ruby | mit | 193 | master | 654 | require 'test_helper'
context "link tags when caching on" do
setup do
javascript_include_tag('testing', :cache => 'cache/actual')
stylesheet_link_tag('foo', 'bar', :cache => 'cache/actual-basic')
stylesheet_link_tag('foo', 'bar', '/javascripts/projwcss/jscss', :cache => 'cache/actual-plus')
end
shou... |
github | thumblemonks/smurf | https://github.com/thumblemonks/smurf | test/rails/config/boot.rb | Ruby | mit | 193 | master | 229 | begin
require File.expand_path("../../../../.bundle/environment", __FILE__)
rescue LoadError
require 'rubygems'
require 'bundler/setup'
Bundler.setup :default
end
$:.unshift File.expand_path('../../../../lib', __FILE__) |
github | thumblemonks/smurf | https://github.com/thumblemonks/smurf | test/rails/config/application.rb | Ruby | mit | 193 | master | 589 | require File.expand_path('../boot', __FILE__)
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require "action_controller/railtie"
require "action_view/railtie"
# Auto-require default libraries and those for the current Rails environment.
Bundler.require :default, Rails.env
module Smurf
class Application... |
github | thumblemonks/smurf | https://github.com/thumblemonks/smurf | test/rails/config/environments/test.rb | Ruby | mit | 193 | master | 235 | Smurf::Application.configure do
config.active_support.deprecation = :stderr
config.cache_classes = true
config.whiny_nils = true
config.action_controller.perform_caching = true # THIS IS IMPORTANT FOR THE TESTS
end |
github | thumblemonks/smurf | https://github.com/thumblemonks/smurf | lib/smurf.rb | Ruby | mit | 193 | master | 539 | require 'smurf/javascript'
require 'smurf/stylesheet'
require 'smurf/noop'
module ActionView::Helpers::AssetTagHelper
private
def minifiers
@@minifiers ||= [Smurf::Javascript, Smurf::Stylesheet, Smurf::Noop]
end
def join_asset_file_contents_with_minification(paths)
content = join_asset_file_contents_wit... |
github | thumblemonks/smurf | https://github.com/thumblemonks/smurf | lib/smurf/stylesheet.rb | Ruby | mit | 193 | master | 1,248 | module Smurf
class Stylesheet
def self.minifies?(paths) !paths.grep(%r[\.css(\?\d+)?$]).empty?; end
def initialize(content)
@content = content.nil? ? nil : minify(content)
end
def minified; @content; end
# TODO: deal with string values better (urls, content blocks, etc.)
def minif... |
github | thumblemonks/smurf | https://github.com/thumblemonks/smurf | lib/smurf/javascript.rb | Ruby | mit | 193 | master | 6,980 | # Author: Justin Knowlden
# Adaption of jsmin.rb published by Uladzislau Latynski
#
# -------------------
# jsmin.rb 2007-07-20
# Author: Uladzislau Latynski
# This work is a translation from C to Ruby of jsmin.c published by
# Douglas Crockford. Permission is hereby granted to use the Ruby
# version under the same co... |
github | thumblemonks/smurf | https://github.com/thumblemonks/smurf | lib/smurf/noop.rb | Ruby | mit | 193 | master | 284 | module Smurf
# This is a no-op; essentially a NullObject pattern implementation. Saves from implementing logic elsewhere
class Noop
def self.minifies?(paths) true; end
def initialize(content) @content = content; end
def minified; @content; end
end # Noop
end # Smurf |
github | chronicle-app/chronicle-etl | https://github.com/chronicle-app/chronicle-etl | chronicle-etl.gemspec | Ruby | mit | 194 | main | 3,231 | # frozen_string_literal: true
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'chronicle/etl/version'
Gem::Specification.new do |spec|
spec.name = 'chronicle-etl'
spec.version = Chronicle::ETL::VERSION
spec.authors = ['Andrew Louis']
... |
github | chronicle-app/chronicle-etl | https://github.com/chronicle-app/chronicle-etl | Guardfile | Ruby | mit | 194 | main | 213 | guard :rspec, cmd: 'bundle exec rspec' do
require 'guard/rspec/dsl'
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { 'spec' }
end |
github | chronicle-app/chronicle-etl | https://github.com/chronicle-app/chronicle-etl | spec/spec_helper.rb | Ruby | mit | 194 | main | 1,679 | # frozen_string_literal: true
require 'simplecov'
SimpleCov.start
require 'bundler/setup'
require 'chronicle/etl'
require 'chronicle/etl/cli'
require 'vcr'
VCR.configure do |config|
config.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
config.allow_http_connections_when_no_cassette = true
config.hook_int... |
github | chronicle-app/chronicle-etl | https://github.com/chronicle-app/chronicle-etl | spec/support/run_extraction.rb | Ruby | mit | 194 | main | 315 | module Chronicle
module ETL
module SpecHelpers
def run_extraction(klass, options = {})
extractor = klass.new(options)
extractor.prepare
results = []
extractor.extract do |extraction|
results << extraction
end
results
end
end
end
end |
github | chronicle-app/chronicle-etl | https://github.com/chronicle-app/chronicle-etl | spec/support/wait_until.rb | Ruby | mit | 194 | main | 404 | module Chronicle
module ETL
module SpecHelpers
# https://stackoverflow.com/questions/19388474/how-can-i-use-sinatra-to-simulate-a-remote-server-in-rspec-vcr
def wait_until(timeout = 1)
start_time = Time.now
loop do
return if yield
raise TimeoutError if (Time.now - ... |
github | chronicle-app/chronicle-etl | https://github.com/chronicle-app/chronicle-etl | spec/support/mocked_config_directory.rb | Ruby | mit | 194 | main | 438 | require 'fakefs/spec_helpers'
RSpec.shared_context 'mocked config directory' do
around(:each) do |example|
include FakeFS::SpecHelpers
FakeFS.with_fresh do
home = File.expand_path(File.join(RSPEC_ROOT, 'support/mock_homedir'))
FakeFS::FileSystem.clone(home)
Chronicle::ETL::Config.xdg_envi... |
github | chronicle-app/chronicle-etl | https://github.com/chronicle-app/chronicle-etl | spec/support/invoke_cli.rb | Ruby | mit | 194 | main | 617 | module Chronicle
module ETL
module SpecHelpers
# Run the main CLI app with given args
#
# @param [Array] the command line arguments to pass to the CLI
# @param [Boolean] rescue_from_exit whether to rescue when CLI explictly
# exits. If set to false, example must include
# `... |
github | chronicle-app/chronicle-etl | https://github.com/chronicle-app/chronicle-etl | spec/support/mocked_stdin.rb | Ruby | mit | 194 | main | 283 | require 'stringio'
RSpec.shared_context 'mocked stdin' do
let(:fake_stdin) { StringIO.new }
def load_stdin(input)
fake_stdin.puts(input)
fake_stdin.rewind
end
around(:each) do |example|
$stdin = fake_stdin
example.run
ensure
$stdin = STDIN
end
end |
github | chronicle-app/chronicle-etl | https://github.com/chronicle-app/chronicle-etl | spec/support/capture_io.rb | Ruby | mit | 194 | main | 1,110 | module Chronicle
module ETL
module SpecHelpers
# Capture stdout/stderr in a block
# Adapted from minitest
# https://github.com/seattlerb/minitest/blob/7d2134a1d386a068f1c7705889c7764a47413861/lib/minitest/assertions.rb#L514
def capture
orig_stdout = $stdout
orig_stderr = $s... |
github | chronicle-app/chronicle-etl | https://github.com/chronicle-app/chronicle-etl | spec/chronicle/etl/runner_spec.rb | Ruby | mit | 194 | main | 1,371 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Chronicle::ETL::Runner do
before(:all) do
Chronicle::ETL::Logger.log_level = Chronicle::ETL::Logger::FATAL
end
describe '#run!' do
it 'runs' do
filename = 'spec/support/sample_data/test.csv'
# rows in sample CSV file (exclu... |
github | chronicle-app/chronicle-etl | https://github.com/chronicle-app/chronicle-etl | spec/chronicle/etl/secrets_spec.rb | Ruby | mit | 194 | main | 1,074 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Chronicle::ETL::Secrets do
include_context 'mocked config directory'
describe '#all' do
it 'can retrieve all secrets' do
expect(described_class.all.keys).to contain_exactly(:'provider-one', :'provider-two')
end
end
describe '#s... |
github | chronicle-app/chronicle-etl | https://github.com/chronicle-app/chronicle-etl | spec/chronicle/etl/oauth_authorizer_spec.rb | Ruby | mit | 194 | main | 1,478 | require 'spec_helper'
OmniAuth.config.test_mode = true
OmniAuth.config.mock_auth[:developer] = {
token: 'abc'
}
# Make sure AuthorizationServer knows we're in test mode
ENV['APP_ENV'] = 'test'
# Prevent Launchy from attempt to open windows in oauth_authorizer.rb
ENV['LAUNCHY_DRY_RUN'] = 'true'
RSpec.describe Chron... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.