Project

sweetie

0.0
No release in over 3 years
Low commit activity in last 3 years
Sweetie counts the links, images, number of html pages, and last-build time of a jekyll project. In addition it can get the last changes of all bitbuckets repositories of a user.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 3.3
~> 12.3

Runtime

~> 2.3
~> 1.13
 Project Readme

Sweetie is a plugin for to get statistics for jekyll and middleman projects. The statistics includes the unique number of all links, images, pages, and the last build time of the given project. You can specify the location the generated files (normally _site for jekyll and build for middleman apps) and of the config file where the changes will be written.

It can also grab the last changes of your bitbucket repositories. You can then use the information on various places in your project

Gem Version CircleCI

Toc

  • Installation
  • Usage create stati
    • Jekyll
    • Configuration variables for Jekyll
    • Middleman
    • Configuration variables for Middleman
  • Usage bitbucket repositories
    • Middleman
    • Jekyll

Installation

$ gem install sweetie

Usage create stati

Jekyll

The easiest way is to add require 'sweetie' on the top of your Rakefile.

Before you build your page, you can run a rake task to update the status information of a page:

require 'sweetie'

desc 'write stats in the _config.yml file'
task :create_stati do
  sweetie = Sweetie::Conversion.new('./site', './_config.yml')
  sweetie.create_stati
end

Make sure that the following fields are set in your _config.yml:

build:
htmlpages:
images:
links:

After running the script, the changes in _config.yml will look like:

build: 6-18-2017
htmlpages: 600
images: 20
links: 271

Configuration variables for Jekyll

You can use the build, htmlpages, images, and links variables defined in your _config.yml file everywhere in your page with the liquid snippet for example:

  • {{ site.build }}
  • {{ site.htmlpages }}
  • {{ site.images }}
  • {{ site.links }}

If you also make use of Usage for Bitbucket repositories you can also use the last update value for your repositories:

<section class="lastupdate">
Last update {{ site.git }}
</section>
...


<section class="lastupdate">
Last update {{ site.pmwiki-twitter-recipe }}
</section>
...

will result the following html:

<h3 id="git">Git</h3>

<section class="lastupdate">
Last update 2011-10-16
</section>


<h3 id="twitter">Twitter</h3>

<section class="lastupdate">
Last update 2011-10-16
</section>

Middleman

The easiest way is to add require 'sweetie' on the top of your Rakefile.

Before you build your page, you can run a rake task to update the status information of a page:

require 'sweetie'

desc 'write stats in the config.rb file'
task :create_stati do
  sweetie = Sweetie::Conversion.new('./build', './config.rb')
  sweetie.create_stati
end

Make sure that the following fields are set in your config.rb:

set :build,
set :images,
set :htmlpages,
set :links,

After running the script, the changes in config.rb will look like for example:

set :build, 6-18-2017
set :images, 75
set :htmlpages, 111
set :links, 694

Configuration variables for Middleman

You can use the build, htmlpages, images, and links variables defined in your _config.yml file everywhere in your page with the erb snippet for example:

  • `<%= config[:build] %>
  • `<%= config[:htmlpages] %>
  • `<%= config[:images] %>
  • `<%= config[:links] %>

If you also make use of Usage for Bitbucket repositories you can also use the last update value for your repositories:

<section class="lastupdate">
Last update <%= config[:git] %>
</section>
...


<section class="lastupdate">
Last update <%= config[:pmwiki_twitter_recipe %>
</section>
...

will result the following html:

<h3 id="git">Git</h3>

<section class="lastupdate">
Last update 2011-10-16
</section>


<h3 id="twitter">Twitter</h3>

<section class="lastupdate">
Last update 2011-10-16
</section>

Usage Bitbucket repositories

Middleman

The easiest way is to add require 'sweetie' on the top of your Rakefile.

Before you build your page, you can run a rake task to update the status of the repositories for the given config-file and username:

require 'sweetie'

desc 'write repositories stats in the config.rb file'
task :create_bitbucket do
  stati_helper = Sweetie::BitbucketStatiHelper.new('./config.rb', 'wikimatze')
  bitbucket = Sweetie::Bitbucket.new(stati_helper)
  bitbucket.update_stati
end

Please note that you have to change wikimatze to your bitbucket user name

set :pmwiki_dropcaps_recipe,
set :pmwiki_syntaxlove_recipe,
set :pmwiki_twitter_recipe,
set :pmwiki_linkicons_recipe,
set :pmwiki_headlineimage_recipe,

After running the script, the names in config.rb above will be changed to:

set :pmwiki_dropcaps_recipe, 2017-02-24
set :pmwiki_syntaxlove_recipe, 2017-02-26
set :pmwiki_twitter_recipe, 2017-02-26
set :pmwiki_linkicons_recipe, 2017-02-26
set :pmwiki_headlineimage_recipe, 2017-02-25

Jekyll

The easiest way is to add require 'sweetie' on the top of your Rakefile.

Before you build your page, you can run a rake task to update the status of the repositories for the given config-file and username:

require 'sweetie'

desc 'write repositories stats in the _config.yml file'
desc 'write stats in the _config.yml'
task :create_bitbucket do
  stati_helper = Sweetie::BitbucketStatiHelper.new('./_config.yml', 'wikimatze')
  bitbucket = Sweetie::Bitbucket.new(stati_helper)
  bitbucket.update_stati
end

Please note that you have to change wikimatze to your bitbucket user name

set :pmwiki_dropcaps_recipe,
set :pmwiki_syntaxlove_recipe,
set :pmwiki_twitter_recipe,
set :pmwiki_linkicons_recipe,
set :pmwiki_headlineimage_recipe,

After running the script, the names in config.rb above will be changed to:

set :pmwiki_dropcaps_recipe, 2017-02-24
set :pmwiki_syntaxlove_recipe, 2017-02-26
set :pmwiki_twitter_recipe, 2017-02-26
set :pmwiki_linkicons_recipe, 2017-02-26
set :pmwiki_headlineimage_recipe, 2017-02-25

License

This software is licensed under the MIT license.

© 2011-2022 Matthias Günther matze@wikimatze.de.