dotify 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +68 -8
- data/dotify.gemspec +3 -0
- data/lib/dotify.rb +7 -2
- data/lib/dotify/cli.rb +115 -55
- data/lib/dotify/config.rb +11 -43
- data/lib/dotify/file_list.rb +41 -0
- data/lib/dotify/files.rb +28 -29
- data/lib/dotify/version.rb +1 -1
- data/lib/dotify/version_checker.rb +29 -0
- data/spec/dotify/cli_spec.rb +0 -1
- data/spec/dotify/config_spec.rb +25 -45
- data/spec/dotify/file_list_spec.rb +113 -0
- data/spec/dotify/files_spec.rb +55 -33
- data/spec/dotify/version_checker_spec.rb +33 -0
- data/spec/fixtures/.dotrc-default +5 -2
- data/spec/fixtures/vcr/version_check.yml +74 -0
- data/spec/spec_helper.rb +0 -3
- data/spec/support/vcr.rb +6 -0
- data/spec/support/with_constants.rb +49 -0
- data/templates/.dotrc +14 -0
- data/templates/.gitkeep +0 -0
- metadata +64 -6
- data/spec/fixtures/.dotrc-mattbridges +0 -3
- data/spec/support/fake.rb +0 -39
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'dotify'
|
3
|
+
require 'dotify/version_checker'
|
4
|
+
|
5
|
+
describe Dotify::VersionChecker do
|
6
|
+
it Dotify::VersionChecker, "#run_check!" do
|
7
|
+
VCR.use_cassette "version_check" do
|
8
|
+
Dotify::VersionChecker.version.should == '0.2.0'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
describe Dotify::VersionChecker, "#out_of_date?" do
|
12
|
+
it "should be return the correct value if version is not current" do
|
13
|
+
Dotify::VersionChecker.stub(:current?).and_return(false)
|
14
|
+
Dotify::VersionChecker.out_of_date?.should == true
|
15
|
+
Dotify::VersionChecker.stub(:current?).and_return(true)
|
16
|
+
Dotify::VersionChecker.out_of_date?.should == false
|
17
|
+
end
|
18
|
+
end
|
19
|
+
describe Dotify::VersionChecker, "#current?" do
|
20
|
+
it "should be false if version is not current" do
|
21
|
+
with_constants "Dotify::VERSION" => '0.2.0' do
|
22
|
+
Dotify::VersionChecker.stub(:version).and_return('0.1.9')
|
23
|
+
Dotify::VersionChecker.current?.should == false
|
24
|
+
end
|
25
|
+
end
|
26
|
+
it "should be true if version is current" do
|
27
|
+
with_constants "Dotify::VERSION" => '0.2.0' do
|
28
|
+
Dotify::VersionChecker.stub(:version).and_return('0.2.0')
|
29
|
+
Dotify::VersionChecker.current?.should == true
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://rubygems.org/api/v1/versions/dotify.json
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- ! '*/*'
|
12
|
+
User-Agent:
|
13
|
+
- Ruby
|
14
|
+
response:
|
15
|
+
status:
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
Server:
|
20
|
+
- nginx/1.2.0
|
21
|
+
Date:
|
22
|
+
- Wed, 27 Jun 2012 23:10:05 GMT
|
23
|
+
Content-Type:
|
24
|
+
- application/json; charset=utf-8
|
25
|
+
Content-Length:
|
26
|
+
- '1793'
|
27
|
+
Connection:
|
28
|
+
- keep-alive
|
29
|
+
X-Powered-By:
|
30
|
+
- Phusion Passenger (mod_rails/mod_rack) 3.0.11
|
31
|
+
X-Frame-Options:
|
32
|
+
- sameorigin
|
33
|
+
X-Xss-Protection:
|
34
|
+
- 1; mode=block
|
35
|
+
X-Ua-Compatible:
|
36
|
+
- IE=Edge,chrome=1
|
37
|
+
Etag:
|
38
|
+
- ! '"5677f4550f3cae2a62a538ddbdac5ed0"'
|
39
|
+
Cache-Control:
|
40
|
+
- max-age=0, private, must-revalidate
|
41
|
+
X-Request-Id:
|
42
|
+
- 52fdb58a9da1c5fed008181f55035d08
|
43
|
+
X-Runtime:
|
44
|
+
- '0.020066'
|
45
|
+
X-Rack-Cache:
|
46
|
+
- miss
|
47
|
+
Status:
|
48
|
+
- '200'
|
49
|
+
body:
|
50
|
+
encoding: US-ASCII
|
51
|
+
string: ! '[{"authors":"Matt Bridges","built_at":"2012-06-26T00:00:00Z","description":"A
|
52
|
+
CLI Tool for managing your dotfiles","downloads_count":45,"number":"0.2.0","summary":"A
|
53
|
+
CLI Tool for managing your dotfiles","platform":"ruby","prerelease":false},{"authors":"Matt
|
54
|
+
Bridges","built_at":"2012-06-26T00:00:00Z","description":"A CLI Tool for managing
|
55
|
+
your dotfiles","downloads_count":70,"number":"0.1.1","summary":"A CLI Tool
|
56
|
+
for managing your dotfiles","platform":"ruby","prerelease":false},{"authors":"Matt
|
57
|
+
Bridges","built_at":"2012-06-25T00:00:00Z","description":"A CLI Tool for managing
|
58
|
+
your dotfiles","downloads_count":47,"number":"0.1","summary":"A CLI Tool for
|
59
|
+
managing your dotfiles","platform":"ruby","prerelease":false},{"authors":"Matt
|
60
|
+
Bridges","built_at":"2012-06-19T00:00:00Z","description":"A CLI Tool for managing
|
61
|
+
your dotfiles and profiles.","downloads_count":63,"number":"0.0.3","summary":"A
|
62
|
+
CLI Tool for managing your dotfiles and profiles.","platform":"ruby","prerelease":false},{"authors":"Matt
|
63
|
+
Bridges","built_at":"2012-06-18T00:00:00Z","description":"A CLI Tool for managing
|
64
|
+
your dotfiles and profiles.","downloads_count":67,"number":"0.0.2.1","summary":"A
|
65
|
+
CLI Tool for managing your dotfiles and profiles.","platform":"ruby","prerelease":false},{"authors":"Matt
|
66
|
+
Bridges","built_at":"2012-06-18T00:00:00Z","description":"A CLI Tool for managing
|
67
|
+
your dotfiles and profiles.","downloads_count":63,"number":"0.0.2","summary":"A
|
68
|
+
CLI Tool for managing your dotfiles and profiles.","platform":"ruby","prerelease":false},{"authors":"Matt
|
69
|
+
Bridges","built_at":"2012-06-13T00:00:00Z","description":"A CLI Tool for managing
|
70
|
+
your dotfiles and profiles.","downloads_count":71,"number":"0.0.1","summary":"A
|
71
|
+
CLI Tool for managing your dotfiles and profiles.","platform":"ruby","prerelease":false}]'
|
72
|
+
http_version:
|
73
|
+
recorded_at: Wed, 27 Jun 2012 23:06:21 GMT
|
74
|
+
recorded_with: VCR 2.2.2
|
data/spec/spec_helper.rb
CHANGED
data/spec/support/vcr.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
module Kernel
|
2
|
+
def silence_warnings
|
3
|
+
with_warnings(nil) { yield }
|
4
|
+
end
|
5
|
+
|
6
|
+
def with_warnings(flag)
|
7
|
+
old_verbose, $VERBOSE = $VERBOSE, flag
|
8
|
+
yield
|
9
|
+
ensure
|
10
|
+
$VERBOSE = old_verbose
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def constantize(camel_cased_word)
|
15
|
+
names = camel_cased_word.split('::')
|
16
|
+
names.shift if names.empty? || names.first.empty?
|
17
|
+
|
18
|
+
constant = Object
|
19
|
+
names.each do |name|
|
20
|
+
constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
|
21
|
+
end
|
22
|
+
constant
|
23
|
+
end
|
24
|
+
|
25
|
+
def parse(constant)
|
26
|
+
source, _, constant_name = constant.to_s.rpartition('::')
|
27
|
+
|
28
|
+
[constantize(source), constant_name]
|
29
|
+
end
|
30
|
+
|
31
|
+
def with_constants(constants, &block)
|
32
|
+
saved_constants = {}
|
33
|
+
constants.each do |constant, val|
|
34
|
+
source_object, const_name = parse(constant)
|
35
|
+
|
36
|
+
saved_constants[constant] = source_object.const_get(const_name)
|
37
|
+
Kernel::silence_warnings { source_object.const_set(const_name, val) }
|
38
|
+
end
|
39
|
+
|
40
|
+
begin
|
41
|
+
block.call
|
42
|
+
ensure
|
43
|
+
constants.each do |constant, val|
|
44
|
+
source_object, const_name = parse(constant)
|
45
|
+
|
46
|
+
Kernel::silence_warnings { source_object.const_set(const_name, saved_constants[constant]) }
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
data/templates/.dotrc
ADDED
data/templates/.gitkeep
ADDED
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dotify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -27,6 +27,22 @@ dependencies:
|
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: json
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
30
46
|
- !ruby/object:Gem::Dependency
|
31
47
|
name: rspec
|
32
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -43,6 +59,38 @@ dependencies:
|
|
43
59
|
- - ! '>='
|
44
60
|
- !ruby/object:Gem::Version
|
45
61
|
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: webmock
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: vcr
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
46
94
|
description: A CLI Tool for managing your dotfiles
|
47
95
|
email:
|
48
96
|
- mbridges.91@gmail.com
|
@@ -64,15 +112,22 @@ files:
|
|
64
112
|
- lib/dotify/cli.rb
|
65
113
|
- lib/dotify/config.rb
|
66
114
|
- lib/dotify/errors.rb
|
115
|
+
- lib/dotify/file_list.rb
|
67
116
|
- lib/dotify/files.rb
|
68
117
|
- lib/dotify/version.rb
|
118
|
+
- lib/dotify/version_checker.rb
|
69
119
|
- spec/dotify/cli_spec.rb
|
70
120
|
- spec/dotify/config_spec.rb
|
121
|
+
- spec/dotify/file_list_spec.rb
|
71
122
|
- spec/dotify/files_spec.rb
|
123
|
+
- spec/dotify/version_checker_spec.rb
|
72
124
|
- spec/fixtures/.dotrc-default
|
73
|
-
- spec/fixtures
|
125
|
+
- spec/fixtures/vcr/version_check.yml
|
74
126
|
- spec/spec_helper.rb
|
75
|
-
- spec/support/
|
127
|
+
- spec/support/vcr.rb
|
128
|
+
- spec/support/with_constants.rb
|
129
|
+
- templates/.dotrc
|
130
|
+
- templates/.gitkeep
|
76
131
|
homepage: https://github.com/mattdbridges/dotify
|
77
132
|
licenses: []
|
78
133
|
post_install_message:
|
@@ -100,8 +155,11 @@ summary: A CLI Tool for managing your dotfiles
|
|
100
155
|
test_files:
|
101
156
|
- spec/dotify/cli_spec.rb
|
102
157
|
- spec/dotify/config_spec.rb
|
158
|
+
- spec/dotify/file_list_spec.rb
|
103
159
|
- spec/dotify/files_spec.rb
|
160
|
+
- spec/dotify/version_checker_spec.rb
|
104
161
|
- spec/fixtures/.dotrc-default
|
105
|
-
- spec/fixtures
|
162
|
+
- spec/fixtures/vcr/version_check.yml
|
106
163
|
- spec/spec_helper.rb
|
107
|
-
- spec/support/
|
164
|
+
- spec/support/vcr.rb
|
165
|
+
- spec/support/with_constants.rb
|
data/spec/support/fake.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
|
3
|
-
class Fake
|
4
|
-
|
5
|
-
def self.paths
|
6
|
-
path = File.dirname(File.dirname(__FILE__))
|
7
|
-
fake_root = File.join(path, 'fake-root')
|
8
|
-
dotify = File.join(fake_root, '.dotify')
|
9
|
-
[fake_root, dotify]
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.tearup
|
13
|
-
fake_root, dotify = paths
|
14
|
-
FileUtils.mkdir_p fake_root
|
15
|
-
reset
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.teardown
|
19
|
-
fake_root, dotify = paths
|
20
|
-
FileUtils.rm_rf fake_root
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.reset
|
24
|
-
fake_root, dotify = paths
|
25
|
-
FileUtils.mkdir_p dotify
|
26
|
-
FileUtils.touch File.join(dotify, '.vimrc')
|
27
|
-
FileUtils.touch File.join(dotify, '.bashrc')
|
28
|
-
FileUtils.touch File.join(dotify, '.zshrc')
|
29
|
-
end
|
30
|
-
|
31
|
-
def self.root_path
|
32
|
-
fake_root, dotify = paths
|
33
|
-
fake_root
|
34
|
-
end
|
35
|
-
def self.dotify_path
|
36
|
-
fake_root, dotify = paths
|
37
|
-
dotify
|
38
|
-
end
|
39
|
-
end
|