Skip to content

Commit

Permalink
get the gem building again and update some old dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
ssoroka committed Jan 29, 2023
1 parent dc52046 commit 93115f3
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 86 deletions.
55 changes: 32 additions & 23 deletions Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
scheduler_daemon (1.1.4)
scheduler_daemon (1.1.6)
activesupport
chronic (>= 0.2.0)
daemons (>= 1.0.10)
Expand All @@ -11,34 +11,43 @@ PATH
GEM
remote: http://rubygems.org/
specs:
activesupport (3.2.17)
i18n (~> 0.6, >= 0.6.4)
multi_json (~> 1.0)
atomic (1.1.14)
activesupport (7.0.4.2)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
chronic (0.10.2)
daemons (1.1.9)
diff-lcs (1.2.5)
eventmachine (1.0.3)
i18n (0.6.9)
multi_json (1.8.4)
rspec (2.13.0)
rspec-core (~> 2.13.0)
rspec-expectations (~> 2.13.0)
rspec-mocks (~> 2.13.0)
rspec-core (2.13.1)
rspec-expectations (2.13.0)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.13.1)
concurrent-ruby (1.2.0)
daemons (1.4.1)
diff-lcs (1.5.0)
eventmachine (1.2.7)
i18n (1.12.0)
concurrent-ruby (~> 1.0)
minitest (5.17.0)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-core (3.12.0)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.0)
rufus-scheduler (2.0.24)
tzinfo (>= 0.3.22)
thread_safe (0.1.3)
atomic
tzinfo (1.1.0)
thread_safe (~> 0.1)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)

PLATFORMS
ruby

DEPENDENCIES
rspec (~> 2.13.0)
rspec (~> 3.12.0)
scheduler_daemon!

BUNDLED WITH
2.4.3
2 changes: 1 addition & 1 deletion Rakefile
Expand Up @@ -27,7 +27,7 @@ begin
gem.add_dependency('daemons', '>= 1.0.10')
gem.add_dependency('rufus-scheduler', '~> 2.0.24')
gem.add_dependency('chronic', '>= 0.2.0')
gem.add_development_dependency('rspec', '~> 2.13.0')
gem.add_development_dependency('rspec', '~> 3.12.0')

gem.executables = ['scheduler_daemon']

Expand Down
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
1.1.5
1.1.6
14 changes: 7 additions & 7 deletions lib/scheduler_daemon/base.rb
Expand Up @@ -39,7 +39,7 @@ def initialize(opts = {}, command_line_args = [])
@env_name = @options['env_name'] || 'scheduler'
@rufus_scheduler = nil
@tasks = []

log("initialized with settings: #{@options.inspect}")

if !@options['skip_init']
Expand All @@ -48,14 +48,14 @@ def initialize(opts = {}, command_line_args = [])
run_scheduler
end
end

# registers a task class with the scheduler
def register_task(task)

end

def load_rails_env
if File.exists?('config/environment.rb') && !@options['skip_rails']
if File.exist?('config/environment.rb') && !@options['skip_rails']
log("loading rails environment")
require File.expand_path('./config/environment')
@env_name = ::Rails.env
Expand All @@ -64,7 +64,7 @@ def load_rails_env
log("Error loading rails environment; #{$!.class.name}: #{$!.message}")
raise $!
end

# time redefines itself with a faster implementation, since it gets called a lot.
def time
if Time.respond_to?(:zone) && Time.zone
Expand All @@ -74,7 +74,7 @@ def time
end
time
end

