Skip to content

Commit

Permalink
Rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
evanthegrayt committed Sep 27, 2020
1 parent 57e16e3 commit b244523
Show file tree
Hide file tree
Showing 24 changed files with 161 additions and 154 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ for the current month in your preferred editor. If an entry for today is already
present, no text will be generated. If an entry for today doesn't exist, one
will be generated with your preferred values. When generating, if a previous
entry exists, it will be added to today's entry as your previous day's work. See
[example](#example). There's also a very robust API if you'd like to use this
in your own code somehow.
[example](#cli-examples). There's also a very robust API if you'd like to use
this in your own code somehow.

## Installation
If you don't have the permissions to install system-wide gems, you're probabaly
Expand Down
4 changes: 3 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative 'lib/standup_md'
require 'bundler/gem_tasks'
require 'rdoc/task'
Expand All @@ -16,4 +18,4 @@ RDoc::Task.new do |rdoc|
rdoc.rdoc_files.include('README.md', 'lib/**/*.rb')
end

task :default => :test
task default: :test
2 changes: 1 addition & 1 deletion doc/README_md.html
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ <h2 id="label-About">About<span><a href="#label-About">&para;</a> <a href="#top"

<p>I&#39;ve now been at two separate companies where we post our daily standups in a chat client, such as Slack, Mattermost, or Riot. Typing out my standup every day became tedious, as I&#39;d have to look up what I did the day before, copy and paste yesterday&#39;s work into a new entry, and add today&#39;s tasks. This gem automates most of this process, along with providing means of opening the file in your editor, and finding and displaying entries from the command line.</p>

<p>In a nutshell, calling <code>standup</code> from the command line will open a standup file for the current month in your preferred editor. If an entry for today is already present, no text will be generated. If an entry for today doesn&#39;t exist, one will be generated with your preferred values. When generating, if a previous entry exists, it will be added to today&#39;s entry as your previous day&#39;s work. See <a href="#example">example</a>. There&#39;s also a very robust API if you&#39;d like to use this in your own code somehow.</p>
<p>In a nutshell, calling <code>standup</code> from the command line will open a standup file for the current month in your preferred editor. If an entry for today is already present, no text will be generated. If an entry for today doesn&#39;t exist, one will be generated with your preferred values. When generating, if a previous entry exists, it will be added to today&#39;s entry as your previous day&#39;s work. See <a href="#cli-examples">example</a>. There&#39;s also a very robust API if you&#39;d like to use this in your own code somehow.</p>

<h2 id="label-Installation">Installation<span><a href="#label-Installation">&para;</a> <a href="#top">&uarr;</a></span></h2>

Expand Down
3 changes: 2 additions & 1 deletion doc/StandupMD.html
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ <h3>Public Class Methods</h3>
<div class="method-source-code" id="configure-source">
<pre><span class="ruby-comment"># File lib/standup_md.rb, line 36</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">configure</span>
<span class="ruby-keyword">yield</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">config</span>
<span class="ruby-keyword">yield</span> <span class="ruby-identifier">config</span>
<span class="ruby-keyword">end</span></pre>
</div>

Expand Down Expand Up @@ -245,6 +245,7 @@ <h3>Public Class Methods</h3>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">load_config_file</span>(<span class="ruby-identifier">file</span>)
<span class="ruby-identifier">file</span> = <span class="ruby-operator">::</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">file</span>)
<span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;File #{file} does not exist.&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-operator">::</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">file?</span>(<span class="ruby-identifier">file</span>)

<span class="ruby-ivar">@config_file_loaded</span> = <span class="ruby-keyword">true</span>
<span class="ruby-identifier">load</span> <span class="ruby-identifier">file</span>
<span class="ruby-keyword">end</span></pre>
Expand Down
22 changes: 11 additions & 11 deletions doc/StandupMD/Cli.html
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ <h3>Public Class Methods</h3>


<div class="method-source-code" id="config-source">
<pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 17</span>
<pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 16</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">config</span>
<span class="ruby-ivar">@config</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">StandupMD</span>.<span class="ruby-identifier">config</span>.<span class="ruby-identifier">cli</span>
<span class="ruby-keyword">end</span></pre>
Expand Down Expand Up @@ -247,7 +247,7 @@ <h3>Public Class Methods</h3>


<div class="method-source-code" id="echo-source">
<pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 25</span>
<pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 24</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">echo</span>(<span class="ruby-identifier">msg</span>)
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">msg</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">config</span>.<span class="ruby-identifier">verbose</span>
<span class="ruby-keyword">end</span></pre>
Expand Down Expand Up @@ -280,7 +280,7 @@ <h3>Public Class Methods</h3>


<div class="method-source-code" id="execute-source">
<pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 31</span>
<pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 30</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">execute</span>(<span class="ruby-identifier">options</span> = [])
<span class="ruby-identifier">exe</span> = <span class="ruby-identifier">new</span>(<span class="ruby-identifier">options</span>)

Expand Down Expand Up @@ -322,16 +322,16 @@ <h3>Public Class Methods</h3>


<div class="method-source-code" id="new-source">
<pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 64</span>
<pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 63</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">options</span> = [], <span class="ruby-identifier">load_config</span> = <span class="ruby-keyword">true</span>)
<span class="ruby-ivar">@config</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">config</span>
<span class="ruby-ivar">@preference_file_loaded</span> = <span class="ruby-keyword">false</span>
<span class="ruby-ivar">@options</span> = <span class="ruby-identifier">options</span>
<span class="ruby-identifier">load_preferences</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">load_config</span>
<span class="ruby-identifier">set_preferences</span>(<span class="ruby-identifier">options</span>)
<span class="ruby-identifier">load_runtime_preferences</span>(<span class="ruby-identifier">options</span>)
<span class="ruby-ivar">@file</span> = <span class="ruby-constant">StandupMD</span><span class="ruby-operator">::</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">find_by_date</span>(<span class="ruby-ivar">@config</span>.<span class="ruby-identifier">date</span>)
<span class="ruby-ivar">@file</span>.<span class="ruby-identifier">load</span>
<span class="ruby-ivar">@entry</span> = <span class="ruby-identifier">set_entry</span>(<span class="ruby-ivar">@file</span>)
<span class="ruby-ivar">@entry</span> = <span class="ruby-identifier">new_entry</span>(<span class="ruby-ivar">@file</span>)
<span class="ruby-keyword">end</span></pre>
</div>

Expand Down Expand Up @@ -372,7 +372,7 @@ <h3>Public Instance Methods</h3>


<div class="method-source-code" id="echo-source">
<pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 118</span>
<pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 117</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">echo</span>(<span class="ruby-identifier">msg</span>)
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">echo</span>(<span class="ruby-identifier">msg</span>)
<span class="ruby-keyword">end</span></pre>
Expand Down Expand Up @@ -407,7 +407,7 @@ <h3>Public Instance Methods</h3>


<div class="method-source-code" id="edit-source">
<pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 100</span>
<pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 99</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">edit</span>
<span class="ruby-identifier">echo</span> <span class="ruby-node">&quot;Opening file in #{@config.editor}&quot;</span>
<span class="ruby-identifier">exec</span>(<span class="ruby-node">&quot;#{@config.editor} #{file.name}&quot;</span>)
Expand Down Expand Up @@ -443,7 +443,7 @@ <h3>Public Instance Methods</h3>


<div class="method-source-code" id="load_preferences-source">
<pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 79</span>
<pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 78</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">load_preferences</span>
<span class="ruby-keyword">if</span> <span class="ruby-operator">::</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-ivar">@config</span>.<span class="ruby-identifier">preference_file</span>)
<span class="ruby-operator">::</span><span class="ruby-constant">StandupMD</span>.<span class="ruby-identifier">load_config_file</span>(<span class="ruby-ivar">@config</span>.<span class="ruby-identifier">preference_file</span>)
Expand Down Expand Up @@ -483,7 +483,7 @@ <h3>Public Instance Methods</h3>


<div class="method-source-code" id="preference_file_loaded-3F-source">
<pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 92</span>
<pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 91</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">preference_file_loaded?</span>
<span class="ruby-ivar">@preference_file_loaded</span>
<span class="ruby-keyword">end</span></pre>
Expand Down Expand Up @@ -518,7 +518,7 @@ <h3>Public Instance Methods</h3>


<div class="method-source-code" id="write_file-source">
<pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 109</span>
<pre><span class="ruby-comment"># File lib/standup_md/cli.rb, line 108</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">write_file</span>
<span class="ruby-identifier">echo</span> <span class="ruby-node">&quot;Writing file #{file.name}&quot;</span>
<span class="ruby-identifier">file</span>.<span class="ruby-identifier">write</span>
Expand Down
9 changes: 5 additions & 4 deletions doc/StandupMD/Cli/Helpers.html
Original file line number Diff line number Diff line change
Expand Up @@ -127,18 +127,19 @@ <h3>Public Instance Methods</h3>


<div class="method-source-code" id="print-source">
<pre><span class="ruby-comment"># File lib/standup_md/cli/helpers.rb, line 16</span>
<pre><span class="ruby-comment"># File lib/standup_md/cli/helpers.rb, line 14</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">print</span>(<span class="ruby-identifier">entry</span>)
<span class="ruby-keyword">if</span> <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">nil?</span>
<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;No record found for #{StandupMD.config.cli.date}&quot;</span>
<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;No record found for #{config.cli.date}&quot;</span>
<span class="ruby-keyword">return</span>
<span class="ruby-keyword">end</span>
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">header</span>(<span class="ruby-identifier">entry</span>)
<span class="ruby-constant">StandupMD</span>.<span class="ruby-identifier">config</span>.<span class="ruby-identifier">file</span>.<span class="ruby-identifier">sub_header_order</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">header_type</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">config</span>.<span class="ruby-identifier">file</span>.<span class="ruby-identifier">sub_header_order</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">header_type</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">tasks</span> = <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">public_send</span>(<span class="ruby-identifier">header_type</span>)
<span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">tasks</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">tasks</span>.<span class="ruby-identifier">empty?</span>

<span class="ruby-identifier">puts</span> <span class="ruby-identifier">sub_header</span>(<span class="ruby-identifier">header_type</span>)
<span class="ruby-identifier">tasks</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">task</span><span class="ruby-operator">|</span> <span class="ruby-identifier">puts</span> <span class="ruby-constant">StandupMD</span>.<span class="ruby-identifier">config</span>.<span class="ruby-identifier">file</span>.<span class="ruby-identifier">bullet_character</span> <span class="ruby-operator">+</span> <span class="ruby-string">&#39; &#39;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">task</span> }
<span class="ruby-identifier">tasks</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">task</span><span class="ruby-operator">|</span> <span class="ruby-identifier">puts</span> <span class="ruby-identifier">config</span>.<span class="ruby-identifier">file</span>.<span class="ruby-identifier">bullet_character</span> <span class="ruby-operator">+</span> <span class="ruby-string">&#39; &#39;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">task</span> }
<span class="ruby-keyword">end</span>
<span class="ruby-identifier">puts</span>
<span class="ruby-keyword">end</span></pre>
Expand Down
2 changes: 1 addition & 1 deletion doc/StandupMD/Config.html
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ <h3>Public Class Methods</h3>


<div class="method-source-code" id="new-source">
<pre><span class="ruby-comment"># File lib/standup_md/config.rb, line 40</span>
<pre><span class="ruby-comment"># File lib/standup_md/config.rb, line 38</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>
<span class="ruby-ivar">@cli</span> = <span class="ruby-constant">StandupMD</span><span class="ruby-operator">::</span><span class="ruby-constant">Config</span><span class="ruby-operator">::</span><span class="ruby-constant">Cli</span>.<span class="ruby-identifier">new</span>
<span class="ruby-ivar">@file</span> = <span class="ruby-constant">StandupMD</span><span class="ruby-operator">::</span><span class="ruby-constant">Config</span><span class="ruby-operator">::</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">new</span>
Expand Down
4 changes: 2 additions & 2 deletions doc/StandupMD/Config/Cli.html
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ <h3>Public Class Methods</h3>


<div class="method-source-code" id="new-source">
<pre><span class="ruby-comment"># File lib/standup_md/config/cli.rb, line 96</span>
<pre><span class="ruby-comment"># File lib/standup_md/config/cli.rb, line 94</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>
<span class="ruby-identifier">reset</span>
<span class="ruby-keyword">end</span></pre>
Expand Down Expand Up @@ -335,7 +335,7 @@ <h3>Public Instance Methods</h3>


<div class="method-source-code" id="reset-source">
<pre><span class="ruby-comment"># File lib/standup_md/config/cli.rb, line 104</span>
<pre><span class="ruby-comment"># File lib/standup_md/config/cli.rb, line 102</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">reset</span>
<span class="ruby-constant">DEFAULTS</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">instance_variable_set</span>(<span class="ruby-node">&quot;@#{k}&quot;</span>, <span class="ruby-identifier">v</span>) }
<span class="ruby-keyword">end</span></pre>
Expand Down
4 changes: 2 additions & 2 deletions doc/StandupMD/Config/Entry.html
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ <h3>Public Class Methods</h3>


<div class="method-source-code" id="new-source">
<pre><span class="ruby-comment"># File lib/standup_md/config/entry.rb, line 55</span>
<pre><span class="ruby-comment"># File lib/standup_md/config/entry.rb, line 53</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>
<span class="ruby-identifier">reset</span>
<span class="ruby-keyword">end</span></pre>
Expand Down Expand Up @@ -267,7 +267,7 @@ <h3>Public Instance Methods</h3>


<div class="method-source-code" id="reset-source">
<pre><span class="ruby-comment"># File lib/standup_md/config/entry.rb, line 63</span>
<pre><span class="ruby-comment"># File lib/standup_md/config/entry.rb, line 61</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">reset</span>
<span class="ruby-constant">DEFAULTS</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">instance_variable_set</span>(<span class="ruby-node">&quot;@#{k}&quot;</span>, <span class="ruby-identifier">v</span>) }
<span class="ruby-keyword">end</span></pre>
Expand Down
Loading

0 comments on commit b244523

Please sign in to comment.