Skip to content

Commit

Permalink
Merge pull request #2671 from tvdeyen/guides-index
Browse files Browse the repository at this point in the history
Add a guides index and generator
  • Loading branch information
jhawthorn authored Apr 5, 2018
2 parents 59494ba + ac0c23c commit 35f2408
Show file tree
Hide file tree
Showing 2 changed files with 131 additions and 0 deletions.
88 changes: 88 additions & 0 deletions guides/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Solidus Guides

## Adjustments
- [Overview](adjustments/overview.md)

## Assets
- [Asset Management](assets/asset-management.md)
- [Override Solidus Assets](assets/override-solidus-assets.md)

## Extensions
- [Decorators](extensions/decorators.md)
- [Installing Extensions](extensions/installing-extensions.md)
- [Testing Extensions](extensions/testing-extensions.md)

## Getting Started
- [Develop Solidus](getting-started/develop-solidus.md)
- [First Time Installation](getting-started/first-time-installation.md)
- [Forking Solidus](getting-started/forking-solidus.md)
- [Installation Options](getting-started/installation-options.md)

## Inventory
- [Inventory Units](inventory/inventory-units.md)
- [Overview](inventory/overview.md)
- [Stock Items](inventory/stock-items.md)
- [Stock Movements](inventory/stock-movements.md)

## Locations
- [Countries And States](locations/countries-and-states.md)
- [Zones](locations/zones.md)

## Orders
- [Display Total Methods](orders/display-total-methods.md)
- [Order State Machine](orders/order-state-machine.md)
- [Overview](orders/overview.md)
- [Update Orders](orders/update-orders.md)

## Payments
- [Custom Gateway](payments/custom_gateway.md)
- [Overview](payments/overview.md)
- [Payment Method](payments/payment_method.md)
- [Payment Processing](payments/payment_processing.md)

## Preferences
- [Add Model Preferences](preferences/add-model-preferences.md)
- [App Configuration](preferences/app-configuration.md)
- [Class Extension Points](preferences/class-extension-points.md)

## Products And Variants
- [Multi Currency Support](products-and-variants/multi-currency-support.md)
- [Overview](products-and-variants/overview.md)
- [Product Images](products-and-variants/product-images.md)
- [Product Properties](products-and-variants/product-properties.md)
- [Products](products-and-variants/products.md)
- [Taxonomies And Taxons](products-and-variants/taxonomies-and-taxons.md)
- [Variants](products-and-variants/variants.md)

## Promotions
- [Overview](promotions/overview.md)
- [Promotion Actions](promotions/promotion-actions.md)
- [Promotion Handlers](promotions/promotion-handlers.md)
- [Promotion Rules](promotions/promotion-rules.md)

## Returns
- [Return Authorizations](returns/return-authorizations.md)

## Shipments
- [Cartons](shipments/cartons.md)
- [Custom Shipping Calculators](shipments/custom-shipping-calculators.md)
- [Overview Of Shipments](shipments/overview-of-shipments.md)
- [Shipment Setup Examples](shipments/shipment-setup-examples.md)
- [Shipping Method Filters](shipments/shipping-method-filters.md)
- [Solidus Active Shipping Extension](shipments/solidus-active-shipping-extension.md)
- [Split Shipments](shipments/split-shipments.md)
- [User Interface For Shipments](shipments/user-interface-for-shipments.md)

## Taxation
- [Custom Tax Calculator](taxation/custom-tax-calculator.md)
- [Displaying Prices](taxation/displaying-prices.md)
- [Example Tax Setups](taxation/example-tax-setups.md)
- [Overview Of Taxation](taxation/overview-of-taxation.md)
- [Value Added Tax](taxation/value-added-tax.md)

## Users
- [Addresses](users/addresses.md)

## Views
- [Custom Frontend](views/custom-frontend.md)
- [Override Views](views/override-views.md)
43 changes: 43 additions & 0 deletions guides/list.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require 'active_support/core_ext/string/inflections'

# Generates a new guides index
#
# Usage
#
# ./index.rb > index.md
#
def generate_index(files)
current_dir = nil

puts "# Solidus Guides"
puts ""

files.each do |file|
next unless File.file?(file)
file_path = file.sub(/^\.\//, '')
dir_name = nicify(File.dirname(file))
file_name = nicify(File.basename(file))
new_dir = current_dir != dir_name
if new_dir && !current_dir
puts "## #{dir_name}"
elsif current_dir && new_dir
puts ""
puts "## #{dir_name}"
end
puts " - [#{file_name}](#{file_path})"
current_dir = dir_name
end
end

def nicify(name)
name.sub(/^\.\//, '').tr('-', ' ').sub(/\.md$/, '').titleize
end

files = Dir.glob("**/*").sort.reject do |file|
File.basename(file) == File.basename(__FILE__) || File.basename(file) == 'index.md'
end

generate_index(files)

0 comments on commit 35f2408

Please sign in to comment.