local_pac 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -27,12 +27,10 @@ module LocalPac
27
27
  end
28
28
 
29
29
  def add_content(path, content = '', mode = 0100644, commit_info = default_commit_info)
30
- oid = repository.write(content, :blob)
31
30
  index = Rugged::Index.new
32
- index.add(:path => path, :oid => oid, :mode => mode)
33
31
 
34
32
  unless repository.empty?
35
- root_commit = @repository.lookup(@repository.head.target)
33
+ root_commit = repository.lookup(repository.head.target)
36
34
 
37
35
  root_commit.tree.walk_blobs(:postorder) do |r, e|
38
36
  e.merge!( { path: "#{r}#{e[:name]}" } )
@@ -42,6 +40,9 @@ module LocalPac
42
40
  end
43
41
  end
44
42
 
43
+ oid = repository.write(content, :blob)
44
+ index.add(:path => path, :oid => oid, :mode => mode)
45
+
45
46
  options = {}
46
47
  options[:tree] = index.write_tree(repository)
47
48
  options[:parents] = repository.empty? ? [] : [ repository.head.target ].compact
@@ -51,6 +52,24 @@ module LocalPac
51
52
  Rugged::Commit.create(repository, options)
52
53
  end
53
54
 
55
+ def added_files(old_commit_id, new_commit_id)
56
+ begin
57
+ commit_old = repository.lookup(old_commit_id)
58
+ rescue Rugged::OdbError
59
+ LocalPac.ui_logger.warn "Invalid commit id \"#{old_commit_id}\". Object cannot be found in repository \"#{storage_path}\"."
60
+ raise Exceptions::CommitDoesNotExist
61
+ end
62
+
63
+ begin
64
+ commit_new = repository.lookup(new_commit_id)
65
+ rescue Rugged::OdbError
66
+ LocalPac.ui_logger.warn "Invalid commit id \"#{old_commit_id}\". Object cannot be found in repository \"#{storage_path}\"."
67
+ raise Exceptions::CommitDoesNotExist
68
+ end
69
+
70
+ commit_old.diff(commit_new).deltas.keep_if { |d| [:added, :modified].include?(d.status) }.collect { |d| File.new(d.new_file[:path], repository.lookup(d.new_file[:oid]).content) }
71
+ end
72
+
54
73
  def find_file(name)
55
74
  files.fetch(name, null_file)
56
75
  end
@@ -39,7 +39,7 @@ module LocalPac
39
39
  def pac_files
40
40
  LocalPac.ui_logger.debug "I'm using the following storage path: \"#{storage_path}\"."
41
41
  files = files_in_repository.keep_if { |f| f.extension? '.pac' }
42
- LocalPac.ui_logger.debug "Found the following files: \"#{files.join(", ")}\"."
42
+ LocalPac.ui_logger.debug "Found the following files: #{files.collect { |f| "\"#{f.path}\"" }.join(", ")}."
43
43
 
44
44
  files
45
45
  end
@@ -13,23 +13,35 @@ module LocalPac
13
13
  end
14
14
 
15
15
  def run
16
- LocalPac.ui_logger.info "Creating pid directory: #{::File.dirname(config.pid_file)}"
17
- Actions::CreateDirectory.new(::File.dirname(config.pid_file), force: options[:force]).run
16
+ if options[:create_pid_directory]
17
+ LocalPac.ui_logger.info "Creating pid directory: #{::File.dirname(config.pid_file)}"
18
+ Actions::CreateDirectory.new(::File.dirname(config.pid_file), force: options[:force]).run
19
+ end
18
20
 
19
- LocalPac.ui_logger.info "Creating log directory: #{::File.dirname(config.access_log)}"
20
- Actions::CreateDirectory.new(::File.dirname(config.access_log), force: options[:force]).run
21
+ if options[:create_log_directory]
22
+ LocalPac.ui_logger.info "Creating log directory: #{::File.dirname(config.access_log)}"
23
+ Actions::CreateDirectory.new(::File.dirname(config.access_log), force: options[:force]).run
24
+ end
21
25
 
22
- LocalPac.ui_logger.info "Creating sass cache #{config.sass_cache}"
23
- Actions::CreateDirectory.new(config.sass_cache, force: options[:force]).run
26
+ if options[:create_sass_cache]
27
+ LocalPac.ui_logger.info "Creating sass cache #{config.sass_cache}"
28
+ Actions::CreateDirectory.new(config.sass_cache, force: options[:force]).run
29
+ end
24
30
 
