module Pluto

Public Class Methods

load_tasks() click to toggle source
# File lib/pluto/tasks.rb, line 40
def self.load_tasks
  # load all builtin Rake tasks (from tasks/*rake)
  load 'pluto/tasks/environment.rake'
  load 'pluto/tasks/setup.rake'
  load 'pluto/tasks/stats.rake'
  load 'pluto/tasks/update.rake'
end
no_longer_used__fetch_config_for__delete_why_why_not( key ) click to toggle source

todo/fix: move to pluto-update for (re)use !!!!

# File lib/pluto/tasks.rb, line 52
def self.no_longer_used__fetch_config_for__delete_why_why_not( key )
  ###
  ## todo:
  ##  move into a method for (re)use
  puts "trying to fetch pluto.index.ini shortcut planet registry..."

  index_txt = fixme_fetcher_read_utf8!( 'https://raw.githubusercontent.com/feedreader/planets/master/pluto.index.ini' )
  shortcuts = INI.load( index_txt )
  pp shortcuts

  shortcut = shortcuts[key]
  if shortcut.nil?
    puts "sorry; no planet shortcut found for key >#{key}<"
    exit 1
  end

  config_txt = InclPreproc.from_url( shortcut['source'] ).read
  config = INI.load( config_txt )
  config
end
setup_planet( key ) click to toggle source

todo: use a better name? setup_planet_for ?? other name??

# File lib/pluto/tasks.rb, line 75
def self.setup_planet( key )
  puts "trying to fetch pluto.index.ini shortcut planet registry..."

  index_txt = fixme_fetcher_read_utf8!( 'https://raw.githubusercontent.com/feedreader/planets/master/planets.ini' )
  shortcuts = INI.load( index_txt )
  pp shortcuts

  shortcut = shortcuts[key]
  if shortcut.nil?
    puts "sorry; no planet shortcut found for key >#{key}<"
    exit 1
  end

  i=1
  loop do
    config_url = shortcut[ "source#{i}" ]
    break if config_url.nil?

    ## "calc" key from url
    #    https://raw.github.com/feedreader/planet-ruby/gh-pages/ruby-news.ini
    # get last entry e.g. ruby-news.ini
    ##   remove -_ chars
    ## e.g. jekyll-meta becomes jekyllmeta etc.

    config_key = config_url[ (config_url.rindex('/')+1)..-1 ]
    config_key = config_key.sub( '.ini', '' )    # remove .ini extension
    config_key = config_key.gsub( /[\-_]/, '' )  # remove -_ chars

    config_txt = InclPreproc.from_url( config_url ).read
    config = INI.load( config_txt )

    puts "dump planet setup settings:"
    pp config
    # note: allow multiple planets (sites) for a single install
    Pluto::Model::Site.deep_create_or_update_from_hash!( config_key, config )

    i+=1
  end
end