Martin Edenhofer 9 лет назад
Родитель
Сommit
ad1b9b18bf

+ 1 - 1
Gemfile

@@ -1,6 +1,6 @@
 source 'http://rubygems.org'
 source 'http://rubygems.org'
 
 
-gem 'rails', '4.1.13'
+gem 'rails', '4.2.4'
 gem 'rails-observers'
 gem 'rails-observers'
 gem 'activerecord-session_store'
 gem 'activerecord-session_store'
 
 

+ 72 - 44
Gemfile.lock

@@ -2,42 +2,51 @@ GEM
   remote: http://rubygems.org/
   remote: http://rubygems.org/
   specs:
   specs:
     abstract_type (0.0.7)
     abstract_type (0.0.7)
-    actionmailer (4.1.13)
-      actionpack (= 4.1.13)
-      actionview (= 4.1.13)
+    actionmailer (4.2.4)
+      actionpack (= 4.2.4)
+      actionview (= 4.2.4)
+      activejob (= 4.2.4)
       mail (~> 2.5, >= 2.5.4)
       mail (~> 2.5, >= 2.5.4)
-    actionpack (4.1.13)
-      actionview (= 4.1.13)
-      activesupport (= 4.1.13)
-      rack (~> 1.5.2)
+      rails-dom-testing (~> 1.0, >= 1.0.5)
+    actionpack (4.2.4)
+      actionview (= 4.2.4)
+      activesupport (= 4.2.4)
+      rack (~> 1.6)
       rack-test (~> 0.6.2)
       rack-test (~> 0.6.2)
-    actionview (4.1.13)
-      activesupport (= 4.1.13)
+      rails-dom-testing (~> 1.0, >= 1.0.5)
+      rails-html-sanitizer (~> 1.0, >= 1.0.2)
+    actionview (4.2.4)
+      activesupport (= 4.2.4)
       builder (~> 3.1)
       builder (~> 3.1)
       erubis (~> 2.7.0)
       erubis (~> 2.7.0)
-    activemodel (4.1.13)
-      activesupport (= 4.1.13)
+      rails-dom-testing (~> 1.0, >= 1.0.5)
+      rails-html-sanitizer (~> 1.0, >= 1.0.2)
+    activejob (4.2.4)
+      activesupport (= 4.2.4)
+      globalid (>= 0.3.0)
+    activemodel (4.2.4)
+      activesupport (= 4.2.4)
       builder (~> 3.1)
       builder (~> 3.1)
-    activerecord (4.1.13)
-      activemodel (= 4.1.13)
-      activesupport (= 4.1.13)
-      arel (~> 5.0.0)
+    activerecord (4.2.4)
+      activemodel (= 4.2.4)
+      activesupport (= 4.2.4)
+      arel (~> 6.0)
     activerecord-session_store (0.1.1)
     activerecord-session_store (0.1.1)
       actionpack (>= 4.0.0, < 5)
       actionpack (>= 4.0.0, < 5)
       activerecord (>= 4.0.0, < 5)
       activerecord (>= 4.0.0, < 5)
       railties (>= 4.0.0, < 5)
       railties (>= 4.0.0, < 5)
-    activesupport (4.1.13)
-      i18n (~> 0.6, >= 0.6.9)
+    activesupport (4.2.4)
+      i18n (~> 0.7)
       json (~> 1.7, >= 1.7.7)
       json (~> 1.7, >= 1.7.7)
       minitest (~> 5.1)
       minitest (~> 5.1)
-      thread_safe (~> 0.1)
+      thread_safe (~> 0.3, >= 0.3.4)
       tzinfo (~> 1.1)
       tzinfo (~> 1.1)
     addressable (2.3.8)
     addressable (2.3.8)
-    arel (5.0.1.20140414130214)
+    arel (6.0.3)
     ast (2.1.0)
     ast (2.1.0)
     astrolabe (1.3.1)
     astrolabe (1.3.1)
       parser (~> 2.2)
       parser (~> 2.2)
-    autoprefixer-rails (6.0.2)
+    autoprefixer-rails (6.0.3)
       execjs
       execjs
       json
       json
     biz (1.3.0)
     biz (1.3.0)
@@ -62,11 +71,11 @@ GEM
       execjs
       execjs
     coffee-script-source (1.9.1.1)
     coffee-script-source (1.9.1.1)
     daemons (1.2.3)
     daemons (1.2.3)