25
- LocalPac.ui_logger.info "Creating local storage: #{config.local_storage}"
26
- Actions::CreateRepository.new(config.local_storage, bare: true, force: options[:force]).run
31
+ if options[:create_local_storage]
32
+ LocalPac.ui_logger.info "Creating local storage: #{config.local_storage}"
33
+ Actions::CreateRepository.new(config.local_storage, bare: true, force: options[:force]).run
34
+ end
27
35
 
28
- LocalPac.ui_logger.info "Creating pre-receive hook in local storage \"#{config.local_storage}\"."
29
- Actions::CreateFile.new(:'git-hook', ::File.join(config.local_storage, 'hooks', 'pre-receive'), Data.new(config), force: options[:force], executable: true).run
36
+ if options[:create_pre_receive_hook]
37
+ LocalPac.ui_logger.info "Creating pre-receive hook in local storage \"#{config.local_storage}\"."
38
+ Actions::CreateFile.new(:'git-hook.rb', ::File.join(config.local_storage, 'hooks', 'pre-receive'), Data.new(config), force: options[:force], executable: true).run
39
+ end
30
40
 
31
- LocalPac.ui_logger.info "Creating config file at \"#{config.config_file}\"."
32
- Actions::CreateFile.new(:'example-config', config.config_file, Data.new(config), force: options[:force], create_directories: true).run
41
+ if options[:create_config_file]
42
+ LocalPac.ui_logger.info "Creating config file at \"#{config.config_file}\"."
43
+ Actions::CreateFile.new(:'example-config', config.config_file, Data.new(config), force: options[:force], create_directories: true).run
44
+ end
33
45
 
34
46
  if options[:pre_seed]
35
47
  LocalPac.ui_logger.info "Adding examples to repository at #{config.local_storage}/examples"
@@ -14,7 +14,10 @@ module LocalPac
14
14
  def find(name)
15
15
  name = name.sub(/.pac$/, '').camelize.downcase.to_sym
16
16
  LocalPac.ui_logger.debug "Using the following name to find pac file: \":#{name}\"."
17
- storage[name]
17
+ file = storage[name]
18
+ LocalPac.ui_logger.debug "Returning the following file: \"#{file.path || 'not found' }\"."
19
+
20
+ file
18
21
  end
19
22
  end
20
23
  end
@@ -1,60 +1,22 @@
1
1
  # encoding: utf-8
2
2
  module LocalPac
3
- @config_semaphore = Mutex.new
4
- @logger_semaphore = Mutex.new
5
- @routing_semaphore = Mutex.new
3
+ @config = LocalPac::Config.new
4
+ @ui_logger = LocalPac::UiLogger.new
6
5
 
7
6
  class << self
8
- attr_reader :config_semaphore
9
- attr_reader :logger_semaphore
10
- attr_reader :routing_semaphore
11
- attr_accessor :debug_mode
7
+ attr_accessor :debug_mode, :config, :ui_logger
12
8
 
13
- def config
14
- config_semaphore.synchronize do
15
- @config ||= LocalPac::Config.new
16
- end
17
- end
18
-
19
- def config=(config)
20
- @config = config
21
- end
9
+ def enable_debug_mode
10
+ LocalPac.ui_logger.info "Activating debug mode."
22
11
 
23
- def ui_logger(local_logger = LocalPac::UiLogger.new)
24
- logger_semaphore.synchronize do
25
- @ui_logger ||= local_logger
26
- end
12
+ require 'pry'
13
+ require 'debugger'
14
+ rescue LoadError
15
+ LocalPac.ui_logger.error "You tried to enable debug-mode, but either 'pry'- or 'debugger'-gem are not installed. Please fix that before using the debug-switch again."
27
16
  end
28
17
 
29
18
  def error_id
30
19
  SecureRandom.hex
31
20
  end
32
-
33
- def routing
34
- routing_semaphore.synchronize do
35
- @routing ||= Rack::Builder.new do
36
- require_relative ::File.expand_path('../../../app/controllers/application_controller.rb', __FILE__)
37
- Dir.glob(::File.expand_path('../../../app/controllers/*.rb', __FILE__)).each { |f| require_relative f }
38
-
39
- map '/' do
40
- run LocalPac::App::FileServeController
41
- end
42
-
43
- map '/v1/pac/' do
44
- run LocalPac::App::FileServeController
45
- end
46
-
47
- map '/v1/lookup/' do
48
- run LocalPac::App::LookupController
49
- end
50
-
51
- map LocalPac::App::ApplicationController.assets_prefix do
52
- run LocalPac::App::ApplicationController.assets
53
- end
54
- end
55
- end
56
- end
57
21
  end
