Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ jobs:

- name: Build website
run: |
bundle exec references:openfact INSTALLPATH=docs
Comment thread
tuxmea marked this conversation as resolved.
Outdated
bundle exec references:openvox INSTALLPATH=docs
bundle exec jekyll build
- name: Archive website
run: |
Expand Down
16 changes: 10 additions & 6 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,20 @@ CLOBBER.include('references_output')
desc 'List the available groups of references. Run `rake references:<GROUP>` to build.'
task :references do
puts 'The following references are available:'
puts 'bundle exec rake references:openvox VERSION=<GIT TAG OR COMMIT>'
puts 'bundle exec rake references:openfact VERSION=<GIT TAG OR COMMIT>'
puts 'bundle exec rake references:openvox [VERSION=<GIT TAG OR COMMIT> INSTALLPATH=<RELATIVE OR ABSOLUTE PATH>]'
puts 'bundle exec rake references:openfact [VERSION=<GIT TAG OR COMMIT> INSTALLPATH=<RELATIVE OR ABSOLUTE PATH>]'
puts 'bundle exec rake references:version_tables'
puts ' VERSION can be omitted, uses latest tag'
puts ' INSTALLPATH can be omitted, defaults to references_output/'
end

namespace :references do
task openvox: 'references:check_version' do
task openvox: 'references:check' do
require 'puppet_references'
PuppetReferences.build_puppet_references(ENV.fetch('VERSION', nil))
end

task openfact: 'references:check_version' do
task openfact: 'references:check' do
require 'puppet_references'
PuppetReferences.build_facter_references(ENV.fetch('VERSION', nil))
end
Expand All @@ -49,7 +51,9 @@ namespace :references do
PuppetReferences.build_version_tables
end

task :check_version do
abort 'No VERSION given to build references for' unless ENV['VERSION']
task :check do
puts 'No VERSION given to build references for - using latest tag' unless ENV['VERSION']
puts "Using provided install path #{ENV.fetch('INSTALLPATH')} instead of default" if ENV['INSTALLPATH']
puts "Using default install path 'references_output'" unless ENV['INSTALLPATH']
end
end
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,4 @@ exclude:
- util
- vendor
- WORKFLOW.md
- WORKFLOW_reference.md
15 changes: 10 additions & 5 deletions lib/puppet_references.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ module PuppetReferences
PUPPET_DIR = BASE_DIR + 'vendor/openvox'
FACTER_DIR = BASE_DIR + 'vendor/openfact'
AGENT_DIR = BASE_DIR + 'vendor/openvox-agent'
OUTPUT_DIR = BASE_DIR + 'references_output'
INSTALLPATH = ENV['INSTALLPATH'] ? ENV.fetch('INSTALLPATH') : 'references_output'
OUTPUT_DIR = BASE_DIR + INSTALLPATH

require 'puppet_references/config'
require 'puppet_references/util'
Expand Down Expand Up @@ -37,7 +38,9 @@ def self.build_puppet_references(commit)
]
config = PuppetReferences::Config.read
repo = PuppetReferences::Repo.new('openvox', PUPPET_DIR, nil, config['puppet']['repo'])
real_commit = repo.checkout(commit)
version_commit = commit || repo.describe.split('-')[0]
puts "Using tag #{version_commit}"
real_commit = repo.checkout(version_commit)
repo.update_bundle
build_from_list_of_classes(references, real_commit)
end
Expand All @@ -54,11 +57,13 @@ def self.build_facter_references(commit)
# we need the CLI docs for 3.y. We can remove this when we stop building 3.y.
version4 = Gem::Version.create('4.0.0')
repo = PuppetReferences::Repo.new('openfact', FACTER_DIR)
real_commit = repo.checkout(commit)
version_commit = commit || repo.describe.split('-')[0]
puts "Using tag #{version_commit}"
real_commit = repo.checkout(version_commit)
repo.update_bundle
if !semantic?(commit) || (semantic?(commit) && Gem::Version.create(commit) >= version4)
if !semantic?(version_commit) || (semantic?(version_commit) && Gem::Version.create(version_commit) >= version4)
references << PuppetReferences::Facter::FacterCli
elsif semantic?(commit) && Gem::Version.create(commit) < version4
elsif semantic?(version_commit) && Gem::Version.create(version_commit) < version4
reference = PuppetReferences::Facter::FacterCli.new(real_commit)
reference.build_v3_cli
end
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet_references/facter/core_facts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
module PuppetReferences
module Facter
class CoreFacts < PuppetReferences::Reference
OUTPUT_DIR = PuppetReferences::OUTPUT_DIR + 'openfact'
OUTPUT_DIR = PuppetReferences::OUTPUT_DIR + '_openfact_latest'
PREAMBLE_FILE = Pathname.new(__FILE__).dirname + 'core_facts_preamble.md'
PREAMBLE = PREAMBLE_FILE.read

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet_references/facter/facter_cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
module PuppetReferences
module Facter
class FacterCli < PuppetReferences::Reference
OUTPUT_DIR = PuppetReferences::OUTPUT_DIR + 'openfact'
OUTPUT_DIR = PuppetReferences::OUTPUT_DIR + '_openfact_latest'
PREAMBLE_FILE = Pathname.new(__FILE__).dirname + 'facter_cli_preamble.md'
PREAMBLE = PREAMBLE_FILE.read

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet_references/puppet/functions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module PuppetReferences
module Puppet
class Functions < PuppetReferences::Reference
TEMPLATE_FILE = Pathname.new(File.expand_path(__FILE__)).dirname + 'functions_template.erb'
OUTPUT_DIR = PuppetReferences::OUTPUT_DIR + 'openvox'
OUTPUT_DIR = PuppetReferences::OUTPUT_DIR + '_openvox_latest'
PREAMBLE_FILE = Pathname.new(File.expand_path(__FILE__)).dirname + 'functions_preamble.md'
PREAMBLE = PREAMBLE_FILE.read

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet_references/puppet/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
module PuppetReferences
module Puppet
class Http < PuppetReferences::Reference
OUTPUT_DIR = PuppetReferences::OUTPUT_DIR + 'openvox'
OUTPUT_DIR = PuppetReferences::OUTPUT_DIR + '_openvox_latest'
DOCS_DIR = OUTPUT_DIR + 'http_api'
API_SOURCE = PuppetReferences::PUPPET_DIR + 'api'

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet_references/puppet/man.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
module PuppetReferences
module Puppet
class Man < PuppetReferences::Reference
OUTPUT_DIR = PuppetReferences::OUTPUT_DIR + 'openvox/man'
OUTPUT_DIR = PuppetReferences::OUTPUT_DIR + '_openvox_latest/man'

