argosnap 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 58c0e9370c15fdbea9a88293750f435b115c448d
4
- data.tar.gz: ebf0309dbbe124b0aa99ec8e283331f4dfafaba5
3
+ metadata.gz: ebd85f5ba30c97bd0f6152d0c904d27bdf13ac88
4
+ data.tar.gz: f315bbc294fb0011eae5ab82027e3aa6eab611de
5
5
  SHA512:
6
- metadata.gz: 44019bb49bb27233a27157488c3e2d159b5b20bd381f3121f024c8446283e82965fe11d72c3e171a1d766e52c89b5ec34587307e7f7a7e06172112bc98d794da
7
- data.tar.gz: 43ea9a9b559d741d336c1fa91ac65be6b74c1b48b37ece810cb5b293e82df1b8b96749b69597b4adf012fe0f6127dffc42f3897e57cab7a5e567ed34ebed81cc
6
+ metadata.gz: 8fe3912b47321cafd27786c6174e4cd24fad9982ae8a33ff2895533b5b5d70f2f185296ea6abfb5529ccec6af9a783de77cff8ba9b7d94d51ea6ceee57d89bc1
7
+ data.tar.gz: 2b933606d435e2455895779bcaa2001be2bd113e7d91347ecfdc1b7ee9506784bf1c0d4732bc5782d9077c4862caa0c68ebc5ff8c29ed7f2b035c6ced22b8698
data/README.md CHANGED
@@ -10,11 +10,11 @@ Install the gem via rubygems:
10
10
 
11
11
  ## Configure
12
12
 
13
- Run `install` for the script to create the configuration file like:
13
+ Run the following command for the script to create a configuration file like:
14
14
 
15
15
  $ argosnap -i config
16
16
 
17
- Then we configure the `config.yml` file which looks like this:
17
+ You'll see the location of the newly created configuration file on your terminal. Then you need to configure the `config.yml` file which looks like this:
18
18
 
19
19
  ---
20
20
  :email: sample@email.com
@@ -33,19 +33,19 @@ In the `config.yml` adjust the `threshold` and `seconds` options as you see fit.
33
33
 
34
34
  $ argosnap -i cron
35
35
 
36
- Now just start the installed `.plist` file and you're done.
36
+ Now just start the installed `.plist` file following instruction you'll see on the screen and you're done.
37
37
 
38
38
  ## Options
39
39
 
40
40
  To run an osx notification use the command:
41
41
 
42
- $ argosnap -p osx
43
- Current balance (picodollars): 4.8812
42
+ $ argosnap -p osx
43
+ Current balance (picodollars): 4.8812
44
44
 
45
45
  To get the amount of picodollars as an integer type:
46
46
 
47
- $ argosnap -p clean
48
- 4.8812
47
+ $ argosnap -p clean
48
+ 4.8812
49
49
 
50
50
  That's all :-)
51
51
 
data/bin/argosnap CHANGED
@@ -7,12 +7,12 @@ options = {}
7
7
  opt_parser = OptionParser.new do |opt|
8
8
  opt.banner = "argosnap #{Argosnap::VERSION} ( https://github.com/atmosx/argosnap/ )\nUsage: argosnap [OPTIONS]"
9
9
  opt.separator ""
10
- opt.separator " version: dislay version"
11
- opt.separator " install [config]: installs configure file 'config.yml'"
12
- opt.separator " install [cron]: installs Launchd script under OSX"
13
- opt.separator " print: prints the output in picodollars"
14
- opt.separator " print [osx]: print osx notification"
15
- opt.separator " print [clean]: prints only the picollars (float rounded in 4 decimals), to use in cli"
10
+ opt.separator " -v: dislay version"
11
+ opt.separator " -i config: install configuration files"
12
+ opt.separator " -i cron: installs Launchd script under OSX"
13
+ opt.separator " -p: prints the current amount in picodollars"
14
+ opt.separator " -p osx: prints desktop osx notification"
15
+ opt.separator " -p clean: prints only the picollars (float rounded in 4 decimals), to use in cli"
16
16
  opt.separator ""
17
17
 
18
18
  opt.on("-v","--version","display version") do |version|
@@ -45,10 +45,12 @@ begin
45
45
  Argosnap::OSXNotifications.new.install_launchd_script
