simple_analytics_rails 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 45d947955578941184edd6a5dca4a19419bd6fceba64e25da625b839eae9c2f3
4
+ data.tar.gz: 79ccb523da4b6eb677696ae54b7a3fd5e94a86fdd409098740085cc62028ee13
5
+ SHA512:
6
+ metadata.gz: e6e790d0cd2487228fddd15e1998dd049aff6d21774903cb7f0b04a86b2e5614f02c7a14da2ee1484031e61542e829274653183ed5ecf60227a62939d5dfacd2
7
+ data.tar.gz: f59ef12bd7e12d7a8e0c3868a9c9b9d96bedb26899e70a9dee353527d4e913c8c86efa244e915280bdae281b8f7585bfa99186590a800c56448c0c3444b1da24
@@ -0,0 +1,42 @@
1
+ # From: https://github.com/hopsoft/stimulus_reflex/blob/master/.github/workflows/changelog.yml
2
+ name: Changelog
3
+
4
+ on:
5
+ workflow_dispatch:
6
+ release:
7
+ types: [created]
8
+ push:
9
+ branches:
10
+ - main
11
+
12
+ jobs:
13
+ build:
14
+ runs-on: ubuntu-latest
15
+ timeout-minutes: 4
16
+ if: "!contains(github.event.head_commit.message, '[nodoc]')"
17
+ steps:
18
+ - uses: actions/checkout@master
19
+ - name: Set up Ruby 3.0
20
+ uses: ruby/setup-ruby@v1
21
+ with:
22
+ ruby-version: 3.0
23
+ - uses: actions/cache@v2
24
+ with:
25
+ path: vendor/bundle
26
+ key: ${{ runner.os }}-changelog-gem-${{ hashFiles('**/Gemfile.lock') }}
27
+ restore-keys: |
28
+ ${{ runner.os }}-changelog-gem-
29
+ - name: Create local changes
30
+ run: |
31
+ gem install github_changelog_generator -v "1.15.2"
32
+ github_changelog_generator -u ${{ github.repository_owner }} -p ${{ github.event.repository.name }} --token ${{ secrets.GITHUB_TOKEN }} --exclude-labels duplicate,question,invalid,wontfix,nodoc
33
+ - name: Commit files
34
+ run: |
35
+ git config --local user.email "github-actions@example.com"
36
+ git config --local user.name "GitHub Actions"
37
+ git commit -am "[nodoc] Update Changelog" || echo "No changes to commit"
38
+ - name: Push changes
39
+ uses: ad-m/github-push-action@master
40
+ with:
41
+ github_token: ${{ secrets.GITHUB_TOKEN }}
42
+ branch: ${{ github.ref }}
@@ -0,0 +1,30 @@
1
+ name: Publish
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ release:
6
+ types: [published]
7
+
8
+ jobs:
9
+ build:
10
+ name: Publish to Rubygems
11
+ runs-on: ubuntu-latest
12
+
13
+ steps:
14
+ - uses: actions/checkout@master
15
+
16
+ - name: Set up Ruby 3.0
17
+ uses: actions/setup-ruby@v1
18
+ with:
19
+ ruby-version: 3.0
20
+
21
+ - name: Publish to RubyGems
22
+ run: |
23
+ mkdir -p $HOME/.gem
24
+ touch $HOME/.gem/credentials
25
+ chmod 0600 $HOME/.gem/credentials
26
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
27
+ gem build simple_analytics_rails.gemspec
28
+ gem push simple_analytics_rails-*.gem
29
+ env:
30
+ GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }}
@@ -0,0 +1,19 @@
1
+ name: Standard
2
+
3
+ on:
4
+ push:
5
+ branches-ignore:
6
+ - main
7
+ jobs:
8
+ standard:
9
+ runs-on: ubuntu-latest
10
+
11
+ steps:
12
+ - uses: actions/checkout@v2
13
+ - name: Set up Ruby 3.0
14
+ uses: ruby/setup-ruby@v1
15
+ with:
16
+ ruby-version: 3.0
17
+ bundler-cache: true
18
+ - name: Run Standard
19
+ run: bundle exec standardrb
@@ -0,0 +1,33 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ schedule:
6
+ - cron: '0 0 * * *'
7
+
8
+ jobs:
9
+ tests:
10
+ name: RSpec
11
+ runs-on: ubuntu-20.04
12
+ strategy:
13
+ matrix:
14
+ rails:
15
+ - 'rails60'
16
+ - 'rails61'
17
+ ruby:
18
+ - '2.6'
19
+ - '2.7'
20
+ - '3.0'
21
+ steps:
22
+ - uses: actions/checkout@v2
23
+ - name: Set up Ruby
24
+ uses: ruby/setup-ruby@v1
25
+ with:
26
+ ruby-version: ${{ matrix.ruby }}
27
+ - name: Setup environment
28
+ run: |
29
+ bundle install --jobs 4 --retry 3
30
+ bundle exec appraisal ${{ matrix.rails }} bundle install
31
+ - name: Run the tests
32
+ run: |
33
+ bundle exec appraisal ${{ matrix.rails }} rake spec
data/.gitignore ADDED
@@ -0,0 +1,21 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+
13
+ Gemfile.lock
14
+
15
+ # The sample rails app
16
+ /spec/example_app/log/*
17
+ /spec/example_app/tmp/*
18
+ !/spec/example_app/log/.keep
19
+ !/spec/example_app/tmp/.keep
20
+ /spec/example_app/public/system
21
+ /spec/example_app/public/assets
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.yardopts ADDED
@@ -0,0 +1,4 @@
1
+ -
2
+ CHANGELOG.md
3
+ CODE_OF_CONDUCT.md
4
+ LICENSE
data/Appraisals ADDED
@@ -0,0 +1,11 @@
1
+ appraise "rails60" do
2
+ gem "rails", "~> 6.0"
3
+ end
4
+
5
+ appraise "rails61" do
6
+ gem "rails", "~> 6.1"
7
+ end
8
+
9
+ appraise "rails-main" do
10
+ gem "rails", git: "https://github.com/rails/rails.git", ref: "main"
11
+ end
data/CHANGELOG.md ADDED
@@ -0,0 +1,27 @@
1
+ # Changelog
2
+
3
+ ## [Unreleased](https://github.com/simpleanalytics/rubyonrails-plugin/tree/HEAD)
4
+
5
+ [Full Changelog](https://github.com/simpleanalytics/rubyonrails-plugin/compare/v0.1.0...HEAD)
6
+
7
+ **Merged pull requests:**
8
+
9
+ - Changing name of ENV used for RubyGems API key [\#8](https://github.com/simpleanalytics/rubyonrails-plugin/pull/8) ([MikeRogers0](https://github.com/MikeRogers0))
10
+
11
+ ## [v0.1.0](https://github.com/simpleanalytics/rubyonrails-plugin/tree/v0.1.0) (2021-04-21)
12
+
13
+ [Full Changelog](https://github.com/simpleanalytics/rubyonrails-plugin/compare/882f86b792e451024157ceddcea9b093b1d77093...v0.1.0)
14
+
15
+ **Merged pull requests:**
16
+
17
+ - Renaming skip\_dnt to collect\_dnt [\#7](https://github.com/simpleanalytics/rubyonrails-plugin/pull/7) ([MikeRogers0](https://github.com/MikeRogers0))
18
+ - Removing TODO list from the Readme [\#6](https://github.com/simpleanalytics/rubyonrails-plugin/pull/6) ([MikeRogers0](https://github.com/MikeRogers0))
19
+ - Move \<noscript\> fallback to before \</body\> [\#5](https://github.com/simpleanalytics/rubyonrails-plugin/pull/5) ([MikeRogers0](https://github.com/MikeRogers0))
20
+ - Adding top level documentation for Yard docs [\#4](https://github.com/simpleanalytics/rubyonrails-plugin/pull/4) ([MikeRogers0](https://github.com/MikeRogers0))
21
+ - Spotted some wording improvements on the Readme [\#3](https://github.com/simpleanalytics/rubyonrails-plugin/pull/3) ([MikeRogers0](https://github.com/MikeRogers0))
22
+ - Sorting dependencies in gemspec file alphabetically [\#2](https://github.com/simpleanalytics/rubyonrails-plugin/pull/2) ([MikeRogers0](https://github.com/MikeRogers0))
23
+ - Adding Appraisals [\#1](https://github.com/simpleanalytics/rubyonrails-plugin/pull/1) ([MikeRogers0](https://github.com/MikeRogers0))
24
+
25
+
26
+
27
+ \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at me@mikerogers.io. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in simple_analytics_rails.gemspec
4
+ gemspec
5
+
6
+ group :test do
7
+ gem "simplecov", require: false
8
+ end
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Simple Analytics
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,114 @@
1
+ <p align="center">
2
+ <a href="https://simpleanalytics.com/?ref=github.com/simpleanalytics/rubyonrails-plugin">
3
+ <img src="https://assets.simpleanalytics.com/images/logos/logo-github-readme.png" alt="Simple Analytics logo" height="62" />
4
+ </a>
5
+ </p>
6
+
7
+ <p align="center">
8
+ <h1 align="center">Simple Analytics Rails</h1>
9
+ <p align="center">
10
+ <img src="https://img.shields.io/gem/v/simple_analytics_rails.svg?color=red" />
11
+ <a href="https://github.com/simpleanalytics/rubyonrails-plugin/blob/main/LICENSE">
12
+ <img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-brightgreen.svg" target="_blank" />
13
+ </a>
14
+ <a href="https://github.com/testdouble/standard" target="_blank">
15
+ <img alt="Ruby Code Style" src="https://img.shields.io/badge/Ruby_Code_Style-standard-brightgreen.svg" />
16
+ </a>
17
+ <a target="_blank" rel="noopener noreferrer" href="https://github.com/simpleanalytics/rubyonrails-plugin/actions/workflows/standard.yml">
18
+ <img src="https://github.com/simpleanalytics/rubyonrails-plugin/actions/workflows/standard.yml/badge.svg" alt="Standard" style="max-width:100%;">
19
+ </a>
20
+ <a target="_blank" rel="noopener noreferrer" href="https://github.com/simpleanalytics/rubyonrails-plugin/actions/workflows/tests.yml">
21
+ <img src="https://github.com/simpleanalytics/rubyonrails-plugin/actions/workflows/tests.yml/badge.svg" alt="Tests">
22
+ </a>
23
+ </p>
24
+ </p>
25
+
26
+ [Simple Analytics](https://simpleanalytics.com/) is a privacy friendly analytics. No consent required from your visitors!
27
+
28
+ This gem adds the [JavaScript Tracking Script](https://docs.simpleanalytics.com/script) to the `<head>` tag of your Ruby on Rails applications.
29
+
30
+ ## 🚀 Installation
31
+
32
+ Add this line to your application's Gemfile:
33
+
34
+ ```ruby
35
+ gem 'simple_analytics_rails'
36
+ ```
37
+
38
+ And then execute:
39
+
40
+ ```bash
41
+ $ bundle install
42
+ ```
43
+
44
+ Or install it yourself as:
45
+
46
+ ```bash
47
+ $ gem install simple_analytics_rails
48
+ ````
49
+
50
+ ## ✨ Usage
51
+
52
+ After the gem is installed, it will automatically append the Simple Analytics JavaScript snippet before the `</head>` tag on your HTML pages.
53
+
54
+ However you can also configure it via an initializer:
55
+
56
+ ```ruby
57
+ # config/initializers/simple_analytics.rb
58
+ SimpleAnalyticsRails.configure do |configuration|
59
+ # ==> Overwrite domain name
60
+ # https://docs.simpleanalytics.com/overwrite-domain-name
61
+ #
62
+ # Default is ""
63
+ configuration.hostname = "example.com"
64
+
65
+ # ==> Hash mode
66
+ # https://docs.simpleanalytics.com/hash-mode
67
+ #
68
+ # Default is ""
69
+ configuration.mode = "hash"
70
+
71
+ # ==> Do not track
72
+ # https://docs.simpleanalytics.com/dnt
73
+ #
74
+ # Default is false
75
+ configuration.collect_dnt = false
76
+
77
+ # ==> Ignore pages
78
+ # https://docs.simpleanalytics.com/ignore-pages
79
+ #
80
+ # Default is ""
81
+ configuration.ignore_pages = "/search/*,/account/*,/vouchers"
82
+
83
+ # ==> Inject JavaScript To Head
84
+ # You can disable the automatic JavaScript injection if you'd like.
85
+ #
86
+ # Default is true
87
+ configuration.enabled = Rails.env.production?
88
+ end
89
+ ```
90
+
91
+ ## 🙏 Contributing
92
+
93
+ Bug reports and pull requests are welcome on GitHub at https://github.com/simpleanalytics/rubyonrails-plugin .
94
+
95
+ ### Code of Conduct
96
+
97
+ Everyone interacting in the SimpleAnalyticsRails project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/simpleanalytics/rubyonrails-plugin/blob/main/CODE_OF_CONDUCT.md).
98
+
99
+ ### Coding Standards
100
+
101
+ This project uses [Standard](https://github.com/testdouble/standard) for Ruby code to minimize bike shedding related to source formatting.
102
+
103
+ Please run `bundle exec standardrb --fix` prior to submitting pull requests.
104
+
105
+ ## 📦 Releasing
106
+
107
+ 1. Bump version number at `lib/simple_analytics_rails/version.rb`
108
+ 1. Commit and push changes
109
+ 1. Publish a new release on GitHub https://github.com/simpleanalytics/rubyonrails-plugin/releases/new
110
+ 1. A [GitHub Action](https://github.com/simpleanalytics/rubyonrails-plugin/blob/main/.github/workflows/publish.yml) will then publish the latest version to https://rubygems.org/
111
+
112
+ ## 📝 License
113
+
114
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).