odania-static-pages 0.1.6 → 0.1.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 543e2e282d07aa73056287f7f7e4607c9ec1f4fc
4
- data.tar.gz: ea24ca48949e7982ce592c2f71d273ab1df09972
3
+ metadata.gz: 19174f40f54e21e3790229962c383ef68b15a79f
4
+ data.tar.gz: 0ff3d92eec6680d814bfcf81358d80cc7cd5da4a
5
5
  SHA512:
6
- metadata.gz: 56d574ecd49ca2187f91996746056f27db0fb40cc170b1fcd97cec1d57062801f1cc25812e5985b0caf2ce4a28b7c65904b8a52c577e940bed63a52b88e899ee
7
- data.tar.gz: ce9419c138211510479cdf438a19cac7de04362badefc836124a69913cd476b5804010618118eb53311750691c0356c7758131cd0f8c5692a89d646a45f11c47
6
+ metadata.gz: 3ae20100eb8c7bc404c831cd32b981ae561e2b880fcd75bed0f5aff278221ae932e263a6c570bbd0cdb6c23d483b72d74e7033b540cfc1f8d09b8ebc9b7cbed8
7
+ data.tar.gz: e7a7cf492690e6f08aa1db9bd15d78f78f5f10df5ae653c947c6e1a11e1acf07b671775c454ab15b581dd5230082ab545a9ef69ca80021586883f53043586b74
@@ -2,7 +2,7 @@ module OdaniaStaticPages
2
2
  class Config
3
3
  module Generator
4
4
  class Jekyll
5
- attr_reader :plugins, :encoding, :common_folder, :extra_options, :gem_extra
5
+ attr_reader :plugins, :encoding, :common_folder, :extra_options, :gem_extra, :nginx_default_redirect
6
6
 
7
7
  def initialize(project_dir, options)
8
8
  @plugins = options['plugins'] || %w(jekyll-feed octopress-image-tag octopress-gist)
@@ -11,6 +11,7 @@ module OdaniaStaticPages
11
11
  @extra_options = options['extra_options'] || {}
12
12
  @gem_extra = options['gem_extra'] || ''
13
13
  @project_dir = project_dir
14
+ @nginx_default_redirect = options['nginx_default_redirect'] || 'https://www.odania-it.com'
14
15
  end
15
16
 
16
17
  def to_h
@@ -1,8 +1,6 @@
1
1
  module OdaniaStaticPages
2
2
  module Deploy
3
3
  class Rsync
4
- include ::NginxHelper
5
-
6
4
  def initialize
7
5
  @config = OdaniaStaticPages.config
8
6
  @deploy_config = @config.current_environment.deploy_module
@@ -14,11 +12,6 @@ module OdaniaStaticPages
14
12
  puts 'Preparing rsync state'
15
13
  load_state
16
14
  save_state
17
-
18
- puts 'Copying Dockerfile'
19
- FileUtils.cp File.join(@config.base_dir, 'templates', 'live', 'Dockerfile'), File.join(@config.output_path, 'Dockerfile')
20
-
21
- generate_nginx_config(false)
22
15
  end
23
16
 
24
17
  def publish(color, do_rebuild)
@@ -1,6 +1,8 @@
1
1
  module OdaniaStaticPages
2
2
  module Generator
3
3
  class Jekyll
4
+ include ::NginxHelper
5
+
4
6
  def init
5
7
  puts 'Initliazing jekyll pages'
6
8
  puts
@@ -20,6 +22,9 @@ module OdaniaStaticPages
20
22
  gem_extra = @generator_config.gem_extra
21
23
  File.write File.join(@generator_config.full_common_folder, 'Gemfile'), ERB.new(File.read(gemfile_template)).result(binding)
22
24
 
25
+ puts 'Copying Dockerfile'
26
+ FileUtils.cp File.join(@config.base_dir, 'templates', 'live', 'Dockerfile'), File.join(@config.output_path, 'Dockerfile')
27
+
23
28
  puts 'Install gems'
