noprocrast 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- noprocast
1
+ noprocrast
2
2
  =========
3
3
 
4
4
  A gem to stop you procastinating. Noprocast automatically adds and removes items from your /etc/hosts, rendering addictive websites useless.
@@ -6,18 +6,18 @@ A gem to stop you procastinating. Noprocast automatically adds and removes items
6
6
  Installation
7
7
  ------------
8
8
 
9
- gem install noprocast
9
+ gem install noprocrast
10
10
 
11
11
  Usage
12
12
  -----
13
13
 
14
- `noprocast status` check if noprocast is enabled or not
14
+ `noprocrast status` check if noprocrast is enabled or not
15
15
 
16
- `noprocast edit` edit noprocast's list of banned websites
16
+ `noprocrast edit` edit noprocrast's list of banned websites
17
17
 
18
- `noprocast on` enable noprocast
18
+ `noprocrast on` enable noprocrast
19
19
 
20
- `noprocast off` disable noprocast
20
+ `noprocrast off` disable noprocrast
21
21
 
22
22
  Notes
23
23
  -----
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.5
1
+ 0.1.6
@@ -1,29 +1,29 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require File.join(File.expand_path(File.dirname(__FILE__)), '..', 'lib', 'noprocast')
3
+ require File.join(File.expand_path(File.dirname(__FILE__)), '..', 'lib', 'noprocrast')
4
4
 
5
5
  begin
6
6
  case ARGV.first
7
7
  when 'on', 'reload'
8
- Noprocast.activate!
8
+ Noprocrast.activate!
9
9
  when 'off'
10
- Noprocast.deactivate!
10
+ Noprocrast.deactivate!
11
11
  when 'status'
12
- puts Noprocast.status_message
12
+ puts Noprocrast.status_message
13
13
  when 'edit'
14
- if File.exists?(Noprocast.deny_file_path) && (Process.uid != File.stat(Noprocast.deny_file_path).uid)
14
+ if File.exists?(Noprocrast.deny_file_path) && (Process.uid != File.stat(Noprocrast.deny_file_path).uid)
15
15
  puts "Can't edit this file as it belongs to another user (hint: don't use sudo)"
16
16
  exit
17
17
  end
18
- Noprocast.edit!
19
- if Noprocast.active?
20
- puts "Saved. Now: noprocast reload"
18
+ Noprocrast.edit!
19
+ if Noprocrast.active?
20
+ puts "Saved. Now: noprocrast reload"
21
21
  else
22
- puts "Saved. Now: noprocast on"
22
+ puts "Saved. Now: noprocrast on"
23
23
  end
24
24
  when 'help', '-h', '--help', nil
25
- puts "Usage: [sudo] noprocast [on|off|status|edit]"
25
+ puts "Usage: [sudo] noprocrast [on|off|status|edit]"
26
26
  end
27
27
  rescue Errno::EACCES
28
- puts "Permission denied: try sudo noprocast"
28
+ puts "Permission denied: try sudo noprocrast"
29
29
  end
@@ -1,6 +1,6 @@
1
1
  require 'fileutils'
2
2
 
3
- class Noprocast
3
+ class Noprocrast
4
4
  class << self
5
5
  def default_hosts
6
6
  ['news.ycombinator.com', 'twitter.com', 'facebook.com', 'reddit.com']
@@ -23,29 +23,29 @@ class Noprocast
23
23
  backup_hosts_file_if_required!
24
24
  deactivate! # ensure that /etc/hosts is clean
25
25
  File.open("/etc/hosts", 'a') do |file|
26
- file << "\n\n# noprocast start\n#{current_hosts.map { |host| "127.0.0.1 #{host}" }.join("\n")}\n# noprocast end"
26
+ file << "\n\n# noprocrast start\n#{current_hosts.map { |host| "127.0.0.1 #{host}" }.join("\n")}\n# noprocrast end"
27
27
  end
28
28
  system "dscacheutil -flushcache" # only for OSX >= 10.5: flush the DNS cache
29
29
  end
30
30
 
31
31
  def deactivate!
