bridgetown-plausible 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 02d2d3172cbd56ad3c8f02f1f1e73d3efcf80f50fdc6d00f83b646f96843c1e8
4
- data.tar.gz: 53e005bd002e70c96d034b27f31f1e1c340ec58a92f0046937e5017f6d447880
3
+ metadata.gz: ef9d4b3c76fedec78de06f8b46a922c9012cacf3ce84c28110adf96e9057e615
4
+ data.tar.gz: 043260ff038a709878448323b6d3c94460398fb1d15d99d7b68579f85bda2c25
5
5
  SHA512:
6
- metadata.gz: 0e7ca25707d7d6038f3005338fbb7ed6c62ec5a6eee29400466d424e54efda534eaeffb9d3d73b919a4e05fab4ccf8425442578a5f724b16889b4538f93ce05e
7
- data.tar.gz: 33b8b638102fd64948321e50f5f2ee7c830fee4a1e763703f138dcc14d83d15e098b8a5b53f6725e97021ca9df4850fd615f4d6842e7bf13676377283fb18ddb
6
+ metadata.gz: c3759ae9fe192e9eb781c177b46e8a5a63168d44f0165d0b4046b8d2146c1646d78afefd9d8b7dbac2114fc904c9035573451bb96f6e92fc0a3ae2cb6f00706a
7
+ data.tar.gz: c6583e55413b8a4321a3b9f703d0fef1c52fc64cf1694d88fe71ed79efd06f7e35fd66b28c3ea6a7781acfc43622500c5bc09b63ea9d5faf381652b89fb77640
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
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
+
10
+ ### [1.0.2](https://www.github.com/bt-rb/bridgetown-plausible/compare/v1.0.1...v1.0.2) (2021-12-22)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * use correct link to repo in gemspec and render safe html ([#9](https://www.github.com/bt-rb/bridgetown-plausible/issues/9)) ([02e61b9](https://www.github.com/bt-rb/bridgetown-plausible/commit/02e61b9930240c3b2810627da1e4b357c7563b33))
16
+ * use correct package name in automation ([#10](https://www.github.com/bt-rb/bridgetown-plausible/issues/10)) ([82eb300](https://www.github.com/bt-rb/bridgetown-plausible/commit/82eb3002ce83d822cab96cbe722c1516635fa8dc))
17
+ * use the correct url for the automation in our readme docs ([b2b5961](https://www.github.com/bt-rb/bridgetown-plausible/commit/b2b596132b4452d93cfca8e6227c82d766a8691d))
18
+
3
19
  ### [1.0.1](https://www.github.com/bt-rb/bridgetown-plausible/compare/v1.0.0...v1.0.1) (2021-02-06)
4
20
 
5
21
 
data/README.md CHANGED
@@ -35,7 +35,7 @@
35
35
  Use the automation to add to your site:
36
36
 
37
37
  ```sh
38
- bundle exec bridgetown apply https://github.com/btrb/bridgetown-plausible
38
+ bundle exec bridgetown apply https://github.com/bt-rb/bridgetown-plausible
39
39
  ```
40
40
 
41
41
  ## System requirements
@@ -56,7 +56,7 @@ or add manually in `Gemfile`:
56
56
 
57
57
  ```ruby
58
58
  group :bridgetown_plugins do
59
- gem "bridgetown-plausible", "~> 0.1.0"
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,8 +8,8 @@ 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."
12
- spec.homepage = "https://github.com/btrb/#{spec.name}"
11
+ spec.description = "Provides a Liquid Tag and ERB Helper to add Plausible analytics to your Bridgetown site."
12
+ spec.homepage = "https://github.com/bt-rb/#{spec.name}"
13
13
  spec.license = "MIT"
14
14
  spec.metadata = {
15
15
  "bug_tracker_uri" => "#{spec.homepage}/issues",
@@ -1,16 +1,27 @@
1
- say_status :plausible, "Installing the bridgetown-plausible-tag plugin..."
1
+ say_status :plausible, "Installing the bridgetown-plausible plugin..."
2
2
 
3
3
  domain_name = ask("What's your Plausible domain?")
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
+ add_bridgetown_plugin "bridgetown-plausible"
4
6
 
5
- add_bridgetown_plugin "bridgetown-plausible-tag"
7
+ if server_name == ""
8
+ append_to_file "bridgetown.config.yml" do
9
+ <<~YAML
6
10
 
7
- append_to_file "bridgetown.config.yml" do
8
- <<~YAML
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"
16
- say_status :plausible, "https://github.com/andrewmcodes/bridgetown-plausible-tag"
27
+ say_status :plausible, "https://github.com/bt-rb/bridgetown-plausible"
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
-
@@ -5,11 +5,11 @@ module Bridgetown
5
5
  class Builder < Bridgetown::Builder
6
6
  def build
7
7
  liquid_tag "plausible" do |_attributes, tag|
8
- render
8
+ render.html_safe
9
9
  end
10
10
 
11
11
  helper "plausible" do
12
- render
12
+ render.html_safe
13
13
  end
14
14
  end
15
15
 
@@ -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.1"
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.1
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-02-06 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: []
@@ -142,15 +143,15 @@ files:
142
143
  - lib/bridgetown-plausible.rb
143
144
  - lib/bridgetown-plausible/builder.rb
144
145
  - lib/bridgetown-plausible/version.rb
145
- homepage: https://github.com/btrb/bridgetown-plausible
146
+ homepage: https://github.com/bt-rb/bridgetown-plausible
146
147
  licenses:
147
148
  - MIT
148
149
  metadata:
149
- bug_tracker_uri: https://github.com/btrb/bridgetown-plausible/issues
150
- changelog_uri: https://github.com/btrb/bridgetown-plausible/blob/main/CHANGELOG.md
151
- documentation_uri: https://github.com/btrb/bridgetown-plausible
152
- homepage_uri: https://github.com/btrb/bridgetown-plausible
153
- source_code_uri: https://github.com/btrb/bridgetown-plausible
150
+ bug_tracker_uri: https://github.com/bt-rb/bridgetown-plausible/issues
151
+ changelog_uri: https://github.com/bt-rb/bridgetown-plausible/blob/main/CHANGELOG.md
152
+ documentation_uri: https://github.com/bt-rb/bridgetown-plausible
153
+ homepage_uri: https://github.com/bt-rb/bridgetown-plausible
154
+ source_code_uri: https://github.com/bt-rb/bridgetown-plausible
154
155
  post_install_message:
155
156
  rdoc_options: []
156
157
  require_paths: