Delete Archive folder in assets and useless files in lib
This commit is contained in:
1 parent
68e12fd737
commit
778f7c7863
1075 files changed
-49691
No files matched your search
@@ -1,11 +0,0 @@
|
||||
# encoding: utf-8
|
||||
|
||||
namespace :app_auth do
|
||||
|
||||
task :build => :environment do
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,19 +0,0 @@
|
||||
# encoding: utf-8
|
||||
|
||||
namespace :items do
|
||||
task :tree_changes => :environment do
|
||||
Item.all.each do |item|
|
||||
item.position -= 1
|
||||
item.parent_ids = ancestors(item)
|
||||
item.rename(:full_name, :path)
|
||||
item.save
|
||||
end
|
||||
end
|
||||
|
||||
def ancestors(item)
|
||||
node, nodes = item, []
|
||||
nodes << node = node.parent while !node.parent.blank? rescue nil
|
||||
nodes.reverse
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,103 +0,0 @@
|
||||
namespace :nccu do
|
||||
task :copy_news_object_auth_to_all_of_news_cate => :environment do
|
||||
# users = user_data.collect do |login_uid|
|
||||
# nccu_id = get_nccu_id_from_mid_site(login_uid)
|
||||
# resource = nccu_id.nil? ? nil : (User.first(conditions:{ nccu_ldap_uid: nccu_id }))
|
||||
# end
|
||||
|
||||
|
||||
nbc = NewsBulletinCategory.first({conditions: "administration"})
|
||||
users_ary = Array.new(ObjectAuth.first({conditions:{title: "submit",obj_authable_type: "NewsBulletinCategory",obj_authable_id: nbc.id}}).privilege_user_ids)
|
||||
to_nbcs = NewsBulletinCategory.where(:key.ne=> 'administration')
|
||||
to_nbcs.each do |cate|
|
||||
oa = ObjectAuth.first({conditions:{title: "submit",obj_authable_type: "NewsBulletinCategory",obj_authable_id: cate.id}})
|
||||
oa.privilege_user_ids = users_ary
|
||||
oa.save
|
||||
end
|
||||
end
|
||||
|
||||
task :apply_180_news_cate_auth_to_171 => :environment do
|
||||
ldap_id_data = [3603,100212, 8151, 3471, 145232, 133380, 133222, 127983, 127977, 127692, 123617, 123566, 58483, 48234, 29237, 9253, 8948, 8703, 8251, 7336, 7242, 7220, 6912, 6603, 6459, 5475, 3643, 3641, 3559, 3310, 3248, 2672, 2531, 1633, 1521, 1516, 145571, 20610, 123604, 100211, 39571, 29479, 8013, 6968, 5868, 5724, 5401, 4369, 3573, 3377, 2918, 2822, 2309, 2134, 1731, 1527]
|
||||
users_ary = Array.new(User.where(:nccu_ldap_uid.in => ldap_id_data ))
|
||||
NewsBulletinCategory.all.each do |cate|
|
||||
oa = ObjectAuth.first({conditions:{title: "submit",obj_authable_type: "NewsBulletinCategory",obj_authable_id: cate.id}})
|
||||
oa.privilege_users = users_ary
|
||||
oa.save
|
||||
end
|
||||
end
|
||||
|
||||
task :remove_3603 => :environment do
|
||||
user_email = 'tu65@nccu.edu.tw'
|
||||
user = User.first({conditions:{email: user_email}})
|
||||
NewsBulletinCategory.all.each do |cate|
|
||||
oa = ObjectAuth.first({conditions:{title: "submit",obj_authable_type: "NewsBulletinCategory",obj_authable_id: cate.id}})
|
||||
oa.privilege_users.delete_if{|t| t == user}
|
||||
oa.save
|
||||
end
|
||||
|
||||
key = 'Announcement'
|
||||
bc = BulletinCategory.first({conditions:{key: key}})
|
||||
oa = ObjectAuth.first({conditions:{title: "submit",obj_authable_type: "BulletinCategory",obj_authable_id: bc.id}})
|
||||
oa.privilege_users.delete_if{|t| t == user}
|
||||
oa.save
|
||||
end
|
||||
|
||||
task :add_nccu_account_1008 => :environment do
|
||||
a = ['yjlin3@nccu.edu.tw','liwen@nccu.edu.tw','yhc@nccu.edu.tw','kenliu@nccu.edu.tw','cfc@nccu.edu.tw','jasper@nccu.edu.tw','donghe@nccu.edu.tw','frees712@nccu.edu.tw','jeanch@nccu.edu.tw','posty@nccu.edu.tw','yiting@nccu.edu.tw','frank997@nccu.edu.tw']
|
||||
users_ary = User.any_in(email: a)
|
||||
NewsBulletinCategory.all.each do |cate|
|
||||
oa = ObjectAuth.first({conditions:{title: "submit",obj_authable_type: "NewsBulletinCategory",obj_authable_id: cate.id}})
|
||||
oa.privilege_users = oa.privilege_users + users_ary
|
||||
oa.save
|
||||
end
|
||||
|
||||
key = 'Announcement'
|
||||
bc = BulletinCategory.first({conditions:{key: key}})
|
||||
oa = ObjectAuth.first({conditions:{title: "submit",obj_authable_type: "BulletinCategory",obj_authable_id: bc.id}})
|
||||
oa.privilege_users = oa.privilege_users + users_ary
|
||||
oa.save
|
||||
|
||||
end
|
||||
|
||||
task :add_nccu_account_1009 => :environment do
|
||||
a = ["blannytg@nccu.edu.tw","yucca@nccu.edu.tw","fish14@nccu.edu.tw","amanda13@nccu.edu.tw"]
|
||||
users_ary = User.any_in(email: a)
|
||||
NewsBulletinCategory.all.each do |cate|
|
||||
oa = ObjectAuth.first({conditions:{title: "submit",obj_authable_type: "NewsBulletinCategory",obj_authable_id: cate.id}})
|
||||
oa.privilege_users = oa.privilege_users + users_ary
|
||||
oa.save
|
||||
end
|
||||
|
||||
a=["annieayu@nccu.edu.tw","blannytg@nccu.edu.tw","yucca@nccu.edu.tw","amanda13@nccu.edu.tw"]
|
||||
users_ary = User.any_in(email: a)
|
||||
key = 'Announcement'
|
||||
bc = BulletinCategory.first({conditions:{key: key}})
|
||||
oa = ObjectAuth.first({conditions:{title: "submit",obj_authable_type: "BulletinCategory",obj_authable_id: bc.id}})
|
||||
oa.privilege_users = oa.privilege_users + users_ary
|
||||
oa.save
|
||||
|
||||
end
|
||||
|
||||
task :add_nccu_account_1016 => :environment do
|
||||
a = ["waynedd@nccu.edu.tw","sfchang@nccu.edu.tw","kyokolin@nccu.edu.tw","sfaylin@nccu.edu.tw","jinyulin@nccu.edu.tw"]
|
||||
users_ary = User.any_in(email: a)
|
||||
NewsBulletinCategory.all.each do |cate|
|
||||
oa = ObjectAuth.first({conditions:{title: "submit",obj_authable_type: "NewsBulletinCategory",obj_authable_id: cate.id}})
|
||||
oa.privilege_users = oa.privilege_users + users_ary
|
||||
oa.save
|
||||
end
|
||||
|
||||
users_ary = User.any_in(email: a)
|
||||
key = 'Announcement'
|
||||
bc = BulletinCategory.first({conditions:{key: key}})
|
||||
oa = ObjectAuth.first({conditions:{title: "submit",obj_authable_type: "BulletinCategory",obj_authable_id: bc.id}})
|
||||
oa.privilege_users = oa.privilege_users + users_ary
|
||||
oa.save
|
||||
|
||||
end
|
||||
|
||||
|
||||
task :consolidate_object_auth => :environment do
|
||||
ObjectAuth.all.each{|t| t.save}
|
||||
end
|
||||
end
|
||||
@@ -1,13 +0,0 @@
|
||||
# encoding: utf-8
|
||||
|
||||
namespace :nokogiri do
|
||||
task :layout => :environment do
|
||||
l = Design.first(:conditions => {:title => 'CCU'}).layout
|
||||
l.layout_parts.destroy rescue nil
|
||||
l.menu.destroy rescue nil
|
||||
l.design.save
|
||||
l = Design.first(:conditions => {:title => 'CCU'}).layout
|
||||
l.file = File.open("#{Rails.root}/lib/noko/layout.html")
|
||||
l.design.save
|
||||
end
|
||||
end
|
||||
@@ -1,11 +0,0 @@
|
||||
# encoding: utf-8
|
||||
|
||||
namespace :add_content do
|
||||
|
||||
task :build => :environment do
|
||||
|
||||
ModuleApp.new.from_json(File.open("#{Rails.root}/vendor/built_in_modules/page_content/page_content.json").read).save
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,66 +0,0 @@
|
||||
# encoding: utf-8
|
||||
|
||||
namespace :pages do
|
||||
|
||||
task :build => :environment do
|
||||
|
||||
Item.destroy_all
|
||||
|
||||
|
||||
var_10 = I18nVariable.create!( :document_class => 'Home', :key => 'home', :en => 'Homepage', :zh_tw => '首頁')
|
||||
var_13 = I18nVariable.create!( :document_class => 'PagePart', :key => 'main_content', :en => 'This is the homepage', :zh_tw => '這是首頁', :parent_id => var_10.id )
|
||||
|
||||
|
||||
design = Design.new(:title => "Fraisier", :author => "Paul", :intro => "Strawberry cake")
|
||||
|
||||
design.build_css_default(:file => File.open("#{Rails.root}/lib/fraisier/default.css"))
|
||||
|
||||
# image = design.images.build(:file => File.open("#{Rails.root}/lib/fraisier/img/buttons.gif"))
|
||||
#
|
||||
# js = design.javascripts.build(:file => File.open("#{Rails.root}/lib/fraisier/inettuts.js"))
|
||||
#
|
||||
theme = design.themes.build(:file => File.open("#{Rails.root}/lib/fraisier/themes/default.css"))
|
||||
theme_1 = design.themes.build(:file => File.open("#{Rails.root}/lib/fraisier/themes/red.css"))
|
||||
|
||||
design.build_layout
|
||||
design.layout.file = File.open("#{Rails.root}/lib/fraisier/layout.html")
|
||||
|
||||
design.layout.save
|
||||
theme.save
|
||||
theme_1.save
|
||||
# image.save
|
||||
# js.save
|
||||
|
||||
design.save
|
||||
|
||||
|
||||
|
||||
design_1 = Design.new(:title => "Bob", :author => "Me", :intro => "Moran")
|
||||
|
||||
design_1.build_css_default(:file => File.open("#{Rails.root}/lib/fraisier/default.css"))
|
||||
|
||||
# image = design.images.build(:file => File.open("#{Rails.root}/lib/fraisier/img/buttons.gif"))
|
||||
#
|
||||
# js = design.javascripts.build(:file => File.open("#{Rails.root}/lib/fraisier/inettuts.js"))
|
||||
#
|
||||
theme = design_1.themes.build(:file => File.open("#{Rails.root}/lib/fraisier/themes/default.css"))
|
||||
theme_1 = design_1.themes.build(:file => File.open("#{Rails.root}/lib/fraisier/themes/red.css"))
|
||||
|
||||
design_1.build_layout
|
||||
design_1.layout.file = File.open("#{Rails.root}/lib/fraisier/layout.html")
|
||||
|
||||
design_1.layout.save
|
||||
theme.save
|
||||
theme_1.save
|
||||
# image.save
|
||||
# js.save
|
||||
|
||||
design_1.save
|
||||
|
||||
|
||||
home = Page.create!( :i18n_variable_id => var_10.id, :design_id => design_1.id, :name => 'home', :is_published => true, :theme_id => theme.id )
|
||||
home.page_parts.create!( :name => 'content_1', :content => File.open("#{Rails.root}/lib/template/home.page").read, :kind => 'text', :i18n_variable_id => var_13.id )
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,29 +0,0 @@
|
||||
# encoding: utf-8
|
||||
namespace :user do
|
||||
|
||||
task :build => :environment do
|
||||
User.all(conditions: {email: /nor/}).destroy_all
|
||||
|
||||
username_list = %w{nor1 nor2 nor3 nor4 nor5 nor6 nor7}
|
||||
userfirstname_list_en = %w{ UserOne UserTwo Thre For Fiv Six Sen }
|
||||
userlastname_list_en = %w{ Aa Bb Cc Dd Ee Ff Gg }
|
||||
|
||||
userfirstname_list_ct = %w{ 一一 二二 三三 四四 五五 六六 七七 }
|
||||
userlastname_list_ct = %w{ 陳 林 吳 李 鄭 方 王 }
|
||||
|
||||
first_name_field = AttributeField.first(conditions: {key: "first_name"})
|
||||
last_name_field = AttributeField.first(conditions: {key: "last_name"})
|
||||
major_field = AttributeField.first(conditions: {key: "major"})
|
||||
department_field = AttributeField.first(conditions: {key: "department"})
|
||||
|
||||
stud_role = Role.first(conditions: {key: 'student'})
|
||||
|
||||
username_list.each_with_index do |username,index|
|
||||
user = User.create( :email => "#{username}@rulingcom.com", :password => 'password', :password_confirmation => 'password', :admin => false ,:role_id => stud_role.id,:sub_role_ids => [stud_role.sub_roles[Random.rand(stud_role.sub_roles.count-1)].id])
|
||||
AttributeValue.create( :user_id => user.id, :attribute_field_id => first_name_field.id, :key => 'first_name', :en => userfirstname_list_en[index], :zh_tw => userfirstname_list_ct[index] )
|
||||
AttributeValue.create( :user_id => user.id, :attribute_field_id => last_name_field.id, :key => 'last_name', :en => userlastname_list_en[index], :zh_tw => userlastname_list_ct[index] )
|
||||
AttributeValue.create( :user_id => user.id, :attribute_field_id => major_field.id, :key => 'major', :en => 'Information management', :zh_tw => '信息化管理' )
|
||||
AttributeValue.create( :user_id => user.id, :attribute_field_id => department_field.id, :key => 'department', :en => 'Computer Science', :zh_tw => '計算機科學' )
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,52 +0,0 @@
|
||||
# encoding: utf-8
|
||||
|
||||
namespace :web_link_url do
|
||||
task :web_link_url_i18n => :environment do
|
||||
|
||||
puts 'start'
|
||||
|
||||
@weblinks = WebLink.all
|
||||
|
||||
@weblinks.each do |wl|
|
||||
|
||||
if wl.url.nil?
|
||||
|
||||
@wlurl = wl.url_translations
|
||||
|
||||
wl.url_translations = {}
|
||||
|
||||
wl.url_translations["zh_tw"] = @wlurl
|
||||
|
||||
wl.url_translations["en"] = @wlurl
|
||||
|
||||
wl.save
|
||||
|
||||
else
|
||||
puts 'no data'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
puts 'end'
|
||||
|
||||
puts @weblinks.count
|
||||
|
||||
end
|
||||
|
||||
task :web_link_url_i18n_test => :environment do
|
||||
|
||||
@test = WebLink.find("50aca25583e75204c00009f4")
|
||||
|
||||
@testurl = @test.url_translations
|
||||
|
||||
@test.url_translations = {}
|
||||
|
||||
@test.url_translations["zh_tw"] = @testurl
|
||||
|
||||
@test.url_translations["en"] = @testurl
|
||||
|
||||
@test.save
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
Reference in new issue
Block a user