Module: Flubber::App

Defined in:
lib/app.rb

Constant Summary collapse

S3_BUCKET_NAME =
"expo-flubber"
APP_INFO_LOCATION =
".flubber"

Class Method Summary collapse

Class Method Details

.bundles_public_urlObject



39
40
41
42
# File 'lib/app.rb', line 39

def self.bundles_public_url
  @bundles_public_url ||= \
    "https://#{S3_BUCKET_NAME}.s3.amazonaws.com/#{uuid}/#{name}"
end

.idObject



18
19
20
21
22
23
# File 'lib/app.rb', line 18

def self.id
  file = File.open(APP_INFO_LOCATION)
  lines = file.readlines.map(&:chomp)
  file.close
  lines[0]
end

.nameObject



25
26
27
28
29
30
# File 'lib/app.rb', line 25

def self.name
  file = File.open(APP_INFO_LOCATION)
  lines = file.readlines.map(&:chomp)
  file.close
  lines[1]
end

.set(flubber_app) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/app.rb', line 6

def self.set(flubber_app)
  file = File.open(APP_INFO_LOCATION, "w+")
  file.puts "#{flubber_app["id"]}"
  file.puts "#{flubber_app["name"].downcase.gsub(" ", "-").gsub(/\s+/, "")}"
  file.puts "#{flubber_app["uuid"]}"
  file.close
end

.set?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/app.rb', line 14

def self.set?
  File.exists?(APP_INFO_LOCATION)
end

.uuidObject



32
33
34
35
36
37
# File 'lib/app.rb', line 32

def self.uuid
  file = File.open(APP_INFO_LOCATION)
  lines = file.readlines.map(&:chomp)
  file.close
  lines[2]
end