Class: FX4S

Inherits:
Object
  • Object
show all
Defined in:
lib/fx4s.rb

Instance Method Summary collapse

Constructor Details

#initializeFX4S

Returns a new instance of FX4S.



15
16
17
18
19
20
21
22
23
24
# File 'lib/fx4s.rb', line 15

def initialize
  check_dependencies
  config_path = File.expand_path('~/.fx4s/fx4s.yml')
  @config = YAML.load(File.read(config_path))

  config_path = File.expand_path('~/.fx4s/aws.yml')
  AWS.config(YAML.load(File.read(config_path)))
  s3 = AWS::S3.new
  @bucket = s3.buckets[@config[:bucket_name]]
end

Instance Method Details

#make_screenshot(secure = true) ⇒ Object



26
27
28
# File 'lib/fx4s.rb', line 26

def make_screenshot(secure=true)
  `xfce4-screenshooter -r -o fx4s#{secure ? '_secure' : ''}`
end

#share(filepath, secure = true) ⇒ Object



30
31
32
33
34
35
36
37
38
# File 'lib/fx4s.rb', line 30

def share(filepath, secure=true)
  unless File.exists?(filepath)
    notify("No such file: #{filepath}")
    return false
  end
  url = upload(filepath, secure)
  url = shorten_link(url)
  set_clipboard(url)
end