Sha256: 15fa2cca19a80fcda2ffb3cf5a3ed4dcfd9ec4624f2e801cf1c8d0e74745d5bc

Contents?: true

Size: 401 Bytes

Versions: 3

Compression:

Stored size: 401 Bytes

Contents

require 'json'

class AppsAPI < Sinatra::Base

  get '/list' do
    list = Dir.new(File.dirname(__FILE__) + "/../apps").entries
    list = list.find_all{|item| item =~ /^[a-z]+$/}
    list = list.map do |item|
      json = JSON.parse(File.read(File.dirname(__FILE__) + "/../apps/#{item}/options.json"))
      {
        path: item,
        name: json['name']
      }
    end
    list.to_json
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
daftos-0.4.1 lib/apis/apps_api.rb
daftos-0.4.0 lib/apis/apps_api.rb
daftos-0.3.0 lib/apis/apps_api.rb