58
-
59
-
60
22
  end
@@ -2,10 +2,11 @@
2
2
  module LocalPac
3
3
  class PacFileValidator
4
4
  def valid?(file)
5
- PAC.source(file.content)
5
+ pac = PAC.source(file.content)
6
+ pac.find('http://www.example.com')
6
7
 
7
8
  true
8
- rescue
9
+ rescue StandardError
9
10
  false
10
11
  end
11
12
  end
@@ -4,6 +4,25 @@ module LocalPac
4
4
  @logger = ::Logger.new($stderr)
5
5
  end
6
6
 
7
+ def level=(l)
8
+ @logger.level = case l.to_s.to_sym
9
+ when :unknown
10
+ ::Logger::UNKNOWN
11
+ when :fatal
12
+ ::Logger::FATAL
13
+ when :error
14
+ ::Logger::ERROR
15
+ when :warn
16
+ ::Logger::WARN
17
+ when :info
18
+ ::Logger::INFO
19
+ when :debug
20
+ ::Logger::DEBUG
21
+ else
22
+ ::Logger::ERROR
23
+ end
24
+ end
25
+
7
26
  def method_missing(method, *args, &block)
8
27
  @logger.public_send method, *args
9
28
  end
@@ -1,4 +1,4 @@
1
1
  #main LocalPac
2
2
  module LocalPac
3
- VERSION = '0.3.0'
3
+ VERSION = '0.4.0'
4
4
  end
data/lib/local_pac.rb CHANGED
@@ -1,5 +1,19 @@
1
+ require 'sass'
2
+ require 'haml'
3
+ require 'i18n'
4
+ require 'i18n/backend/fallbacks'
5
+ require 'rack/contrib/locale'
6
+ require 'rack/contrib/nested_params'
7
+ require 'rack/contrib/post_body_content_type_parser'
8
+ require 'sprockets-helpers'
9
+ require 'sinatra'
10
+ require 'sinatra/param'
11
+ require "sinatra/json"
12
+ require 'json'
13
+
1
14
  require 'thor'
2
15
  require 'sys/proctable'
16
+ require 'set'
3
17
  require 'facter'
4
18
  require 'fileutils'
5
19
  require 'pathname'
@@ -16,22 +30,19 @@ require 'thread'
16
30
  require 'open3'
17
31
  require 'addressable/uri'
18
32
  require 'securerandom'
19
- #require 'fedux_org/stdlib/filesystem'
20
33
 
21
34
  require 'active_support/cache'
22
35
  require 'active_support/core_ext/string/inflections'
23
36
 
24
37
  require 'local_pac/exceptions'
38
+ require 'local_pac/config'
39
+ require 'local_pac/ui_logger'
25
40
  require 'local_pac/main'
26
41
  require 'local_pac/access_logger'
27
42
  require 'local_pac/null_access_logger'
28
- require 'local_pac/ui_logger'
29
-
30
- LocalPac.ui_logger.level = ::Logger::UNKNOWN
31
43
 
32
44
  require 'local_pac/git_repository'
33
45
  require 'local_pac/git_storage'
34
- require 'local_pac/config'
35
46
  require 'local_pac/runner'
36
47
  require 'local_pac/erb_generator'
37
48
  require 'local_pac/data'
data/local_pac.gemspec CHANGED
@@ -1,4 +1,4 @@
1
- # coding: utf-8
1
+ # encoding: utf-8
2
2
  lib = ::File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'local_pac/version'
@@ -40,6 +40,8 @@ EOS
40
40
  spec.add_runtime_dependency 'facter'
41
41
  spec.add_runtime_dependency 'pager'
42
42
  spec.add_runtime_dependency 'sys-proctable'
43
+ spec.add_runtime_dependency 'sinatra-param'
44
+ spec.add_runtime_dependency 'sinatra-contrib'
43
45
  spec.add_runtime_dependency 'rugged'
44
46
  # spec.add_runtime_dependency 'fedux_org-stdlib'
45
47
  end
@@ -34,7 +34,7 @@ describe Actions::AddExamplesToLocalStorage do
34
34
  action.run
