2014-04-01 07:12:43 +00:00
|
|
|
$:.push File.expand_path("../lib", __FILE__)
|
|
|
|
|
|
|
|
# Maintain your gem's version:
|
|
|
|
require "announcement/version"
|
2020-02-14 03:03:01 +00:00
|
|
|
app_path = File.expand_path(__dir__)
|
|
|
|
template_path = ENV['PWD'] + '/app/templates'
|
|
|
|
all_template = Dir.glob(template_path+'/*/')
|
|
|
|
puts 'editing files for sassc'
|
|
|
|
new_gemfile_text = File.read(app_path+'/temp_file/Gemfile')
|
|
|
|
old_gemfile_text = File.read(ENV['PWD']+'/Gemfile')
|
|
|
|
check_texts = ['@import "../../bootstrap/variables";',".response-content {\n position: relative;\n\n @media (min-width: $screen-sm) {\n width: 100%;\n }\n\n @media (min-width: $screen-md) {\n width: 970px;\n }\n\n @media (min-width: $screen-lg) {\n width: 1100px;\n }\n}\n"]
|
|
|
|
all_template.each do |folder|
|
|
|
|
if !folder.include?('mobile')
|
|
|
|
begin
|
|
|
|
if folder.split('/')[-1] != 'mobile'
|
|
|
|
@filename = folder+'assets/stylesheets/template/base/_variables.scss'
|
|
|
|
texts = File.read(@filename)
|
|
|
|
check_texts.each do |check_text|
|
|
|
|
if !texts.include?(check_text)
|
|
|
|
puts "editing #{folder}assets/stylesheets/template/base/_variables.scss"
|
|
|
|
File.open(@filename, 'a') do |file|
|
|
|
|
file.puts check_text
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2020-02-14 03:06:40 +00:00
|
|
|
rescue => e
|
2020-02-14 03:03:01 +00:00
|
|
|
puts "not found #{folder}assets/stylesheets/template/base/_variables.scss"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2020-02-14 05:08:27 +00:00
|
|
|
puts ['old_path', ENV['PWD'] + '/app/templates','new',app_path+'/temp_file/Gemfile']
|
2020-02-14 03:47:46 +00:00
|
|
|
puts ['flag',old_gemfile_text != new_gemfile_text]
|
2020-02-14 03:03:01 +00:00
|
|
|
if old_gemfile_text != new_gemfile_text
|
2020-02-14 03:09:20 +00:00
|
|
|
File.open(ENV['PWD']+'/Gemfile', 'w') do |file|
|
2020-02-14 03:03:01 +00:00
|
|
|
file.write new_gemfile_text
|
|
|
|
end
|
2020-02-14 08:22:49 +00:00
|
|
|
log_development = File.mtime(ENV['PWD']+'/log/development.log').strftime('%Y%m%d%H%M').to_i rescue 0
|
|
|
|
log_production = File.mtime(ENV['PWD']+'/log/production.log').strftime('%Y%m%d%H%M').to_i rescue 0
|
|
|
|
if log_development > log_production
|
|
|
|
mode = 'development'
|
|
|
|
else
|
|
|
|
mode = 'production'
|
|
|
|
end
|
2020-02-14 08:51:02 +00:00
|
|
|
if Dir[ENV['PWD']+'/Gemfile.lock'].blank?
|
|
|
|
command = "gem install bundler -v 1.17.3 && cd #{ENV['PWD']} \r\n bundle update \r\n"
|
|
|
|
else
|
|
|
|
command = "gem install bundler -v 1.17.3 && cd #{ENV['PWD']} \r\n mv -f Gemfile.lock Gemfile.lock.bak123 \r\n bundle update \r\n"
|
|
|
|
end
|
|
|
|
all_command = "#{command} kill -s TERM `cat tmp/pids/unicorn.pid` && bundle exec unicorn_rails -c config/unicorn.rb -D -E development"
|
2020-02-14 04:47:38 +00:00
|
|
|
a = Thread.start do
|
2020-02-14 04:32:15 +00:00
|
|
|
Bundler.with_clean_env do
|
2020-02-14 04:17:55 +00:00
|
|
|
puts ENV['PWD']
|
2020-02-14 07:59:10 +00:00
|
|
|
puts mode
|
2020-02-14 08:51:02 +00:00
|
|
|
system(all_command)
|
2020-02-14 04:17:55 +00:00
|
|
|
end
|
2020-02-14 04:32:15 +00:00
|
|
|
end
|
2020-02-14 04:35:22 +00:00
|
|
|
a.priority = 2
|
2020-02-14 08:51:02 +00:00
|
|
|
sleep 2
|
2020-02-14 04:45:07 +00:00
|
|
|
a.run
|
2020-02-14 04:55:10 +00:00
|
|
|
Thread.kill(Thread.current)
|
2020-02-14 04:32:15 +00:00
|
|
|
puts '123'
|
2020-02-14 04:07:23 +00:00
|
|
|
#Thread.exit
|
2020-02-14 03:03:01 +00:00
|
|
|
end
|
2014-04-01 07:12:43 +00:00
|
|
|
# Describe your gem and declare its dependencies:
|
|
|
|
Gem::Specification.new do |s|
|
|
|
|
s.name = "announcement"
|
|
|
|
s.version = Announcement::VERSION
|
|
|
|
s.authors = ["RulingDigital"]
|
|
|
|
s.email = ["orbit@rulingcom.com"]
|
|
|
|
s.homepage = "http://www.rulingcom.com"
|
|
|
|
s.summary = "Announcements for Orbit"
|
|
|
|
s.description = "Announcements for Orbit"
|
|
|
|
s.license = "MIT"
|
|
|
|
|
|
|
|
s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
|
|
|
|
s.test_files = Dir["test/**/*"]
|
2019-10-09 08:43:37 +00:00
|
|
|
|
|
|
|
s.add_dependency "rufus-scheduler", "~> 3.6.0"
|
2014-04-01 07:12:43 +00:00
|
|
|
end
|