diff --git a/.gitignore b/.gitignore index 0cd336786..0ac235089 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,8 @@ /config/database.yml /files/* /log/* -/tmp/* +/public/tmp/* +/public/cache/* .gitignore /public/images/avatars/* /Gemfile diff --git a/.metadata/.log b/.metadata/.log index 0cb16378c..fbbe00cbe 100644 --- a/.metadata/.log +++ b/.metadata/.log @@ -209,3 +209,111 @@ java.lang.UnsupportedOperationException: Not supported yet. at com.aptana.index.core.IndexRequestJob.indexFileStores(IndexRequestJob.java:205) at com.aptana.index.core.IndexContainerJob.run(IndexContainerJob.java:114) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) +!SESSION 2015-01-05 10:21:34.093 ----------------------------------------------- +eclipse.buildId=unknown +java.version=1.6.0_24 +java.vendor=Sun Microsystems Inc. +BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=zh_CN +Command-line arguments: -os win32 -ws win32 -arch x86 + +!ENTRY org.eclipse.core.resources 4 567 2015-01-05 10:21:56.435 +!MESSAGE Workspace restored, but some problems occurred. +!SUBENTRY 1 org.eclipse.core.resources 4 567 2015-01-05 10:21:56.435 +!MESSAGE Could not read metadata for 'demo'. +!STACK 1 +org.eclipse.core.internal.resources.ResourceException: The project description file (.project) for 'demo' is missing. This file contains important information about the project. The project will not function properly until this file is restored. + at org.eclipse.core.internal.localstore.FileSystemResourceManager.read(FileSystemResourceManager.java:851) + at org.eclipse.core.internal.resources.SaveManager.restoreMetaInfo(SaveManager.java:874) + at org.eclipse.core.internal.resources.SaveManager.restoreMetaInfo(SaveManager.java:854) + at org.eclipse.core.internal.resources.SaveManager.restore(SaveManager.java:703) + at org.eclipse.core.internal.resources.SaveManager.startup(SaveManager.java:1528) + at org.eclipse.core.internal.resources.Workspace.startup(Workspace.java:2503) + at org.eclipse.core.internal.resources.Workspace.open(Workspace.java:2251) + at org.eclipse.core.resources.ResourcesPlugin.start(ResourcesPlugin.java:439) + at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711) + at java.security.AccessController.doPrivileged(Native Method) + at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702) + at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683) + at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381) + at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:299) + at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:440) + at org.eclipse.osgi.internal.loader.BundleLoader.setLazyTrigger(BundleLoader.java:268) + at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:107) + at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:463) + at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216) + at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:400) + at org.eclipse.osgi.internal.loader.SingleSourcePackage.loadClass(SingleSourcePackage.java:35) + at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:473) + at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429) + at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417) + at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107) + at java.lang.ClassLoader.loadClass(Unknown Source) + at com.aptana.rcp.IDEApplication.start(IDEApplication.java:125) + at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) + at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) + at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) + at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344) + at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) + at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) + at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) + at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) + at java.lang.reflect.Method.invoke(Unknown Source) + at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622) + at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577) + at org.eclipse.equinox.launcher.Main.run(Main.java:1410) +!SUBENTRY 2 org.eclipse.core.resources 4 567 2015-01-05 10:21:56.435 +!MESSAGE The project description file (.project) for 'demo' is missing. This file contains important information about the project. The project will not function properly until this file is restored. + +!ENTRY com.aptana.terminal 1 0 2015-01-05 10:22:03.546 +!MESSAGE Starting terminal process failed. +!STACK 1 +org.eclipse.core.runtime.CoreException: Shell executable could not be found. + at com.aptana.core.ShellExecutable.getPath(ShellExecutable.java:113) + at com.aptana.terminal.internal.configurations.WindowsMingwConfiguration.getCommandLine(WindowsMingwConfiguration.java:40) + at com.aptana.terminal.internal.ProcessLauncher.launch(ProcessLauncher.java:38) + at com.aptana.terminal.connector.LocalTerminalConnector.startProcess(LocalTerminalConnector.java:220) + at com.aptana.terminal.connector.LocalTerminalConnector.access$0(LocalTerminalConnector.java:208) + at com.aptana.terminal.connector.LocalTerminalConnector$1.run(LocalTerminalConnector.java:102) +!SUBENTRY 1 com.aptana.core 4 0 2015-01-05 10:22:03.546 +!MESSAGE Shell executable could not be found. + +!ENTRY org.eclipse.core.jobs 2 2 2015-01-05 10:27:30.988 +!MESSAGE Job found still running after platform shutdown. Jobs should be canceled by the plugin that scheduled them during shutdown: org.eclipse.tm.internal.terminal.emulator.VT100TerminalControl$1 + +!ENTRY org.eclipse.core.jobs 2 2 2015-01-05 10:27:30.989 +!MESSAGE Job found still running after platform shutdown. Jobs should be canceled by the plugin that scheduled them during shutdown: com.aptana.usage.internal.DefaultAnalyticsEventHandler$1 +!SESSION 2015-01-05 10:27:31.720 ----------------------------------------------- +eclipse.buildId=3.4.2.201308081805 +java.version=1.6.0_24 +java.vendor=Sun Microsystems Inc. +BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=zh_CN +Command-line arguments: -os win32 -ws win32 -arch x86 + +!ENTRY com.aptana.terminal 1 0 2015-01-05 10:27:34.915 +!MESSAGE Starting terminal process failed. +!STACK 1 +org.eclipse.core.runtime.CoreException: Shell executable could not be found. + at com.aptana.core.ShellExecutable.getPath(ShellExecutable.java:113) + at com.aptana.terminal.internal.configurations.WindowsMingwConfiguration.getCommandLine(WindowsMingwConfiguration.java:40) + at com.aptana.terminal.internal.ProcessLauncher.launch(ProcessLauncher.java:38) + at com.aptana.terminal.connector.LocalTerminalConnector.startProcess(LocalTerminalConnector.java:220) + at com.aptana.terminal.connector.LocalTerminalConnector.access$0(LocalTerminalConnector.java:208) + at com.aptana.terminal.connector.LocalTerminalConnector$1.run(LocalTerminalConnector.java:102) +!SUBENTRY 1 com.aptana.core 4 0 2015-01-05 10:27:34.915 +!MESSAGE Shell executable could not be found. + +!ENTRY com.aptana.terminal 1 0 2015-01-05 10:27:37.984 +!MESSAGE Starting terminal process failed. +!STACK 1 +org.eclipse.core.runtime.CoreException: Shell executable could not be found. + at com.aptana.core.ShellExecutable.getPath(ShellExecutable.java:113) + at com.aptana.terminal.internal.configurations.WindowsMingwConfiguration.getCommandLine(WindowsMingwConfiguration.java:40) + at com.aptana.terminal.internal.ProcessLauncher.launch(ProcessLauncher.java:38) + at com.aptana.terminal.connector.LocalTerminalConnector.startProcess(LocalTerminalConnector.java:220) + at com.aptana.terminal.connector.LocalTerminalConnector.access$0(LocalTerminalConnector.java:208) + at com.aptana.terminal.connector.LocalTerminalConnector$1.run(LocalTerminalConnector.java:102) +!SUBENTRY 1 com.aptana.core 4 0 2015-01-05 10:27:37.984 +!MESSAGE Shell executable could not be found. + +!ENTRY org.eclipse.core.jobs 2 2 2015-01-05 10:27:55.438 +!MESSAGE Job found still running after platform shutdown. Jobs should be canceled by the plugin that scheduled them during shutdown: org.eclipse.tm.internal.terminal.emulator.VT100TerminalControl$1 diff --git a/.metadata/.plugins/com.aptana.core.io/connections.9 b/.metadata/.plugins/com.aptana.core.io/connections.15 similarity index 72% rename from .metadata/.plugins/com.aptana.core.io/connections.9 rename to .metadata/.plugins/com.aptana.core.io/connections.15 index 4371c4759..46f15223a 100644 --- a/.metadata/.plugins/com.aptana.core.io/connections.9 +++ b/.metadata/.plugins/com.aptana.core.io/connections.15 @@ -1,2 +1,2 @@ - + \ No newline at end of file diff --git a/.metadata/.plugins/com.aptana.syncing.core/defaultConnection.9 b/.metadata/.plugins/com.aptana.syncing.core/defaultConnection.15 similarity index 62% rename from .metadata/.plugins/com.aptana.syncing.core/defaultConnection.9 rename to .metadata/.plugins/com.aptana.syncing.core/defaultConnection.15 index 375897785..7f1a49fed 100644 --- a/.metadata/.plugins/com.aptana.syncing.core/defaultConnection.9 +++ b/.metadata/.plugins/com.aptana.syncing.core/defaultConnection.15 @@ -1,7 +1,7 @@ - - - -Default -file:/C:/Users/nudt - + + + +Default +file:/C:/Users/Administrator + \ No newline at end of file diff --git a/.metadata/.plugins/com.aptana.syncing.core/sites.9 b/.metadata/.plugins/com.aptana.syncing.core/sites.15 similarity index 81% rename from .metadata/.plugins/com.aptana.syncing.core/sites.9 rename to .metadata/.plugins/com.aptana.syncing.core/sites.15 index d9b475695..dc24d7a57 100644 --- a/.metadata/.plugins/com.aptana.syncing.core/sites.9 +++ b/.metadata/.plugins/com.aptana.syncing.core/sites.15 @@ -1,2 +1,2 @@ - + \ No newline at end of file diff --git a/.metadata/.plugins/com.aptana.webserver.core/webservers.8 b/.metadata/.plugins/com.aptana.webserver.core/webservers.12 similarity index 92% rename from .metadata/.plugins/com.aptana.webserver.core/webservers.8 rename to .metadata/.plugins/com.aptana.webserver.core/webservers.12 index 5c07542b1..2979c56a7 100644 --- a/.metadata/.plugins/com.aptana.webserver.core/webservers.8 +++ b/.metadata/.plugins/com.aptana.webserver.core/webservers.12 @@ -1,6 +1,6 @@ - - - -demo - + + + +demo + \ No newline at end of file diff --git a/.metadata/.plugins/org.eclipse.core.resources/.root/2.tree b/.metadata/.plugins/org.eclipse.core.resources/.projects/demo/6.tree similarity index 95% rename from .metadata/.plugins/org.eclipse.core.resources/.root/2.tree rename to .metadata/.plugins/org.eclipse.core.resources/.projects/demo/6.tree index 5b2529389..215d06c77 100644 Binary files a/.metadata/.plugins/org.eclipse.core.resources/.root/2.tree and b/.metadata/.plugins/org.eclipse.core.resources/.projects/demo/6.tree differ diff --git a/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.index b/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.index index fddafcbcd..167d2542c 100644 Binary files a/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.index and b/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.index differ diff --git a/.metadata/.plugins/org.eclipse.core.resources/.root/4.tree b/.metadata/.plugins/org.eclipse.core.resources/.root/4.tree new file mode 100644 index 000000000..942a97c51 Binary files /dev/null and b/.metadata/.plugins/org.eclipse.core.resources/.root/4.tree differ diff --git a/.metadata/.plugins/org.eclipse.core.resources/.safetable/com.aptana.core.io.15 b/.metadata/.plugins/org.eclipse.core.resources/.safetable/com.aptana.core.io.15 new file mode 100644 index 000000000..971c3ef7e --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.safetable/com.aptana.core.io.15 @@ -0,0 +1,3 @@ +#safe table +#Mon Jan 05 10:27:54 CST 2015 +connections=connections.15 diff --git a/.metadata/.plugins/org.eclipse.core.resources/.safetable/com.aptana.core.io.9 b/.metadata/.plugins/org.eclipse.core.resources/.safetable/com.aptana.core.io.9 deleted file mode 100644 index 0b4ef3b47..000000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.safetable/com.aptana.core.io.9 +++ /dev/null @@ -1,3 +0,0 @@ -#safe table -#Tue Mar 11 17:27:27 CST 2014 -connections=connections.9 diff --git a/.metadata/.plugins/org.eclipse.core.resources/.safetable/com.aptana.syncing.core.15 b/.metadata/.plugins/org.eclipse.core.resources/.safetable/com.aptana.syncing.core.15 new file mode 100644 index 000000000..01bf076fe --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.safetable/com.aptana.syncing.core.15 @@ -0,0 +1,4 @@ +#safe table +#Mon Jan 05 10:27:54 CST 2015 +defaultConnection=defaultConnection.15 +sites=sites.15 diff --git a/.metadata/.plugins/org.eclipse.core.resources/.safetable/com.aptana.syncing.core.9 b/.metadata/.plugins/org.eclipse.core.resources/.safetable/com.aptana.syncing.core.9 deleted file mode 100644 index 371e94161..000000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.safetable/com.aptana.syncing.core.9 +++ /dev/null @@ -1,4 +0,0 @@ -#safe table -#Tue Mar 11 17:27:27 CST 2014 -defaultConnection=defaultConnection.9 -sites=sites.9 diff --git a/.metadata/.plugins/org.eclipse.core.resources/.safetable/com.aptana.webserver.core.12 b/.metadata/.plugins/org.eclipse.core.resources/.safetable/com.aptana.webserver.core.12 new file mode 100644 index 000000000..26cede301 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.safetable/com.aptana.webserver.core.12 @@ -0,0 +1,3 @@ +#safe table +#Mon Jan 05 10:27:28 CST 2015 +webservers=webservers.12 diff --git a/.metadata/.plugins/org.eclipse.core.resources/.safetable/com.aptana.webserver.core.8 b/.metadata/.plugins/org.eclipse.core.resources/.safetable/com.aptana.webserver.core.8 deleted file mode 100644 index 1af4b85d6..000000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.safetable/com.aptana.webserver.core.8 +++ /dev/null @@ -1,3 +0,0 @@ -#safe table -#Tue Mar 11 17:27:27 CST 2014 -webservers=webservers.8 diff --git a/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources b/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources index b3b591e28..de5f19a7c 100644 Binary files a/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources and b/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources differ diff --git a/.metadata/.plugins/org.eclipse.core.runtime/.settings/com.aptana.portal.ui.prefs b/.metadata/.plugins/org.eclipse.core.runtime/.settings/com.aptana.portal.ui.prefs index a710d7ff4..e78c19c52 100644 --- a/.metadata/.plugins/org.eclipse.core.runtime/.settings/com.aptana.portal.ui.prefs +++ b/.metadata/.plugins/org.eclipse.core.runtime/.settings/com.aptana.portal.ui.prefs @@ -1,2 +1,2 @@ eclipse.preferences.version=1 -last_known_studio_version=3.4.0.1358388620 +last_known_studio_version=3.4.2.1368863613 diff --git a/.metadata/.plugins/org.eclipse.core.runtime/.settings/com.aptana.theme.prefs b/.metadata/.plugins/org.eclipse.core.runtime/.settings/com.aptana.theme.prefs index 590c84632..b13d8f53c 100644 --- a/.metadata/.plugins/org.eclipse.core.runtime/.settings/com.aptana.theme.prefs +++ b/.metadata/.plugins/org.eclipse.core.runtime/.settings/com.aptana.theme.prefs @@ -1,7 +1,7 @@ ACTIVE_HYPERLINK_COLOR=84,143,160 ACTIVE_THEME=Aptana Studio HYPERLINK_COLOR=84,143,160 -THEME_CHANGED=1394527579080 +THEME_CHANGED=1420424854199 eclipse.preferences.version=1 hyperlinkColor=84,143,160 hyperlinkColor.SystemDefault=false diff --git a/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs b/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs index 71a846af6..6624ec57e 100644 --- a/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs +++ b/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs @@ -2,6 +2,6 @@ PROBLEMS_FILTERS_MIGRATE=true SHOW_COOLBAR=true SHOW_PERSPECTIVEBAR=true eclipse.preferences.version=1 -platformState=1394526372425 +platformState=1420424495377 quickStart=false tipsAndTricks=true diff --git a/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/.workspace/2015/1/2/refactorings.history b/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/.workspace/2015/1/2/refactorings.history new file mode 100644 index 000000000..664784aa9 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/.workspace/2015/1/2/refactorings.history @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/.workspace/2015/1/2/refactorings.index b/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/.workspace/2015/1/2/refactorings.index new file mode 100644 index 000000000..d5428a792 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/.workspace/2015/1/2/refactorings.index @@ -0,0 +1,2 @@ +1420424676858 Delete resource 'trustie2' +1420424775104 Delete resource 'trustie2' diff --git a/.metadata/.plugins/org.eclipse.ltk.ui.refactoring/dialog_settings.xml b/.metadata/.plugins/org.eclipse.ltk.ui.refactoring/dialog_settings.xml new file mode 100644 index 000000000..27eb4040f --- /dev/null +++ b/.metadata/.plugins/org.eclipse.ltk.ui.refactoring/dialog_settings.xml @@ -0,0 +1,7 @@ + +
+
+ + +
+
diff --git a/.metadata/.plugins/org.eclipse.ui.ide/dialog_settings.xml b/.metadata/.plugins/org.eclipse.ui.ide/dialog_settings.xml index 4868ecd96..09856e2e7 100644 --- a/.metadata/.plugins/org.eclipse.ui.ide/dialog_settings.xml +++ b/.metadata/.plugins/org.eclipse.ui.ide/dialog_settings.xml @@ -1,14 +1,26 @@
- - - - + + + + - + +
+ + +
+
+ + +
+
+ + +
diff --git a/.metadata/.plugins/org.eclipse.ui.workbench/dialog_settings.xml b/.metadata/.plugins/org.eclipse.ui.workbench/dialog_settings.xml index f7e4d66f0..c8c1e4f77 100644 --- a/.metadata/.plugins/org.eclipse.ui.workbench/dialog_settings.xml +++ b/.metadata/.plugins/org.eclipse.ui.workbench/dialog_settings.xml @@ -1,7 +1,9 @@
+
+
- + diff --git a/.metadata/.plugins/org.eclipse.ui.workbench/workbench.xml b/.metadata/.plugins/org.eclipse.ui.workbench/workbench.xml index 88eaacee1..3467fd0f7 100644 --- a/.metadata/.plugins/org.eclipse.ui.workbench/workbench.xml +++ b/.metadata/.plugins/org.eclipse.ui.workbench/workbench.xml @@ -1,5 +1,5 @@ - + @@ -8,14 +8,14 @@ - + - - - + + + - + @@ -37,7 +37,7 @@ demo -E:\code\demo +C:\Users\Administrator @@ -46,7 +46,7 @@ Terminal -C:\Users\nudt +C:\Users\Administrator @@ -66,19 +66,13 @@ - - - - - - - + - + @@ -150,7 +144,7 @@ - + @@ -166,7 +160,7 @@ - + diff --git a/Gemfile b/Gemfile index 6c2101345..318b8dcf0 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,4 @@ -source 'http://rubygems.org' -#source 'http://ruby.sdutlinux.org/' +source 'https://rubygems.org' unless RUBY_PLATFORM =~ /w32/ # unix-like only @@ -16,43 +15,24 @@ gem "coderay", "~> 1.0.6" gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby] gem "builder", "3.0.0" gem 'acts-as-taggable-on', '2.4.1' -gem 'spreadsheet' -gem 'ruby-ole' group :development do gem 'better_errors', path: 'lib/better_errors' gem 'rack-mini-profiler', path: 'lib/rack-mini-profiler' + if ENV['PRY'] + gem 'pry' + gem 'pry-nav' + end end -group :test do - gem "shoulda", "~> 3.5.0" - gem "mocha", "~> 1.1.0" - gem 'capybara', '~> 2.4.1' - gem 'nokogiri', '~> 1.6.3' - gem 'factory_girl', '~> 4.4.0' - gem 'selenium-webdriver', '~> 2.42.0' - - - # platforms :mri, :mingw do - # group :rmagick do - # # RMagick 2 supports ruby 1.9 - # # RMagick 1 would be fine for ruby 1.8 but Bundler does not support - # # different requirements for the same gem on different platforms - # gem "rmagick", ">= 2.0.0" - # end - #end -end - -group :development, :test do - # gem "guard-rails", '~> 0.5.3' - gem 'spork-testunit', '~> 0.0.8' - # gem 'guard-spork', '~> 1.5.1' - # gem 'guard-test', '~> 1.0.0' - gem 'ruby-prof', '~> 0.15.1' unless RUBY_PLATFORM =~ /w32/ - gem 'pry' - gem 'pry-nav' - -end +# group :test do +# # shoulda的版本做了改动 +# #gem "shoulda", "~> 3.3.2" +# gem "shoulda", "> 3.3.2" +# gem "mocha", "~> 0.13.3" +# gem 'capybara', '~> 2.0.0' +# gem 'nokogiri', '< 1.6.0' +# end # Gems used only for assets and not required @@ -73,6 +53,15 @@ group :ldap do end +# platforms :mri, :mingw do +# group :rmagick do +# # RMagick 2 supports ruby 1.9 +# # RMagick 1 would be fine for ruby 1.8 but Bundler does not support +# # different requirements for the same gem on different platforms +# gem "rmagick", ">= 2.0.0" +# end +# end + # Optional gem for OpenID authentication group :openid do gem "ruby-openid", "~> 2.1.4", :require => "openid" diff --git a/app/helpers/expire_helper.rb b/app/helpers/expire_helper.rb new file mode 100644 index 000000000..0a9cab69c --- /dev/null +++ b/app/helpers/expire_helper.rb @@ -0,0 +1,16 @@ +module ExpireHelper + #index.html 中 “projects”塊 緩存過期 + def expire_project_cache + ActionController::Base.new.expire_fragment('projects') + end + + #index.html 中 “activities”塊 緩存過期 + def expire_activitie_cache + ActionController::Base.new.expire_fragment('activities') + end + + #welcome/index.html 中 “forums”塊 緩存過期 + def expire_forum_cache + ActionController::Base.new.expire_fragment('forums') + end +end diff --git a/app/models/bid.rb b/app/models/bid.rb index 88014477b..f423266b8 100644 --- a/app/models/bid.rb +++ b/app/models/bid.rb @@ -17,6 +17,7 @@ class Bid < ActiveRecord::Base HomeworkProject = 2 attr_accessible :author_id, :budget, :deadline, :name, :description, :homework_type, :password include Redmine::SafeAttributes + include ExpireHelper belongs_to :author, :class_name => 'User', :foreign_key => :author_id belongs_to :course @@ -32,7 +33,11 @@ class Bid < ActiveRecord::Base has_many :join_in_contests, :dependent => :destroy has_many :praise_tread, as: :praise_tread_object, dependent: :destroy # has_many :fork_homework, :class_name => 'Bid', :conditions => "#{Bid.table_name}.parent_id = #{id}" - + + + after_create :expire_activitie_cache + after_update :expire_activitie_cache + before_destroy :expire_activitie_cache acts_as_attachable @@ -149,4 +154,6 @@ class Bid < ActiveRecord::Base end end end + + end diff --git a/app/models/changeset.rb b/app/models/changeset.rb index e05a7d2da..101647824 100644 --- a/app/models/changeset.rb +++ b/app/models/changeset.rb @@ -16,6 +16,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class Changeset < ActiveRecord::Base + include ExpireHelper belongs_to :repository belongs_to :user include UserScoreHelper @@ -64,8 +65,9 @@ class Changeset < ActiveRecord::Base includes(:repository => :project).where(Project.allowed_to_condition(args.shift || User.current, :view_changesets, *args)) } - after_create :scan_for_issues,:refresh_changests#:be_user_score # user_score - after_update :be_user_score + after_create :scan_for_issues,:refresh_changests,:expire_activitie_cache#:be_user_score # user_score + after_update :be_user_score,:expire_activitie_cache + before_destroy :expire_activitie_cache after_destroy :down_user_score before_create :before_create_cs diff --git a/app/models/contest_notification.rb b/app/models/contest_notification.rb index 1613f1378..0ccd0d5a7 100644 --- a/app/models/contest_notification.rb +++ b/app/models/contest_notification.rb @@ -1,4 +1,10 @@ class ContestNotification < ActiveRecord::Base + include ExpireHelper attr_accessible :content, :title validates :title, length: {maximum: 30} + after_create :expire_forum_cache + after_update :expire_forum_cache + before_destroy :expire_forum_cache + + end diff --git a/app/models/document.rb b/app/models/document.rb index 7c2fa5a6d..e607b9292 100644 --- a/app/models/document.rb +++ b/app/models/document.rb @@ -17,13 +17,16 @@ class Document < ActiveRecord::Base include Redmine::SafeAttributes + include ExpireHelper belongs_to :project belongs_to :user belongs_to :category, :class_name => "DocumentCategory", :foreign_key => "category_id" include UserScoreHelper after_save :be_user_score # user_score after_destroy :down_user_score - + after_create :expire_activitie_cache + after_update :expire_activitie_cache + before_destroy :expire_activitie_cache acts_as_attachable :delete_permission => :delete_documents acts_as_searchable :columns => ['title', "#{table_name}.description"], :include => :project @@ -76,4 +79,8 @@ class Document < ActiveRecord::Base update_document(self.user,1) update_document(self.user,2,self.project) end + + def expire_cache + ActionController::Base.new.expire_fragment('activities') + end end diff --git a/app/models/forum.rb b/app/models/forum.rb index 61ba528a0..dc1603288 100644 --- a/app/models/forum.rb +++ b/app/models/forum.rb @@ -1,8 +1,13 @@ class Forum < ActiveRecord::Base include Redmine::SafeAttributes + include ExpireHelper has_many :topics, :class_name => 'Memo', :conditions => "#{Memo.table_name}.parent_id IS NULL", :order => "#{Memo.table_name}.created_at DESC", :dependent => :destroy has_many :memos, :dependent => :destroy, conditions: "parent_id IS NULL" - belongs_to :creator, :class_name => "User", :foreign_key => 'creator_id' + belongs_to :creator, :class_name => "User", :foreign_key => 'creator_id' + + after_create :expire_forum_cache + after_update :expire_forum_cache + before_destroy :expire_forum_cache safe_attributes 'name', 'description', 'topic_count', @@ -40,5 +45,7 @@ class Forum < ActiveRecord::Base " memo_count = (SELECT COUNT(*) FROM #{Memo.table_name} WHERE forum_id=#{forum_id} AND parent_id IS NOT NULL)," + " last_memo_id = (SELECT MAX(id) FROM #{Memo.table_name} WHERE forum_id=#{forum_id})", ["id = ?", forum_id]) - end + end + + end diff --git a/app/models/issue.rb b/app/models/issue.rb index 4dc685b3b..a7b1a5943 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -19,7 +19,7 @@ class Issue < ActiveRecord::Base include Redmine::SafeAttributes include Redmine::Utils::DateCalculation include UserScoreHelper - + include ExpireHelper belongs_to :project belongs_to :tracker belongs_to :status, :class_name => 'IssueStatus', :foreign_key => 'status_id' @@ -80,6 +80,9 @@ class Issue < ActiveRecord::Base after_create :act_as_activity,:be_user_score_new_issue after_update :be_user_score after_destroy :down_user_score + after_create :expire_activitie_cache + after_update :expire_activitie_cache + before_destroy :expire_activitie_cache # after_create :be_user_score # end @@ -1553,4 +1556,5 @@ class Issue < ActiveRecord::Base end + end diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 4819cd253..c71fbaf47 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -4,6 +4,7 @@ class JournalsForMessage < ActiveRecord::Base include Redmine::SafeAttributes include UserScoreHelper + include ExpireHelper safe_attributes "jour_type", # 留言所属类型 "jour_id", # 留言所属类型的id "notes", # 留言内容 @@ -54,7 +55,9 @@ class JournalsForMessage < ActiveRecord::Base has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy validates :notes, presence: true - after_create :act_as_activity #huang + after_create :act_as_activity ,:expire_activitie_cache#huang + after_update :expire_activitie_cache + before_destroy :expire_activitie_cache after_create :reset_counters! after_destroy :reset_counters! after_save :be_user_score @@ -162,4 +165,6 @@ class JournalsForMessage < ActiveRecord::Base end end end + + end diff --git a/app/models/memo.rb b/app/models/memo.rb index cfc509923..495f97ad3 100644 --- a/app/models/memo.rb +++ b/app/models/memo.rb @@ -1,9 +1,13 @@ class Memo < ActiveRecord::Base include Redmine::SafeAttributes include UserScoreHelper + include ExpireHelper belongs_to :forum - belongs_to :author, :class_name => "User", :foreign_key => 'author_id' + belongs_to :author, :class_name => "User", :foreign_key => 'author_id' + after_create :expire_cache + after_update :expire_cache + before_destroy :expire_cache validates_presence_of :author_id, :forum_id, :subject,:content # 若是主题帖,则内容可以是空 #validates :content, presence: true, if: Proc.new{|o| !o.parent_id.nil? } @@ -164,5 +168,8 @@ class Memo < ActiveRecord::Base update_memo_number(User.current,1) update_replay_for_memo(User.current,1) end - + def expire_cache + expire_forum_cache + expire_activitie_cache + end end diff --git a/app/models/message.rb b/app/models/message.rb index 8af3265cc..9ce4d583a 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -18,7 +18,7 @@ class Message < ActiveRecord::Base include Redmine::SafeAttributes include UserScoreHelper - + include ExpireHelper belongs_to :board belongs_to :author, :class_name => 'User', :foreign_key => 'author_id' has_many :praise_tread, as: :praise_tread_object, dependent: :destroy @@ -59,8 +59,9 @@ class Message < ActiveRecord::Base validates_length_of :subject, :maximum => 255 validate :cannot_reply_to_locked_topic, :on => :create - after_create :add_author_as_watcher, :reset_counters! - after_update :update_messages_board + after_create :add_author_as_watcher, :reset_counters!,:expire_activitie_cache + after_update :update_messages_board,:expire_activitie_cache + before_destroy :expire_activitie_cache after_destroy :reset_counters!,:down_user_score # fq @@ -195,4 +196,6 @@ class Message < ActiveRecord::Base end end end + + end diff --git a/app/models/news.rb b/app/models/news.rb index 4d153e81f..9c37719f3 100644 --- a/app/models/news.rb +++ b/app/models/news.rb @@ -17,6 +17,7 @@ class News < ActiveRecord::Base include Redmine::SafeAttributes + include ExpireHelper belongs_to :project #added by nwb belongs_to :course @@ -47,6 +48,9 @@ class News < ActiveRecord::Base # fq after_create :act_as_activity # end + after_create :expire_activitie_cache + after_update :expire_activitie_cache + before_destroy :expire_activitie_cache scope :visible, lambda {|*args| includes(:project).where(Project.allowed_to_condition(args.shift || User.current, :view_news, *args)) @@ -91,4 +95,6 @@ class News < ActiveRecord::Base def act_as_activity self.acts << Activity.new(:user_id => self.author_id) end + + end diff --git a/app/models/project.rb b/app/models/project.rb index 14763347f..c4d07a1ad 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -17,6 +17,7 @@ class Project < ActiveRecord::Base include Redmine::SafeAttributes + include ExpireHelper ProjectType_project = 0 ProjectType_course = 1 @@ -127,8 +128,9 @@ class Project < ActiveRecord::Base #after_save :update_position_under_parent, :if => Proc.new {|project| project.name_changed?} after_save :update_inherited_members, :if => Proc.new {|project| project.inherit_members_changed?} # 创建project之后默认创建一个board,之后的board去掉了board的概念 - after_create :create_board_sync - before_destroy :delete_all_members + after_create :create_board_sync,:expire_project_cache + after_update :expire_project_cache + before_destroy :delete_all_members,:expire_project_cache def remove_references_before_destroy return if self.id.nil? Watcher.delete_all ['watchable_id = ?', id] @@ -1148,7 +1150,7 @@ class Project < ActiveRecord::Base logger.error "[Project Model] ===> Auto create board when Project saved, because #{@board.full_messages}" end end - - + + end diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index 0dc62c6a3..11a7f44fa 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -70,8 +70,10 @@
    + <% cache("projects") do %> <% @projects.map do |project| %> -
  • + <% cache project do %> +
  • <%= image_tag(get_project_avatar(project), :class => "avatar-4") %>
    @@ -98,8 +100,9 @@ :id => "tooltip-#{project.id}" %>
- + <% end %> <% end; reset_cycle %> + <% end %> @@ -112,8 +115,10 @@
+ <% cache("activities") do %> <%activities = find_all_activities%> <% activities.each do |event| %> + <% cache event do %>
  • <%= image_tag url_to_avatar(event.event_author), :class => "avatar-3" %> @@ -127,7 +132,7 @@

    <%= l(:field_updated_on) %> - <%= time_tag_welcome event.event_datetime %>前 + <%= format_time event.event_datetime %>       @@ -136,7 +141,9 @@

  • + <% end %> <% end %> + <% end %>
    @@ -157,9 +164,10 @@
    + <% cache("forums") do %> <% topics = find_new_forum_topics(6) %> <% topics.includes(:forum, :last_reply, :author).each do |topic|%> - + <% cache topic do %>
  • <%= link_to '['+topic.forum.name + ']',forum_path(topic.forum),:class => 'memo_Bar_title' %> @@ -167,7 +175,9 @@
    - <%= "#{l(:label_updated_time, value: time_tag_welcome(topic_last_time topic))}".html_safe %> + <%#= "#{l(:field_updated_on, value: format_time(topic_last_time topic))}" %> + <%= l(:field_updated_on) %> + <%= format_time topic_last_time topic %> <%= l(:label_question_sponsor)%>: @@ -185,8 +195,9 @@
  • - - <% end %> + <%end %> + <% end %> + <% end %>
    diff --git a/config/environments/development.rb b/config/environments/development.rb index 9d3cbf244..765fda433 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -10,8 +10,8 @@ RedmineApp::Application.configure do # Show full error reports and disable caching config.consider_all_requests_local = true - config.action_controller.perform_caching = false - + config.action_controller.perform_caching = true + config.cache_store = :file_store, "#{Rails.root }/public/tmp/" # Don't care if the mailer can't send config.action_mailer.raise_delivery_errors = false diff --git a/config/environments/production.rb b/config/environments/production.rb index ab4cd4011..8a2847731 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -18,7 +18,7 @@ RedmineApp::Application.configure do # Full error reports are disabled and caching is turned on config.action_controller.perform_caching = true - + config.cache_store = :file_store, "#{Rails.root }/public/tmp/" # Enable serving of images, stylesheets, and javascripts from an asset server # config.action_controller.asset_host = "http://assets.example.com" diff --git a/lib/plugins/acts_as_event/lib/acts_as_event.rb b/lib/plugins/acts_as_event/lib/acts_as_event.rb index e323c2b3e..42673cde7 100644 --- a/lib/plugins/acts_as_event/lib/acts_as_event.rb +++ b/lib/plugins/acts_as_event/lib/acts_as_event.rb @@ -43,6 +43,7 @@ module Redmine base.extend ClassMethods end + %w(datetime title description author type).each do |attr| src = <<-END_SRC def event_#{attr} diff --git a/test/unit/helpers/expire_helper_test.rb b/test/unit/helpers/expire_helper_test.rb new file mode 100644 index 000000000..318e451cc --- /dev/null +++ b/test/unit/helpers/expire_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class ExpireHelperTest < ActionView::TestCase +end diff --git a/tmp/plugins/README b/tmp/plugins/README deleted file mode 100644 index edef25679..000000000 --- a/tmp/plugins/README +++ /dev/null @@ -1 +0,0 @@ -Put your Redmine plugins here.