Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

moving things around in an attempt to get the raw app started -- rake…

…file to build gem (the gem builds)
  • Loading branch information...
commit 20d7178b37d29e0b28a6a3f59d7689f183194f1a 1 parent 5433ee8
@jashkenas jashkenas authored
View
3  .gitignore
@@ -6,4 +6,5 @@ config/secrets.yml
lib/dc
lib/daemons/*.pid
lib/daemons/*.output
-lib/daemons/*.log
+lib/daemons/*.log
+*.gem
View
22 Rakefile
@@ -1,10 +1,16 @@
-# Add your own tasks in files placed in lib/tasks ending in .rake,
-# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
-
-require(File.join(File.dirname(__FILE__), 'config', 'boot'))
-
-require 'rake'
require 'rake/testtask'
-require 'rake/rdoctask'
-require 'tasks/rails'
+namespace :gem do
+
+ desc 'Build and install cloud-crowd gem'
+ task :install do
+ sh "gem build cloud-crowd.gemspec"
+ sh "sudo gem install #{Dir['*.gem'].join(' ')} --no-ri --no-rdoc"
+ end
+
+ desc 'Uninstall the cloud-crowd gem'
+ task :uninstall do
+ sh "sudo gem uninstall -x cloud-crowd"
+ end
+
+end
View
5 bin/crowd
@@ -0,0 +1,5 @@
+#!/usr/bin/env ruby
+
+require "#{File.dirname(__FILE__)}/../lib/cloud_crowd/command_line"
+
+CloudCrowd::CommandLine.new
View
18 cloud_crowd.gemspec → cloud-crowd.gemspec
@@ -1,11 +1,19 @@
+# TODO: Before pushing to GitHub replace 'files' with a complete file list.
+
Gem::Specification.new do |s|
s.name = 'cloud-crowd'
s.version = '0.0.1'
s.date = '2009-08-23'
-
- s.summary = ""
- s.description = ""
- s.homepage = "wiki page on github?"
+
+ s.homepage = "http://documentcloud.org" # wiki page on github?
+ s.summary = "MapReduce your files in style and comfort."
+ s.description = <<-EOS
+ The crowd, suddenly there where there was nothing before, is a mysterious and
+ universal phenomenon. A few people may have been standing together -- five, ten
+ or twelve, nor more; nothing has been announced, nothing is expected. Suddenly
+ everywhere is black with people and more come streaming from all sides as though
+ streets had only one direction.
+ EOS
s.authors = ['Jeremy Ashkenas']
s.email = 'jeremy@documentcloud.org'
@@ -30,5 +38,5 @@ Gem::Specification.new do |s|
s.add_development_dependency 'notahat-machinist', ['>= 1.0.3']
end
-
+ s.files = Dir['./**/*.*']
end
View
7 config/cloud_crowd.example.ru
@@ -1,11 +1,10 @@
#!/usr/bin/env ruby
require 'rubygems'
-require 'cloud_crowd'
+# require 'cloud-crowd'
+require 'lib/cloud-crowd'
CloudCrowd.new(File.dirname(__FILE__) + '/cloud_crowd.yml')
map '/' do
run CloudCrowd::App
-end
-
-CloudCrowd
View
15 lib/cloud_crowd.rb → lib/cloud-crowd.rb
@@ -1,6 +1,5 @@
$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__))
-
# Standard Library:
require 'tmpdir'
@@ -12,18 +11,14 @@
require 'rest_client'
require 'right_aws'
-# CloudCrowd:
-require 'cloud_crowd/models'
-require 'cloud_crowd/helpers'
require 'cloud_crowd/app'
-
-# SECRETS = YAML.load_file("#{RAILS_ROOT}/config/secrets.yml")[RAILS_ENV]
+# SECRETS = YAML.load_file("#{CloudCrowd::App.root}/config/secrets.yml")[CloudCrowd::App.environment]
module CloudCrowd
# Load configuration.
- CONFIG = YAML.load_file("#{RAILS_ROOT}/config/cloud_crowd.yml")[RAILS_ENV]
+ CONFIG = YAML.load_file("#{CloudCrowd::App.root}/config/cloud_crowd.yml")[CloudCrowd::App.environment]
# All the possible statuses for Jobs and WorkUnits
PROCESSING = 1
@@ -47,4 +42,8 @@ def self.display_status(status)
DISPLAY_STATUS_MAP[status]
end
-end
+
+# CloudCrowd:
+require 'cloud_crowd/models'
+require 'cloud_crowd/helpers'
View
4 lib/cloud_crowd/app.rb
@@ -1,7 +1,7 @@
module CloudCrowd
- class App < Sinatra
- set :root "#{File.dirname(__FILE__)}/../.."
+ class App < Sinatra::Default
+ set :root, "#{File.dirname(__FILE__)}/../.."
enable :static
helpers CloudCrowd::Helpers
View
7 lib/cloud_crowd/command_line.rb
@@ -0,0 +1,7 @@
+module CloudCrowd
+ class CommandLine
+
+
+
+ end
+end
View
2  lib/cloud_crowd/models.rb
@@ -0,0 +1,2 @@
+require 'cloud_crowd/models/job'
+require 'cloud_crowd/models/work_unit'
View
7 lib/cloud_crowd/app/models/job.rb → lib/cloud_crowd/models/job.rb
@@ -3,7 +3,6 @@
# of inputs (usually public urls to files), an action (the name of a script that
# CloudCrowd knows how to run), and, eventually a corresponding list of output.
class Job < ActiveRecord::Base
- include ActionView::Helpers::DateHelper
has_many :work_units
@@ -86,7 +85,11 @@ def display_eta
time = self.eta
return "unknown" if !time
return "complete" if time == 0
- distance_of_time_in_words(0, eta, :include_seconds => true)
+ case time
+ when (0..60) then "#{time} seconds"
+ when (61..3600) then "#{time/60} minutes"
+ else "#{time/3600} hours"
+ end
end
def display_status
View
0  lib/cloud_crowd/app/models/work_unit.rb → lib/cloud_crowd/models/work_unit.rb
File renamed without changes
View
2  lib/cloud_crowd/worker.rb
@@ -86,7 +86,7 @@ def load_action
begin
Module.const_get(action_class).new(@input, @options, @store)
rescue NameError => e
- require "#{RAILS_ROOT}/actions/#{@action_name}"
+ require "#{CloudCrowd::App.root}/actions/#{@action_name}"
retry
end
end
View
10 lib/daemons/runner.rb
@@ -2,8 +2,8 @@
# daemons don't load the entire rails stack, this file functions like a mini
# environment.rb, loading all the common gems that we need.
-RAILS_ENV = ENV['RAILS_ENV'] || 'development' unless defined?(RAILS_ENV)
-RAILS_ROOT = File.expand_path(File.dirname(__FILE__) + '/../..') unless defined?(RAILS_ROOT)
+# CloudCrowd::App.environment = ENV['CloudCrowd::App.environment'] || 'development' unless defined?(CloudCrowd::App.environment)
+# CloudCrowd::App.root = File.expand_path(File.dirname(__FILE__) + '/../..') unless defined?(CloudCrowd::App.root)
# Standard Lib and Gems
require 'rubygems'
@@ -15,10 +15,10 @@
require 'right_aws'
# Daemon/Worker Dependencies.
-require "#{RAILS_ROOT}/lib/cloud_crowd"
-Dir["#{RAILS_ROOT}/lib/cloud_crowd/*.rb"].each {|ruby| require ruby }
+require "#{CloudCrowd::App.root}/lib/cloud_crowd"
+Dir["#{CloudCrowd::App.root}/lib/cloud_crowd/*.rb"].each {|ruby| require ruby }
-Daemons.run("#{RAILS_ROOT}/lib/daemons/daemon.rb", {
+Daemons.run("#{CloudCrowd::App.root}/lib/daemons/daemon.rb", {
:app_name => "cloud_crowd_worker",
:multiple => true,
:backtrace => true,
Please sign in to comment.
Something went wrong with that request. Please try again.