Skip to content

Commit

Permalink
Merge branch 'master' into openshift2
Browse files Browse the repository at this point in the history
Conflicts:
	bin/setup_heroku
  • Loading branch information
cantino committed Nov 2, 2014
2 parents 3f64c7f + 423fefe commit 225d73a
Show file tree
Hide file tree
Showing 113 changed files with 2,079 additions and 562 deletions.
12 changes: 10 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ INVITATION_CODE=try-huginn

# Outgoing email settings. To use Gmail or Google Apps, put your Google Apps domain or gmail.com
# as the SMTP_DOMAIN and your Gmail username and password as the SMTP_USER_NAME and SMTP_PASSWORD.
#
# PLEASE NOTE: In order to enable emails locally (e.g., when not in the production Rails environment),
#
# PLEASE NOTE: In order to enable emails locally (e.g., when not in the production Rails environment),
# you must also change config.action_mailer.perform_deliveries in config/environments/development.rb.

SMTP_DOMAIN=your-domain-here.com
Expand Down Expand Up @@ -92,6 +92,9 @@ GITHUB_OAUTH_SECRET=
TUMBLR_OAUTH_KEY=
TUMBLR_OAUTH_SECRET=

DROPBOX_OAUTH_KEY=
DROPBOX_OAUTH_SECRET=

#############################
# AWS and Mechanical Turk #
#############################
Expand Down Expand Up @@ -132,6 +135,11 @@ ENABLE_INSECURE_AGENTS=false
# "on the minute") is disallowed to prevent abuse of service.
ENABLE_SECOND_PRECISION_SCHEDULE=false

# Specify the scheduler frequency in seconds (default: 0.3).
# Increasing this value will help reduce the use of system resources
# at the expense of time accuracy.
#SCHEDULER_FREQUENCY=0.3

# Use Graphviz for generating diagrams instead of using Google Chart
# Tools. Specify a dot(1) command path built with SVG support
# enabled.
Expand Down
10 changes: 9 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ gem 'omniauth-twitter'
gem 'tumblr_client'
gem 'omniauth-tumblr'

# Dropbox Agents
gem 'dropbox-api'
gem 'omniauth-dropbox'

# Optional Services.
gem 'omniauth-37signals' # BasecampAgent
# gem 'omniauth-github'
Expand All @@ -46,7 +50,7 @@ gem 'coffee-rails', '~> 4.0.0'
gem 'daemons', '~> 1.1.9'
gem 'delayed_job', '~> 4.0.0'
gem 'delayed_job_active_record', '~> 4.0.0'
gem 'devise', '~> 3.2.4'
gem 'devise', '~> 3.4.0'
gem 'em-http-request', '~> 1.1.2'
gem 'faraday', '~> 0.9.0'
gem 'faraday_middleware'
Expand Down Expand Up @@ -81,6 +85,9 @@ group :development do
gem 'better_errors', '~> 1.1'
gem 'binding_of_caller'
gem 'quiet_assets'
gem 'guard'
gem 'guard-livereload'
gem 'guard-rspec'
end

