Skip to content

Commit

Permalink
Merge branch 'release/1.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
arBmind committed Mar 25, 2019
2 parents e47abb4 + dc3c9f6 commit 9421eec
Show file tree
Hide file tree
Showing 74 changed files with 604 additions and 329 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ Gemfile.lock

tmp/rubycritic/
/.bundle
.ruby-version
75 changes: 48 additions & 27 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,64 +11,85 @@ env:
- PLUGIN=redmine_hourglass
- REDMINE=test_redmine
- TRACE=--trace
- RAILS_ENV=test

matrix:
include:
- name: Ruby 2.0 / Redmine 3.2
rvm: 2.0.0
env: REDMINE_VERSION=3.2.9
env:
- REDMINE_VERSION=3.2.9
- name: Ruby 2.0 / Redmine 3.3
rvm: 2.0.0
env: REDMINE_VERSION=3.3.9
env:
- REDMINE_VERSION=3.3.9

- name: Ruby 2.1 / Redmine 3.3
rvm: 2.1.10
env: REDMINE_VERSION=3.3.9
env:
- REDMINE_VERSION=3.3.9
- DATABASE=MYSQL
- name: Ruby 2.1 / Redmine 3.4
rvm: 2.1.10
env: REDMINE_VERSION=3.4.9
env:
- REDMINE_VERSION=3.4.9
- DATABASE=MYSQL

- name: Ruby 2.2 / Redmine 3.3
rvm: 2.2.10
env: REDMINE_VERSION=3.3.9
env:
- REDMINE_VERSION=3.3.9
- DATABASE=POSTGRESQL
- name: Ruby 2.2 / Redmine 3.4
rvm: 2.2.10
env: REDMINE_VERSION=3.4.9
env:
- REDMINE_VERSION=3.4.9
- DATABASE=POSTGRESQL

- name: Ruby 2.3 / Redmine 3.4.1
rvm: 2.3.8
env: REDMINE_VERSION=3.4.1
env:
- REDMINE_VERSION=3.4.1
- name: Ruby 2.3 / Redmine 3.4.9
rvm: 2.3.8
env: REDMINE_VERSION=3.4.9
env:
- REDMINE_VERSION=3.4.9

- name: Ruby 2.3 / Redmine 4
rvm: 2.3.8
env:
- REDMINE_VERSION=4.0.2

- name: Ruby 2.5 / Redmine 4
rvm: 2.5.3
env: REDMINE_VERSION=4.0.2
env:
- REDMINE_VERSION=4.0.2

- name: Ruby 2.6 / Redmine 4
rvm: 2.6.1
env: REDMINE_VERSION=4.0.2

allow_failures:
- env: REDMINE_VERSION=4.0.2
env:
- REDMINE_VERSION=4.0.2
- UPDATE_DEFAULT_GEMS=1

before_install:
- source .travis/clone_redmine.sh
- gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
- gem install bundler -v '< 2'
- source .travis/clone_redmine.sh
- gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
- gem install bundler -v '< 2'

services:
- mysql
- postgresql

install:
- export BUNDLE_GEMFILE=$PATH_TO_REDMINE/Gemfile
- cd $PATH_TO_REDMINE
- bundle install --without rmagick --jobs=3 --retry=3 --path=$PATH_TO_PLUGIN/vendor/bundle
- bundle exec rake $TRACE db:migrate
- bundle exec rake $TRACE redmine:load_default_data REDMINE_LANG=en
- bundle exec rake $TRACE $GENERATE_SECRET
- bundle exec rake $TRACE $MIGRATE_PLUGINS
- export BUNDLE_GEMFILE=$PATH_TO_REDMINE/Gemfile
- cd $PATH_TO_REDMINE
- bundle install --without rmagick --jobs=3 --retry=3 --path=$PATH_TO_PLUGIN/vendor/bundle
- bundle exec rake $TRACE db:create
- bundle exec rake $TRACE db:migrate
- bundle exec rake $TRACE redmine:load_default_data REDMINE_LANG=en
- bundle exec rake $TRACE $GENERATE_SECRET
- bundle exec rake $TRACE $MIGRATE_PLUGINS

script:
- cd $PATH_TO_REDMINE
- if [ "$TRACE" == "--trace" ]; then export BACKTRACE=--backtrace; fi
- if [ -z "$TRACE" ]; then unset BACKTRACE; fi
- bundle exec rspec $BACKTRACE --pattern $PATH_TO_PLUGIN/spec/**/*_spec.rb
- cd $PATH_TO_REDMINE
- bundle exec rake $TRACE redmine:plugins:hourglass:spec $BACKTRACE
14 changes: 13 additions & 1 deletion .travis/clone_redmine.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,16 @@ if [ -L "$PATH_TO_PLUGINS/$PLUGIN" ]; then
fi
ln -s "$PATH_TO_PLUGIN" "$PATH_TO_PLUGINS/$PLUGIN"

