Class: ProxyPacRb::Cli::InitProxyPac

Inherits:
Thor::Group
  • Object
show all
Includes:
Shared, Thor::Actions
Defined in:
lib/proxy_pac_rb/cli/init_proxy_pac.rb

Overview

Find proxy for url

Instance Method Summary collapse

Methods included from Shared

#enable_debug_mode, #remove_proxy_environment_variables

Instance Method Details

#add_sourcesObject



19
20
21
# File 'lib/proxy_pac_rb/cli/init_proxy_pac.rb', line 19

def add_sources
  source_paths << File.expand_path('../../../../templates', __FILE__)
end

#create_build_filesObject



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/proxy_pac_rb/cli/init_proxy_pac.rb', line 69

def create_build_files
  return unless options[:build] == 'middleman'

  directory 'build/middleman', './'

  append_file 'Gemfile', "  gem 'middleman', '~>3.3.10'\n  gem 'therubyracer'\n  EOS\n\n  append_file 'Rakefile', <<~EOS\n  desc 'Build site'\n  task :build do\n    sh 'bundle exec middleman build --verbose'\n  end\n\n  desc 'Serve site'\n  task :serve do\n    sh 'bundle exec middleman server --verbose'\n  end\n  EOS\n\n  @destination_directory = File.join(@destination_directory, 'source')\nend\n"

#create_default_filesObject



23
24
25
# File 'lib/proxy_pac_rb/cli/init_proxy_pac.rb', line 23

def create_default_files
  directory 'default/', './'
end

#create_proxy_pacObject



94
95
96
# File 'lib/proxy_pac_rb/cli/init_proxy_pac.rb', line 94

def create_proxy_pac
  template 'new_proxy_pac.pac.erb', File.join(@destination_directory, options[:proxy_pac])
end

#create_test_framework_filesObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/proxy_pac_rb/cli/init_proxy_pac.rb', line 27

def create_test_framework_files
  return unless options[:test] == 'rspec'

  directory 'test_framework/rspec/', 'spec'

  append_file 'Gemfile', "  group :development, :test do\n    gem 'aruba', require: false\n\n    gem 'pry'\n    gem 'pry-byebug'\n    gem 'pry-stack_explorer'\n    gem 'pry-doc'\n\n    gem 'rspec', '~>3.0'\n    gem 'fuubar'\n  end\n  EOS\n\n  append_file 'Rakefile', <<~EOS\n  desc 'Run tests'\n  task test: 'test:local'\n\n  namespace :test do\n    desc 'Run all tests'\n    task :all do\n      sh 'bundle exec rspec'\n    end\n\n    desc 'Run local tests'\n    task :local do\n      sh 'bundle exec rspec --tag ~remote'\n    end\n\n    desc 'Run remote tests'\n    task :remote do\n      sh 'bundle exec rspec --tag remote'\n    end\n  end\n  EOS\nend\n"

#pre_initObject



13
14
15
16
17
# File 'lib/proxy_pac_rb/cli/init_proxy_pac.rb', line 13

def pre_init
  enable_debug_mode

  @destination_directory = Dir.getwd
end