local_pac 0.1.9 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- data/features/show_known_pacfiles.feature +0 -0
- data/lib/local_pac/actions/create_directory.rb +3 -3
- data/lib/local_pac/actions/create_file.rb +1 -1
- data/lib/local_pac/actions/create_repository.rb +1 -1
- data/lib/local_pac/git_repository.rb +6 -8
- data/lib/local_pac/initializer.rb +0 -2
- data/lib/local_pac/logger.rb +0 -1
- data/lib/local_pac/version.rb +1 -1
- data/lib/local_pac.rb +0 -1
- data/spec/actions/create_directory_spec.rb +12 -0
- data/spec/actions/create_file_spec.rb +25 -0
- data/spec/actions/create_repository_spec.rb +12 -0
- metadata +3 -2
- data/lib/local_pac/fileable.rb +0 -12
File without changes
|
@@ -9,9 +9,9 @@ module LocalPac
|
|
9
9
|
public
|
10
10
|
|
11
11
|
def initialize(path, options = {}, fs_engine = FileUtils)
|
12
|
-
@path
|
13
|
-
@options
|
14
|
-
@fs_engine
|
12
|
+
@path = File.expand_path(path)
|
13
|
+
@options = options
|
14
|
+
@fs_engine = fs_engine
|
15
15
|
end
|
16
16
|
|
17
17
|
def run
|
@@ -10,7 +10,7 @@ module LocalPac
|
|
10
10
|
|
11
11
|
def initialize(name, destination, data, options = {}, engine = ErbGenerator, repository = TemplateRepository.new)
|
12
12
|
@name = name
|
13
|
-
@destination = destination
|
13
|
+
@destination = File.expand_path(destination)
|
14
14
|
@data = data
|
15
15
|
@options = options
|
16
16
|
@engine = engine
|
@@ -37,16 +37,14 @@ module LocalPac
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def pac_files
|
40
|
-
|
41
|
-
LocalPac.ui_logger.debug "I'm using the following storage path: \"#{storage_path}\"."
|
40
|
+
LocalPac.ui_logger.debug "I'm using the following storage path: \"#{storage_path}\"."
|
42
41
|
|
43
|
-
|
44
|
-
|
45
|
-
end
|
46
|
-
|
47
|
-
LocalPac.ui_logger.debug "Found the following files: \"#{files.join(", ")}\"."
|
48
|
-
files
|
42
|
+
files = Git.ls_tree(storage_path).collect do |l|
|
43
|
+
GitFile.new(l, storage_path)
|
49
44
|
end
|
45
|
+
|
46
|
+
LocalPac.ui_logger.debug "Found the following files: \"#{files.join(", ")}\"."
|
47
|
+
files
|
50
48
|
end
|
51
49
|
end
|
52
50
|
end
|
data/lib/local_pac/logger.rb
CHANGED
data/lib/local_pac/version.rb
CHANGED
data/lib/local_pac.rb
CHANGED
@@ -43,5 +43,17 @@ describe Actions::CreateDirectory do
|
|
43
43
|
|
44
44
|
expect(result).to include('Creating repository')
|
45
45
|
end
|
46
|
+
|
47
|
+
it 'resolves ~' do
|
48
|
+
action = with_environment 'HOME' => working_directory do
|
49
|
+
Actions::CreateDirectory.new('~/file')
|
50
|
+
end
|
51
|
+
|
52
|
+
silence(:stderr) do
|
53
|
+
action.run
|
54
|
+
end
|
55
|
+
|
56
|
+
expect(path_exists?('file')).to be_true
|
57
|
+
end
|
46
58
|
end
|
47
59
|
end
|
@@ -91,5 +91,30 @@ describe Actions::CreateFile do
|
|
91
91
|
|
92
92
|
expect(result).to include('Creating file')
|
93
93
|
end
|
94
|
+
|
95
|
+
it 'resolves ~' do
|
96
|
+
repository = double('TemplateRepository')
|
97
|
+
expect(repository).to receive(:find).with(:template)
|
98
|
+
|
99
|
+
data = double('Data')
|
100
|
+
|
101
|
+
engine_klass = Class.new do
|
102
|
+
def initialize(data)
|
103
|
+
end
|
104
|
+
|
105
|
+
def compile(template, destination)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
action = with_environment 'HOME' => working_directory do
|
110
|
+
Actions::CreateFile.new(:template, '~/file', data, { force: true }, engine_klass, repository)
|
111
|
+
end
|
112
|
+
|
113
|
+
silence(:stderr) do
|
114
|
+
action.run
|
115
|
+
end
|
116
|
+
|
117
|
+
expect(path_exists?('file')).to be_true
|
118
|
+
end
|
94
119
|
end
|
95
120
|
end
|
@@ -43,5 +43,17 @@ describe Actions::CreateRepository do
|
|
43
43
|
|
44
44
|
expect(result).to include('Creating repository')
|
45
45
|
end
|
46
|
+
|
47
|
+
it 'resolves ~' do
|
48
|
+
action = with_environment 'HOME' => working_directory do
|
49
|
+
Actions::CreateRepository.new('~/repo')
|
50
|
+
end
|
51
|
+
|
52
|
+
silence(:stderr) do
|
53
|
+
action.run
|
54
|
+
end
|
55
|
+
|
56
|
+
expect(path_exists?('repo')).to be_true
|
57
|
+
end
|
46
58
|
end
|
47
59
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: local_pac
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -165,6 +165,7 @@ files:
|
|
165
165
|
- features/fetch_proxy_pac.feature
|
166
166
|
- features/initializer.feature
|
167
167
|
- features/show_config.feature
|
168
|
+
- features/show_known_pacfiles.feature
|
168
169
|
- features/support/env.rb
|
169
170
|
- files/config.yaml
|
170
171
|
- files/git-hook.erb
|
@@ -178,7 +179,6 @@ files:
|
|
178
179
|
- lib/local_pac/erb_generator.rb
|
179
180
|
- lib/local_pac/exceptions.rb
|
180
181
|
- lib/local_pac/file_server.rb
|
181
|
-
- lib/local_pac/fileable.rb
|
182
182
|
- lib/local_pac/git.rb
|
183
183
|
- lib/local_pac/git_file.rb
|
184
184
|
- lib/local_pac/git_repository.rb
|
@@ -262,6 +262,7 @@ test_files:
|
|
262
262
|
- features/fetch_proxy_pac.feature
|
263
263
|
- features/initializer.feature
|
264
264
|
- features/show_config.feature
|
265
|
+
- features/show_known_pacfiles.feature
|
265
266
|
- features/support/env.rb
|
266
267
|
- spec/actions/create_directory_spec.rb
|
267
268
|
- spec/actions/create_file_spec.rb
|