-    delayed_job (4.0.6)
+    delayed_job (4.1.1)
       activesupport (>= 3.0, < 5.0)
       activesupport (>= 3.0, < 5.0)
-    delayed_job_active_record (4.0.3)
-      activerecord (>= 3.0, < 5.0)
-      delayed_job (>= 3.0, < 4.1)
+    delayed_job_active_record (4.1.0)
+      activerecord (>= 3.0, < 5)
+      delayed_job (>= 3.0, < 5)
     docile (1.1.5)
     docile (1.1.5)
     eco (1.0.0)
     eco (1.0.0)
       coffee-script
       coffee-script
@@ -84,6 +93,8 @@ GEM
       multipart-post (>= 1.2, < 3)
       multipart-post (>= 1.2, < 3)
     ffi (1.9.10)
     ffi (1.9.10)
     formatador (0.2.5)
     formatador (0.2.5)
+    globalid (0.3.6)
+      activesupport (>= 4.1.0)
     guard (2.13.0)
     guard (2.13.0)
       formatador (>= 0.2.4)
       formatador (>= 0.2.4)
       listen (>= 2.7, <= 4.0)
       listen (>= 2.7, <= 4.0)
@@ -113,6 +124,8 @@ GEM
     listen (3.0.3)
     listen (3.0.3)
       rb-fsevent (>= 0.9.3)
       rb-fsevent (>= 0.9.3)
       rb-inotify (>= 0.9)
       rb-inotify (>= 0.9)
+    loofah (2.0.3)
+      nokogiri (>= 1.5.9)
     lumberjack (1.0.9)
     lumberjack (1.0.9)
     mail (2.5.4)
     mail (2.5.4)
       mime-types (~> 1.16)
       mime-types (~> 1.16)
@@ -121,7 +134,8 @@ GEM
       thread_safe (~> 0.3, >= 0.3.1)
       thread_safe (~> 0.3, >= 0.3.1)
     method_source (0.8.2)
     method_source (0.8.2)
     mime-types (1.25.1)
     mime-types (1.25.1)
-    minitest (5.8.0)
+    mini_portile (0.6.2)
+    minitest (5.8.1)
     multi_json (1.11.2)
     multi_json (1.11.2)
     multi_xml (0.5.5)
     multi_xml (0.5.5)
     multipart-post (2.0.0)
     multipart-post (2.0.0)
@@ -129,7 +143,9 @@ GEM
     naught (1.1.0)
     naught (1.1.0)
     nenv (0.2.0)
     nenv (0.2.0)
     net-ldap (0.11)
     net-ldap (0.11)
-    notiffany (0.0.7)
+    nokogiri (1.6.6.2)
+      mini_portile (~> 0.6.0)
+    notiffany (0.0.8)
       nenv (~> 0.1)
       nenv (~> 0.1)
       shellany (~> 0.0)
       shellany (~> 0.0)
     oauth (0.4.7)
     oauth (0.4.7)
@@ -163,31 +179,40 @@ GEM
     polyglot (0.3.5)
     polyglot (0.3.5)
     power_assert (0.2.4)
     power_assert (0.2.4)
     powerpack (0.1.1)
     powerpack (0.1.1)
-    pry (0.10.1)
+    pry (0.10.2)
       coderay (~> 1.1.0)
       coderay (~> 1.1.0)
       method_source (~> 0.8.1)
       method_source (~> 0.8.1)
       slop (~> 3.4)
       slop (~> 3.4)
-    puma (2.13.4)
-    rack (1.5.5)
+    puma (2.14.0)
+    rack (1.6.4)
     rack-livereload (0.3.16)
     rack-livereload (0.3.16)
       rack
       rack
     rack-test (0.6.3)
     rack-test (0.6.3)
       rack (>= 1.0)
       rack (>= 1.0)
-    rails (4.1.13)
-      actionmailer (= 4.1.13)
-      actionpack (= 4.1.13)
-      actionview (= 4.1.13)
-      activemodel (= 4.1.13)
-      activerecord (= 4.1.13)
-      activesupport (= 4.1.13)
+    rails (4.2.4)
+      actionmailer (= 4.2.4)
+      actionpack (= 4.2.4)
+      actionview (= 4.2.4)
+      activejob (= 4.2.4)
+      activemodel (= 4.2.4)
+      activerecord (= 4.2.4)
+      activesupport (= 4.2.4)
       bundler (>= 1.3.0, < 2.0)
       bundler (>= 1.3.0, < 2.0)