cp $PATH_TO_PLUGINS/$PLUGIN/.travis/database.yml config/database.yml
case $DATABASE in
MYSQL) cp $PATH_TO_PLUGINS/$PLUGIN/.travis/mysql_database.yml config/database.yml
;;
POSTGRESQL)
cp $PATH_TO_PLUGINS/$PLUGIN/.travis/postgresql_database.yml config/database.yml
;;
*) cp $PATH_TO_PLUGINS/$PLUGIN/.travis/sqlite3_database.yml config/database.yml
;;
esac

if [ "$UPDATE_DEFAULT_GEMS" = "1" ]; then
gem update --system
fi
3 changes: 0 additions & 3 deletions .travis/database.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .travis/mysql_database.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test:
adapter: mysql2
database: redmine_test
3 changes: 3 additions & 0 deletions .travis/postgresql_database.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test:
adapter: postgresql
database: redmine_test
3 changes: 3 additions & 0 deletions .travis/sqlite3_database.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test:
adapter: sqlite3
database: db/redmine_test.sqlite3
19 changes: 12 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,25 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [1.1.0] - TBA
The first enhancement release aims to enhance the user experience even further.
## [1.1.0] - 2019-03-25

First release with Redmine 4.0 support.
Redmine versions 3.x are still supported, but will be removed in future releases.

### Added
- [please add new features]
- support for Redmine version 4.0.0 and above
- backend and frontend validation of settings

### Changed
- [please add noteworthy changes]
- improved testing of multiple databases

### Removed
- [please add dropped features]
### Fixed
- removal of database specific tests that led to errors
- enhanced datetime parsing
- enhanced filters of time logs


## [1.0.0] - 2019.02.26
## [1.0.0] - 2019-02-26

This is the first mature release after a long beta testing period.
We added plenty of new features which were long time overdue.
Expand Down
17 changes: 14 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ source 'https://rubygems.org'
gem 'uglifier'
gem 'coffee-script', '~> 2.4.1'
gem 'sass', '~> 3.5.1'
gem 'rb-inotify', '<0.10' # required for ruby 2.0 support

# access control
gem 'pundit', '~> 1.1.0'
Expand All @@ -23,12 +22,24 @@ gem 'rspec-core'
gem 'rqrcode', '~> 0.10.1'

group :development, :test do
gem 'rubycritic', '<4.0.0', require: false
gem 'rainbow', '<3.0.0' # required for ruby 2.0 support
gem 'rspec-rails', '~> 3.5', '>= 3.5.2'
gem 'factory_bot_rails', '< 5.0'
gem 'zonebie'
gem 'timecop'
gem 'faker', '1.7.3'
gem 'database_cleaner'
end

