Permalink
Browse files

initial commit

  • Loading branch information...
1 parent fc8949f commit 4ed4efe70b8cc64fe19b2166165d9f0ba1a460e7 @DerGuteMoritz DerGuteMoritz committed Nov 16, 2010
Showing with 199 additions and 0 deletions.
  1. +4 −0 .document
  2. +42 −0 .gitignore
  3. +11 −0 Gemfile
  4. +16 −0 Gemfile.lock
  5. +19 −0 LICENSE.txt
  6. +8 −0 README.rdoc
  7. +41 −0 Rakefile
  8. +53 −0 bin/salesforce-sync
  9. +5 −0 lib/salesforce_sync.rb
View
@@ -0,0 +1,4 @@
+lib/**/*.rb
+bin/*
+-
+LICENSE.txt
View
@@ -0,0 +1,42 @@
+# rcov generated
+coverage
+
+# rdoc generated
+rdoc
+
+# yard generated
+doc
+.yardoc
+
+# bundler
+.bundle
+
+# jeweler generated
+pkg
+
+# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
+#
+# * Create a file at ~/.gitignore
+# * Include files you want ignored
+# * Run: git config --global core.excludesfile ~/.gitignore
+#
+# After doing this, these files will be ignored in all your git projects,
+# saving you from having to 'pollute' every project you touch with them
+#
+# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
+#
+# For MacOS:
+#
+#.DS_Store
+#
+# For TextMate
+#*.tmproj
+#tmtags
+#
+# For emacs:
+#*~
+#\#*
+#.\#*
+#
+# For vim:
+#*.swp
View
11 Gemfile
@@ -0,0 +1,11 @@
+source "http://rubygems.org"
+# Add dependencies required to use your gem here.
+# Example:
+# gem "activesupport", ">= 2.3.5"
+
+# Add dependencies to develop your gem here.
+# Include everything needed to run rake, tests, features, etc.
+group :development do
+ gem "bundler", "~> 1.0.0"
+ gem "jeweler", "~> 1.5.1"
+end
View
@@ -0,0 +1,16 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ git (1.2.5)
+ jeweler (1.5.1)
+ bundler (~> 1.0.0)
+ git (>= 1.2.5)
+ rake
+ rake (0.8.7)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ bundler (~> 1.0.0)
+ jeweler (~> 1.5.1)
View
@@ -0,0 +1,19 @@
+Copyright (c) 2010 Christof Spies, Moritz Heidkamp
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
View
@@ -0,0 +1,8 @@
+= salesforce-sync
+
+Export Salesforce objects into a local database.
+
+== Copyright
+
+Copyright (c) 2010 Moritz Heidkamp. See LICENSE.txt for
+further details.
View
@@ -0,0 +1,41 @@
+require 'rubygems'
+require 'bundler'
+begin
+ Bundler.setup(:default, :development)
+rescue Bundler::BundlerError => e
+ $stderr.puts e.message
+ $stderr.puts "Run `bundle install` to install missing gems"
+ exit e.status_code
+end
+require 'rake'
+
+require 'jeweler'
+Jeweler::Tasks.new do |gem|
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
+ gem.name = "salesforce-sync"
+ gem.homepage = "http://github.com/DerGuteMoritz/salesforce-sync"
+ gem.license = "MIT"
+ gem.summary = %Q{Synchronize Salesforce objects into a local database}
+ gem.description = %Q{This gem provides a program named salesforce-sync which allows you to synchronize Salesforce objects into a local database. Currently only unidirectional synchronization from Salesforce into a local database is implemented.}
+ gem.email = "moritz@twoticketsplease.de"
+ gem.authors = ["Moritz Heidkamp", "Christof Spies"]
+ # Include your dependencies below. Runtime dependencies are required when using your gem,
+ # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
+ # gem.add_runtime_dependency 'jabber4r', '> 0.1'
+ # gem.add_development_dependency 'rspec', '> 1.2.3'
+
+ gem.add_runtime_dependency 'activesupport', '= 3.0.2'
+end
+Jeweler::RubygemsDotOrgTasks.new
+
+require 'rake/rdoctask'
+Rake::RDocTask.new do |rdoc|
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
+
+ rdoc.rdoc_dir = 'rdoc'
+ rdoc.title = "salesforce-sync #{version}"
+ rdoc.rdoc_files.include('README*')
+ rdoc.rdoc_files.include('lib/**/*.rb')
+end
+
+task :default => :build
View
@@ -0,0 +1,53 @@
+#!/usr/bin/ruby
+
+require 'yaml'
+require 'optparse'
+gem 'activesupport', '= 3.0.2'
+require 'active_support'
+require 'active_support/dependencies'
+
+defaults = {
+ :lock_file => '/var/run/salesforce_sync.lock'
+}
+
+options = { }
+
+opts = OptionParser.new do |opts|
+
+ opts.banner = "Usage: #{File.basename($0)} [OPTIONS]"
+
+ opts.on('-c', '--config-file FILE', 'Config file to use') do |file|
+ options[:config_file] = file
+ end
+
+ opts.on('-v', '--verbose', 'Log debug information') do
+ options[:verbose] = true
+ end
+
+ opts.on('-l', '--lock-file', "Lock file for this run (default: #{options[:lock_file]})") do |file|
+ options[:lock_file] = file
+ end
+
+ opts.on('-h', '--help', 'Display this help') do
+ puts opts
+ exit
+ end
+
+end
+
+opts.parse!
+
+if options[:config_file].blank?
+ puts opts
+ exit 1
+end
+
+options = defaults.merge(YAML.load_file(options[:config_file]).symbolize_keys).merge(options)
+
+unless File.new(options[:lock_file], 'w').flock(File::LOCK_EX|File::LOCK_NB)
+ puts 'another process is already running. exiting.'
+ exit 2
+end
+
+ActiveSupport::Dependencies.load_paths << File.join(File.dirname(__FILE__), '../lib')
+SalesforceSync.run(options)
View
@@ -0,0 +1,5 @@
+module SalesforceSync
+
+
+
+end

0 comments on commit 4ed4efe

Please sign in to comment.