-      railties (= 4.1.13)
-      sprockets-rails (~> 2.0)
+      railties (= 4.2.4)
+      sprockets-rails
+    rails-deprecated_sanitizer (1.0.3)
+      activesupport (>= 4.2.0.alpha)
+    rails-dom-testing (1.0.7)
+      activesupport (>= 4.2.0.beta, < 5.0)
+      nokogiri (~> 1.6.0)
+      rails-deprecated_sanitizer (>= 1.0.1)
+    rails-html-sanitizer (1.0.2)
+      loofah (~> 2.0)
     rails-observers (0.1.2)
     rails-observers (0.1.2)
       activemodel (~> 4.0)
       activemodel (~> 4.0)
-    railties (4.1.13)
-      actionpack (= 4.1.13)
-      activesupport (= 4.1.13)
+    railties (4.2.4)
+      actionpack (= 4.2.4)
+      activesupport (= 4.2.4)
       rake (>= 0.8.7)
       rake (>= 0.8.7)
       thor (>= 0.18.1, < 2.0)
       thor (>= 0.18.1, < 2.0)
     rainbow (2.0.0)
     rainbow (2.0.0)
@@ -196,7 +221,7 @@ GEM
     rb-inotify (0.9.5)
     rb-inotify (0.9.5)
       ffi (>= 0.5.0)
       ffi (>= 0.5.0)
     ref (2.0.0)
     ref (2.0.0)
-    rubocop (0.34.1)
+    rubocop (0.34.2)
       astrolabe (~> 1.3)
       astrolabe (~> 1.3)
       parser (>= 2.2.2.5, < 3.0)
       parser (>= 2.2.2.5, < 3.0)
       powerpack (~> 0.1)
       powerpack (~> 0.1)
@@ -227,7 +252,7 @@ GEM
     simplecov-rcov (0.2.3)
     simplecov-rcov (0.2.3)
       simplecov (>= 0.4.1)
       simplecov (>= 0.4.1)
     slop (3.6.0)
     slop (3.6.0)
-    spring (1.3.6)
+    spring (1.4.0)
     sprockets (3.3.4)
     sprockets (3.3.4)
       rack (~> 1.0)
       rack (~> 1.0)
     sprockets-rails (2.3.3)
     sprockets-rails (2.3.3)
@@ -298,7 +323,7 @@ DEPENDENCIES
   omniauth-twitter
   omniauth-twitter
   puma
   puma
   rack-livereload
   rack-livereload
-  rails (= 4.1.13)
+  rails (= 4.2.4)
   rails-observers
   rails-observers
   rb-fsevent
   rb-fsevent
   rubocop
   rubocop
@@ -315,3 +340,6 @@ DEPENDENCIES
   twitter (~> 5.13.0)
   twitter (~> 5.13.0)
   uglifier
   uglifier
   writeexcel
   writeexcel
+
+BUNDLED WITH
+   1.10.5

+ 5 - 5
app/assets/javascripts/app/controllers/_settings/area.js.coffee

@@ -67,9 +67,9 @@ class App.SettingsAreaItem extends App.Controller
       directValue += 1
       directValue += 1
     if directValue > 1
     if directValue > 1
       for item in @setting.options['form']
       for item in @setting.options['form']
-        item['default'] = @setting.state.value[item.name]
+        item['default'] = @setting.state_current.value[item.name]
     else
     else
-      item['default'] = @setting.state.value
+      item['default'] = @setting.state_current.value
 
 
     # form
     # form
     @configure_attributes = @setting.options['form']
     @configure_attributes = @setting.options['form']
@@ -97,17 +97,17 @@ class App.SettingsAreaItem extends App.Controller
       directData  = params[item.name]
       directData  = params[item.name]
 
 
     if directValue > 1
     if directValue > 1
-      state = {
+      state_current = {
         value: params
         value: params
       }
       }
       #App.Config.set((@setting.name, params)
       #App.Config.set((@setting.name, params)
     else
     else
