Skip to content
This repository has been archived by the owner on Aug 29, 2022. It is now read-only.

v1 #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

v1 #1

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
appraise "rails-5.0" do
gem "activerecord", "~> 5.0.0"
end

appraise "rails-5.1" do
gem "activerecord", "~> 5.1.0"
end

appraise "rails-5.2" do
gem "activerecord", "~> 5.2.0"
end

appraise "rails-6.0" do
gem "activerecord", "~> 6.0.0"
end
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Changelog

See README.md before updating this file.

## 0.1.0

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Version number doesn't match VERSION = '0.1.2' later on -- let's sync up or update here?

* Initial release
20 changes: 20 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

# Declare your gem's dependencies in land.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
gemspec

# Declare any dependencies that are still in development here instead of in
# your gemspec. These might include edge Rails or gems from your path or
# Git. Remember to move these dependencies to your gemspec before releasing
# your gem to rubygems.org.

# gem "pry", github: "pry/pry"

group :development, :test do
gem "combustion"
gem "pry-rails"
gem "simplecov", require: false
end
25 changes: 25 additions & 0 deletions MIT-LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
The MIT License (MIT)

Copyright (c) 2020 Erik Peterson

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Some code originated from github.com/enova/landable
Copyright 2013 Enova International
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Land
Land is a clickstream tracker for Rails applications. It will track visits, pageviews, marketing attribution and more.

## Installation
Add this line to your application's Gemfile:

```ruby
gem 'land'
```

And then execute:

$ bundle install

Or, install it yourself:

$ gem install land

To copy migrations to db/migrate run:

$ rails land:install:migrations

## Configuration

Install with:

$ rails g land:install

Then edit `config/initializers/land.rb`.

## Development

After checking out the repo, run `bin/setup` to install dependencies, create database, and confirm test suite is working. You can also run `rails console` for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).

To start a console run `bin/rails console` or `rails c`

## Testing

Land uses a gem called __appraisal__ to test against multiple versions of Rails. Another gem, __combustion__ provides a minimal environment to run Rails.

Setup your database using `rails db:drop db:create db:migrate`.

To run the test suite against all versions of rails run `rake` or `appraisal rspec`.
To run the test suite against just the latest version of rails run `rspec`.

[Appraisal](https://github.com/thoughtbot/appraisal) | [Combustion](https://github.com/pat/combustion)

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/companygardener/land.

## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
61 changes: 61 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
begin
require "bundler/setup"
require "bundler/gem_tasks"
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end

require 'lookup_by'
require "combustion"

Combustion::Application.configure_for_combustion
Combustion::Application.load_tasks

if defined?(ActiveRecord)
ActiveRecord::Base.schema_format = :sql
end

require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec)

require 'rdoc/task'

RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'Land'
rdoc.options << '--line-numbers'
rdoc.rdoc_files.include('README.md')
rdoc.rdoc_files.include('lib/**/*.rb')
end

# Lifted from appraisal/task to avoid deprecated clutter.
desc "Run the given task for all appraisals"
task :appraisal do
ARGV.shift
exec "bundle exec appraisal rake #{ARGV.join(' ')}"
end

if !ENV["APPRAISAL_INITIALIZED"] && !ENV["TRAVIS"]
task default: :appraisal
else
task default: :spec
end

# Clean up some clutter in `rake -T`.
%w[
app:template
app:update
restart
].each { |name| Rake::Task[name].clear }

%w[
clean
clobber_rdoc
install:local
log:clear
rerdoc
secret
time:zones
tmp:clear
tmp:create
].each { |name| Rake::Task[name].clear_comments }
1 change: 1 addition & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Add support for circle ci
5 changes: 5 additions & 0 deletions app/helpers/land/helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module Land
module Helper
attr_reader :land
end
end
4 changes: 4 additions & 0 deletions app/jobs/land/application_job.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Land
class ApplicationJob < ActiveJob::Base

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class needed?

end
end
9 changes: 9 additions & 0 deletions app/lookups/land/ad_group.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Land
class AdGroup < ApplicationRecord
include TableName

lookup_by :ad_group, cache: 50, find_or_create: true

