local_pac 0.5.0 → 0.6.1
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.
- data/.travis.yml +1 -1
- data/Gemfile.lock +1 -3
- data/app/controllers/git_hook_controller.rb +25 -4
- data/app/controllers/lookup_controller.rb +1 -0
- data/app/locales/en.yml +9 -1
- data/bin/local_pac +5 -129
- data/config.ru +2 -2
- data/features/{show_status.feature_ → show_status.feature} +2 -1
- data/features/step_definitions.rb +4 -0
- data/lib/local_pac.rb +9 -2
- data/lib/local_pac/actions/get_system_information.rb +2 -2
- data/lib/local_pac/actions/handle_error.rb +26 -0
- data/lib/local_pac/actions/initialize_application.rb +71 -0
- data/lib/local_pac/actions/reload_local_storage.rb +2 -0
- data/lib/local_pac/actions/show_application_status.rb +39 -0
- data/lib/local_pac/actions/show_pac_file.rb +29 -0
- data/lib/local_pac/actions/validate_pac_file.rb +34 -0
- data/lib/local_pac/cli/main.rb +122 -0
- data/lib/local_pac/cli/reload.rb +8 -4
- data/lib/local_pac/cli/show.rb +34 -0
- data/lib/local_pac/cli/validate.rb +22 -0
- data/lib/local_pac/config.rb +1 -1
- data/lib/local_pac/error_handler.rb +60 -0
- data/lib/local_pac/exceptions.rb +6 -0
- data/lib/local_pac/git_storage.rb +30 -10
- data/lib/local_pac/pac_file_validator.rb +17 -2
- data/lib/local_pac/version.rb +1 -1
- data/local_pac.gemspec +0 -2
- data/script/acceptance_test +4 -0
- data/script/bootstrap +5 -0
- data/script/ci +3 -0
- data/script/release +3 -0
- data/script/unit_test +3 -0
- data/spec/actions/handle_error_spec.rb +29 -0
- data/spec/{initializer_spec.rb → actions/initialize_application_spec.rb} +3 -3
- data/spec/{application_status_spec.rb → actions/show_application_status_spec.rb} +5 -5
- data/spec/actions/show_pac_file_spec.rb +36 -0
- data/spec/actions/validate_pac_file_spec.rb +62 -0
- data/spec/error_handler_spec.rb +70 -0
- data/spec/features/check_git_push_spec.rb +34 -6
- data/spec/git_repository_spec.rb +1 -0
- data/spec/git_storage_spec.rb +33 -0
- data/spec/pac_file_validator_spec.rb +19 -10
- metadata +30 -26
- data/lib/local_pac/application_status.rb +0 -37
- data/lib/local_pac/initializer.rb +0 -69
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.
|
4
|
+
version: 0.6.1
|
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: 2014-03-
|
12
|
+
date: 2014-03-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -267,22 +267,6 @@ dependencies:
|
|
267
267
|
- - ! '>='
|
268
268
|
- !ruby/object:Gem::Version
|
269
269
|
version: '0'
|
270
|
-
- !ruby/object:Gem::Dependency
|
271
|
-
name: git_hook-pre_receive
|
272
|
-
requirement: !ruby/object:Gem::Requirement
|
273
|
-
none: false
|
274
|
-
requirements:
|
275
|
-
- - ~>
|
276
|
-
- !ruby/object:Gem::Version
|
277
|
-
version: 0.1.0
|
278
|
-
type: :runtime
|
279
|
-
prerelease: false
|
280
|
-
version_requirements: !ruby/object:Gem::Requirement
|
281
|
-
none: false
|
282
|
-
requirements:
|
283
|
-
- - ~>
|
284
|
-
- !ruby/object:Gem::Version
|
285
|
-
version: 0.1.0
|
286
270
|
- !ruby/object:Gem::Dependency
|
287
271
|
name: facter
|
288
272
|
requirement: !ruby/object:Gem::Requirement
|
@@ -464,7 +448,7 @@ files:
|
|
464
448
|
- config.ru
|
465
449
|
- features/fetch_proxy_pac.feature_
|
466
450
|
- features/initializer.feature_
|
467
|
-
- features/show_status.
|
451
|
+
- features/show_status.feature
|
468
452
|
- features/step_definitions.rb
|
469
453
|
- features/support/env.rb
|
470
454
|
- files/config.yaml
|
@@ -482,25 +466,32 @@ files:
|
|
482
466
|
- lib/local_pac/actions/create_output.rb
|
483
467
|
- lib/local_pac/actions/create_repository.rb
|
484
468
|
- lib/local_pac/actions/get_system_information.rb
|
469
|
+
- lib/local_pac/actions/handle_error.rb
|
470
|
+
- lib/local_pac/actions/initialize_application.rb
|
485
471
|
- lib/local_pac/actions/print_newline.rb
|
486
472
|
- lib/local_pac/actions/print_title.rb
|
487
473
|
- lib/local_pac/actions/reload_configuration.rb
|
488
474
|
- lib/local_pac/actions/reload_local_storage.rb
|
489
475
|
- lib/local_pac/actions/send_signal.rb
|
476
|
+
- lib/local_pac/actions/show_application_status.rb
|
490
477
|
- lib/local_pac/actions/show_available_proxy_pac_files.rb
|
491
478
|
- lib/local_pac/actions/show_config.rb
|
479
|
+
- lib/local_pac/actions/show_pac_file.rb
|
492
480
|
- lib/local_pac/actions/show_process_information.rb
|
493
|
-
- lib/local_pac/
|
481
|
+
- lib/local_pac/actions/validate_pac_file.rb
|
494
482
|
- lib/local_pac/cli/helper.rb
|
483
|
+
- lib/local_pac/cli/main.rb
|
495
484
|
- lib/local_pac/cli/reload.rb
|
485
|
+
- lib/local_pac/cli/show.rb
|
486
|
+
- lib/local_pac/cli/validate.rb
|
496
487
|
- lib/local_pac/config.rb
|
497
488
|
- lib/local_pac/data.rb
|
498
489
|
- lib/local_pac/erb_generator.rb
|
490
|
+
- lib/local_pac/error_handler.rb
|
499
491
|
- lib/local_pac/exceptions.rb
|
500
492
|
- lib/local_pac/file.rb
|
501
493
|
- lib/local_pac/git_repository.rb
|
502
494
|
- lib/local_pac/git_storage.rb
|
503
|
-
- lib/local_pac/initializer.rb
|
504
495
|
- lib/local_pac/java_script_compressor.rb
|
505
496
|
- lib/local_pac/local_storage.rb
|
506
497
|
- lib/local_pac/main.rb
|
@@ -528,7 +519,12 @@ files:
|
|
528
519
|
- lib/local_pac/ui_logger.rb
|
529
520
|
- lib/local_pac/version.rb
|
530
521
|
- local_pac.gemspec
|
522
|
+
- script/acceptance_test
|
523
|
+
- script/bootstrap
|
524
|
+
- script/ci
|
531
525
|
- script/console
|
526
|
+
- script/release
|
527
|
+
- script/unit_test
|
532
528
|
- share/archlinux/Makefile
|
533
529
|
- share/archlinux/PKGBUILD
|
534
530
|
- share/archlinux/config.yaml
|
@@ -544,25 +540,29 @@ files:
|
|
544
540
|
- spec/actions/create_output_spec.rb
|
545
541
|
- spec/actions/create_repository_spec.rb
|
546
542
|
- spec/actions/get_system_information_spec.rb
|
543
|
+
- spec/actions/handle_error_spec.rb
|
544
|
+
- spec/actions/initialize_application_spec.rb
|
547
545
|
- spec/actions/print_new_line_spec.rb
|
548
546
|
- spec/actions/print_title_spec.rb
|
549
547
|
- spec/actions/reload_configuration_spec.rb
|
550
548
|
- spec/actions/reload_repository_spec.rb
|
551
549
|
- spec/actions/send_signal_spec.rb
|
550
|
+
- spec/actions/show_application_status_spec.rb
|
552
551
|
- spec/actions/show_available_proxy_pac_files_spec.rb
|
553
552
|
- spec/actions/show_config_spec.rb
|
553
|
+
- spec/actions/show_pac_file_spec.rb
|
554
554
|
- spec/actions/show_process_information_spec.rb
|
555
|
-
- spec/
|
555
|
+
- spec/actions/validate_pac_file_spec.rb
|
556
556
|
- spec/config_spec.rb
|
557
557
|
- spec/data_spec.rb
|
558
558
|
- spec/erb_generator_spec.rb
|
559
|
+
- spec/error_handler_spec.rb
|
559
560
|
- spec/features/check_git_push_spec.rb
|
560
561
|
- spec/features/fetch_proxy_pac_spec.rb
|
561
562
|
- spec/features/lookup_proxy_spec.rb
|
562
563
|
- spec/file_spec.rb
|
563
564
|
- spec/git_repository_spec.rb
|
564
565
|
- spec/git_storage_spec.rb
|
565
|
-
- spec/initializer_spec.rb
|
566
566
|
- spec/java_script_compressor_spec.rb
|
567
567
|
- spec/local_storage_spec.rb
|
568
568
|
- spec/null_file_spec.rb
|
@@ -619,7 +619,7 @@ summary: Serve local proxy pac
|
|
619
619
|
test_files:
|
620
620
|
- features/fetch_proxy_pac.feature_
|
621
621
|
- features/initializer.feature_
|
622
|
-
- features/show_status.
|
622
|
+
- features/show_status.feature
|
623
623
|
- features/step_definitions.rb
|
624
624
|
- features/support/env.rb
|
625
625
|
- spec/actions/add_examples_to_local_storage_spec.rb
|
@@ -628,25 +628,29 @@ test_files:
|
|
628
628
|
- spec/actions/create_output_spec.rb
|
629
629
|
- spec/actions/create_repository_spec.rb
|
630
630
|
- spec/actions/get_system_information_spec.rb
|
631
|
+
- spec/actions/handle_error_spec.rb
|
632
|
+
- spec/actions/initialize_application_spec.rb
|
631
633
|
- spec/actions/print_new_line_spec.rb
|
632
634
|
- spec/actions/print_title_spec.rb
|
633
635
|
- spec/actions/reload_configuration_spec.rb
|
634
636
|
- spec/actions/reload_repository_spec.rb
|
635
637
|
- spec/actions/send_signal_spec.rb
|
638
|
+
- spec/actions/show_application_status_spec.rb
|
636
639
|
- spec/actions/show_available_proxy_pac_files_spec.rb
|
637
640
|
- spec/actions/show_config_spec.rb
|
641
|
+
- spec/actions/show_pac_file_spec.rb
|
638
642
|
- spec/actions/show_process_information_spec.rb
|
639
|
-
- spec/
|
643
|
+
- spec/actions/validate_pac_file_spec.rb
|
640
644
|
- spec/config_spec.rb
|
641
645
|
- spec/data_spec.rb
|
642
646
|
- spec/erb_generator_spec.rb
|
647
|
+
- spec/error_handler_spec.rb
|
643
648
|
- spec/features/check_git_push_spec.rb
|
644
649
|
- spec/features/fetch_proxy_pac_spec.rb
|
645
650
|
- spec/features/lookup_proxy_spec.rb
|
646
651
|
- spec/file_spec.rb
|
647
652
|
- spec/git_repository_spec.rb
|
648
653
|
- spec/git_storage_spec.rb
|
649
|
-
- spec/initializer_spec.rb
|
650
654
|
- spec/java_script_compressor_spec.rb
|
651
655
|
- spec/local_storage_spec.rb
|
652
656
|
- spec/null_file_spec.rb
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
module LocalPac
|
3
|
-
class ApplicationStatus
|
4
|
-
|
5
|
-
private
|
6
|
-
|
7
|
-
include Pager
|
8
|
-
|
9
|
-
attr_reader :should_page
|
10
|
-
|
11
|
-
public
|
12
|
-
|
13
|
-
def initialize(options = {})
|
14
|
-
@should_page = options.fetch(:pager, :true)
|
15
|
-
config = options.fetch(:config, LocalPac.config)
|
16
|
-
|
17
|
-
@actions = []
|
18
|
-
@actions << Actions::PrintTitle.new('System Information')
|
19
|
-
@actions << Actions::GetSystemInformation.new
|
20
|
-
@actions << Actions::PrintNewline.new(2)
|
21
|
-
@actions << Actions::PrintTitle.new('Application Configuration')
|
22
|
-
@actions << Actions::ShowConfig.new
|
23
|
-
@actions << Actions::PrintNewline.new(2)
|
24
|
-
@actions << Actions::PrintTitle.new('Process Information')
|
25
|
-
@actions << Actions::ShowProcessInformation.new(config.pid_file)
|
26
|
-
@actions << Actions::PrintNewline.new(2)
|
27
|
-
@actions << Actions::PrintTitle.new('Available Proxy.Pac-Files')
|
28
|
-
@actions << Actions::ShowAvailableProxyPacFiles.new(config.local_storage)
|
29
|
-
end
|
30
|
-
|
31
|
-
def show
|
32
|
-
page if should_page
|
33
|
-
|
34
|
-
@actions.each(&:run)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,69 +0,0 @@
|
|
1
|
-
module LocalPac
|
2
|
-
class Initializer
|
3
|
-
|
4
|
-
private
|
5
|
-
|
6
|
-
attr_reader :config, :options
|
7
|
-
|
8
|
-
public
|
9
|
-
|
10
|
-
def initialize(options = {}, config = LocalPac.config)
|
11
|
-
@options = options
|
12
|
-
@config = config
|
13
|
-
end
|
14
|
-
|
15
|
-
def run
|
16
|
-
create_pid_directory if options[:create_pid_directory]
|
17
|
-
create_log_directory if options[:create_log_directory]
|
18
|
-
create_sass_cache if options[:create_sass_cache]
|
19
|
-
create_local_storage if options[:create_local_storage]
|
20
|
-
create_pre_receive_hook if options[:create_pre_receive_hook]
|
21
|
-
create_config_file if options[:create_config_file]
|
22
|
-
pre_seed if options[:pre_seed]
|
23
|
-
|
24
|
-
show_example_config
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def create_pid_directory
|
30
|
-
LocalPac.ui_logger.info "Creating pid directory: #{::File.dirname(config.pid_file)}"
|
31
|
-
Actions::CreateDirectory.new(::File.dirname(config.pid_file), force: options[:force]).run
|
32
|
-
end
|
33
|
-
|
34
|
-
def create_log_directory
|
35
|
-
LocalPac.ui_logger.info "Creating log directory: #{::File.dirname(config.access_log)}"
|
36
|
-
Actions::CreateDirectory.new(::File.dirname(config.access_log), force: options[:force]).run
|
37
|
-
end
|
38
|
-
|
39
|
-
def create_sass_cache
|
40
|
-
LocalPac.ui_logger.info "Creating sass cache #{config.sass_cache}"
|
41
|
-
Actions::CreateDirectory.new(config.sass_cache, force: options[:force]).run
|
42
|
-
end
|
43
|
-
|
44
|
-
def create_local_storage
|
45
|
-
LocalPac.ui_logger.info "Creating local storage: #{config.local_storage}"
|
46
|
-
Actions::CreateRepository.new(config.local_storage, bare: true, force: options[:force]).run
|
47
|
-
end
|
48
|
-
|
49
|
-
def create_pre_receive_hook
|
50
|
-
LocalPac.ui_logger.info "Creating pre-receive hook in local storage \"#{config.local_storage}\"."
|
51
|
-
Actions::CreateFile.new(:'git-hook.rb', ::File.join(config.local_storage, 'hooks', 'pre-receive'), Data.new(config), force: options[:force], executable: true).run
|
52
|
-
end
|
53
|
-
|
54
|
-
def create_config_file
|
55
|
-
LocalPac.ui_logger.info "Creating config file at \"#{config.config_file}\"."
|
56
|
-
Actions::CreateFile.new(:'example-config', config.config_file, Data.new(config), force: options[:force], create_directories: true).run
|
57
|
-
end
|
58
|
-
|
59
|
-
def pre_seed
|
60
|
-
LocalPac.ui_logger.info "Adding examples to repository at #{config.local_storage}/examples"
|
61
|
-
Actions::AddExamplesToLocalStorage.new(config.local_storage).run
|
62
|
-
end
|
63
|
-
|
64
|
-
def show_example_config
|
65
|
-
LocalPac.ui_logger.info "Showing the configuration of local_pac on your system."
|
66
|
-
Actions::CreateOutput.new(:'example-config', $stdout, Data.new(config)).run
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|