46
46
  end
47
47
  elsif options[:help]
48
- # do nothing - avoids double printing of 'opt_parser'
48
+ # avoids double printing of 'opt_parser'
49
49
  elsif options[:print]
50
50
  if options[:print] == 'osx'
51
51
  Argosnap::OSXNotifications.new.display
52
+ elsif options[:print] == 'osx_check'
53
+ Argosnap::OSXNotifications.new.display_check
52
54
  elsif options[:print] == 'default'
53
55
  b = Argosnap::Fetch.new.balance
54
56
  puts "Current balance (picodollars): #{b}"
data/files/local.sh CHANGED
@@ -12,4 +12,4 @@ else
12
12
  fi
13
13
 
14
14
  # Executable now should be in path
15
- argosnap -p osx
15
+ argosnap -p osx_check
@@ -8,7 +8,7 @@ module Argosnap
8
8
  def initialize
9
9
  begin
10
10
  user = ENV['USER']
11
- raise ArgumentError.new("Please make sure you run 'asnap install' in order to install configuration files, before running asnap!") unless File.exists?("#{Dir.home}/.argosnap/config.yml")
11
+ raise ArgumentError.new("Please make sure you run 'argosnap install' in order to install configuration files, before running asnap!") unless File.exists?("#{Dir.home}/.argosnap/config.yml")
12
12
  r = YAML::load_file("#{Dir.home}/.argosnap/config.yml")
13
13
  logfile = "#{Dir.home}/.argosnap/argosnap.log"
14
14
  @email, @password, @threshold, @logger, @agent = r[:email], r[:password], r[:threshold], Logger.new(logfile), Mechanize.new
@@ -20,7 +20,7 @@ module Argosnap
20
20
 
21
21
  # Creates launchd script with user's variables
22
22
  def install_launchd_script
23
- raise ArgumentError.new("Please make sure you run 'asnap install' in order to install configuration files, before running asnap!") unless File.exists?("#{Dir.home}/.argosnap/config.yml")
23
+ raise ArgumentError.new("Please make sure you run 'argosnap install' in order to install configuration files, before running asnap!") unless File.exists?("#{Dir.home}/.argosnap/config.yml")
24
24
  user = ENV['USER']
25
25
  c = "#{Dir.home}/.argosnap/config.yml"
26
26
  begin
@@ -45,9 +45,14 @@ module Argosnap
45
45
  end
46
46
  end
47
47
 
48
- # Display notifications
49
- def display
48
+ # Display notification if threshold is surpassed
49
+ def display_check
50
50
  TerminalNotifier.notify("Current balance: #{@picodollars}", :title => 'TarSnap', :subtitle => 'balance running out') if @picodollars < @threshold.to_i
51
51
  end
52
+
53
+ # Display current ballance in OSX style notifications
54
+ def display
55
+ TerminalNotifier.notify("Current balance: #{@picodollars}", :title => 'TarSnap', :subtitle => 'balance running out')
56
+ end
52
57
  end
53
58
  end
@@ -1,3 +1,3 @@
1
1
  module Argosnap
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/argosnap.rb CHANGED
@@ -3,8 +3,4 @@
3
3
  require_relative File.expand_path("../argosnap/version", __FILE__)
4
4
  require_relative File.expand_path("../argosnap/install", __FILE__)
5
5
  require_relative File.expand_path("../argosnap/balance", __FILE__)
6
- require_relative File.expand_path("../argosnap/osxnotify", __FILE__)
7
- # require 'argosnap/install'
8
- # require 'argosnap/balance'
9
- # require 'argosnap/version'
10
- # require 'argosnap/osxnotify'
6
+ require_relative File.expand_path("../argosnap/osxnotify", __FILE__) if Gem::Platform.local.os == 'darwin'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: argosnap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Panagiotis Atmatzidis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-21 00:00:00.000000000 Z
11
+ date: 2014-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -83,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
83
  version: '0'
84
84
  requirements: []
85
85
  rubyforge_project:
86
- rubygems_version: 2.1.10
86
+ rubygems_version: 2.4.2
87
87
  signing_key:
88
88
  specification_version: 4
89
89
  summary: Display osx notifications when tarsnap account runs out of picodollars