bridgetown-plausible 1.0.2 → 1.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 274f79cc340a1931282e1576222faebb147fa5e0e21f7339210c9015b096c3fd
4
- data.tar.gz: 1ab93674cee6b180c53b12666948c4011a18c76b6e38bdf5052a177ddd4cd749
3
+ metadata.gz: ef9d4b3c76fedec78de06f8b46a922c9012cacf3ce84c28110adf96e9057e615
4
+ data.tar.gz: 043260ff038a709878448323b6d3c94460398fb1d15d99d7b68579f85bda2c25
5
5
  SHA512:
6
- metadata.gz: 201335bca947648ae012be89419bc8e323fd8107805a0cfb0f3934682edffd785b6fca95be75f568d9109a9c320d7f6356b20e985cbded39d2896914d23ab06e
7
- data.tar.gz: ba0f6c7e5f669dd49800ce3f9bea12ea60081cb313c4cb883cdcbc6d2e5e2519ccd1eb77cae0e18f4234cf97525427fe3641d3e65b5e589b51a33bedc7daa003
6
+ metadata.gz: c3759ae9fe192e9eb781c177b46e8a5a63168d44f0165d0b4046b8d2146c1646d78afefd9d8b7dbac2114fc904c9035573451bb96f6e92fc0a3ae2cb6f00706a
7
+ data.tar.gz: c6583e55413b8a4321a3b9f703d0fef1c52fc64cf1694d88fe71ed79efd06f7e35fd66b28c3ea6a7781acfc43622500c5bc09b63ea9d5faf381652b89fb77640
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.1.0](https://www.github.com/bt-rb/bridgetown-plausible/compare/v1.0.2...v1.1.0) (2022-09-22)
4
+
5
+
6
+ ### Features
7
+
8
+ * make server configurable ([#11](https://www.github.com/bt-rb/bridgetown-plausible/issues/11)) ([5c5cd29](https://www.github.com/bt-rb/bridgetown-plausible/commit/5c5cd296477bee6eb6ce38e32051968291995d44))
9
+
3
10
  ### [1.0.2](https://www.github.com/bt-rb/bridgetown-plausible/compare/v1.0.1...v1.0.2) (2021-12-22)
4
11
 
5
12
 
data/README.md CHANGED
@@ -56,7 +56,7 @@ or add manually in `Gemfile`:
56
56
 
57
57
  ```ruby
58
58
  group :bridgetown_plugins do
59
- gem "bridgetown-plausible", "~> 1.0.2"
59
+ gem "bridgetown-plausible", "~> 1.1.0"
60
60
  end
61
61
  ```
62
62
 
@@ -74,6 +74,14 @@ plausible:
74
74
  # Type: String
75
75
  # Required: true
76
76
  domain: example.com
77
+ # Your Plausible instance domain.
78
+ # Only set this if you are self-hosting Plausible on your own domain.
79
+ # Requires https.
80
+ #
81
+ # Type: String
82
+ # Required: false
83
+ # Default: "plausible.io"
84
+ server: selfhosted-plausible.com
77
85
  ```
78
86
 
79
87
  ## Usage
data/Rakefile CHANGED
@@ -5,4 +5,4 @@ require "rspec/core/rake_task"
5
5
 
6
6
  RSpec::Core::RakeTask.new(:spec)
7
7
 
8
- task :default => :spec
8
+ task default: :spec
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
8
8
  spec.authors = ["Andrew Mason"]
9
9
  spec.email = ["andrewmcodes@protonmail.com"]
10
10
  spec.summary = "Plausible Analytics Plugin for Bridgetown"
11
- spec.description = "A Liquid tag to add Plausible analytics to your site."
11
+ spec.description = "Provides a Liquid Tag and ERB Helper to add Plausible analytics to your Bridgetown site."
12
12
  spec.homepage = "https://github.com/bt-rb/#{spec.name}"
13
13
  spec.license = "MIT"
14
14
  spec.metadata = {
@@ -1,15 +1,26 @@
1
1
  say_status :plausible, "Installing the bridgetown-plausible plugin..."
2
2
 
3
3
  domain_name = ask("What's your Plausible domain?")
4
-
4
+ server_name = ask("If you are self-hosting Plausible, what's your instance domain? Leave blank if not self-hosting to default to plausible.io")
5
5
  add_bridgetown_plugin "bridgetown-plausible"
6
6
 
7
- append_to_file "bridgetown.config.yml" do
8
- <<~YAML
7
+ if server_name == ""
8
+ append_to_file "bridgetown.config.yml" do
9
+ <<~YAML
10
+
11
+ plausible:
12
+ domain: #{domain_name}
13
+ YAML
14
+ end
15
+ else
16
+ append_to_file "bridgetown.config.yml" do
17
+ <<~YAML
9
18
 
10
- plausible:
11
- domain: #{domain_name}
12
- YAML
19
+ plausible:
20
+ domain: #{domain_name}
21
+ server: #{server_name}
22
+ YAML
23
+ end
13
24
  end
14
25
 
15
26
  say_status :plausible, "All set! Double-check the plausible block in your config file and review docs at"
data/demo/Gemfile CHANGED
@@ -16,7 +16,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
16
16
  #
17
17
  # Happy Bridgetowning!
18
18
 
19
- gem "bridgetown", "~> 0.19.2"
19
+ gem "bridgetown", "~> 1.1.0"
20
20
  group :bridgetown_plugins do
21
21
  gem "bridgetown-plausible", path: "../"
22
22
  end
@@ -27,4 +27,12 @@ plausible:
27
27
  #
28
28
  # Type: String
29
29
  # Required: true
30
- domain: example.com
30
+ domain: tracked-site.com
31
+ # Your Plausible instance domain.
32
+ # Only set this if you are self-hosting Plausible on your own domain.
33
+ # Requires https.
34
+ #
35
+ # Type: String
36
+ # Required: false
37
+ # Default: "plausible.io"
38
+ server: selfhosted-plausible.com
@@ -1,4 +1,3 @@
1
1
  class SiteBuilder < Bridgetown::Builder
2
2
  # write builders which subclass SiteBuilder in plugins/builder
3
3
  end
4
-
@@ -17,12 +17,13 @@ module Bridgetown
17
17
 
18
18
  def render
19
19
  domain = options.dig(:domain)&.strip
20
+ server = options.dig(:server)&.strip || "plausible.io"
20
21
 
21
22
  tag = if domain
22
- markup_for_domain(domain)
23
+ markup_for_snippet(domain, server)
23
24
  else
24
25
  Bridgetown.logger.warn "Plausible", "Domain not configured."
25
- markup_for_domain("NOT CONFIGURED")
26
+ markup_for_snippet("NOT CONFIGURED", server)
26
27
  end
27
28
 
28
29
  return wrap_with_comment(tag) unless Bridgetown.environment.production?
@@ -30,8 +31,8 @@ module Bridgetown
30
31
  tag
31
32
  end
32
33
 
33
- def markup_for_domain(domain)
34
- "<script async defer data-domain=\"#{domain}\" src=\"https://plausible.io/js/plausible.js\"></script>"
34
+ def markup_for_snippet(domain, server)
35
+ "<script async defer data-domain=\"#{domain}\" src=\"https://#{server}/js/plausible.js\"></script>"
35
36
  end
36
37
 
37
38
  def wrap_with_comment(tag)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Bridgetown
4
4
  module Plausible
5
- VERSION = "1.0.2"
5
+ VERSION = "1.1.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bridgetown-plausible
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Mason
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-22 00:00:00.000000000 Z
11
+ date: 2022-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bridgetown
@@ -100,7 +100,8 @@ dependencies:
100
100
  - - "~>"
101
101
  - !ruby/object:Gem::Version
102
102
  version: '0.12'
103
- description: A Liquid tag to add Plausible analytics to your site.
103
+ description: Provides a Liquid Tag and ERB Helper to add Plausible analytics to your
104
+ Bridgetown site.
104
105
  email:
105
106
  - andrewmcodes@protonmail.com
106
107
  executables: []