has_many :attributions
end
end
9 changes: 9 additions & 0 deletions app/lookups/land/ad_type.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Land
class AdType < ApplicationRecord
include TableName

lookup_by :ad_type, cache: 50, find_or_create: true

has_many :attributions
end
end
9 changes: 9 additions & 0 deletions app/lookups/land/app.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Land
class App < ApplicationRecord
include TableName

lookup_by :app, cache: 50, find_or_create: true

has_many :attributions
end
end
9 changes: 9 additions & 0 deletions app/lookups/land/bid_match_type.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Land
class BidMatchType < ApplicationRecord
include TableName

lookup_by :bid_match_type, cache: 50, find_or_create: true

has_many :attributions
end
end
9 changes: 9 additions & 0 deletions app/lookups/land/browser.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Land
class Browser < ApplicationRecord
include TableName

lookup_by :browser, cache: 50, find_or_create: true

has_many :user_agents
end
end
10 changes: 10 additions & 0 deletions app/lookups/land/campaign.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module Land
class Campaign < ApplicationRecord

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove empty line

include TableName

lookup_by :campaign, cache: 50, find_or_create: true

has_many :attributions
end
end
9 changes: 9 additions & 0 deletions app/lookups/land/content.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Land
class Content < ApplicationRecord
include TableName

lookup_by :content, cache: 50, find_or_create: true

has_many :attributions
end
end
9 changes: 9 additions & 0 deletions app/lookups/land/creative.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Land
class Creative < ApplicationRecord
include TableName

lookup_by :creative, cache: 50, find_or_create: true

has_many :attributions
end
end
9 changes: 9 additions & 0 deletions app/lookups/land/device.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Land
class Device < ApplicationRecord
include TableName

lookup_by :device, cache: 50, find_or_create: true

has_many :user_agents
end
end
9 changes: 9 additions & 0 deletions app/lookups/land/device_type.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Land
class DeviceType < ApplicationRecord
include TableName

lookup_by :device_type, cache: 50, find_or_create: true

has_many :attributions
end
end
9 changes: 9 additions & 0 deletions app/lookups/land/domain.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Land
class Domain < ApplicationRecord
include TableName

lookup_by :domain, cache: 50, find_or_create: true, allow_blank: true

has_many :referers
end
end
9 changes: 9 additions & 0 deletions app/lookups/land/event_type.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Land
class EventType < ApplicationRecord
include TableName

lookup_by :event_type, cache: 100

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only this one isn't find_or_create. I'm assuming it's intentional, so maybe we need to add how to add event types to the README or somewhere.


has_many :events
end
end
9 changes: 9 additions & 0 deletions app/lookups/land/experiment.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Land
class Experiment < ApplicationRecord
include TableName

lookup_by :experiment, cache: 50, find_or_create: true

has_many :attributions
end
end
9 changes: 9 additions & 0 deletions app/lookups/land/http_method.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Land
class HttpMethod < ApplicationRecord
include TableName

lookup_by :http_method, cache: 50, find_or_create: true

has_many :pageviews
end
end
9 changes: 9 additions & 0 deletions app/lookups/land/keyword.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Land
class Keyword < ApplicationRecord
include TableName

lookup_by :keyword, cache: 50, find_or_create: true

has_many :attributions
end
end
9 changes: 9 additions & 0 deletions app/lookups/land/match_type.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Land
class MatchType < ApplicationRecord
include TableName

lookup_by :match_type, cache: 50, find_or_create: true

has_many :attributions
end
end
9 changes: 9 additions & 0 deletions app/lookups/land/medium.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Land
class Medium < ApplicationRecord
include TableName

lookup_by :medium, cache: 50, find_or_create: true

has_many :attributions
end
end
9 changes: 9 additions & 0 deletions app/lookups/land/mime_type.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Land
class MimeType < ApplicationRecord
include TableName

lookup_by :mime_type, cache: 50, find_or_create: true

has_many :pageviews
end
end
9 changes: 9 additions & 0 deletions app/lookups/land/network.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Land
class Network < ApplicationRecord
include TableName

lookup_by :network, cache: 50, find_or_create: true

has_many :attributions
end
end
Loading