Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a guides index and generator #2671

Merged
merged 2 commits into from
Apr 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
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
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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lint/ScriptPermission: Script file list.rb doesn't have execute permission.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to, but git doesn't let me to.

# 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)