-      state = {
+      state_current = {
         value: directData
         value: directData
       }
       }
       #App.Config.set(@setting.name, directData)
       #App.Config.set(@setting.name, directData)
 
 
-    @setting['state'] = state
+    @setting['state_current'] = state_current
     ui = @
     ui = @
     @setting.save(
     @setting.save(
       done: =>
       done: =>

+ 1 - 1
app/assets/javascripts/app/models/setting.js.coffee

@@ -1,4 +1,4 @@
 class App.Setting extends App.Model
 class App.Setting extends App.Model
-  @configure 'Setting', 'name', 'state'
+  @configure 'Setting', 'name', 'state_current'
   @extend Spine.Model.Ajax
   @extend Spine.Model.Ajax
   @url: @apiPath + '/settings'
   @url: @apiPath + '/settings'

+ 11 - 9
app/models/setting.rb

@@ -2,7 +2,7 @@
 
 
 class Setting < ApplicationModel
 class Setting < ApplicationModel
   store         :options
   store         :options
-  store         :state
+  store         :state_current
   store         :state_initial
   store         :state_initial
   store         :preferences
   store         :preferences
   before_create :state_check, :set_initial
   before_create :state_check, :set_initial
@@ -11,6 +11,8 @@ class Setting < ApplicationModel
   after_update  :reset_cache
   after_update  :reset_cache
   after_destroy :reset_cache
   after_destroy :reset_cache
 
 
+  attr_accessor :state
+
   @@current        = {} # rubocop:disable Style/ClassVars
   @@current        = {} # rubocop:disable Style/ClassVars
   @@change_id      = nil # rubocop:disable Style/ClassVars
   @@change_id      = nil # rubocop:disable Style/ClassVars
   @@lookup_at      = nil # rubocop:disable Style/ClassVars
   @@lookup_at      = nil # rubocop:disable Style/ClassVars
@@ -29,7 +31,7 @@ set config setting
     if !setting
     if !setting
       fail "Can't find config setting '#{name}'"
       fail "Can't find config setting '#{name}'"
     end
     end
-    setting.state = { value: value }
+    setting.state_current = { value: value }
     setting.save
     setting.save
     logger.info "Setting.set(#{name}, #{value.inspect})"
     logger.info "Setting.set(#{name}, #{value.inspect})"
   end
   end
@@ -64,9 +66,9 @@ reset config setting to default
     if !setting
     if !setting
       fail "Can't find config setting '#{name}'"
       fail "Can't find config setting '#{name}'"
     end
     end
-    setting.state = setting.state_initial
+    setting.state_current = setting.state_initial
     setting.save
     setting.save
-    logger.info "Setting.reset(#{name}, #{setting.state.inspect})"
+    logger.info "Setting.reset(#{name}, #{setting.state_current.inspect})"
     load
     load
     @@current[:settings_config][name]
     @@current[:settings_config][name]
   end
   end
@@ -83,8 +85,8 @@ reset config setting to default
 
 
     # read all config settings
     # read all config settings
     config = {}
     config = {}
-    Setting.select('name, state').order(:id).each { |setting|
-      config[setting.name] = setting.state[:value]
+    Setting.select('name, state_current').order(:id).each { |setting|
+      config[setting.name] = setting.state_current[:value]
     }
     }
 
 
     # config lookups
     # config lookups
@@ -103,7 +105,7 @@ reset config setting to default
 
 
   # set initial value in state_initial
   # set initial value in state_initial
   def set_initial
   def set_initial
-    self.state_initial = state
+    self.state_initial = state_current
   end
   end
 
 
   # set new cache
   # set new cache
@@ -141,7 +143,7 @@ reset config setting to default
 
 
   # convert state ot hash to be able to store it as store
   # convert state ot hash to be able to store it as store
   def state_check
   def state_check
-    return if state.respond_to?('has_key?') && state.key?(:value)
-    self.state = { value: state }
+    return if state && state.respond_to?('has_key?') && state.key?(:value)
+    self.state_current = { value: state }
   end
   end
 end
 end

+ 3 - 0
bin/bundle

@@ -0,0 +1,3 @@
+#!/usr/bin/env ruby
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
+load Gem.bin_path('bundler', 'bundle')

+ 4 - 0
bin/rails

@@ -0,0 +1,4 @@
+#!/usr/bin/env ruby
+APP_PATH = File.expand_path('../../config/application', __FILE__)
+require_relative '../config/boot'
+require 'rails/commands'

+ 4 - 0
bin/rake

@@ -0,0 +1,4 @@
+#!/usr/bin/env ruby
+require_relative '../config/boot'
+require 'rake'
+Rake.application.run

+ 29 - 0
bin/setup

@@ -0,0 +1,29 @@
+#!/usr/bin/env ruby
+require 'pathname'
+
+# path to your application root.
+APP_ROOT = Pathname.new File.expand_path('../../',  __FILE__)
+
+Dir.chdir APP_ROOT do
+  # This script is a starting point to setup your application.
+  # Add necessary setup steps to this file:
+
+  puts "== Installing dependencies =="
+  system "gem install bundler --conservative"
+  system "bundle check || bundle install"
+
+  # puts "\n== Copying sample files =="
+  # unless File.exist?("config/database.yml")
+  #   system "cp config/database.yml.sample config/database.yml"
+  # end
+
+  puts "\n== Preparing database =="
+  system "bin/rake db:setup"
+
+  puts "\n== Removing old logs and tempfiles =="
+  system "rm -f log/*"
+  system "rm -rf tmp/cache"
+
+  puts "\n== Restarting application server =="
+  system "touch tmp/restart.txt"
+end

+ 9 - 31
config/application.rb

@@ -2,12 +2,9 @@ require File.expand_path('../boot', __FILE__)
 
 
 require 'rails/all'
 require 'rails/all'
 
 
-if defined?(Bundler)
-  # If you precompile assets before deploying to production, use this line
-  Bundler.require(*Rails.groups(assets: %w(development test)))
-  # If you want your assets lazily compiled in production, use this line
-  # Bundler.require(:default, :assets, Rails.env)
-end
+# Require the gems listed in Gemfile, including any gems
+# you've limited to :test, :development, or :production.
+Bundler.require(*Rails.groups)
 
 
 module Zammad
 module Zammad
   class Application < Rails::Application
   class Application < Rails::Application
@@ -15,13 +12,12 @@ module Zammad
     # Application configuration should go into files in config/initializers
     # Application configuration should go into files in config/initializers
     # -- all .rb files in that directory are automatically loaded.
     # -- all .rb files in that directory are automatically loaded.
 
 
+    # Do not swallow errors in after_commit/after_rollback callbacks.
+    config.active_record.raise_in_transactional_callbacks = true
+
     # Custom directories with classes and modules you want to be autoloadable.
     # Custom directories with classes and modules you want to be autoloadable.
     config.autoload_paths += %W(#{config.root}/lib)
     config.autoload_paths += %W(#{config.root}/lib)
 
 
-    # Only load the plugins named here, in the order given (default is alphabetical).
-    # :all can be used as a placeholder for all plugins not explicitly named.
-    # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
-
     # Activate observers that should always be running.
     # Activate observers that should always be running.
     # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
     # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
     config.active_record.observers =
     config.active_record.observers =
@@ -46,29 +42,11 @@ module Zammad
       'observer::_user::_geo',
       'observer::_user::_geo',
       'observer::_organization::_ref_object_touch'
       'observer::_organization::_ref_object_touch'
 
 
-    # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
-    # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
-    # config.i18n.default_locale = :de
-
-    # Configure the default encoding used in templates for Ruby 1.9.
-    config.encoding = 'utf-8'
-
-    # Configure sensitive parameters which will be filtered from the log file.
-    config.filter_parameters += [:password]
-
-    # Use SQL instead of Active Record's schema dumper when creating the database.
-    # This is necessary if your schema can't be completely dumped by the schema dumper,
-    # like if you have constraints or database-specific column types
-    # config.active_record.schema_format = :sql
-
-    # Enable the asset pipeline
-    config.assets.enabled = true
-
-    # Version of your assets, change this if you want to expire all your assets
-    config.assets.version = '1.0'
-
     # REST api path
     # REST api path
     config.api_path = '/api/v1'
     config.api_path = '/api/v1'
 
 
+    # define cache store
+    config.cache_store = :file_store, "tmp/cache_file_store_#{Rails.env}"
+
   end
   end
 end
 end

Некоторые файлы не были показаны из-за большого количества измененных файлов