Skip to content
This repository has been archived by the owner on Mar 7, 2018. It is now read-only.

Remove dependencies on Thin, so Dashing can run on JRuby. #427

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions dashing.gemspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-

Gem::Specification.new do |s|
s.name = 'dashing'
s.name = 'dashing-jruby'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no sense on put that line on the commit of your PR.
Because if it would merged, you would change the gemspec of the entire project to dashing-jruby.
I think you just want to fork that project, and on your fork only, put these line.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, the project should remain available as the gem dashing.

However, the remainder of this PR has merit and could be considered. I have no allegiances to Thin.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cefigueiredo I opened this PR as a good faith attempt to work with you to make Dashing work on JRuby. I assumed the PR will evolve as we discuss its changes and find the best way to replace Thin with Puma. If you prefer to only receive fully-formed PRs before discussing them, I will try to do that in the future.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That certainly is not what I am saying... My intent in commenting was to re-spark discussion around this. There are other issues that may be resolved by moving to Puma, so I think this is good even without providing jruby compatibility.

But the gem isn't going to be renamed... People are going to type gem install dashing 👍

s.version = '1.3.4'
s.date = '2014-05-30'
s.executables = %w(dashing)
Expand All @@ -20,7 +20,7 @@ Gem::Specification.new do |s|
s.add_dependency('execjs', '~> 2.0.2')
s.add_dependency('sinatra', '~> 1.4.4')
s.add_dependency('sinatra-contrib', '~> 1.4.2')
s.add_dependency('thin', '~> 1.6.1')
s.add_dependency('puma')
s.add_dependency('rufus-scheduler', '~> 2.0.24')
s.add_dependency('thor', '~> 0.18.1')
s.add_dependency('sprockets', '~> 2.10.1')
Expand Down
11 changes: 0 additions & 11 deletions lib/dashing/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
require 'sass'
require 'json'
require 'yaml'
require 'thin'

SCHEDULER = Rufus::Scheduler.new

Expand Down Expand Up @@ -120,16 +119,6 @@ def protected!
end
end

Thin::Server.class_eval do
def stop_with_connection_closing
Sinatra::Application.settings.connections.dup.each(&:close)
stop_without_connection_closing
end

alias_method :stop_without_connection_closing, :stop
alias_method :stop, :stop_with_connection_closing
end

def send_event(id, body, target=nil)
body[:id] = id
body[:updatedAt] ||= Time.now.to_i
Expand Down
8 changes: 1 addition & 7 deletions lib/dashing/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,11 @@ def install(gist_id)
def start(*args)
port_option = args.include?('-p') ? '' : ' -p 3030'
args = args.join(' ')
command = "bundle exec thin -R config.ru start#{port_option} #{args}"
command = "bundle exec puma #{port_option} #{args} config.ru"
command.prepend "export JOB_PATH=#{options[:job_path]}; " if options[:job_path]
run_command(command)
end

desc "stop", "Stops the thin server"
def stop
command = "bundle exec thin stop"
run_command(command)
end

desc "job JOB_NAME AUTH_TOKEN(optional)", "Runs the specified job. Make sure to supply your auth token if you have one set."
def job(name, auth_token = "")
Dir[File.join(Dir.pwd, 'lib/**/*.rb')].each {|file| require_file(file) }
Expand Down