if RUBY_VERSION < "2.1"
group :development, :test do
gem 'rubycritic', '<2.9.0', require: false
end
elsif RUBY_VERSION < "2.3"
group :development, :test do
gem 'rubycritic', '<4.0.0', require: false
end
else
group :development, :test do
gem 'rubycritic', require: false
end
end
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ The Binaries are made available as downloads in the [Releases](https://github.co
## Requirements

* Ruby 2.0.0 - 2.3.x
* Redmine 3.2.0 - 3.4.x
* Redmine 4.0.x support is in the works
* Redmine 3.2.0 - 4.0.x
* An [ExecJS](https://github.com/sstephenson/execjs) compatible runtime, the gemfile includes [therubyracer](https://github.com/cowboyd/therubyracer) for unix based systems and windows ships with a default js interpreter (from Win 7 upwards), so most people should be set. If you happen to have problems like for example [#29](https://github.com/hicknhack-software/redmine_hourglass/issues/29), take a look on the linked ExecJS and install one of the mentioned runtimes.

See [.travis.yml](.travis.yml) for details about supported versions.
Expand Down
1 change: 1 addition & 0 deletions app/assets/javascripts/forms.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,4 @@ $ ->
event.stopPropagation()
return isFormValid
.on 'ajax:before', '.js-check-splitting', checkSplitting
$('.js-issue-autocompletion:focus:not(.ui-autocomplete-input)').each(initIssueAutoCompletion)
2 changes: 1 addition & 1 deletion app/assets/javascripts/redmine_integrations.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ window.toggleOperator = (field) ->
window.oldToggleOperator field

$ ->
$issueActionList = $('#content .contextual')
$issueActionList = $('#content > .contextual')
$issueActionsToAdd = $('.js-issue-action')
$issueActionList.first().add($issueActionList.last())
.find(':nth-child(2)').after $issueActionsToAdd.removeClass('hidden')
Expand Down
41 changes: 6 additions & 35 deletions app/controllers/concerns/boolean_parsing.rb
Original file line number Diff line number Diff line change
@@ -1,43 +1,14 @@
module BooleanParsing
extend ActiveSupport::Concern

def parse_boolean(keys, params = self.params)
def parse_boolean(keys, params)
keys = [keys] if keys.is_a? Symbol
keys.each do |key|
params[key] = case params[key].class.name
when 'String'
params[key] == '1' || params[key] == 'true'
when 'Fixnum', 'Integer'
params[key] == 1
else
params[key]
end
end
params
end

def parse_float(keys, params = self.params)
keys = [keys] if keys.is_a? Symbol
keys.each do |key|
params[key] = case params[key].class.name
when 'String', 'Fixnum', 'Integer'
params[key].to_f
else
params[key]
end
end
params
end

def parse_int(keys, params = self.params)
keys = [keys] if keys.is_a? Symbol
keys.each do |key|
params[key] = case params[key].class.name
when 'String', 'Fixnum', 'Integer'
params[key].to_i
else
params[key]
end
if Rails::VERSION::MAJOR <= 4
params[key] = ActiveRecord::Type::Boolean.new.type_cast_from_user(params[key])
else
params[key] = ActiveRecord::Type::Boolean.new.cast(params[key])
end
end
params
end
Expand Down
26 changes: 17 additions & 9 deletions app/controllers/hourglass/api_base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class ApiBaseController < ApplicationController
include ::AuthorizationConcern

private

# use only these codes:
# :ok (200)
# :not_modified (304)
Expand All @@ -24,8 +25,8 @@ class ApiBaseController < ApplicationController
# :internal_server_error (500)
def respond_with_error(status, message, **options)
render json: {
message: message.is_a?(Array) && options[:array_mode] == :sentence ? message.to_sentence : message,
status: Rack::Utils.status_code(status)
message: message.is_a?(Array) && options[:array_mode] == :sentence ? message.to_sentence : message,
status: Rack::Utils.status_code(status)
},
status: status
throw :halt unless options[:no_halt]
Expand Down Expand Up @@ -71,18 +72,25 @@ def list_records(klass)
scope = @query.results_scope order: sort_clause
offset, limit = api_offset_and_limit
respond_with_success(
count: scope.count,
offset: offset,
limit: limit,
records: scope.offset(offset).limit(limit).to_a
count: scope.count,
offset: offset,
limit: limit,
records: scope.offset(offset).limit(limit).to_a
)
end

def bulk(params_key = controller_name, &block)
@bulk_success = []
@bulk_errors = []
params[params_key].each_with_index do |(id, params), index|
id, params = "new#{index}", id if id.is_a?(Hash)
entries = params[params_key]
entries = entries.to_unsafe_h if Rails::VERSION::MAJOR >= 5 && entries.instance_of?(ActionController::Parameters)
entries.each_with_index do |(id, params), index|
if Rails::VERSION::MAJOR <= 4
id, params = "new#{index}", id if id.is_a?(Hash)
else
id, params = "new#{index}", id if id.instance_of?(ActionController::Parameters)
params = ActionController::Parameters.new(params) if params.is_a?(Hash)
end
error_preface = id.start_with?('new') ? bulk_error_preface(index, mode: :create) : bulk_error_preface(id)
evaluate_entry bulk_entry(id, params, &block), error_preface
end
Expand Down Expand Up @@ -132,7 +140,7 @@ def internal_server_error(e)
end

def flash_array(type, messages)
flash[type] = render_to_string partial: 'hourglass_ui/flash_array', locals: {messages: messages}
flash[type] = render_to_string partial: 'hourglass_ui/flash_array', locals: { messages: messages }
end

def custom_field_keys(params_hash)
Expand Down
13 changes: 7 additions & 6 deletions app/controllers/hourglass/time_logs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def bulk_destroy
end

private

def time_log_params(params_hash = params.require(:time_log))
parse_boolean :round, params_hash.permit(:start, :stop, :comments, :round, :user_id)
end
Expand All @@ -116,12 +117,12 @@ def create_time_log_params(params_hash = params.require(:time_log))
end

def split_params
parse_boolean [:round, :insert_new_before]
{
split_at: Time.parse(params[:split_at]),
insert_new_before: params[:insert_new_before],
round: params[:round]
}
parse_boolean [:round, :insert_new_before],
{
split_at: Time.parse(params[:split_at]),
insert_new_before: params[:insert_new_before],
round: params[:round]
}
end

def time_booking_params(params_hash = params.require(:time_booking))
Expand Down

0 comments on commit 9421eec

Please sign in to comment.