group :development, :test do
Expand All @@ -92,6 +99,7 @@ group :development, :test do
gem 'rspec', '~> 3.0'
gem 'rspec-collection_matchers', '~> 1.0.0'
gem 'rspec-rails', '~> 3.0.1'
gem 'rspec-html-matchers', '~> 0.6.1'
gem 'shoulda-matchers'
gem 'spring'
gem 'spring-commands-rspec'
Expand Down
54 changes: 50 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ GEM
rails (>= 3.1)
buftok (0.2.0)
builder (3.2.2)
celluloid (0.15.2)
timers (~> 1.1.0)
chronic (0.10.2)
coderay (1.1.0)
coffee-rails (4.0.1)
Expand Down Expand Up @@ -82,10 +84,11 @@ GEM
delayed_job (>= 3.0, < 4.1)
delorean (2.1.0)
chronic
devise (3.2.4)
devise (3.4.0)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5)
responders
thread_safe (~> 0.1)
warden (~> 1.2.3)
diff-lcs (1.2.5)
Expand All @@ -95,6 +98,10 @@ GEM
dotenv-deployment (0.0.2)
dotenv-rails (0.11.1)
dotenv (= 0.11.1)
dropbox-api (0.4.2)
hashie
multi_json
oauth
em-http-request (1.1.2)
addressable (>= 2.3.4)
cookiejar
Expand All @@ -103,6 +110,9 @@ GEM
http_parser.rb (>= 0.6.0)
em-socksify (0.3.0)
eventmachine (>= 1.0.0.beta.4)
em-websocket (0.5.1)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
equalizer (0.0.9)
erector (0.10.0)
treetop (>= 1.2.3)
Expand All @@ -129,6 +139,7 @@ GEM
foreman (0.63.0)
dotenv (>= 0.7)
thor (>= 0.13.6)
formatador (0.2.5)
geokit (1.8.5)
multi_json (>= 1.3.2)
geokit-rails (2.0.1)
Expand All @@ -145,6 +156,19 @@ GEM
retriable (>= 1.4)
signet (>= 0.5.0)
uuidtools (>= 2.1.0)
guard (2.6.1)
formatador (>= 0.2.4)
listen (~> 2.7)
lumberjack (~> 1.0)
pry (>= 0.9.12)
thor (>= 0.18.1)
guard-livereload (2.2.0)
em-websocket (~> 0.5)
guard (~> 2.0)
multi_json (~> 1.8)
guard-rspec (4.3.1)
guard (~> 2.1)
rspec (>= 2.14, < 4.0)
hashie (2.0.5)
hike (1.2.3)
hipchat (1.2.0)
Expand All @@ -171,8 +195,13 @@ GEM
kramdown (1.3.3)
launchy (2.4.2)
addressable (~> 2.3)
libv8 (3.16.14.3)
libv8 (3.16.14.7)
liquid (2.6.1)
listen (2.7.9)
celluloid (>= 0.15.2)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
lumberjack (1.0.9)
macaddr (1.7.1)
systemu (~> 2.6.2)
mail (2.5.4)
Expand All @@ -184,7 +213,7 @@ GEM
mime-types (1.25.1)
mini_portile (0.6.0)
minitest (5.4.0)
mqtt (0.2.0)
mqtt (0.3.1)
multi_json (1.10.1)
multi_xml (0.5.5)
multipart-post (2.0.0)
Expand All @@ -206,6 +235,8 @@ GEM
omniauth-37signals (1.0.5)
omniauth (~> 1.0)
omniauth-oauth2 (~> 1.0)
omniauth-dropbox (0.2.0)
omniauth-oauth (~> 1.0)
omniauth-oauth (1.0.1)
oauth
omniauth (~> 1.0)
Expand Down Expand Up @@ -255,9 +286,14 @@ GEM
thor (>= 0.18.1, < 2.0)
raindrops (0.13.0)
rake (10.3.2)
rb-fsevent (0.9.4)
rb-inotify (0.9.5)
ffi (>= 0.5.0)
rdoc (4.1.1)
json (~> 1.4)
ref (1.0.5)
responders (1.1.1)
railties (>= 3.2, < 4.2)
rest-client (1.6.8)
mime-types (~> 1.16)
rdoc (>= 2.4.2)
Expand All @@ -274,6 +310,9 @@ GEM
rspec-expectations (3.0.4)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.0.0)
rspec-html-matchers (0.6.1)
nokogiri (~> 1)
rspec (~> 3)
rspec-mocks (3.0.4)
rspec-support (~> 3.0.0)
rspec-rails (3.0.2)
Expand Down Expand Up @@ -341,6 +380,7 @@ GEM
thor (0.19.1)
thread_safe (0.3.4)
tilt (1.4.1)
timers (1.1.0)
tins (1.3.2)
treetop (1.4.15)
polyglot
Expand Down Expand Up @@ -414,9 +454,10 @@ DEPENDENCIES
delayed_job (~> 4.0.0)
delayed_job_active_record (~> 4.0.0)
delorean
devise (~> 3.2.4)
devise (~> 3.4.0)
dotenv-deployment
dotenv-rails
dropbox-api
em-http-request (~> 1.1.2)
faraday (~> 0.9.0)
faraday_middleware
Expand All @@ -428,6 +469,9 @@ DEPENDENCIES
geokit (~> 1.8.4)
geokit-rails (~> 2.0.1)
google-api-client
guard
guard-livereload
guard-rspec
hipchat (~> 1.2.0)
httparty (~> 0.13)
jquery-rails (~> 3.1.0)
Expand All @@ -443,6 +487,7 @@ DEPENDENCIES
nokogiri (~> 1.6.1)
omniauth
omniauth-37signals
omniauth-dropbox
omniauth-tumblr
omniauth-twitter
pg
Expand All @@ -455,6 +500,7 @@ DEPENDENCIES
rr
rspec (~> 3.0)
rspec-collection_matchers (~> 1.0.0)
rspec-html-matchers (~> 0.6.1)
rspec-rails (~> 3.0.1)
rturk (~> 2.12.1)
ruby-growl (~> 4.1.0)
Expand Down
25 changes: 25 additions & 0 deletions Guardfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