35
35
 
36
36
  result = capture(:stderr) do
37
- LocalPac.ui_logger.level = ::Logger::INFO
37
+ LocalPac.ui_logger.level = :info
38
38
  action.run
39
39
  end
40
40
 
@@ -24,7 +24,7 @@ describe Actions::CreateDirectory do
24
24
  action = Actions::CreateDirectory.new(::File.join(working_directory, 'repo'))
25
25
 
26
26
  result = capture(:stderr) do
27
- LocalPac.ui_logger.level = ::Logger::INFO
27
+ LocalPac.ui_logger.level = :info
28
28
  action.run
29
29
  end
30
30
 
@@ -37,7 +37,7 @@ describe Actions::CreateDirectory do
37
37
  action = Actions::CreateDirectory.new(::File.join(working_directory, 'repo'), force: true)
38
38
 
39
39
  result = capture(:stderr) do
40
- LocalPac.ui_logger.level = ::Logger::INFO
40
+ LocalPac.ui_logger.level = :info
41
41
  action.run
42
42
  end
43
43
 
@@ -79,7 +79,7 @@ describe Actions::CreateFile do
79
79
  file = create_file('file')
80
80
  action = Actions::CreateFile.new(:template, file, data, {}, engine_klass, repository)
81
81
  result = capture(:stderr) do
82
- LocalPac.ui_logger.level = ::Logger::INFO
82
+ LocalPac.ui_logger.level = :info
83
83
  action.run
84
84
  end
85
85
 
@@ -104,7 +104,7 @@ describe Actions::CreateFile do
104
104
  action = Actions::CreateFile.new(:template, file, data, { force: true }, engine_klass, repository)
105
105
 
106
106
  result = capture(:stderr) do
107
- LocalPac.ui_logger.level = ::Logger::INFO
107
+ LocalPac.ui_logger.level = :info
108
108
  action.run
109
109
  end
110
110
 
@@ -24,7 +24,7 @@ describe Actions::CreateRepository do
24
24
  action = Actions::CreateRepository.new(::File.join(working_directory, 'repo'))
25
25
 
26
26
  result = capture(:stderr) do
27
- LocalPac.ui_logger.level = ::Logger::INFO
27
+ LocalPac.ui_logger.level = :info
28
28
  action.run
29
29
  end
30
30
 
@@ -37,7 +37,7 @@ describe Actions::CreateRepository do
37
37
  action = Actions::CreateRepository.new(::File.join(working_directory, 'repo'), force: true)
38
38
 
39
39
  result = capture(:stderr) do
40
- LocalPac.ui_logger.level = ::Logger::INFO
40
+ LocalPac.ui_logger.level = :info
41
41
  action.run
42
42
  end
43
43
 
@@ -45,7 +45,7 @@ describe Actions::SendSignal do
45
45
  end
46
46
 
47
47
  it 'logs a warning if pid file does not exist' do
48
- LocalPac.ui_logger.level = ::Logger::WARN
48
+ LocalPac.ui_logger.level = :warn
49
49
 
50
50
  result = capture(:stderr) do
51
51
  Actions::SendSignal.new(:USR1, 'pid_file').run
