localdev 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +7 -0
  3. data/bin/localdev +0 -0
  4. data/lib/localdev.rb +11 -4
  5. metadata +24 -44
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 80ee8a71006d5f83bb9d7337d69694981c8f58bc
4
+ data.tar.gz: 3d845faf2a9dbd5ddbc51a33f13ab26493856805
5
+ SHA512:
6
+ metadata.gz: cd1eac2f6ccbd745aa334ab385e1e461e7218821fa5fe08708d25d6bd3b875bc185ab50fd2179e5324e400759b4566394467be09febc3aa0b51ec3b2c02a9814
7
+ data.tar.gz: 9b2a9cd25c95330a5154c04b286f3bd38a26fa9119000c67c64350abd21d572ad2110413c5ae4b5367c3aa5211f503dc85542ceae0a0f2bbdae609f09e3325ff
data/README.md CHANGED
@@ -4,6 +4,7 @@ Localdev is a Ruby command line script to register domains that you sometimes us
4
4
 
5
5
  Available commands:
6
6
 
7
+ * `localdev list` — lists the localdev domains
7
8
  * `localdev add {domain}` — adds the specified domain
8
9
  * `localdev remove {domain}` — removes the specified domain
9
10
  * `localdev on` — enables local development
@@ -12,6 +13,12 @@ Available commands:
12
13
 
13
14
  Note: if local development is on, `add` and `remove` commands will immediately update the hosts file and trigger a DNS flush.
14
15
 
16
+ Tip: To avoid being prompted by `sudo` for your password, you can add a line like this to your `/etc/sudoers` file (replace `markjaquith` with your user name):
17
+
18
+ ```
19
+ markjaquith ALL = NOPASSWD: /usr/bin/localdev
20
+ ```
21
+
15
22
  ## Installation
16
23
 
17
24
  To install Localdev, use RubyGems:
File without changes
@@ -20,7 +20,7 @@
20
20
  require 'digest/md5'
21
21
 
22
22
  class Localdev
23
- VERSION = '0.3.1'
23
+ VERSION = '0.3.2'
24
24
 
25
25
  def initialize
26
26
  @debug = false
@@ -28,7 +28,7 @@ class Localdev
28
28
  @hosts = '/etc/hosts'
29
29
  @start = '#==LOCALDEV==#'
30
30
  @end = '#/==LOCALDEV==#'
31
- if !ARGV.first.nil? && [:on, :off, :add, :remove, :list].include?( ARGV.first.to_sym )
31
+ if !ARGV.first.nil? && [:on, :off, :add, :remove, :clear].include?( ARGV.first.to_sym )
32
32
  require_sudo
33
33
  ensure_localdev_exists
34
34
  end
@@ -38,7 +38,7 @@ class Localdev
38
38
  case command
39
39
  when :"--v", :"--version"
40
40
  info
41
- when :on, :off, :status, :list
41
+ when :on, :off, :status, :list, :clear
42
42
  send command
43
43
  when :add, :remove
44
44
  require_sudo
@@ -46,7 +46,7 @@ class Localdev
46
46
  ensure_localdev_exists
47
47
  send command, object
48
48
  when nil, '--help', '-h'
49
- exit_message "Usage: localdev [on|off|status]\n localdev [add|remove] domain"
49
+ exit_message "Usage: localdev [on|off|status|list|clear]\n localdev [add|remove] domain"
50
50
  else
51
51
  exit_error_message "Invalid command"
52
52
  end
@@ -158,6 +158,13 @@ class Localdev
158
158
  status
159
159
  end
160
160
 
161
+ def clear
162
+ update_localdev {|domains| domains.clear() }
163
+ enable if :on == get_status
164
+ puts "Removed all domains"
165
+ status
166
+ end
167
+
161
168
  def get_status
162
169
  status = :off
163
170
  return status unless File.readable? @hosts
metadata CHANGED
@@ -1,33 +1,24 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: localdev
3
- version: !ruby/object:Gem::Version
4
- hash: 17
5
- prerelease:
6
- segments:
7
- - 0
8
- - 3
9
- - 1
10
- version: 0.3.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.2
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Mark Jaquith
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2011-07-03 00:00:00 Z
11
+ date: 2015-04-01 00:00:00.000000000 Z
19
12
  dependencies: []
20
-
21
- description: Localdev manages part of your hosts file and lets you specify domains to host locally. You can quickly enable or disable local hosting of those domains.
22
- email:
13
+ description: Localdev manages part of your hosts file and lets you specify domains
14
+ to host locally. You can quickly enable or disable local hosting of those domains.
15
+ email:
23
16
  - mark@jaquith.me
24
- executables:
17
+ executables:
25
18
  - localdev
26
19
  extensions: []
27
-
28
20
  extra_rdoc_files: []
29
-
30
- files:
21
+ files:
31
22
  - .gitignore
32
23
  - COPYING
33
24
  - README.md
@@ -36,36 +27,25 @@ files:
36
27
  - localdev.gemspec
37
28
  homepage: http://github.com/markjaquith/Localdev
38
29
  licenses: []
39
-
30
+ metadata: {}
40
31
  post_install_message:
41
32
  rdoc_options: []
42
-
43
- require_paths:
33
+ require_paths:
44
34
  - lib
45
- required_ruby_version: !ruby/object:Gem::Requirement
46
- none: false
47
- requirements:
48
- - - ">="
49
- - !ruby/object:Gem::Version
50
- hash: 3
51
- segments:
52
- - 0
53
- version: "0"
54
- required_rubygems_version: !ruby/object:Gem::Requirement
55
- none: false
56
- requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- hash: 3
60
- segments:
61
- - 0
62
- version: "0"
35
+ required_ruby_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ required_rubygems_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
63
45
  requirements: []
64
-
65
46
  rubyforge_project:
66
- rubygems_version: 1.8.5
47
+ rubygems_version: 2.0.14
67
48
  signing_key:
68
- specification_version: 3
49
+ specification_version: 4
69
50
  summary: Add locally hosted domains to your hosts file, and disable/enable their use
70
51
  test_files: []
71
-