24
29
  puts `cd #{@generator_config.full_common_folder} && bundle check`
25
30
  puts `cd #{@generator_config.full_common_folder} && bundle install --path ~/.gems` unless $?.success?
@@ -57,6 +62,8 @@ module OdaniaStaticPages
57
62
  puts 'Building all jekyll websites'
58
63
  setup_generator
59
64
 
65
+ generate_nginx_config(false)
66
+
60
67
  grouped_domains.each_pair do |site_name, page_config|
61
68
  build_for_configs(page_config, site_name, @config.output_site_path, env)
62
69
  end
@@ -71,6 +78,10 @@ module OdaniaStaticPages
71
78
  @pages_path = @config.pages_path
72
79
  @jekyll_config_file = @generator_config.jekyll_config_file
73
80
  @jekyll_config = @generator_config.jekyll_config
81
+
82
+ @deploy_config = @current_environment.deploy_module
83
+ @nginx_dir = File.join(@config.output_path, 'nginx')
84
+ @nginx_conf_dir = File.join(@nginx_dir, 'conf.d')
74
85
  end
75
86
 
76
87
  def grouped_domains
@@ -5,7 +5,13 @@ module NginxHelper
5
5
  grouped_domains.each_pair do |site_name, page_config|
6
6
  full_site_name = "#{site_name}.lvh.me"
7
7
  puts "Writing vhost for: #{full_site_name}"
8
- expires = @deploy_config.expires
8
+
9
+ if @deploy_config.respond_to? :expires
10
+ expires = @deploy_config.expires
11
+ else
12
+ expires = 'live'.eql?(@config.environment) ? 'modified +24h' : '-1'
13
+ end
14
+
9
15
  FileUtils.mkdir_p @nginx_conf_dir
10
16
  File.write File.join(@nginx_conf_dir, "#{site_name}.conf"), vhost_renderer.result(binding)
11
17
 
@@ -16,13 +22,19 @@ module NginxHelper
16
22
  end if page_config.count > 1
17
23
  end
18
24
 
19
- puts 'Generating index.html'
20
- FileUtils.mkdir_p @config.output_site_path
21
- renderer = ERB.new(File.read(File.join(@config.base_dir, 'templates', 'nginx', 'index.html.erb')))
22
- File.write File.join(@config.output_site_path, 'index.html'), renderer.result(binding)
25
+ nginx_default_redirect = @generator_config.nginx_default_redirect
26
+ if 'live'.eql?(@config.environment)
27
+ default_vhost_file = 'default-live-vhost.conf.erb'
28
+ else
29
+ default_vhost_file = 'default-vhost.conf'
30
+
31
+ puts 'Generating index.html'
32
+ FileUtils.mkdir_p @config.output_site_path
33
+ renderer = ERB.new(File.read(File.join(@config.base_dir, 'templates', 'nginx', 'index.html.erb')))
34
+ File.write File.join(@config.output_site_path, 'index.html'), renderer.result(binding)
35
+ end
23
36
 
24
37
  puts 'Copy default vhost'
25
- default_vhost_file = 'live'.eql?(@config.environment) ? 'default-live-vhost.conf' : 'default-vhost.conf'
26
38
  FileUtils.cp File.join(@config.base_dir, 'templates', 'nginx', default_vhost_file), File.join(@nginx_conf_dir, 'default.conf')
27
39
 
28
40
  puts 'Copy nginx.conf'
@@ -1,3 +1,3 @@
1
1
  module OdaniaStaticPages
2
- VERSION = '0.1.6'
2
+ VERSION = '0.1.7'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: odania-static-pages
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Petersen
@@ -191,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
191
  version: '0'
192
192
  requirements: []
193
193
  rubyforge_project:
194
- rubygems_version: 2.6.14
194
+ rubygems_version: 2.6.10
195
195
  signing_key:
196
196
  specification_version: 4
197
197
  summary: Helper For creating static pages