@@ -0,0 +1,105 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+ require 'spec_helper_features'
4
+
5
+ describe 'Lookup proxy for url' do
6
+ context '/v1/githook' do
7
+ let(:valid_pac_file1) do <<-EOS.strip_heredoc.chomp
8
+ function FindProxyForURL(url, host) {
9
+ return "DIRECT";
10
+ }
11
+ EOS
12
+ end
13
+
14
+ let(:valid_pac_file2) do <<-EOS.strip_heredoc.chomp
15
+ function FindProxyForURL(url, host) {
16
+ return "PROXY 127.0.0.1:3128";
17
+ }
18
+ EOS
19
+ end
20
+
21
+ let(:valid_pac_file3) do <<-EOS.strip_heredoc.chomp
22
+ function FindProxyForURL(url, host) {
23
+ return "PROXY 10.0.0.1:3128";
24
+ }
25
+ EOS
26
+ end
27
+
28
+ let(:git_repo_path) { File.join(working_directory, 'git_repo.git') }
29
+ let(:git_repo) { GitRepository.create(git_repo_path) }
30
+
31
+ before :each do
32
+ config = Class.new do
33
+ include FeduxOrg::Stdlib::Filesystem
34
+
35
+ def root_directory
36
+ ::File.expand_path('../../../', __FILE__)
37
+ end
38
+
39
+ def local_storage
40
+ ::File.join(working_directory, 'git_repo.git')
41
+ end
42
+
43
+ def api_key
44
+ SecureRandom.hex
45
+ end
46
+ end.new
47
+
48
+ LocalPac.config = config
49
+ Capybara.app = LocalPac::App::GitHookController
50
+ end
51
+
52
+ context 'checks proxy.pac' do
53
+ it 'succeeds on valid proxy pac' do
54
+ oid1 = git_repo.add_content('file1.pac', valid_pac_file1)
55
+ oid2 = git_repo.add_content('file2.pac', valid_pac_file2)
56
+
57
+ repo = Rugged::Repository.new(git_repo_path)
58
+ commit1 = repo.lookup(oid1)
59
+ commit2 = repo.lookup(oid2)
60
+
61
+ params = {
62
+ old_commit_id: commit1.oid,
63
+ new_commit_id: commit2.oid,
64
+ reference: 'refs/heads/master',
65
+ api_key: LocalPac.config.api_key
66
+ }
67
+
68
+ response = page.driver.post('/pre-receive', params )
69
+ result = JSON.parse(response.body)['result']
70
+
71
+ expect(result).to eq('success')
72
+ end
73
+
74
+ it 'fails on invalid proxy.pac' do
75
+ oid1 = git_repo.add_content('file1.pac', valid_pac_file1)
76
+ oid2 = git_repo.add_content('dir/file2.pac', 'asdf()')
77
+ oid3 = git_repo.add_content('dir/file3.pac', valid_pac_file3)
78
+
79
+ repo = Rugged::Repository.new(git_repo_path)
80
+ commit1 = repo.lookup(oid1)
81
+ commit2 = repo.lookup(oid2)
82
+ commit3 = repo.lookup(oid3)
83
+
84
+ params = {
85
+ old_commit_id: commit1.oid,
86
+ new_commit_id: commit3.oid,
87
+ reference: 'refs/heads/master',
88
+ api_key: LocalPac.config.api_key
89
+ }
90
+
91
+ response = page.driver.post('/pre-receive', params )
92
+ result = JSON.parse(response.body)['error_summary']
93
+
94
+ expect(result).to eq('Invalid PAC-file...')
95
+ expect(response.status).to eq(403)
96
+ end
97
+ end
98
+
99
+ it 'returns a error message for an invalid url' do
100
+ visit('/blub-gith-hook')
101
+ expect(page).to have_content('Unknown git hook...')
102
+ expect(page).to have_content('/blub-gith-hook')
103
+ end
104
+ end
105
+ end
@@ -18,13 +18,6 @@ describe 'Lookup proxy for url' do
18
18
  EOS
19
19
  end
20
20
 
21
- let(:invalid_pac_file) do <<-EOS.strip_heredoc.chomp
22
- function FindProxyForURL(url, host) {
23
- asdfasdf();
24
- }
25
- EOS
26
- end
27
-
28
21
  let(:git_repo) { File.join(working_directory, 'git_repo.git') }
29
22
 
30
23
  before :each do
@@ -61,4 +61,68 @@ describe GitRepository do
61
61
  expect(f).to be(null_file)
62
62
  end
63
63
  end
