Module: Pluto

Defined in:
lib/pluto/tasks.rb

Class Method Summary collapse

Class Method Details

.load_tasksObject



40
41
42
43
44
45
46
# 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) ⇒ Object

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



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# 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) ⇒ Object

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



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# 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