32
- clean_hosts = hosts_file_content.gsub(/(\n\n)?\# noprocast start.*\# noprocast end/m, '')
32
+ clean_hosts = hosts_file_content.gsub(/(\n\n)?\# noprocrast start.*\# noprocrast end/m, '')
33
33
  File.open("/etc/hosts", 'w') do |file|
34
34
  file << clean_hosts
35
35
  end
36
36
  end
37
37
 
38
38
  def active?
39
- hosts_file_content.match(/\# noprocast start/)
39
+ hosts_file_content.match(/\# noprocrast start/)
40
40
  end
41
41
 
42
42
  def status_message
43
- active? ? "noprocast enabled for #{current_hosts.size} hosts" : "noprocast disabled"
43
+ active? ? "noprocrast enabled for #{current_hosts.size} hosts" : "noprocrast disabled"
44
44
  end
45
45
 
46
46
  def backup_hosts_file_if_required!
47
- unless File.exists?("/etc/.hosts.noprocastbackup")
48
- FileUtils.cp("/etc/hosts", "/etc/.hosts.noprocastbackup")
47
+ unless File.exists?("/etc/.hosts.noprocrastbackup")
48
+ FileUtils.cp("/etc/hosts", "/etc/.hosts.noprocrastbackup")
49
49
  end
50
50
  end
51
51
 
@@ -4,16 +4,16 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{noprocast}
8
- s.version = "0.1.4"
7
+ s.name = %q{noprocrast}
8
+ s.version = "0.1.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Rob Watson"]
12
12
  s.date = %q{2010-11-11}
13
- s.default_executable = %q{noprocast}
13
+ s.default_executable = %q{noprocrast}
14
14
  s.description = %q{Block access to addictive websites in one command-line swoop.}
15
15
  s.email = %q{rfwatson@gmail.com}
16
- s.executables = ["noprocast"]
16
+ s.executables = ["noprocrast"]
17
17
  s.extra_rdoc_files = [
18
18
  "LICENSE",
19
19
  "README.md"
@@ -25,20 +25,20 @@ Gem::Specification.new do |s|
25
25
  "README.md",
26
26
  "Rakefile",
27
27
  "VERSION",
28
- "bin/noprocast",
29
- "lib/noprocast.rb",
30
- "noprocast.gemspec",
31
- "spec/noprocast_spec.rb",
28
+ "bin/noprocrast",
29
+ "lib/noprocrast.rb",
30
+ "noprocrast.gemspec",
31
+ "spec/noprocrast_spec.rb",
32
32
  "spec/spec.opts",
33
33
  "spec/spec_helper.rb"
34
34
  ]
35
- s.homepage = %q{http://github.com/rfwatson/noprocast}
35
+ s.homepage = %q{http://github.com/rfwatson/noprocrast}
36
36
  s.rdoc_options = ["--charset=UTF-8"]
37
37
  s.require_paths = ["lib"]
38
38
  s.rubygems_version = %q{1.3.7}
39
- s.summary = %q{Give procastination a swift kick in the balls.}
39
+ s.summary = %q{Give procrastination a swift kick in the balls.}
40
40
  s.test_files = [
41
- "spec/noprocast_spec.rb",
41
+ "spec/noprocrast_spec.rb",
42
42
  "spec/spec_helper.rb"
43
43
  ]
44
44
 
@@ -1,6 +1,6 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
 
3
- describe "Noprocast" do
3
+ describe "Noprocrast" do
4
4
  it "fails" do
5
5
  fail "hey buddy, you should probably rename this file and start specing for real"
6
6
  end
@@ -1,6 +1,6 @@
1
1
  $LOAD_PATH.unshift(File.dirname(__FILE__))
2
2
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
- require 'noprocast'
3
+ require 'noprocrast'
4
4
  require 'spec'
5
5
  require 'spec/autorun'
6
6
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: noprocrast
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 5
10
- version: 0.1.5
9
+ - 6
10
+ version: 0.1.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Rob Watson
@@ -50,12 +50,12 @@ files:
50
50
  - README.md
51
51
  - Rakefile
52
52
  - VERSION
53
- - lib/noprocast.rb
54
- - noprocast.gemspec
55
- - spec/noprocast_spec.rb
53
+ - bin/noprocrast
54
+ - lib/noprocrast.rb
55
+ - noprocrast.gemspec
56
+ - spec/noprocrast_spec.rb
56
57
  - spec/spec.opts
57
58
  - spec/spec_helper.rb
58
- - bin/noprocrast
59
59
  has_rdoc: true
60
60
  homepage: http://github.com/rfwatson/noprocrast
61
61
  licenses: []
@@ -91,5 +91,5 @@ signing_key:
91
91
  specification_version: 3
92
92
  summary: Give procrastination a swift kick in the balls.
93
93
  test_files:
94
- - spec/noprocast_spec.rb
94
+ - spec/noprocrast_spec.rb
95
95
  - spec/spec_helper.rb