def initialize(*)
@latest = '/openvox/latest/man'
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet_references/puppet/puppet_doc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module PuppetReferences
module Puppet
class PuppetDoc < PuppetReferences::Reference
REFERENCES = %w[configuration].freeze
OUTPUT_DIR = PuppetReferences::OUTPUT_DIR + 'openvox'
OUTPUT_DIR = PuppetReferences::OUTPUT_DIR + '_openvox_latest'

def initialize(*)
@latest = '/openvox/latest'
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet_references/puppet/strings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
module PuppetReferences
module Puppet
class Strings < Hash
STRINGS_JSON_FILE = PuppetReferences::OUTPUT_DIR + 'openvox/strings.json'
STRINGS_JSON_FILE = PuppetReferences::OUTPUT_DIR + '_openvox_latest/strings.json'
@@strings_data_cached = false

def initialize(force_cached: false)
Expand Down
4 changes: 2 additions & 2 deletions lib/puppet_references/puppet/type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class Type < PuppetReferences::Reference

def initialize(*)
@latest = '/openvox/latest'
@output_dir_unified = PuppetReferences::OUTPUT_DIR + 'openvox'
@output_dir_individual = PuppetReferences::OUTPUT_DIR + 'openvox/types'
@output_dir_unified = PuppetReferences::OUTPUT_DIR + '_openvox_latest'
@output_dir_individual = PuppetReferences::OUTPUT_DIR + '_openvox_latest/types'
@base_filename = 'type'
super
end
Expand Down
5 changes: 3 additions & 2 deletions lib/puppet_references/puppet/type_strings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ module Puppet
class TypeStrings < PuppetReferences::Puppet::Type
def initialize(*)
super
@output_dir_individual = PuppetReferences::OUTPUT_DIR + 'openvox/types_strings'
@output_dir_individual = PuppetReferences::OUTPUT_DIR + '_openvox_latest/types_strings'
@output_dir = PuppetReferences::OUTPUT_DIR + '_openvox_latest'
@base_filename = 'type_strings'
end

Expand All @@ -16,7 +17,7 @@ def get_type_json
# 2. Munge it to match the old format I threw together, which the template uses.
# 3. Dump result to JSON.
strings_data = PuppetReferences::Puppet::Strings.new
File.write('references_output/openvox/raw_strings_data_output.json', strings_data)
File.write("#{@output_dir}/raw_strings_data_output.json", strings_data)
type_hash = strings_data['resource_types'].each_with_object({}) do |type, memo|
memo[ type['name'] ] = {
'description' => type['docstring']['text'],
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet_references/puppet/yard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
module PuppetReferences
module Puppet
class Yard < PuppetReferences::Reference
OUTPUT_DIR = PuppetReferences::OUTPUT_DIR + 'openvox/yard'
OUTPUT_DIR = PuppetReferences::OUTPUT_DIR + '_openvox_latest/yard'

def initialize(*)
@latest = '/openvox/latest/yard'
Expand Down
5 changes: 5 additions & 0 deletions lib/puppet_references/repo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def initialize(name, directory, sources = nil, config = nil)
puts 'done cloning.'
end
@repo = Git.open(@directory)
@repo.checkout('remotes/origin/HEAD')
# fetch the main source
@repo.fetch unless @config['skip_download']
# fetch tags from secondary sources
Expand All @@ -36,6 +37,10 @@ def checkout(commit)
@repo.revparse(commit)
end

def describe
@repo.describe
end

def tags
@repo.tags
end
Expand Down
Loading