64
+ context '#added_files' do
65
+ it 'returns all added files' do
66
+ repo_path = File.join(working_directory, 'git_repo')
67
+ Rugged::Repository.init_at(repo_path)
68
+
69
+ file_creator = double('file_creator')
70
+ null_file = double('null_file')
71
+
72
+ repo = GitRepository.new(repo_path, file_creator, null_file)
73
+ oid1 = repo.add_content('file1.txt', 'asdf1')
74
+ repo.add_content('file2.txt', 'asdf2')
75
+ oid3 = repo.add_content('file3.txt', 'asdf3')
76
+
77
+ result = repo.added_files(oid1, oid3)
78
+ expect(result.size).to eq(2)
79
+ expect(result.first.path).to eq('file2.txt')
80
+ end
81
+
82
+ it 'returns empty array on invalid commit ids' do
83
+ repo_path = File.join(working_directory, 'git_repo')
84
+ Rugged::Repository.init_at(repo_path)
85
+
86
+ file_creator = double('file_creator')
87
+ null_file = double('null_file')
88
+
89
+ repo = GitRepository.new(repo_path, file_creator, null_file)
90
+ expect {
91
+ result = repo.added_files('00000000000', '00000000000')
92
+ }.to raise_error Exceptions::CommitDoesNotExist
93
+ end
94
+
95
+ it 'returns an empty array if nothing has changed' do
96
+ repo_path = File.join(working_directory, 'git_repo')
97
+ Rugged::Repository.init_at(repo_path)
98
+
99
+ file_creator = double('file_creator')
100
+ null_file = double('null_file')
101
+
102
+ repo = GitRepository.new(repo_path, file_creator, null_file)
103
+ oid1 = repo.add_content('file1.txt', 'asdf1')
104
+ repo.add_content('file1.txt', 'asdf1')
105
+ oid3 = repo.add_content('file1.txt', 'asdf1')
106
+
107
+ result = repo.added_files(oid1, oid3)
108
+ expect(result).to eq([])
109
+ end
110
+
111
+ it 'returns all modified and added files' do
112
+ repo_path = File.join(working_directory, 'git_repo')
113
+ Rugged::Repository.init_at(repo_path)
114
+
115
+ file_creator = double('file_creator')
116
+ null_file = double('null_file')
117
+
118
+ repo = GitRepository.new(repo_path, file_creator, null_file)
119
+ oid1 = repo.add_content('file1.txt', 'asdf1')
120
+ repo.add_content('file1.txt', 'asdf2')
121
+ oid3 = repo.add_content('file3.txt', 'asdf3')
122
+
123
+ result = repo.added_files(oid1, oid3)
124
+ expect(result.size).to eq(2)
125
+ expect(result.first.path).to eq('file1.txt')
126
+ end
127
+ end
64
128
  end
@@ -14,23 +14,31 @@ describe Initializer do
14
14
  :config_file: #{File.join(working_directory, 'config', 'config.yaml')}
15
15
  :gem_path: []
16
16
  EOS
17
- config_file = create_file('config_spec.yaml', config_string)
18
17
 
19
- config = LocalPac::Config.new(config_file)
20
- initializer = Initializer.new({}, config)
21
- result = capture(:stdout) do
22
- silence(:stderr) do
23
- initializer.run
24
- end
18
+ config_file = create_file('config_spec.yaml', config_string)
19
+
20
+ config = LocalPac::Config.new(config_file)
21
+ initializer = Initializer.new({
22
+ create_pid_directory: true,
23
+ create_log_directory: true,
24
+ create_sass_cache: true,
25
+ create_local_storage: true,
26
+ create_pre_receive_hook: true,
27
+ create_config_file: true,
28
+ }, config)
29
+ result = capture(:stdout) do
30
+ silence(:stderr) do
31
+ initializer.run
25
32
  end
33
+ end
26
34
 
27
- expect(path_exists?('log')).to be_true
28
- expect(path_exists?('config/config.yaml')).to be_true
29
- expect(path_exists?('cache/sass')).to be_true
30
- expect(path_exists?('data/storage.git')).to be_true
31
- expect(path_exists?(::File.join('data', 'storage.git', 'hooks', 'pre-receive'))).to be_true
32
- expect(path_exists?('run')).to be_true
33
- expect(result).to include("access_log: #{File.expand_path(::File.join(working_directory, 'log', 'access.log'))}")
35
+ expect(path_exists?('log')).to be_true
36
+ expect(path_exists?('config/config.yaml')).to be_true
37
+ expect(path_exists?('cache/sass')).to be_true
38
+ expect(path_exists?('data/storage.git')).to be_true
39
+ expect(path_exists?(::File.join('data', 'storage.git', 'hooks', 'pre-receive'))).to be_true
40
+ expect(path_exists?('run')).to be_true
41
+ expect(result).to include("access_log: #{File.expand_path(::File.join(working_directory, 'log', 'access.log'))}")
34
42
  end
35
43
 
36
44
  it 'adds examples on request' do
@@ -46,7 +54,10 @@ describe Initializer do
46
54
  config_file = create_file('config_spec.yaml', config_string)
47
55
 
48
56
  config = LocalPac::Config.new(config_file)
49
- initializer = Initializer.new({pre_seed: true}, config)
57
+ initializer = Initializer.new({
58
+ pre_seed: true,
59
+ create_local_storage: true,
60
+ }, config)
50
61
  silence(:stdout) do
51
62
  silence(:stderr) do
52
63
  initializer.run