8000 Documentation Changes by gamemaker1 · Pull Request #1815 · jordansissel/fpm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Documentation Changes #1815

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 i 8000 n to your account

Merged
merged 7 commits into from
Aug 16, 2021
Merged

Documentation Changes #1815

merged 7 commits into from
Aug 16, 2021

Conversation

gamemaker1
Copy link
Contributor

Hi!

Hi there! First off, thanks to all the contributors for creating such a wonderful tool! I have used FPM for many of my projects, and I thought I might express my thanks by giving back to the community.

What this PR changes

I noticed that the docs were a bit incomplete - though installation instructions were pretty clear, there was no actual tutorial/getting started guide. This PR aims to add a bit of introductory material to the FPM docs.

Changes made:

  • Rewrote some parts of the installation page.
  • Added a getting started page.
    • Added a tutorial to package a simple bash script and man page, which explains most of the basic flags one would use in FPM.
    • Merged most examples for sources like python, CPAN and npm into this page.
    • Added a section documenting the .fpm configuration file.
  • Added a CLI reference page detailing all the options you can use with the CLI tool.

Related issues

#1744 #1718

Screenshots of the new documentation

Landing/Index page

fpm-docs-index-page

Installation page

fpm-docs-install-page

Getting started page

fpm-docs-getting-started-page

CLI reference page

fpm-docs-cli-reference-page

Contributing page

fpm-docs-contributing-page


Please do let me know if there can be any improvements to the changes made in this PR. Also let me know if some of these changes should be added to the Github Wiki for this project?

Thanks and regards!

@jordansissel
Copy link
Owner
jordansissel commented Aug 6, 2021 via email

@gamemaker1
Copy link
Contributor Author

Sure, thanks!

@jordansissel
Copy link
Owner

I like the way this restructures the documentation and also provides a few good examples. Nice work :)

I have some ideas for generating the "cli-reference" page automatically from the code, and I'll try to get to that soon.

Thanks again for improving fpm for folks!

@gamemaker1
Copy link
Contributor Author

I have some ideas for generating the "cli-reference" page automatically from the code, and I'll try to get to that soon.

I did it using VSCode's multiple cursors feature and some manual formatting; a programmatic solution would be great!

I like the way this restructures the documentation and also provides a few good examples. Nice work :)

Thanks!

@jordansissel
Copy link
Owner
jordansissel commented Aug 16, 2021 via email

@gamemaker1
Copy link
Contributor Author

It looks great; one thing I noticed was some flag names were not properly formatted as code:

image

Perhaps it is because of the trailing space after the options, maybe calling strip! on the flags and options might fix that.

@gamemaker1
Copy link
Contributor Author
gamemaker1 commented Aug 16, 2021

Here's a diff to fix that issue:

diff --git a/docs/generate-cli-reference.rb b/docs/generate-cli-reference.rb
index 84f71c6..0ed8b54 100644
--- a/docs/generate-cli-reference.rb
+++ b/docs/generate-cli-reference.rb
@@ -18,13 +18,13 @@ FPM::Command.instance_variable_get(:@declared_options).each do |o
8000
ption|
 
     if option.type == :flag
         # it's a flag which means there are no parameters to the option
-        puts "* ``#{option.switches.first}``"
+        puts "* ``#{option.switches.first.strip}``"
     else
-        puts "* ``#{option.switches.first} #{option.type}``"
+        puts "* ``#{option.switches.first} #{option.type.strip}``"
     end
 
     if option.switches.length > 1
-        puts "    - Alternate option spellings: ``#{option.switches[1..].join(", ")}``"
+        puts "    - Alternate option spellings: ``#{option.switches[1..].join(", ").strip}``"
     end
     puts "    - #{text}"
     puts
@@ -42,9 +42,9 @@ FPM::Package.types.sort_by { |k,v| k }.each do |name, type|
 
     options.sort_by { |flag, _| flag }.each do |flag, param, help, options, block|
         if param == :flag 
-            puts "* ``#{flag.first}``"
+            puts "* ``#{flag.first.strip}``"
         else
-            puts "* ``#{flag.first} #{param}``"
+            puts "* ``#{flag.first} #{param.strip}``"
         end
 
         text = help.sub(/^\([^)]+\) /, "")

I'd be happy to open a PR, if needed

@gamemaker1
Copy link
Contributor Author

Also, the output-type-specific options have been nicely divided into their own sub-sections as well; but they still appear under General options.

@gamemaker1
Copy link
Contributor Author
gamemaker1 commented Aug 16, 2021

Diff for both the above fixes:

diff --git a/docs/generate-cli-reference.rb b/docs/generate-cli-reference.rb
index 84f71c6..b2e9afb 100644
--- a/docs/generate-cli-reference.rb
+++ b/docs/generate-cli-reference.rb
@@ -12,22 +12,26 @@ puts
 
 puts "General Options"
 puts "---------------"
+puts
 
 FPM::Command.instance_variable_get(:@declared_options).each do |option|
     text = option.description.gsub("\n", " ")
 
-    if option.type == :flag
-        # it's a flag which means there are no parameters to the option
-        puts "* ``#{option.switches.first}``"
-    else
-        puts "* ``#{option.switches.first} #{option.type}``"
-    end
+    # Don't show output-format-specific options, they get their own section
// This method is a bit hacky, any better way to do it?
+    if !text.include? "only)"
+        if option.type == :flag
+            # it's a flag which means there are no parameters to the option
+            puts "* ``#{option.switches.first.strip}``"
+        else
+            puts "* ``#{option.switches.first} #{option.type.strip}``"
+        end
 
-    if option.switches.length > 1
-        puts "    - Alternate option spellings: ``#{option.switches[1..].join(", ")}``"
+        if option.switches.length > 1
+            puts "    - Alternate option spellings: ``#{option.switches[1..].join(", ").strip}``"
+        end
+        puts "    - #{text}"
+        puts
     end
-    puts "    - #{text}"
-    puts
 end
 
 FPM::Package.types.sort_by { |k,v| k }.each do |name, type|
@@ -42,9 +46,9 @@ FPM::Package.types.sort_by { |k,v| k }.each do |name, type|
 
     options.sort_by { |flag, _| flag }.each do |flag, param, help, options, block|
         if param == :flag 
-            puts "* ``#{flag.first}``"
+            puts "* ``#{flag.first.strip}``"
         else
-            puts "* ``#{flag.first} #{param}``"
+            puts "* ``#{flag.first} #{param.strip}``"
         end
 
         text = help.sub(/^\([^)]+\) /, "")

My fork has these changes, let me know if I should open a PR. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0