def log(*args)
return if @options[:silent]
Kernel::puts(%([#{time}] #{args.join("\n")}))
Expand Down
59 changes: 22 additions & 37 deletions scheduler_daemon.gemspec
Expand Up @@ -2,17 +2,19 @@
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
# stub: scheduler_daemon 1.1.6 ruby lib

Gem::Specification.new do |s|
s.name = "scheduler_daemon"
s.version = "1.1.5"
s.name = "scheduler_daemon".freeze
s.version = "1.1.6"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Steven Soroka"]
s.date = "2014-02-25"
s.description = "a Rails 2.3, Rails 3, and Ruby compatible scheduler daemon. Replaces cron/rake pattern of periodically running rake tasks to perform maintenance tasks, only loading the environment ONCE."
s.email = "ssoroka78@gmail.com"
s.executables = ["scheduler_daemon"]
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["Steven Soroka".freeze]
s.date = "2023-01-29"
s.description = "a Rails 2.3, Rails 3, and Ruby compatible scheduler daemon. Replaces cron/rake pattern of periodically running rake tasks to perform maintenance tasks, only loading the environment ONCE.".freeze
s.email = "ssoroka78@gmail.com".freeze
s.executables = ["scheduler_daemon".freeze]
s.extra_rdoc_files = [
"README.markdown"
]
Expand All @@ -38,42 +40,25 @@ Gem::Specification.new do |s|
"lib/scheduler_daemon/rails/generators/scheduler_task/templates/scheduled_tasks/example_task.rb",
"lib/scheduler_daemon/rails/railtie.rb",
"lib/scheduler_daemon/scheduler_task.rb",
"scheduler_daemon-1.1.5.gem",
"scheduler_daemon.gemspec",
"spec/command_line_args_to_hash_spec.rb",
"spec/scheduled_tasks/session_cleaner_task_spec.rb",
"spec/scheduler_spec.rb",
"spec/spec_helper.rb"
]
s.homepage = "http://github.com/ssoroka/scheduler_daemon"
s.require_paths = ["lib"]
s.rubygems_version = "1.8.23"
s.summary = "Rails 3 compatible scheduler daemon. Replaces cron/rake pattern of periodically running rake tasks to perform maintenance tasks in Rails apps. Scheduler Daemon is made specifically for your Rails app, and only loads the environment once, no matter how many tasks run. What's so great about it? Well, I'm glad you asked! - Only loads your Rails environment once on daemon start, not every time a task is run - Allows you to easily deploy the scheduled tasks with your Rails app instead of depending on an administrator to update crontab - It doesn't use rake or cron! - Gets you up and running with your own daemon in under 2 minutes"
s.homepage = "http://github.com/ssoroka/scheduler_daemon".freeze
s.rubygems_version = "3.4.5".freeze
s.summary = "Rails 3 compatible scheduler daemon. Replaces cron/rake pattern of periodically running rake tasks to perform maintenance tasks in Rails apps. Scheduler Daemon is made specifically for your Rails app, and only loads the environment once, no matter how many tasks run. What's so great about it? Well, I'm glad you asked! - Only loads your Rails environment once on daemon start, not every time a task is run - Allows you to easily deploy the scheduled tasks with your Rails app instead of depending on an administrator to update crontab - It doesn't use rake or cron! - Gets you up and running with your own daemon in under 2 minutes".freeze

if s.respond_to? :specification_version then
s.specification_version = 3
s.specification_version = 4

if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<activesupport>, [">= 0"])
s.add_runtime_dependency(%q<eventmachine>, [">= 0.12.8"])
s.add_runtime_dependency(%q<daemons>, [">= 1.0.10"])
s.add_runtime_dependency(%q<rufus-scheduler>, ["~> 2.0.24"])
s.add_runtime_dependency(%q<chronic>, [">= 0.2.0"])
s.add_development_dependency(%q<rspec>, ["~> 2.13.0"])
else
s.add_dependency(%q<activesupport>, [">= 0"])
s.add_dependency(%q<eventmachine>, [">= 0.12.8"])
s.add_dependency(%q<daemons>, [">= 1.0.10"])
s.add_dependency(%q<rufus-scheduler>, ["~> 2.0.24"])
s.add_dependency(%q<chronic>, [">= 0.2.0"])
s.add_dependency(%q<rspec>, ["~> 2.13.0"])
end
else
s.add_dependency(%q<activesupport>, [">= 0"])
s.add_dependency(%q<eventmachine>, [">= 0.12.8"])
s.add_dependency(%q<daemons>, [">= 1.0.10"])
s.add_dependency(%q<rufus-scheduler>, ["~> 2.0.24"])
s.add_dependency(%q<chronic>, [">= 0.2.0"])
s.add_dependency(%q<rspec>, ["~> 2.13.0"])
end
s.add_runtime_dependency(%q<scheduler_daemon>.freeze, [">= 0"])
s.add_development_dependency(%q<rspec>.freeze, ["~> 3.12.0"])
s.add_runtime_dependency(%q<activesupport>.freeze, [">= 0"])
s.add_runtime_dependency(%q<eventmachine>.freeze, [">= 0.12.8"])
s.add_runtime_dependency(%q<daemons>.freeze, [">= 1.0.10"])
s.add_runtime_dependency(%q<rufus-scheduler>.freeze, ["~> 2.0.24"])
s.add_runtime_dependency(%q<chronic>.freeze, [">= 0.2.0"])
end

18 changes: 9 additions & 9 deletions spec/command_line_args_to_hash_spec.rb
Expand Up @@ -4,23 +4,23 @@
describe CommandLineArgsToHash do
it 'should process arguments' do
h = CommandLineArgsToHash.parse(['--hello'])
h['hello'].should == true
expect(h['hello']).to eq true
end

it 'should change key names with - to _' do
h = CommandLineArgsToHash.parse(['--hi-there'])
h['hi_there'].should == true
expect(h['hi_there']).to eq true
end

it 'should play nice with array args' do
h = CommandLineArgsToHash.parse(['--only=one,two,three'], :array_args => 'only')
h['only'].should == %w(one two three)
expect(h['only']).to eq %w(one two three)
end

it 'should handle multiple args ok' do
h = CommandLineArgsToHash.parse(['--one', '--two=three'])
h['one'].should == true
h['two'].should == 'three'
expect(h['one']).to eq true
expect(h['two']).to eq 'three'
end

end
9 changes: 5 additions & 4 deletions spec/scheduled_tasks/session_cleaner_task_spec.rb
Expand Up @@ -9,7 +9,7 @@
describe SessionCleanerTask do
before(:each) do
@task = SessionCleanerTask.new
@task.stub(:log)
# expect(@task).to receive(:log)
end

it "should remove old sessions" do
Expand All @@ -25,11 +25,12 @@
ActiveRecord::Base.connection.select_one(%(select count(*) as count from #{@task.session_table_name}))['count'].to_i
}

lambda {
expect(lambda {
@task.run
}.should change(get_session_count, :call).by_at_most(-1)
}).to change(get_session_count, :call).by_at_most(-1)
else
pending 'skipping SessionCleanerTask test since it depends on rails and ActiveRecord::SessionStore; try copying this spec to your rails application.'
raise 'skipping'
end
end
end
end
8 changes: 4 additions & 4 deletions spec/scheduler_spec.rb
Expand Up @@ -4,18 +4,18 @@
describe Scheduler::Base do
before(:each) do
@scheduler = Scheduler::Base.new(:skip_init => true, :silent => true)
@scheduler.stub(:log)
# @scheduler.stub(:log)
end

describe 'decide_what_to_run' do
it "should support --only" do
@scheduler = Scheduler::Base.new({:skip_init => true, :silent => true}, ['--only=alphabets'])
@scheduler.options['only'].should == ['alphabets']
expect(@scheduler.options['only']).to eq ['alphabets']
end

it "should support --except" do
@scheduler = Scheduler::Base.new({:skip_init => true, :silent => true}, ['--except=balloons,monkeys'])
@scheduler.options['except'].should == ['balloons', 'monkeys']
expect(@scheduler.options['except']).to eq ['balloons', 'monkeys']
end
end
end
end

0 comments on commit 93115f3

Please sign in to comment.