guard 'livereload' do
watch(%r{app/views/.+\.(erb|haml|slim)$})
watch(%r{app/helpers/.+\.rb})
watch(%r{public/.+\.(css|js|html)})
watch(%r{config/locales/.+\.yml})
# Rails Assets Pipeline
watch(%r{(app|vendor)(/assets/\w+/(.+\.(css|js|html|png|jpg))).*}) { |m| "/assets/#{m[3]}" }
end

guard :rspec, cmd: 'bundle exec spring rspec' do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }

# Rails example
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
watch('config/routes.rb') { "spec/routing" }
watch('app/controllers/application_controller.rb') { "spec/controllers" }
watch('spec/rails_helper.rb') { "spec" }
end

1 change: 1 addition & 0 deletions app/assets/javascripts/application.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#= require select2
#= require json2
#= require jquery.json-editor
#= require jquery.serializeObject
#= require latlon_and_geo
#= require spectrum
#= require_tree ./components
Expand Down
76 changes: 76 additions & 0 deletions app/assets/javascripts/components/form_configurable.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
$ ->
getFormData = (elem) ->
form_data = $("#edit_agent, #new_agent").serializeObject()
attribute = $(elem).data('attribute')
form_data['attribute'] = attribute
delete form_data['_method']
form_data

window.initializeFormCompletable = ->
returnedResults = {}
completableDefaultOptions = (input) ->
results: [
(returnedResults[$(input).data('attribute')] || {text: 'Options', children: [{id: undefined, text: 'loading ...'}]}),
{
text: 'Current',
children: [id: $(input).val(), text: $(input).val()]
},
{
text: 'Custom',
children: [id: 'manualInput', text: 'manual input']
},
]

$("input[role~=validatable], select[role~=validatable]").on 'change', (e) =>
form_data = getFormData(e.currentTarget)
form_group = $(e.currentTarget).closest('.form-group')
$.ajax '/agents/validate',
type: 'POST',
data: form_data
success: (data) ->
form_group.addClass('has-feedback').removeClass('has-error')
form_group.find('span').addClass('hidden')
form_group.find('.glyphicon-ok').removeClass('hidden')
returnedResults = {}
error: (data) ->
form_group.addClass('has-feedback').addClass('has-error')
form_group.find('span').addClass('hidden')
form_group.find('.glyphicon-remove').removeClass('hidden')
returnedResults = {}

$("input[role~=validatable], select[role~=validatable]").trigger('change')

$.each $("input[role~=completable]"), (i, input) ->
$(input).select2(
data: ->
completableDefaultOptions(input)
).on("change", (e) ->
if e.added && e.added.id == 'manualInput'
$(e.currentTarget).select2("destroy")
$(e.currentTarget).val(e.removed.id)
)

updateDropdownData = (form_data, element, data) ->
returnedResults[form_data.attribute] = {text: 'Options', children: data}
$(element).trigger('change')
$(element).select2('open')

$("input[role~=completable]").on 'select2-open', (e) ->
form_data = getFormData(e.currentTarget)
return if returnedResults[form_data.attribute]

$.ajax '/agents/complete',
type: 'POST',
data: form_data
success: (data) ->
updateDropdownData(form_data, e.currentTarget, data)
error: (data) ->
updateDropdownData(form_data, e.currentTarget, [{id: undefined, text: 'Error loading data.'}])

$("input[type=radio][role~=form-configurable]").change (e) ->
input = $(e.currentTarget).parents().siblings("input[data-attribute=#{$(e.currentTarget).data('attribute')}]")
if $(e.currentTarget).val() == 'manual'
input.removeClass('hidden')
else
input.val($(e.currentTarget).val())
input.addClass('hidden')
Loading

0 comments on commit 225d73a

Please sign in to comment.