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 | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/i18n/enable_option_disable_i18n.rb | Ruby | apache-2.0 | 7,843 | main | 3,091 | test_name 'Verify that disable_i18n can be set to true and have translations disabled' do
confine :except, :platform => /^solaris/ # translation not supported
tag 'audit:medium',
'audit:acceptance'
require 'puppet/acceptance/environment_utils.rb'
extend Puppet::Acceptance::EnvironmentUtils
require 'p... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/i18n/modules/puppet_face.rb | Ruby | apache-2.0 | 7,843 | main | 2,798 | test_name 'C100573: puppet application/face with module translates messages' do
confine :except, :platform => /^solaris/ # translation not supported
tag 'audit:medium',
'audit:acceptance'
require 'puppet/acceptance/i18n_utils'
extend Puppet::Acceptance::I18nUtils
require 'puppet/acceptance/i18ndemo_u... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/i18n/modules/puppet_agent_cached_catalog.rb | Ruby | apache-2.0 | 7,843 | main | 5,493 | test_name 'C100566: puppet agent with module should translate messages when using a cached catalog' do
confine :except, :platform => /^solaris/ # translation not supported
tag 'audit:medium',
'audit:acceptance'
require 'puppet/acceptance/environment_utils.rb'
extend Puppet::Acceptance::EnvironmentUtils
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/i18n/modules/puppet_agent_with_multiple_environments.rb | Ruby | apache-2.0 | 7,843 | main | 4,258 | test_name 'C100575: puppet agent with different modules in different environments should translate based on their module' do
confine :except, :platform => /^solaris/ # translation not supported
tag 'audit:medium',
'audit:acceptance'
require 'puppet/acceptance/environment_utils.rb'
extend Puppet::Accepta... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/i18n/modules/puppet_apply_module_lang.rb | Ruby | apache-2.0 | 7,843 | main | 4,574 | test_name 'C100574: puppet apply using a module should translate messages in a language not supported by puppet' do
confine :except, :platform => /^windows/ # Can't print Finish on an English or Japanese code page
tag 'audit:medium',
'audit:acceptance'
require 'puppet/acceptance/temp_file_utils'
extend... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/i18n/modules/puppet_agent.rb | Ruby | apache-2.0 | 7,843 | main | 5,540 | test_name 'C100565: puppet agent with module should translate messages' do
confine :except, :platform => /^solaris/ # translation not supported
tag 'audit:medium',
'audit:acceptance'
skip_test('i18n test module uses deprecated function; update module to resume testing.')
# function validate_absolute_pat... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/i18n/modules/puppet_apply.rb | Ruby | apache-2.0 | 7,843 | main | 3,837 | test_name 'C100567: puppet apply of module should translate messages' do
confine :except, :platform => /^solaris/ # translation not supported
tag 'audit:medium',
'audit:acceptance'
require 'puppet/acceptance/temp_file_utils'
extend Puppet::Acceptance::TempFileUtils
require 'puppet/acceptance/i18n_uti... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/i18n/modules/puppet_resource.rb | Ruby | apache-2.0 | 7,843 | main | 2,180 | test_name 'C100572: puppet resource with module translates messages' do
confine :except, :platform => /^solaris/ # translation not supported
tag 'audit:medium',
'audit:acceptance'
require 'puppet/acceptance/i18n_utils'
extend Puppet::Acceptance::I18nUtils
require 'puppet/acceptance/i18ndemo_utils'
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/i18n/modules/puppet_describe.rb | Ruby | apache-2.0 | 7,843 | main | 2,243 | test_name 'C100576: puppet describe with module type translates message' do
confine :except, :platform => /^solaris/ # translation not supported
tag 'audit:medium',
'audit:acceptance'
require 'puppet/acceptance/i18n_utils'
extend Puppet::Acceptance::I18nUtils
require 'puppet/acceptance/i18ndemo_utils... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/i18n/modules/puppet_apply_unsupported_lang.rb | Ruby | apache-2.0 | 7,843 | main | 3,949 | test_name 'C100568: puppet apply of module for an unsupported language should fall back to english' do
tag 'audit:medium',
'audit:acceptance'
require 'puppet/acceptance/temp_file_utils'
extend Puppet::Acceptance::TempFileUtils
require 'puppet/acceptance/i18ndemo_utils'
extend Puppet::Acceptance::I18n... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/utf8/utf8-in-catalog.rb | Ruby | apache-2.0 | 7,843 | main | 3,180 | test_name 'utf-8 characters in cached catalog' do
tag 'audit:high', # utf-8 is high impact in general
'audit:integration', # not package dependent but may want to vary platform by LOCALE/encoding
'audit:refactor', # use mk_tmp_environment_with_teardown
'server'
utf8chars = "\u20ac\u2030\u311... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/utf8/utf8-in-file-resource.rb | Ruby | apache-2.0 | 7,843 | main | 1,996 | test_name 'utf-8 characters in resource title and param values' do
tag 'audit:high', # utf-8 is high impact in general
'audit:integration' # not package dependent but may want to vary platform by LOCALE/encoding
confine :except, :platform => [
'windows', # PUP-6983
'aix', # PUP-7194
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/utf8/utf8-in-puppet-describe.rb | Ruby | apache-2.0 | 7,843 | main | 3,175 | test_name 'utf-8 characters in module doc string, puppet describe' do
tag 'audit:high', # utf-8 is high impact in general, puppet describe low risk?
'audit:integration', # not package dependent but may want to vary platform by LOCALE/encoding
'audit:refactor' # if keeping, use mk_tmp_environment... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/utf8/utf8-recursive-copy.rb | Ruby | apache-2.0 | 7,843 | main | 2,115 | test_name "PUP-8735: UTF-8 characters are preserved after recursively copying directories" do
tag 'audit:high', # utf-8 is high impact in general
'audit:integration' # not package dependent but may want to vary platform by LOCALE/encoding
# Translation is not supported on these platforms:
confine :except,... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/utf8/utf8-in-function-args.rb | Ruby | apache-2.0 | 7,843 | main | 8,495 | test_name 'utf-8 characters in function parameters' do
confine :except, :platform => /debian-12-amd64/ # PUP-12020
tag 'audit:high',
'audit:integration', # not package dependent but may want to vary platform by LOCALE/encoding
'audit:refactor' # if keeping, use mk_tmp_environment_with_teardown
c... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/windows/enable_password_changes_special_users.rb | Ruby | apache-2.0 | 7,843 | main | 3,522 | test_name 'Puppet should change passwords for disabled, expired, or locked out Windows user accounts' do
tag 'audit:high',
'audit:acceptance'
require 'date'
require 'puppet/acceptance/windows_utils'
extend Puppet::Acceptance::WindowsUtils
confine :to, platform: 'windows'
def random_username
"p... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/windows/QA-506_windows_exit_codes_test.rb | Ruby | apache-2.0 | 7,843 | main | 3,321 | test_name "Windows Exec `exit_code` Parameter Acceptance Test"
tag 'risk:high',
'audit:high',
'audit:refactor', # Use block style `test_name`
'audit:integration' # exec resource succeeds when the `exit_code` parameter
# is given a windows specific exit code and a exec
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/windows/QA-760_win_dash_dot_file_test.rb | Ruby | apache-2.0 | 7,843 | main | 1,026 | test_name "QA-760 - Windows Files Containing '-' and '.'"
tag 'risk:high',
'audit:high',
'audit:refactor', # Use block style `test_name`
'audit:integration'
confine(:to, :platform => 'windows')
temp_folder = <<-MANIFEST
file { 'c:/temp':
ensure => directory
}
MANIFEST
dash_dot_file = <<-MANIFEST
fil... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/windows/PA-2191_windows_nocodepage_utf8_fallback.rb | Ruby | apache-2.0 | 7,843 | main | 618 | test_name 'PA-2191 - winruby fallsback to UTF8 for invalid CodePage' do
confine :to, platform: 'windows'
tag 'audit:high',
'audit:acceptance'
agents.each do |host|
initial_chcp_code = on(host, 'cmd.exe /c chcp').stdout.delete('^0-9')
teardown do
on(host, "cmd.exe /c chcp #{initial_chcp_cod... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/windows/PUP-9719_windows_system_first_pa_run.rb | Ruby | apache-2.0 | 7,843 | main | 2,479 | # frozen_string_literal: true
test_name 'PUP-9719 Windows First Agent run as SYSTEM sets cache file permissions correctly' do
tag 'risk:high',
'audit:high',
'audit:integration'
confine :to, platform: 'windows'
require 'puppet/acceptance/temp_file_utils'
extend Puppet::Acceptance::TempFileUtils
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/windows/service_manager_integration.rb | Ruby | apache-2.0 | 7,843 | main | 1,231 | test_name 'Test agent state via service control manager' do
tag 'audit:integration'
confine :to, platform: 'windows'
teardown do
agents.each do |agent|
state = query_agent_state(agent)
if state != "STOPPED"
stop_puppet_windows_daemon(agent)
ensure_agent_state(agent, "STOPPED")
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/pluginsync/4420_pluginfacts_should_be_resolvable_on_agent.rb | Ruby | apache-2.0 | 7,843 | main | 4,197 | test_name "Pluginsync'ed external facts should be resolvable on the agent" do
tag 'audit:high',
'audit:integration'
#
# This test is intended to ensure that external facts downloaded onto an agent via
# pluginsync are resolvable. In Linux, the external fact should have the same
# permissions as its source on t... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/pluginsync/7316_apps_should_be_available_via_pluginsync.rb | Ruby | apache-2.0 | 7,843 | main | 3,760 | test_name 'the pluginsync functionality should sync app definitions, and they should be runnable afterwards' do
tag 'audit:high',
'audit:integration'
#
# This test is intended to ensure that pluginsync syncs app definitions to the agents.
# Further, the apps should be runnable on the agent after the syn... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/pluginsync/7316_faces_with_app_stubs_should_be_available_via_pluginsync.rb | Ruby | apache-2.0 | 7,843 | main | 6,124 | test_name "the pluginsync functionality should sync app definitions, and they should be runnable afterwards"
tag 'audit:high',
'audit:integration',
'server'
#
# This test is intended to ensure that pluginsync syncs face definitions to the agents.
# Further, the face should be runnable on the agent after the s... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/pluginsync/4847_pluginfacts_should_be_resolvable_from_applications.rb | Ruby | apache-2.0 | 7,843 | main | 2,366 | test_name "Pluginsync'ed custom facts should be resolvable during application runs" do
tag 'audit:high',
'audit:integration'
#
# This test is intended to ensure that custom facts downloaded onto an agent via
# pluginsync are resolvable by puppet applications besides agent/apply.
#
require 'puppet/a... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/pluginsync/files_earlier_in_modulepath_take_precendence.rb | Ruby | apache-2.0 | 7,843 | main | 1,711 | test_name "earlier modules take precendence over later modules in the modulepath"
tag 'audit:high',
'audit:integration',
'server'
step "Create some modules in the modulepath"
basedir = master.tmpdir("module_precedence")
module_dir1 = "#{basedir}/environments/production/modules1"
module_dir2 = "#{basedir}/mod... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/pluginsync/3935_pluginsync_should_follow_symlinks.rb | Ruby | apache-2.0 | 7,843 | main | 1,374 | test_name "pluginsync should not error when modulepath is a symlink and no modules have plugin directories"
tag 'audit:high',
'audit:integration',
'server'
step "Create a modulepath directory which is a symlink and includes a module without facts.d or lib directories"
basedir = master.tmpdir("symlink_modulepa... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/pluginsync/feature/pluginsync_should_sync_features.rb | Ruby | apache-2.0 | 7,843 | main | 7,788 | test_name "the pluginsync functionality should sync feature and function definitions" do
tag 'audit:high',
'audit:integration'
#
# This test is intended to ensure that pluginsync syncs feature definitions to
# the agents. It checks the feature twice; once to make sure that it gets
# loaded successful... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/agent/fallback_to_cached_catalog.rb | Ruby | apache-2.0 | 7,843 | main | 864 | test_name "fallback to the cached catalog"
tag 'audit:high',
'audit:integration', # This test is not OS sensitive.
'audit:refactor' # A catalog fixture can be used for this test. Remove the usage of `with_puppet_running_on`.
step "run agents once to cache the catalog" do
with_puppet_running_on master, {... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/agent/agent_parses_json_catalog.rb | Ruby | apache-2.0 | 7,843 | main | 880 | test_name "C99978: Agent parses a JSON catalog"
tag 'risk:high',
'audit:high', # tests defined catalog format
'audit:integration', # There is no OS specific risk here.
'server',
'catalog:json'
require 'puppet/acceptance/common_utils'
require 'json'
step "Agent parses a JSON catalog" do
agent... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/agent/last_run_summary_report.rb | Ruby | apache-2.0 | 7,843 | main | 4,800 | test_name "The 'last_run_summary.yaml' report has the right location and permissions" do
tag 'audit:high'
require 'puppet/acceptance/temp_file_utils'
extend Puppet::Acceptance::TempFileUtils
agents.each do |agent|
skip_test('This test does not work on Windows in japanese') if agent['platform'] =~ /windo... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/agent/agent_disable_lockfile.rb | Ruby | apache-2.0 | 7,843 | main | 3,891 | test_name "C4553 - agent --disable/--enable functionality should manage the agent lockfile properly"
tag 'audit:integration', # lockfile uses the standard `vardir` location to store/query lockfile.
# The validation of the `vardir` at the OS level
# should be accomplishe... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/agent/agent_fails_with_unknown_resource.rb | Ruby | apache-2.0 | 7,843 | main | 2,649 | test_name "agent run should fail if it finds an unknown resource type" do
tag 'audit:high',
'audit:integration'
require 'puppet/acceptance/common_utils'
require 'puppet/acceptance/environment_utils'
extend Puppet::Acceptance::EnvironmentUtils
require 'puppet/acceptance/temp_file_utils'
extend Puppe... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/security/cve-2013-1652_improper_query_params.rb | Ruby | apache-2.0 | 7,843 | main | 1,672 | require 'json'
test_name "CVE 2013-1652 Improper query parameter validation" do
confine :except, :platform => 'windows'
confine :except, :platform => /osx/ # see PUP-4820
confine :except, :platform => /aix/
tag 'audit:high', # risk low, high (security) impact
'audit:integration',
'server'
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/security/cve-2013-4761_injection_of_class_names_loading_code.rb | Ruby | apache-2.0 | 7,843 | main | 2,472 | test_name "CVE 2013-4761 Injection of bad class names causing code loading" do
confine :except, :platform => 'windows'
tag 'audit:high', # low risk, high (security) impact
'audit:integration', # issue is completely on the master side
'server'
testdir = create_tmpdir_for_user master, 'class-na... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/security/cve-2013-1640_facter_string.rb | Ruby | apache-2.0 | 7,843 | main | 635 | # Setting a custom fact to "string" will overwrite a local variable during
# template compilation on the master allowing remote code execution by
# any authenticated client.
test_name "CVE 2013-1640 Remote Code Execution" do
tag 'audit:high', # low risk, high (security) impact
'audit:integration'
conf... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/security/cve-2013-2275_report_acl.rb | Ruby | apache-2.0 | 7,843 | main | 1,229 | test_name "(#19531) report save access control"
tag 'audit:high', # low risk, high (security) impact
'audit:refactor', # Use block style `test_name`
'audit:integration', # issue completely on the server side
'server'
step "Verify puppet only allows saving reports from the node matching the certi... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | acceptance/tests/security/cve-2013-1652_poison_other_node_cache.rb | Ruby | apache-2.0 | 7,843 | main | 1,675 | test_name "CVE 2013-1652 Poison node cache" do
tag 'audit:high', # low risk, high (security) impact
'audit:integration', # master side only
'server'
step "Determine suitability of the test" do
skip_test( "This test will only run on Puppet 3.x" ) if
on(master, puppet('--version')).stdo... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | examples/nagios/check_puppet.rb | Ruby | apache-2.0 | 7,843 | main | 2,586 | #!/usr/bin/env ruby
require 'optparse'
require 'sys/proctable'
include Sys
class CheckPuppet
VERSION = '0.1'
script_name = File.basename($0)
# default options
OPTIONS = {
:statefile => "/opt/puppetlabs/puppet/cache/state/state.yaml",
:process => "puppet",
:interval => 30,
}
OptionParser.... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | examples/enc/regexp_nodes/regexp_nodes.rb | Ruby | apache-2.0 | 7,843 | main | 9,749 | #!/usr/bin/env ruby
# = Synopsis
# This is an external node classifier script, after
# https://puppet.com/docs/puppet/latest/lang_write_functions_in_puppet.html
#
# = Usage
# regexp_nodes.rb <host>
#
# = Description
# This classifier implements filesystem autoloading: It looks through classes,
# parameters, and enviro... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | yardoc/templates/default/method_details/html/setup.rb | Ruby | apache-2.0 | 7,843 | main | 1,115 | def init
super
end
def format_method_detail_extras(object)
result = ""
if object
if object.respond_to?(:visibility)
if object.visibility != :public
result << "<span class=\"note title #{object.visibility}\">#{object.visibility}</span>"
end
end
if object.has_tag?(:abstract)
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | util/binary_search_specs.rb | Ruby | apache-2.0 | 7,843 | main | 723 | #!/usr/bin/env ruby
# Author: Nick Lewis
specs_in_order = File.read('spec_order.txt').split
failing_spec = ARGV.first
specs = specs_in_order[0...specs_in_order.index(failing_spec)]
suspects = specs
while suspects.length > 1 do
count = suspects.length
specs_to_run = suspects[0...(count/2)]
puts "Trying #{spec... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | benchmarks/fq_var_lookup/benchmarker.rb | Ruby | apache-2.0 | 7,843 | main | 2,166 | require 'erb'
require 'ostruct'
require 'fileutils'
require 'json'
class Benchmarker
include FileUtils
def initialize(target, size)
@target = target
@size = size
end
def setup
require 'puppet'
config = File.join(@target, 'puppet.conf')
Puppet.initialize_settings(['--config', config])
en... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | benchmarks/hiera_include_one/benchmarker.rb | Ruby | apache-2.0 | 7,843 | main | 2,347 | require 'fileutils'
class Benchmarker
include FileUtils
def initialize(target, size)
@target = target
@size = size > 1000 ? size : 1000
end
def setup
require 'puppet'
@config = File.join(@target, 'puppet.conf')
Puppet.initialize_settings(['--config', @config])
envs = Puppet.lookup(:en... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | benchmarks/hiera_global_lookup/benchmarker.rb | Ruby | apache-2.0 | 7,843 | main | 2,765 | require 'fileutils'
class Benchmarker
include FileUtils
def initialize(target, size)
@target = target
@size = size > 100 ? size : 100
end
def setup
require 'puppet'
@config = File.join(@target, 'puppet.conf')
Puppet.initialize_settings(['--config', @config])
envs = Puppet.lookup(:envi... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | benchmarks/catalog_memory/benchmarker.rb | Ruby | apache-2.0 | 7,843 | main | 4,072 | require 'erb'
require 'ostruct'
require 'fileutils'
require 'json'
# For memory debugging - if the core_ext is not loaded, things break inside mass
# require 'mass'
require 'objspace'
# Only runs for Ruby > 2.1.0, and must do this early since ObjectSpace.trace_object_allocations_start must be called
# as early as pos... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | benchmarks/full_catalog/benchmarker.rb | Ruby | apache-2.0 | 7,843 | main | 3,989 | require 'erb'
require 'ostruct'
require 'fileutils'
require 'json'
require 'bundler'
class Benchmarker
include FileUtils
def initialize(target, size='medium')
@target = target
@size = 'large'
end
def check_submodule
submodule = File.join('benchmarks', 'full_catalog', 'puppetlabs-puppetserver_perf... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | benchmarks/empty_catalog/benchmarker.rb | Ruby | apache-2.0 | 7,843 | main | 1,489 | require 'erb'
require 'ostruct'
require 'fileutils'
require 'json'
class Benchmarker
include FileUtils
def initialize(target, size)
@target = target
@size = size
end
def setup
end
def run(args=nil)
unless @initialized
require 'puppet'
config = File.join(@target, 'puppet.conf')
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | benchmarks/hiera_function/benchmarker.rb | Ruby | apache-2.0 | 7,843 | main | 2,275 | require 'fileutils'
class Benchmarker
include FileUtils
def initialize(target, size)
@target = target
@size = size > 100 ? size : 100
end
def setup
require 'puppet'
@config = File.join(@target, 'puppet.conf')
Puppet.initialize_settings(['--config', @config])
envs = Puppet.lookup(:envi... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | benchmarks/dependency_loading/benchmarker.rb | Ruby | apache-2.0 | 7,843 | main | 3,248 | require 'erb'
require 'ostruct'
require 'fileutils'
require 'json'
class Benchmarker
include FileUtils
def initialize(target, size)
@target = target
@size = size
@@benchmark_count ||= 0
end
def setup
require 'puppet'
config = File.join(@target, 'puppet.conf')
Puppet.initialize_setting... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | benchmarks/system_startup/benchmarker.rb | Ruby | apache-2.0 | 7,843 | main | 336 | class Benchmarker
def initialize(target, size)
end
def setup
end
def generate
end
def run(args=nil)
# Just running help is probably a good proxy of a full startup.
# Simply asking for the version might also be good, but it would miss all
# of the app searching and loading parts
`puppet ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | benchmarks/evaluations/benchmarker_task.rb | Ruby | apache-2.0 | 7,843 | main | 385 | # Helper class that is used by the Rake task generator.
# Currently only supports defining arguments that are passed to run
# (The rake task generator always passes :warm_up_runs as an Integer when profiling).
# Other benchmarks, and for regular runs that wants arguments must specified them
# as an Array of symbols.
#
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | benchmarks/evaluations/benchmarker.rb | Ruby | apache-2.0 | 7,843 | main | 4,768 | require 'erb'
require 'ostruct'
require 'fileutils'
require 'json'
class Benchmarker
include FileUtils
def initialize(target, size)
@target = target
@size = size
@micro_benchmarks = {}
@parsecount = 100
@evalcount = 100
end
def setup
require 'puppet'
require 'puppet/pops'
conf... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | benchmarks/function_loading/benchmarker.rb | Ruby | apache-2.0 | 7,843 | main | 3,475 | require 'erb'
require 'ostruct'
require 'fileutils'
require 'json'
class Benchmarker
include FileUtils
def initialize(target, size)
@target = target
@size = size
@@benchmark_count ||= 0
end
def setup
require 'puppet'
config = File.join(@target, 'puppet.conf')
Puppet.initialize_setting... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | benchmarks/hiera_env_lookup/benchmarker.rb | Ruby | apache-2.0 | 7,843 | main | 2,745 | require 'fileutils'
class Benchmarker
include FileUtils
def initialize(target, size)
@target = target
@size = size > 100 ? size : 100
end
def setup
require 'puppet'
@config = File.join(@target, 'puppet.conf')
Puppet.initialize_settings(['--config', @config])
envs = Puppet.lookup(:envi... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | benchmarks/hiera_conf_interpol/benchmarker.rb | Ruby | apache-2.0 | 7,843 | main | 1,968 | require 'fileutils'
class Benchmarker
include FileUtils
def initialize(target, size)
@target = target
@size = size > 100 ? size : 100
end
def setup
require 'puppet'
@config = File.join(@target, 'puppet.conf')
Puppet.initialize_settings(['--config', @config])
envs = Puppet.lookup(:envi... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | benchmarks/hiera_include/benchmarker.rb | Ruby | apache-2.0 | 7,843 | main | 2,378 | require 'fileutils'
class Benchmarker
include FileUtils
def initialize(target, size)
@target = target
@size = size > 100 ? size : 100
end
def setup
require 'puppet'
@config = File.join(@target, 'puppet.conf')
Puppet.initialize_settings(['--config', @config])
envs = Puppet.lookup(:envi... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | benchmarks/legacy_hiera_lookup/benchmarker.rb | Ruby | apache-2.0 | 7,843 | main | 1,511 | require 'fileutils'
class Benchmarker
include FileUtils
def initialize(target, size)
@target = target
@hiera_yaml = File.join(target, 'hiera.yaml')
@size = size > 100 ? size : 100
end
def setup
require 'puppet'
require 'hiera'
@config = File.join(@target, 'puppet.conf')
Puppet.ini... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | benchmarks/missing_type_caching/benchmarker.rb | Ruby | apache-2.0 | 7,843 | main | 1,849 | require 'erb'
require 'ostruct'
require 'fileutils'
require 'json'
class Benchmarker
include FileUtils
def initialize(target, size)
@target = target
@size = size
end
def setup
require 'puppet'
config = File.join(@target, 'puppet.conf')
Puppet.initialize_settings(['--config', config])
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | benchmarks/virtual_collection/benchmarker.rb | Ruby | apache-2.0 | 7,843 | main | 1,286 | require 'erb'
require 'ostruct'
require 'fileutils'
require 'json'
class Benchmarker
include FileUtils
def initialize(target, size)
@target = target
@size = 200
end
def setup
require 'puppet'
config = File.join(@target, 'puppet.conf')
Puppet.initialize_settings(['--config', config])
end... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | benchmarks/defined_types/benchmarker.rb | Ruby | apache-2.0 | 7,843 | main | 2,087 | require 'erb'
require 'ostruct'
require 'fileutils'
require 'json'
class Benchmarker
include FileUtils
def initialize(target, size)
@target = target
@size = size
end
def setup
require 'puppet'
config = File.join(@target, 'puppet.conf')
Puppet.initialize_settings(['--config', config])
en... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | benchmarks/type_inference/benchmarker.rb | Ruby | apache-2.0 | 7,843 | main | 1,524 | require 'erb'
require 'ostruct'
require 'fileutils'
require 'json'
class Benchmarker
include FileUtils
def initialize(target, size)
@target = target
@size = size
end
def setup
end
def run(args=nil)
unless @initialized
require 'puppet'
config = File.join(@target, 'puppet.conf')
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | benchmarks/many_modules/benchmarker.rb | Ruby | apache-2.0 | 7,843 | main | 3,061 | require 'erb'
require 'ostruct'
require 'fileutils'
require 'json'
class Benchmarker
include FileUtils
def initialize(target, size)
@target = target
@size = size
end
def setup
require 'puppet'
config = File.join(@target, 'puppet.conf')
Puppet.initialize_settings(['--config', config])
en... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | benchmarks/serialization/benchmarker.rb | Ruby | apache-2.0 | 7,843 | main | 1,275 | require 'puppet'
class Benchmarker
def initialize(target, size)
@size = size
@direction = ENV['SER_DIRECTION'] == 'generate' ? :generate : :parse
@format = ENV['SER_FORMAT'] == 'pson' ? :pson : :json
puts "Benchmarker #{@direction} #{@format}"
end
def setup
end
def generate
path = File... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | benchmarks/many_environments/benchmarker.rb | Ruby | apache-2.0 | 7,843 | main | 823 | require 'fileutils'
class Benchmarker
include FileUtils
def initialize(target, size)
@target = target
@size = size > 1000 ? size : 1000
end
def setup
require 'puppet'
@config = File.join(@target, 'puppet.conf')
Puppet.initialize_settings(['--config', @config])
end
def run(args=nil)
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | ext/windows/service/daemon.rb | Ruby | apache-2.0 | 7,843 | main | 6,994 | #!/usr/bin/env ruby
# frozen_string_literal: true
require 'fileutils'
require 'puppet/util/windows/daemon'
# This file defines utilities for logging to eventlog. While it lives inside
# Puppet, it is completely independent and loads no other parts of Puppet, so we
# can safely require *just* it.
require 'puppet/util/... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | rakelib/ci.rake | Ruby | apache-2.0 | 7,843 | main | 701 | require 'yaml'
require 'time'
namespace "ci" do
desc "Tar up the acceptance/ directory so that package test runs have tests to run against."
task :acceptance_artifacts => :tag_creator do
Dir.chdir("acceptance") do
rm_f "acceptance-artifacts.tar.gz"
sh "tar -czv --exclude .bundle -f acceptance-artif... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | rakelib/yard.rake | Ruby | apache-2.0 | 7,843 | main | 1,457 | begin
require 'yard'
namespace :doc do
desc "Clean up generated documentation"
task :clean do
rm_rf "doc"
end
desc "Generate public documentation pages for the API"
YARD::Rake::YardocTask.new(:api) do |t|
t.files = ['lib/**/*.rb']
t.options = %w{
--protected
-... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | rakelib/manpages.rake | Ruby | apache-2.0 | 7,843 | main | 2,764 | desc "Build Puppet manpages"
task :gen_manpages do
require 'puppet/face'
require 'fileutils'
Puppet.initialize_settings
helpface = Puppet::Face[:help, '0.0.1']
non_face_applications = helpface.legacy_applications
faces = Puppet::Face.faces.map(&:to_s)
# exclude puppet-strings
faces.delete('strings')
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | rakelib/generate_references.rake | Ruby | apache-2.0 | 7,843 | main | 15,011 | require 'tempfile'
OUTPUT_DIR = 'references'
MANDIR = File.join(OUTPUT_DIR, 'man')
TYPES_DIR = File.join(OUTPUT_DIR, 'types')
CONFIGURATION_ERB = File.join(__dir__, 'references/configuration.erb')
CONFIGURATION_MD = File.join(OUTPUT_DIR, 'configuration.md')
METAPARAMETER_ERB = File.join(__dir__, 'references/metapara... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | rakelib/generate_cert_fixtures.rake | Ruby | apache-2.0 | 7,843 | main | 8,530 | # Run this rake task to generate cert fixtures used in unit tests. This should
# be run whenever new fixtures are required that derive from the existing ones
# such as to add an extension to client certs, change expiration, etc. All
# regenerated fixtures should be committed together.
desc "Generate cert test fixtures"... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | rakelib/parser.rake | Ruby | apache-2.0 | 7,843 | main | 715 | desc "Generate the 4.x 'future' parser"
task :gen_eparser => :require_racc do
%x{racc -olib/puppet/pops/parser/eparser.rb lib/puppet/pops/parser/egrammar.ra}
end
desc "Generate the 4.x 'future' parser with egrammar.output"
task :gen_eparser_output => :require_racc do
%x{racc -v -olib/puppet/pops/parser/eparser.rb ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | rakelib/parallel.rake | Ruby | apache-2.0 | 7,843 | main | 12,097 | # encoding: utf-8
require 'rubygems'
require 'thread'
begin
require 'rspec'
require 'rspec/core/formatters/helpers'
require 'etc'
rescue LoadError
# Don't define the task if we don't have rspec present
else
module Parallel
module RSpec
#
# Responsible for buffering the output of RSpec's progr... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | rakelib/memwalk.rake | Ruby | apache-2.0 | 7,843 | main | 5,944 | # Walks the memory dumped into heap.json, and produces a graph of the memory dumped in diff.json
# If a single argument (a hex address to one object) is given, the graph is limited to this object and what references it
# The heap dumps should be in the format produced by Ruby ObjectSpace in Ruby version 2.1.0 or later.... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | rakelib/benchmark.rake | Ruby | apache-2.0 | 7,843 | main | 5,523 | require 'benchmark'
require 'tmpdir'
require 'csv'
require 'objspace'
namespace :benchmark do
def generate_scenario_tasks(location, name)
desc File.read(File.join(location, 'description'))
task name => "#{name}:run"
# Load a BenchmarkerTask to handle config of the benchmark
task_handler_file = File.e... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | rakelib/generate_ast_model.rake | Ruby | apache-2.0 | 7,843 | main | 4,269 | begin
require 'puppet'
rescue LoadError
#nothing to see here
else
desc "Generate the Pcore model that represents the AST for the Puppet Language"
task :gen_pcore_ast do
Puppet::Pops.generate_ast
end
module Puppet::Pops
def self.generate_ast
Puppet.initialize_settings
env = Puppet.lookup... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | rakelib/references/get_typedocs.rb | Ruby | apache-2.0 | 7,843 | main | 4,897 | # This script will print the Puppet type docs to stdout in JSON format.
# There are some subtleties that make this a pain to run. Basically: Even if you
# 'require' a specific copy of the Puppet code, the autoloader will grab bits
# and pieces of Puppet code from other copies of Puppet scattered about the Ruby
# load ... |
github | github/scientist | https://github.com/github/scientist | scientist.gemspec | Ruby | mit | 7,697 | main | 950 | $: << "lib" and require "scientist/version"
Gem::Specification.new do |gem|
gem.name = "scientist"
gem.description = "A Ruby library for carefully refactoring critical paths"
gem.version = Scientist::VERSION
gem.authors = ["GitHub Open Source", "John Barnette", "Rick Bradley", "Jesse Tot... |
github | github/scientist | https://github.com/github/scientist | test/scientist_test.rb | Ruby | mit | 7,697 | main | 1,969 | describe Scientist do
it "has a version or whatever" do
assert Scientist::VERSION
end
it "provides a helper to instantiate and run experiments" do
obj = Object.new
obj.extend(Scientist)
r = obj.science "test" do |e|
e.use { :control }
e.try { :candidate }
end
assert_equal :c... |
github | github/scientist | https://github.com/github/scientist | test/scientist/experiment_test.rb | Ruby | mit | 7,697 | main | 19,671 | describe Scientist::Experiment do
class Fake
include Scientist::Experiment
# Undo auto-config magic / preserve default behavior of Scientist::Experiment.new
Scientist::Experiment.set_default(nil)
def initialize(*args)
end
def enabled?
true
end
attr_reader :published_result
... |
github | github/scientist | https://github.com/github/scientist | test/scientist/result_test.rb | Ruby | mit | 7,697 | main | 3,564 | describe Scientist::Result do
before do
@experiment = Scientist::Experiment.new "experiment"
end
it "is immutable" do
control = Scientist::Observation.new("control", @experiment)
candidate = Scientist::Observation.new("candidate", @experiment)
result = Scientist::Result.new @experiment, [control... |
github | github/scientist | https://github.com/github/scientist | test/scientist/observation_test.rb | Ruby | mit | 7,697 | main | 4,983 | describe Scientist::Observation do
before do
@experiment = Scientist::Experiment.new "test"
end
it "observes and records the execution of a block" do
ob = Scientist::Observation.new("test", @experiment) do
start_time = Time.now
while Time.now - start_time < 0.1
# Perform some CPU-int... |
github | github/scientist | https://github.com/github/scientist | test/scientist/default_test.rb | Ruby | mit | 7,697 | main | 466 | describe Scientist::Default do
before do
@ex = Scientist::Default.new "default"
end
it "is always disabled" do
refute @ex.enabled?
end
it "noops publish" do
assert_nil @ex.publish("data")
end
it "is an experiment" do
assert Scientist::Default < Scientist::Experiment
end
it "reraise... |
github | github/scientist | https://github.com/github/scientist | lib/scientist.rb | Ruby | mit | 7,697 | main | 2,137 | # Include this module into any class which requires science experiments in its
# methods. Provides the `science` and `default_scientist_context` methods for
# defining and running experiments.
#
# If you need to run science on class methods, extend this module instead.
#
# If including or extending this module are not ... |
github | github/scientist | https://github.com/github/scientist | lib/scientist/errors.rb | Ruby | mit | 7,697 | main | 836 | module Scientist
# Smoking in the bathroom and/or sassing.
class BadBehavior < StandardError
attr_reader :experiment
attr_reader :name
def initialize(experiment, name, message)
@experiment = experiment
@name = name
super message
end
end
class BehaviorMissing < BadBehavior
... |
github | github/scientist | https://github.com/github/scientist | lib/scientist/result.rb | Ruby | mit | 7,697 | main | 1,940 | # The immutable result of running an experiment.
class Scientist::Result
# An Array of candidate Observations.
attr_reader :candidates
# The control Observation to which the rest are compared.
attr_reader :control
# An Experiment.
attr_reader :experiment
# An Array of observations which didn't match t... |
github | github/scientist | https://github.com/github/scientist | lib/scientist/default.rb | Ruby | mit | 7,697 | main | 298 | require "scientist/experiment"
# A null experiment.
class Scientist::Default
include Scientist::Experiment
attr_reader :name
def initialize(name)
@name = name
end
# Don't run experiments.
def enabled?
false
end
# Don't publish anything.
def publish(result)
end
end |
github | github/scientist | https://github.com/github/scientist | lib/scientist/experiment.rb | Ruby | mit | 7,697 | main | 10,425 | # This mixin provides shared behavior for experiments. Includers must implement
# `enabled?` and `publish(result)`.
#
# Override Scientist::Experiment.new to set your own class which includes and
# implements Scientist::Experiment's interface.
module Scientist::Experiment
# Whether to raise when the control and cand... |
github | github/scientist | https://github.com/github/scientist | lib/scientist/observation.rb | Ruby | mit | 7,697 | main | 3,406 | # What happened when this named behavior was executed? Immutable.
class Scientist::Observation
# An Array of Exception types to rescue when initializing an observation.
# NOTE: This Array will change to `[StandardError]` in the next major release.
RESCUES = [Exception]
# The experiment this observation is for... |
github | github-changelog-generator/github-changelog-generator | https://github.com/github-changelog-generator/github-changelog-generator | Gemfile | Ruby | mit | 7,519 | master | 503 | # frozen_string_literal: true
source "https://rubygems.org"
ruby RUBY_VERSION
gemspec
group :development, :test do
gem "bundler"
gem "overcommit", ">= 0.60"
gem "rake"
gem "rubocop", ">= 1.75"
gem "rubocop-performance"
gem "yard-junk"
end
group :development do
gem "bump"
end
group :test do
gem "co... |
github | github-changelog-generator/github-changelog-generator | https://github.com/github-changelog-generator/github-changelog-generator | github_changelog_generator.gemspec | Ruby | mit | 7,519 | master | 1,588 | # frozen_string_literal: true
lib = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "github_changelog_generator/version"
Gem::Specification.new do |spec|
spec.name = "github_changelog_generator"
spec.version = GitHubChangelogGenerator::VERS... |
github | github-changelog-generator/github-changelog-generator | https://github.com/github-changelog-generator/github-changelog-generator | Rakefile | Ruby | mit | 7,519 | master | 537 | # frozen_string_literal: true
require "bundler"
require "bundler/gem_tasks"
require "rubocop/rake_task"
require "rspec/core/rake_task"
require "pathname"
require "fileutils"
require "overcommit"
RuboCop::RakeTask.new
RSpec::Core::RakeTask.new
desc "When releasing the gem, re-fetch latest cacert.pem from curl.haxx.se... |
github | github-changelog-generator/github-changelog-generator | https://github.com/github-changelog-generator/github-changelog-generator | lib/github_changelog_generator.rb | Ruby | mit | 7,519 | master | 1,587 | # frozen_string_literal: true
require "octokit"
require "faraday-http-cache"
require "logger"
require "active_support"
require "active_support/core_ext/object/blank"
require "json"
require "benchmark"
require_relative "github_changelog_generator/helper"
require_relative "github_changelog_generator/options"
require_re... |
github | github-changelog-generator/github-changelog-generator | https://github.com/github-changelog-generator/github-changelog-generator | lib/github_changelog_generator/argv_parser.rb | Ruby | mit | 7,519 | master | 12,424 | # frozen_string_literal: true
require "optparse"
require_relative "version"
module GitHubChangelogGenerator
class ArgvParser
attr_reader :options
def initialize(options = {})
@options = options
end
def parse!(argv)
parser.parse(argv)
rescue OptionParser::ParseError => e
warn ... |
github | github-changelog-generator/github-changelog-generator | https://github.com/github-changelog-generator/github-changelog-generator | lib/github_changelog_generator/file_parser_chooser.rb | Ruby | mit | 7,519 | master | 538 | # frozen_string_literal: true
require "pathname"
module GitHubChangelogGenerator
class FileParserChooser
def initialize(options)
@options = options
@config_file = Pathname.new(options[:config_file])
end
def parse!(_argv)
return nil unless (path = resolve_path)
ParserFile.new(@o... |
github | github-changelog-generator/github-changelog-generator | https://github.com/github-changelog-generator/github-changelog-generator | lib/github_changelog_generator/reader.rb | Ruby | mit | 7,519 | master | 2,893 | # frozen_string_literal: true
#
# Author:: Enrico Stahn <mail@enricostahn.com>
#
# Copyright 2014, Zanui, <engineering@zanui.com.au>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# h... |
github | github-changelog-generator/github-changelog-generator | https://github.com/github-changelog-generator/github-changelog-generator | lib/github_changelog_generator/octo_fetcher.rb | Ruby | mit | 7,519 | master | 17,830 | # frozen_string_literal: true
require "tmpdir"
require "async"
require "async/barrier"
require "async/semaphore"
require "async/http/faraday"
module GitHubChangelogGenerator
# A Fetcher responsible for all requests to GitHub and all basic manipulation with related data
# (such as filtering, validating, e.t.c)
#... |
github | github-changelog-generator/github-changelog-generator | https://github.com/github-changelog-generator/github-changelog-generator | lib/github_changelog_generator/task.rb | Ruby | mit | 7,519 | master | 2,206 | # frozen_string_literal: true
require "rake"
require "rake/tasklib"
require "github_changelog_generator"
module GitHubChangelogGenerator
class RakeTask < ::Rake::TaskLib
include ::Rake::DSL if defined?(::Rake::DSL)
OPTIONS = %w[ user project token date_format output
bug_prefix enhancement... |
github | github-changelog-generator/github-changelog-generator | https://github.com/github-changelog-generator/github-changelog-generator | lib/github_changelog_generator/options.rb | Ruby | mit | 7,519 | master | 3,948 | # frozen_string_literal: true
require "delegate"
require_relative "helper"
module GitHubChangelogGenerator
# This class wraps Options, and knows a list of known options. Others options
# will raise exceptions.
class Options < SimpleDelegator
# Raised on initializing with unknown keys in the values hash,
... |
github | github-changelog-generator/github-changelog-generator | https://github.com/github-changelog-generator/github-changelog-generator | lib/github_changelog_generator/parser.rb | Ruby | mit | 7,519 | master | 3,108 | # frozen_string_literal: true
require_relative "helper"
require_relative "argv_parser"
require_relative "parser_file"
require_relative "file_parser_chooser"
module GitHubChangelogGenerator
class Parser
class << self
PARSERS = [
ArgvParser, # Parse arguments first to get initial options populated
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.