blertr 0.1.6 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/bin/blertr CHANGED
@@ -52,24 +52,34 @@ EOS
52
52
  end
53
53
 
54
54
  def take_action action, parameters
55
+ blertr_path = File.expand_path(File.join(File.dirname(__FILE__), ".."))
56
+ blertr_local_dir = File.expand_path("~/.blertr")
57
+ blertr_symlink = File.join(blertr_local_dir, "app")
55
58
  case action
56
59
  when "help"
57
60
  help
58
61
  when "install"
59
- blertr_path = File.expand_path(File.join(File.dirname(__FILE__), ".."))
60
- blertr_symlink = File.expand_path("~/.blertr")
61
62
  if File.exists? blertr_symlink
62
- puts "ERROR: Blertr appears to already be installed.\nUninstall with blertr remove"
63
+ puts "ERROR: Blertr appears to already be installed.\nUninstall with blertr uninstall"
63
64
  else
65
+ puts "creating #{blertr_local_dir} directory"
66
+ system("mkdir -p #{blertr_local_dir}")
67
+
64
68
  puts "creating symlink from #{blertr_path} to #{blertr_symlink}"
65
69
  system("ln -s #{blertr_path} #{blertr_symlink}")
70
+
71
+ config_dir = File.expand_path(Blertr::CONFIG_DIR_PATH)
72
+ if !File.exists?(config_dir)
73
+ blertr_config_dir = File.expand_path(File.join(File.dirname(__FILE__), "..", "config"))
74
+ puts "copying config files to #{blertr_path}"
75
+ system("cp -r #{blertr_config_dir} #{blertr_local_dir}")
76
+ end
66
77
  puts "Blertr is now (almost) installed!\nPut this at the bottom of your .bashrc file:"
67
- puts "[[ -s \"$HOME/.blertr/scripts/blertr\" ]] && . \"$HOME/.blertr/scripts/blertr\""
78
+ puts "[[ -s \"$HOME/.blertr/app/scripts/blertr\" ]] && . \"$HOME/.blertr/app/scripts/blertr\""
68
79
  end
69
80
  when "uninstall"
70
- blertr_symlink = File.expand_path("~/.blertr")
71
81
  if File.exists? blertr_symlink
72
- puts "Removing ~/.blertr"
82
+ puts "Removing #{blertr_symlink}"
73
83
  system("rm #{blertr_symlink}")
74
84
  puts "Blertr is now (almost) uninstalled.\nRemove from .bashrc file:"
75
85
  puts "[[ -s \"$HOME/.blertr/scripts/blertr\" ]] && . \"$HOME/.blertr/scripts/blertr\""
@@ -0,0 +1,3 @@
1
+ module Blertr
2
+ CONFIG_DIR_PATH = "~/.blertr/config"
3
+ end
@@ -1,4 +1,5 @@
1
1
  require 'fileutils'
2
+ require 'blertr/constants'
2
3
 
3
4
  module Blertr
4
5
  class Options
@@ -28,7 +29,12 @@ module Blertr
28
29
  end
29
30
 
30
31
  def self.config_path
31
- File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "config"))
32
+ # first try local config
33
+ path = File.expand_path(CONFIG_DIR_PATH)
34
+ if !File.exists?(path)
35
+ path = File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "config"))
36
+ end
37
+ path
32
38
  end
33
39
 
34
40
  def self.config_file_for name
@@ -1,3 +1,3 @@
1
1
  module Blertr
2
- VERSION = "0.1.6".freeze
2
+ VERSION = "0.2.0".freeze
3
3
  end
data/lib/blertr.rb CHANGED
@@ -1,2 +1,4 @@
1
1
 
2
+ require 'blertr/constants'
2
3
  require 'blertr/control'
4
+
data/scripts/blertr CHANGED
@@ -36,9 +36,9 @@ then
36
36
  then
37
37
  if [[ "$blertr_prefix" = "$HOME" ]]
38
38
  then
39
- blertr_path="${blertr_prefix}/.blertr"
39
+ blertr_path="${blertr_prefix}/.blertr/app"
40
40
  else
41
- blertr_path="${blertr_prefix}/blertr"
41
+ blertr_path="${blertr_prefix}/blertr/app"
42
42
  fi
43
43
  fi
44
44
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blertr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -92,6 +92,7 @@ files:
92
92
  - config/notify_send_config.yaml
93
93
  - lib/blertr.rb
94
94
  - lib/blertr/blacklist.rb
95
+ - lib/blertr/constants.rb
95
96
  - lib/blertr/control.rb
96
97
  - lib/blertr/growl_notifier.rb
97
98
  - lib/blertr/mail_notifier.rb