mirror of
https://github.com/TracksApp/tracks.git
synced 2025-09-21 21:40:48 +02:00
Merge remote-tracking branch 'origin/master' into bug/#2259_charts_quality
This commit is contained in:
commit
f7bad05dad
20 changed files with 205 additions and 101 deletions
11
.github/workflows/continuous-integration.yml
vendored
Normal file
11
.github/workflows/continuous-integration.yml
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
name: Continuous Integration
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- run: bash -x script/cibuild
|
21
.travis.yml
21
.travis.yml
|
@ -1,21 +0,0 @@
|
|||
sudo: true
|
||||
services:
|
||||
- docker
|
||||
env:
|
||||
- DOCKER_COMPOSE_VERSION=1.21.0
|
||||
before_install:
|
||||
- sudo rm /usr/local/bin/docker-compose
|
||||
- curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
|
||||
- chmod 0755 docker-compose
|
||||
- sudo mv docker-compose /usr/local/bin
|
||||
install: true
|
||||
script: "script/cibuild"
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- docker-ce
|
||||
notifications:
|
||||
email: false
|
||||
#irc:
|
||||
#channels: "chat.freenode.net#tracks"
|
||||
#skip_join: true
|
|
@ -6,7 +6,7 @@ RUN touch /etc/app-env
|
|||
|
||||
COPY Gemfile* /app/
|
||||
RUN gem install bundler
|
||||
RUN bundle install
|
||||
RUN bundle install --jobs 4
|
||||
|
||||
RUN mkdir /app/log
|
||||
|
||||
|
|
8
Gemfile
8
Gemfile
|
@ -15,7 +15,7 @@ gem 'therubyracer', group: :therubyracer
|
|||
|
||||
gem 'uglifier', '>=1.3.0'
|
||||
|
||||
gem 'jquery-rails' , '~> 4.0'
|
||||
gem 'jquery-rails' , '~> 4.3'
|
||||
gem 'jquery-ui-rails' , '~>5.0.5'
|
||||
|
||||
# you may comment out the database driver(s) you will not be using.
|
||||
|
@ -32,7 +32,7 @@ gem "acts_as_list"
|
|||
gem "aasm", '~> 3.4.0'
|
||||
gem "htmlentities"
|
||||
gem "rails_autolink"
|
||||
gem 'puma', '~> 3.12'
|
||||
gem 'puma', '~> 4.1'
|
||||
gem 'paperclip'
|
||||
|
||||
# To use ActiveModel has_secure_password
|
||||
|
@ -53,7 +53,7 @@ group :development do
|
|||
gem "spring"
|
||||
gem "yard"
|
||||
|
||||
gem 'tolk', '~> 3.1.0'
|
||||
gem 'tolk', '~> 3.2.1'
|
||||
|
||||
gem "bullet"
|
||||
gem "rack-mini-profiler"
|
||||
|
@ -62,7 +62,7 @@ end
|
|||
group :development, :test do
|
||||
gem 'byebug'
|
||||
gem 'listen'
|
||||
gem "rubocop", "~> 0.71", require: false
|
||||
gem "rubocop", "~> 0.74", require: false
|
||||
end
|
||||
|
||||
group :test do
|
||||
|
|
66
Gemfile.lock
66
Gemfile.lock
|
@ -70,11 +70,11 @@ GEM
|
|||
autoprefixer-rails (>= 5.2.1)
|
||||
sassc (>= 2.0.0)
|
||||
builder (3.2.3)
|
||||
bullet (6.0.0)
|
||||
bullet (6.0.1)
|
||||
activesupport (>= 3.0.0)
|
||||
uniform_notifier (~> 1.11)
|
||||
byebug (11.0.1)
|
||||
childprocess (1.0.1)
|
||||
childprocess (2.0.0)
|
||||
rake (< 13.0)
|
||||
climate_control (0.2.0)
|
||||
codeclimate-test-reporter (1.0.7)
|
||||
|
@ -87,10 +87,10 @@ GEM
|
|||
execjs
|
||||
coffee-script-source (1.12.2)
|
||||
concurrent-ruby (1.1.5)
|
||||
crass (1.0.4)
|
||||
crass (1.0.5)
|
||||
database_cleaner (1.7.0)
|
||||
diff-lcs (1.3)
|
||||
docile (1.3.1)
|
||||
docile (1.3.2)
|
||||
erubi (1.8.0)
|
||||
execjs (2.7.0)
|
||||
factory_bot (4.11.1)
|
||||
|
@ -106,20 +106,20 @@ GEM
|
|||
htmlentities (4.3.4)
|
||||
i18n (1.6.0)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jaro_winkler (1.5.2)
|
||||
jquery-rails (4.3.3)
|
||||
jaro_winkler (1.5.3)
|
||||
jquery-rails (4.3.5)
|
||||
rails-dom-testing (>= 1, < 3)
|
||||
railties (>= 4.2.0)
|
||||
thor (>= 0.14, < 2.0)
|
||||
jquery-ui-rails (5.0.5)
|
||||
railties (>= 3.2.16)
|
||||
json (2.1.0)
|
||||
json (2.2.0)
|
||||
libv8 (3.16.14.19)
|
||||
listen (3.1.5)
|
||||
rb-fsevent (~> 0.9, >= 0.9.4)
|
||||
rb-inotify (~> 0.9, >= 0.9.7)
|
||||
ruby_dep (~> 1.2)
|
||||
loofah (2.2.3)
|
||||
loofah (2.3.1)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.5.9)
|
||||
mail (2.7.1)
|
||||
|
@ -132,15 +132,15 @@ GEM
|
|||
mime-types-data (~> 3.2015)
|
||||
mime-types-data (3.2016.0521)
|
||||
mimemagic (0.3.3)
|
||||
mini_mime (1.0.1)
|
||||
mini_mime (1.0.2)
|
||||
mini_portile2 (2.4.0)
|
||||
minitest (5.11.3)
|
||||
minitest-stub-const (0.6)
|
||||
mocha (1.8.0)
|
||||
mocha (1.9.0)
|
||||
metaclass (~> 0.0.1)
|
||||
mysql2 (0.5.2)
|
||||
nio4r (2.3.1)
|
||||
nokogiri (1.10.3)
|
||||
nio4r (2.5.1)
|
||||
nokogiri (1.10.4)
|
||||
mini_portile2 (~> 2.4.0)
|
||||
nokogumbo (2.0.1)
|
||||
nokogiri (~> 1.8, >= 1.8.4)
|
||||
|
@ -153,7 +153,8 @@ GEM
|
|||
parallel (1.17.0)
|
||||
parser (2.6.3.0)
|
||||
ast (~> 2.4.0)
|
||||
puma (3.12.1)
|
||||
puma (4.1.1)
|
||||
nio4r (~> 2.0)
|
||||
rack (2.0.7)
|
||||
rack-mini-profiler (1.0.2)
|
||||
rack (>= 1.2.0)
|
||||
|
@ -179,7 +180,7 @@ GEM
|
|||
rails-dom-testing (2.0.3)
|
||||
activesupport (>= 4.2.0)
|
||||
nokogiri (>= 1.6)
|
||||
rails-html-sanitizer (1.0.4)
|
||||
rails-html-sanitizer (1.2.0)
|
||||
loofah (~> 2.2, >= 2.2.2)
|
||||
rails_autolink (1.1.6)
|
||||
rails (> 3.1)
|
||||
|
@ -190,7 +191,7 @@ GEM
|
|||
rake (>= 0.8.7)
|
||||
thor (>= 0.19.0, < 2.0)
|
||||
rainbow (3.0.0)
|
||||
rake (12.3.2)
|
||||
rake (12.3.3)
|
||||
rb-fsevent (0.10.3)
|
||||
rb-inotify (0.10.0)
|
||||
ffi (~> 1.0)
|
||||
|
@ -199,7 +200,7 @@ GEM
|
|||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.8.0)
|
||||
rspec-support (3.8.2)
|
||||
rubocop (0.71.0)
|
||||
rubocop (0.74.0)
|
||||
jaro_winkler (~> 1.5.1)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 2.6)
|
||||
|
@ -208,13 +209,13 @@ GEM
|
|||
unicode-display_width (>= 1.4.0, < 1.7)
|
||||
ruby-progressbar (1.10.1)
|
||||
ruby_dep (1.5.0)
|
||||
rubyzip (1.2.2)
|
||||
safe_yaml (1.0.4)
|
||||
rubyzip (1.2.4)
|
||||
safe_yaml (1.0.5)
|
||||
sanitize (5.0.0)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.8.0)
|
||||
nokogumbo (~> 2.0)
|
||||
sass (3.7.3)
|
||||
sass (3.7.4)
|
||||
sass-listen (~> 4.0.0)
|
||||
sass-listen (4.0.0)
|
||||
rb-fsevent (~> 0.9, >= 0.9.4)
|
||||
|
@ -228,16 +229,15 @@ GEM
|
|||
sassc (2.0.0)
|
||||
ffi (~> 1.9.6)
|
||||
rake
|
||||
selenium-webdriver (3.142.3)
|
||||
childprocess (>= 0.5, < 2.0)
|
||||
selenium-webdriver (3.142.4)
|
||||
childprocess (>= 0.5, < 3.0)
|
||||
rubyzip (~> 1.2, >= 1.2.2)
|
||||
simplecov (0.16.1)
|
||||
simplecov (0.17.0)
|
||||
docile (~> 1.1)
|
||||
json (>= 1.8, < 3)
|
||||
simplecov-html (~> 0.10.0)
|
||||
simplecov-html (0.10.2)
|
||||
spring (2.0.2)
|
||||
activesupport (>= 4.2)
|
||||
spring (2.1.0)
|
||||
sprockets (3.7.2)
|
||||
concurrent-ruby (~> 1.0)
|
||||
rack (> 1, < 3)
|
||||
|
@ -254,7 +254,7 @@ GEM
|
|||
thor (0.20.3)
|
||||
thread_safe (0.3.6)
|
||||
tilt (2.0.8)
|
||||
tolk (3.1.0)
|
||||
tolk (3.2.1)
|
||||
rails (>= 5.0)
|
||||
safe_yaml (>= 0.8.6)
|
||||
sass
|
||||
|
@ -264,11 +264,11 @@ GEM
|
|||
execjs (>= 0.3.0, < 3)
|
||||
unicode-display_width (1.6.0)
|
||||
uniform_notifier (1.12.1)
|
||||
websocket-driver (0.7.0)
|
||||
websocket-driver (0.7.1)
|
||||
websocket-extensions (>= 0.1.0)
|
||||
websocket-extensions (0.1.3)
|
||||
will_paginate (3.1.7)
|
||||
yard (0.9.19)
|
||||
websocket-extensions (0.1.4)
|
||||
will_paginate (3.1.8)
|
||||
yard (0.9.20)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
@ -290,21 +290,21 @@ DEPENDENCIES
|
|||
factory_bot_rails
|
||||
font-awesome-sass (~> 4.5.0)
|
||||
htmlentities
|
||||
jquery-rails (~> 4.0)
|
||||
jquery-rails (~> 4.3)
|
||||
jquery-ui-rails (~> 5.0.5)
|
||||
listen
|
||||
minitest-stub-const
|
||||
mocha
|
||||
mysql2 (~> 0.5.2)
|
||||
paperclip
|
||||
puma (~> 3.12)
|
||||
puma (~> 4.1)
|
||||
rack-mini-profiler
|
||||
rails (~> 5.2.3)
|
||||
rails-controller-testing
|
||||
rails-dom-testing (~> 2.0.0)
|
||||
rails_autolink
|
||||
rspec-expectations
|
||||
rubocop (~> 0.71)
|
||||
rubocop (~> 0.74)
|
||||
sanitize (~> 5.0)
|
||||
sass-rails (~> 5.0)
|
||||
selenium-webdriver (~> 3.142)
|
||||
|
@ -312,7 +312,7 @@ DEPENDENCIES
|
|||
spring
|
||||
sqlite3
|
||||
therubyracer
|
||||
tolk (~> 3.1.0)
|
||||
tolk (~> 3.2.1)
|
||||
uglifier (>= 1.3.0)
|
||||
will_paginate
|
||||
yard
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
* IRC channel: #tracks on Freenode
|
||||
* Original developer: bsag (http://www.rousette.org.uk/)
|
||||
* Contributors: https://github.com/TracksApp/tracks/wiki/Contributors
|
||||
* Version: 2.4devel
|
||||
* Version: 2.4.1
|
||||
|
||||
[](https://travis-ci.org/TracksApp/tracks)
|
||||
[](https://github.com/TracksApp/tracks/actions)
|
||||
[](https://codeclimate.com/github/TracksApp/tracks)
|
||||
|
||||
Full instructions for both new installations and upgrades from older installations of Tracks
|
||||
|
@ -29,7 +29,7 @@ you cannot find a solution to your problem.
|
|||
The wiki has a lot of user contributed installation HOWTOs for various webhosts, specific OS's and more.
|
||||
|
||||
If you are thinking about contributing towards the development of Tracks,
|
||||
please read /doc/README_DEVELOPERS for general information. Also you can find
|
||||
please read /CONTRIBUTING.md for general information. Also you can find
|
||||
some information on development, testing and contributing on the wiki.
|
||||
|
||||
While fully usable for everyday use, Tracks is still a work in progress. Make
|
||||
|
|
|
@ -712,9 +712,8 @@ class TodosController < ApplicationController
|
|||
|
||||
|
||||
def tags
|
||||
# TODO: limit to current_user
|
||||
tags_beginning = Tag.where(Tag.arel_table[:name].matches("#{params[:term]}%"))
|
||||
tags_all = Tag.where(Tag.arel_table[:name].matches("%#{params[:term]}%"))
|
||||
tags_beginning = current_user.tags.where(Tag.arel_table[:name].matches("#{params[:term]}%"))
|
||||
tags_all = current_user.tags.where(Tag.arel_table[:name].matches("%#{params[:term]}%"))
|
||||
tags_all = tags_all - tags_beginning
|
||||
|
||||
respond_to do |format|
|
||||
|
|
|
@ -570,7 +570,7 @@ module TodosHelper
|
|||
end
|
||||
|
||||
def context_container_id(todo)
|
||||
return "c#{todo.context_id}"
|
||||
return "context_#{todo.context_id}"
|
||||
end
|
||||
|
||||
def todo_container_id(todo)
|
||||
|
|
|
@ -3,13 +3,15 @@ class Tag < ApplicationRecord
|
|||
has_many :taggings
|
||||
has_many :taggable, :through => :taggings
|
||||
|
||||
belongs_to :user
|
||||
|
||||
DELIMITER = ",".freeze # Controls how to split and join tagnames from strings. You may need to change the <tt>validates_format_of parameters</tt> if you change this.
|
||||
JOIN_DELIMITER = ", ".freeze
|
||||
|
||||
# If database speed becomes an issue, you could remove these validations and
|
||||
# rescue the ActiveRecord database constraint errors instead.
|
||||
validates_presence_of :name
|
||||
validates_uniqueness_of :name, :case_sensitive => false
|
||||
validates_uniqueness_of :name, :scope => "user_id", :case_sensitive => false
|
||||
|
||||
before_create :before_create
|
||||
|
||||
|
|
|
@ -94,6 +94,7 @@ class User < ApplicationRecord
|
|||
end
|
||||
end
|
||||
|
||||
has_many :tags, dependent: :delete_all
|
||||
has_many :notes, -> { order "created_at DESC" }, dependent: :delete_all
|
||||
has_one :preference, dependent: :destroy
|
||||
has_many :attachments, through: :todos
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
tracks_version='2.4devel'
|
||||
tracks_version='2.4.1'
|
||||
# comment out next two lines if you do not want (or can not) the date of the
|
||||
# last git commit in the footer
|
||||
info=`git log --pretty=format:"%ai" -1`
|
||||
|
|
88
db/migrate/20190618202817_add_user_id_to_tag.rb
Normal file
88
db/migrate/20190618202817_add_user_id_to_tag.rb
Normal file
|
@ -0,0 +1,88 @@
|
|||
class AddUserIdToTag < ActiveRecord::Migration[5.2]
|
||||
def self.up
|
||||
add_column :tags, :user_id, :integer
|
||||
|
||||
# Find uses of each tag for both Todos and RecurringTodos to
|
||||
# figure out which users use which tags.
|
||||
@tags = exec_query <<-EOQ
|
||||
SELECT t.id AS tid, tds.user_id AS todo_uid, rt.user_id AS rtodo_uid
|
||||
FROM tags t
|
||||
JOIN taggings tgs ON tgs.tag_id = t.id
|
||||
LEFT OUTER JOIN todos tds
|
||||
ON tgs.taggable_type = 'Todo' AND tds.id = tgs.taggable_id
|
||||
LEFT OUTER JOIN recurring_todos rt
|
||||
ON tgs.taggable_type = 'RecurringTodo' AND rt.id = tgs.taggable_id
|
||||
WHERE rt.id IS NOT NULL OR tds.id IS NOT NULL
|
||||
GROUP BY t.id, tds.user_id, rt.user_id
|
||||
EOQ
|
||||
|
||||
# Map each tag to the users using it.
|
||||
@tag_users = {}
|
||||
@tags.each do |row|
|
||||
uid = (row['todo_uid'] ? row['todo_uid'] : row['rtodo_uid'])
|
||||
if not @tag_users[row['tid']]
|
||||
@tag_users[row['tid']] = [uid]
|
||||
elsif not @tag_users[row['tid']].include? uid
|
||||
@tag_users[row['tid']] << uid
|
||||
end
|
||||
end
|
||||
|
||||
# Go through the tags assigning users and duplicating as necessary.
|
||||
@tag_users.each do |tid, uids|
|
||||
tag = Tag.find(tid)
|
||||
|
||||
# One of the users will get the original tag instance, but first
|
||||
# duplicate their own copy to all the others.
|
||||
extras = uids.length - 1
|
||||
extras.times do |n|
|
||||
uid = uids[n+1]
|
||||
|
||||
# Create a duplicate of the tag assigned to the user.
|
||||
new_tag = tag.dup
|
||||
new_tag.user_id = uid
|
||||
new_tag.save!
|
||||
|
||||
# Move all the user's regular todos to the new tag.
|
||||
execute <<-EOQ
|
||||
UPDATE taggings ta
|
||||
JOIN todos t
|
||||
ON ta.taggable_type = 'Todo' AND t.id = ta.taggable_id
|
||||
SET ta.tag_id = #{new_tag.id}
|
||||
WHERE t.user_id = #{uid} AND ta.tag_id = #{tid}
|
||||
EOQ
|
||||
|
||||
# Move all the user's recurring todos to the new tag.
|
||||
execute <<-EOQ
|
||||
UPDATE taggings ta
|
||||
JOIN recurring_todos t
|
||||
ON ta.taggable_type = 'RecurringTodo' AND t.id = ta.taggable_id
|
||||
SET ta.tag_id = #{new_tag.id}
|
||||
WHERE t.user_id = #{uid} AND ta.tag_id = #{tid}
|
||||
EOQ
|
||||
end
|
||||
|
||||
tag.user_id = uids[0]
|
||||
tag.save!
|
||||
end
|
||||
|
||||
# Set all unowned tags to the only user, if there's only one. Otherwise
|
||||
# remove them since there's no way of knowing who they belong to.
|
||||
if User.all.count == 1
|
||||
uid = User.first.id
|
||||
execute <<-EOQ
|
||||
UPDATE tags
|
||||
SET user_id = #{uid}
|
||||
WHERE user_id IS NULL
|
||||
EOQ
|
||||
else
|
||||
execute <<-EOQ
|
||||
DELETE FROM tags
|
||||
WHERE user_id IS NULL
|
||||
EOQ
|
||||
end
|
||||
end
|
||||
def self.down
|
||||
remove_column :tags, :user_id
|
||||
end
|
||||
end
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2016_01_31_233303) do
|
||||
ActiveRecord::Schema.define(version: 2019_06_18_202817) do
|
||||
|
||||
create_table "attachments", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
|
||||
t.integer "todo_id"
|
||||
|
@ -159,6 +159,7 @@ ActiveRecord::Schema.define(version: 2016_01_31_233303) do
|
|||
t.string "name"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.integer "user_id"
|
||||
t.index ["name"], name: "index_tags_on_name"
|
||||
end
|
||||
|
||||
|
|
|
@ -1,13 +1,35 @@
|
|||
## Version 2.4
|
||||
## Version 2.4.1
|
||||
|
||||
### Bug fixes
|
||||
* Fixed a bug in the tag migration that prevented the migration from completing
|
||||
at least in some MySQL environments. The bug only affected upgrading an existing Tracks
|
||||
installation.
|
||||
|
||||
## Version 2.4.0
|
||||
|
||||
### New features
|
||||
* Removed support for deprecated password-hashing algorithm. This
|
||||
eliminates config.salt. Note the addition of a pre-upgrade step to
|
||||
check for obsolete passwords.
|
||||
* Rails 4.2
|
||||
* All tags now belong to a user. Existing tags are migrated to users based on
|
||||
the taggings and duplicated as necessary. If there's only one user, all unused tags are
|
||||
assigned to them, otherwise unused tags are removed.
|
||||
* All REST APIs now also accept user token as password.
|
||||
* The stats view now uses Charts.js instead of the Flash-based chart library.
|
||||
* A Docker environment is used unless the .skip-docker file exists.
|
||||
* Rails 5.2
|
||||
* Thin replaces WEBrick as the included web server
|
||||
* Tracks is tested on Ruby 1.9.3, 2.0.0, 2.1, and 2.2.
|
||||
* Tracks is tested on Ruby 2.4 and 2.5
|
||||
* The MessageGateway will save the received email as an attachement to the todo
|
||||
* Add a configuration option for serving static assets from Rails
|
||||
|
||||
### Removed features
|
||||
* Ruby versions below 2.4 are no longer supported.
|
||||
|
||||
### Bug fixes
|
||||
* Multiple fixes to REST APIs.
|
||||
* Several UI bugs fixed.
|
||||
|
||||
## Version 2.3.0
|
||||
|
||||
### New and changed features
|
||||
|
|
|
@ -10,7 +10,7 @@ For alternative installation options and tips for specific environments, please
|
|||
|
||||
Tracks has a few software requirements that must be satisfied before installation:
|
||||
|
||||
1. **Ruby**. Tracks requires Ruby 1.9.3 or greater.
|
||||
1. **Ruby**. Tracks requires Ruby 2.4 or greater.
|
||||
2. **Bundler**. Tracks requires a recent version of [Bundler](http://bundler.io) to handle the installation of dependencies. Bundler is typically installed by running `gem install bundler`.
|
||||
3. **Database**. Tracks is tested on [MySQL](http://www.mysql.com/) and [SQLite](http://www.sqlite.org/), but [PostgreSQL](http://www.postgresql.org/) can also be used. Of the three, SQLite requires the least configuration. Whatever your choice, the appropriate database software must be installed.
|
||||
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
# Upgrading Tracks
|
||||
|
||||
## Upgrading from Tracks 2.3 to 2.4devel
|
||||
## Upgrading from Tracks 2.3 to 2.4.1
|
||||
|
||||
WARNING: 2.4devel is a development tree of Tracks and may (will?) contain bugs that might destroy your data! It is not recommended to upgrade to 2.4devel unless you know what you are doing.
|
||||
These upgrade instructions are rough. Please suggest improvements in a GitHub issue if you run into problems.
|
||||
|
||||
That said. To upgrade:
|
||||
To upgrade:
|
||||
|
||||
1. Support for Tracks' older, less secure password-hashing algorithm has been removed. Active user accounts will already have been upgraded, but you should check for outdated accounts by running `bundle exec rake tracks:check_passwords` from your existing Tracks install directory. If any users are listed, they can log in to be prompted to update their passwords, or you can run `bundle exec rake tracks:password USER=<username>` to reset their passwords using the new algorithm. If no users are listed, you can proceed with the upgrade.
|
||||
2. Back up your existing database and installation of Tracks
|
||||
3. Install Tracks 2.4devel in a new directory. Or you can create a separate installation of 2.4devel for testing purposes.
|
||||
4. Copy over the configuration from your previous Tracks installation. If using SQLite3, copy the old database into the new Tracks 2.4devel directory.
|
||||
3. Install Tracks 2.4.0 in a new directory. Or you can create a separate installation of 2.4.0 for testing purposes.
|
||||
4. Copy over the configuration from your previous Tracks installation. If using SQLite3, copy the old database into the new Tracks 2.4.0 directory.
|
||||
5. Check that you have all dependencies installed: `bundle install --without development test` Or leave out the `--without development test` part if you intend to test or develop on this tree.
|
||||
6. Run `bundle exec rake db:migrate RAILS_ENV=production` to update your old database to the new schema. This is the point of no return. Make sure you have backups!
|
||||
7. Precompile your static assets (css, javascript, etc.) by running `bundle exec rake assets:precompile RAILS_ENV=production`.
|
||||
8. Run `bundle exec rails server -e production` inside your Tracks 2.4devel directory to start up Tracks. Or use `-e development` if you intend to try your changes and get more log info.
|
||||
8. Run `bundle exec rails server -e production` inside your Tracks 2.4.0 directory to start up Tracks. Or use `-e development` if you intend to try your changes and get more log info.
|
||||
|
||||
Please note that if you intend to deploy Tracks using its included web server, you’ll need to copy over the `serve_static_assets` option into your `config/site.yml` and set it as it was in `config/production.rb` in order for the images, stylesheets, and javascript files to be served correctly.
|
||||
|
||||
|
|
|
@ -15,43 +15,43 @@ module IsTaggable
|
|||
self.to_a.reject{|tag| tag.name == Todo::STARRED_TAG_NAME}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def tag_list
|
||||
tags.reload
|
||||
tags.to_s
|
||||
end
|
||||
|
||||
|
||||
def tag_list=(value)
|
||||
tag_with(value)
|
||||
end
|
||||
|
||||
|
||||
# Replace the existing tags on <tt>self</tt>. Accepts a string of tagnames, an array of tagnames, or an array of Tags.
|
||||
def tag_with list
|
||||
def tag_with(list)
|
||||
list = tag_cast_to_string(list)
|
||||
|
||||
|
||||
# Transactions may not be ideal for you here; be aware.
|
||||
Tag.transaction do
|
||||
current = tags.to_a.map(&:name)
|
||||
_add_tags(list - current)
|
||||
_remove_tags(current - list)
|
||||
end
|
||||
|
||||
|
||||
self
|
||||
end
|
||||
|
||||
def has_tag?(tag_name)
|
||||
return tags.any? {|tag| tag.name == tag_name}
|
||||
end
|
||||
|
||||
|
||||
# Add tags to <tt>self</tt>. Accepts a string of tagnames, an array of tagnames, or an array of Tags.
|
||||
#
|
||||
# We need to avoid name conflicts with the built-in ActiveRecord association methods, thus the underscores.
|
||||
def _add_tags incoming
|
||||
def _add_tags(incoming)
|
||||
tag_cast_to_string(incoming).each do |tag_name|
|
||||
# added following check to prevent empty tags from being saved (which will fail)
|
||||
if tag_name.present?
|
||||
begin
|
||||
tag = Tag.where(:name => tag_name).first_or_create
|
||||
tag = self.user.tags.where(:name => tag_name).first_or_create
|
||||
raise Tag::Error, "tag could not be saved: #{tag_name}" if tag.new_record?
|
||||
tags << tag
|
||||
rescue ActiveRecord::StatementInvalid => e
|
||||
|
@ -62,11 +62,11 @@ module IsTaggable
|
|||
end
|
||||
|
||||
# Removes tags from <tt>self</tt>. Accepts a string of tagnames, an array of tagnames, or an array of Tags.
|
||||
def _remove_tags outgoing
|
||||
def _remove_tags(outgoing)
|
||||
outgoing = tag_cast_to_string(outgoing)
|
||||
tags.destroy(*(tags.select{|tag| outgoing.include? tag.name}))
|
||||
tags.destroy(*(self.user.tags.select{|tag| outgoing.include? tag.name}))
|
||||
end
|
||||
|
||||
|
||||
def get_tag_name_from_item(item)
|
||||
case item
|
||||
# removed next line as it prevents using numbers as tags
|
||||
|
@ -94,8 +94,6 @@ module IsTaggable
|
|||
raise "Invalid object of class #{obj.class} as tagging method parameter"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -26,8 +26,8 @@ $docker_compose up -d
|
|||
script/poll-for-db
|
||||
|
||||
# Leaving this in since it will be needed for Rails 5
|
||||
bin/rails db:environment:set RAILS_ENV=test || true
|
||||
$docker_compose run web bin/rails db:environment:set RAILS_ENV=test || true
|
||||
|
||||
bin/rake db:reset
|
||||
bin/rake test
|
||||
$docker_compose run web bin/rake db:reset
|
||||
$docker_compose run web bin/rake test
|
||||
|
||||
|
|
5
test/fixtures/tags.yml
vendored
5
test/fixtures/tags.yml
vendored
|
@ -10,18 +10,21 @@ end
|
|||
foo:
|
||||
id: 1
|
||||
name: foo
|
||||
user_id: 1
|
||||
created_at: <%= today %>
|
||||
updated_at: <%= today %>
|
||||
|
||||
bar:
|
||||
id: 2
|
||||
name: bar
|
||||
user_id: 1
|
||||
created_at: <%= today %>
|
||||
updated_at: <%= today %>
|
||||
|
||||
baz:
|
||||
id: 3
|
||||
name: baz
|
||||
user_id: 1
|
||||
created_at: <%= today %>
|
||||
updated_at: <%= today %>
|
||||
|
||||
|
||||
|
|
|
@ -25,20 +25,20 @@ class TagTest < ActiveSupport::TestCase
|
|||
tag = Tag.where(:name => "8.1.2").first_or_create
|
||||
assert !tag.new_record?
|
||||
end
|
||||
|
||||
|
||||
def test_tag_name_always_lowercase
|
||||
tag = Tag.where(:name => "UPPER").first_or_create
|
||||
assert !tag.new_record?
|
||||
|
||||
|
||||
upper = Tag.where(:name => "upper").first
|
||||
assert_not_nil upper
|
||||
assert upper.name == "upper"
|
||||
end
|
||||
|
||||
|
||||
def test_tag_name_stripped_of_spaces
|
||||
tag = Tag.where(:name => " strip spaces ").first_or_create
|
||||
assert !tag.new_record?
|
||||
|
||||
|
||||
assert tag.name == "strip spaces"
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue