-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ddfcf8b
Showing
14 changed files
with
551 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*.gem | ||
.bundle | ||
Gemfile.lock | ||
pkg/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source "http://rubygems.org" | ||
|
||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
# Highrise Assist | ||
|
||
highrise_assist is command line for 37signals' highrise. | ||
|
||
## Description | ||
|
||
TODO | ||
|
||
## Installation | ||
|
||
$ gem install highrise_assist | ||
|
||
## Usage | ||
|
||
Usage: ./bin/highrise_assist COMMAND [options] | ||
|
||
Commands: | ||
* export - export next highrise items: | ||
* cases | ||
* deals | ||
* people | ||
* companies | ||
* emails | ||
* notes | ||
* comments | ||
* attachments | ||
|
||
Common options: | ||
--domain DOMAIN highrise subdomain or full domain name | ||
--token TOKEN highrise API authentication token | ||
|
||
Export options: | ||
--tag TAG filter items with given tag name | ||
--directory DIRECTORY working directory | ||
--format FORMAT data format (yaml,xml) | ||
--skip-attachments don't download attachments | ||
--skip-cases don't export cases | ||
--skip-deals don't export deals | ||
--skip-notes don't export notes | ||
--skip-emails don't export emails | ||
--skip-comments don't export comments | ||
|
||
Misc options: | ||
-h, --help Show this message | ||
-v, --version Show version | ||
|
||
## Export Command | ||
|
||
### DESCRIPTION | ||
|
||
TODO | ||
|
||
### Synopsis | ||
|
||
$ highrise_assistexport OPTIONS | ||
|
||
### Options | ||
|
||
* _domain_ (required) is either your full highrise domain name or subdomain name. | ||
* _token_ (required) is your API authentication token. | ||
* _tag_ is tag name for entities associated with it. | ||
* _directory_ - directory to store export data (default is highrise_data_YYYYMMDDHHMMSS) | ||
|
||
### Example | ||
|
||
$ highrise_assist export \ | ||
--domain MYSUBDOMAIN \ | ||
--token 11111111111111111111111111111111 \ | ||
--directory highrise_data \ | ||
--tag old-clients \ | ||
--format xml \ | ||
--skip-attachments | ||
|
||
Export result: | ||
|
||
$ tree --dirsfirst | ||
. | ||
├── cases | ||
│ ├── case-573785-test-case | ||
│ │ ├── attachments | ||
│ │ │ └── 22039573-20111111-p7km4bk33ugutcrrb5mxxw7fjj.jpeg | ||
│ │ ├── case-573785-test-case.xml | ||
│ │ └── note-78169727-test.xml | ||
│ └── case-573786-what-is-highrise | ||
│ ├── attachments | ||
│ └── case-573786-what-is-highrise.xml | ||
├── deals | ||
│ └── deal-1471928-test-deal | ||
│ ├── attachments | ||
│ ├── deal-1471928-test-deal.xml | ||
│ └── note-78499917.xml | ||
└── persons | ||
└── person-92632832-test-test | ||
├── attachments | ||
├── cases | ||
│ └── case-573785-test-case -> ../../../cases/case-573785-test-case | ||
├── deals | ||
│ └── deal-1471928-test-deal -> ../../../deals/deal-1471928-test-deal | ||
└── person-92632832-test-test.xml | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require "bundler/gem_tasks" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require "highrise_assist" | ||
|
||
HighriseAssist::Runner.run(ARGV) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# -*- encoding: utf-8 -*- | ||
$:.push File.expand_path("../lib", __FILE__) | ||
require "highrise_assist/version" | ||
|
||
Gem::Specification.new do |s| | ||
s.name = "highrise_assist" | ||
s.version = HighriseAssist::VERSION | ||
s.authors = ["Andriy Yanko"] | ||
s.email = ["andriy.yanko@gmail.com"] | ||
s.homepage = "https://github.com/railsware/highrise_assist" | ||
s.summary = %q{Assist for 37signals' highrise} | ||
s.description = %q{Assist for 37signals' highrise} | ||
|
||
s.rubyforge_project = "highrise_assist" | ||
|
||
s.files = `git ls-files`.split("\n") | ||
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") | ||
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } | ||
s.require_paths = ["lib"] | ||
|
||
s.add_runtime_dependency "highrise", "~>3.0.0" | ||
s.add_runtime_dependency "net-http-persistent", "~>2.3" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
require "highrise_assist/version" | ||
|
||
require "highrise_ext" | ||
|
||
module HighriseAssist | ||
autoload :Runner, "highrise_assist/runner" | ||
autoload :Command, "highrise_assist/command" | ||
autoload :FileTransfer, "highrise_assist/file_transfer" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module HighriseAssist | ||
module Command | ||
class << self | ||
def names | ||
@names ||= [] | ||
end | ||
|
||
def defined?(name) | ||
names.include?(name) | ||
end | ||
|
||
def run(name, options) | ||
self.const_get(name.classify).new(options).run | ||
end | ||
end | ||
end | ||
end | ||
|
||
require "highrise_assist/command/base" | ||
require "highrise_assist/command/export" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
require "fileutils" | ||
|
||
module HighriseAssist | ||
module Command | ||
class Base | ||
class << self | ||
def inherited(klass) | ||
Command.names.push klass.name.split("::").last.underscore | ||
super(klass) | ||
end | ||
end | ||
|
||
def initialize(options) | ||
@options = options.dup | ||
authenticate | ||
end | ||
|
||
attr_reader :options | ||
|
||
def run | ||
raise NotImplementedError, "'run' is not implemented by #{self.class.name}" | ||
end | ||
|
||
protected | ||
|
||
def authenticate | ||
require_option!(:domain, :token) | ||
|
||
Highrise::Base.site = "https://" + options[:domain] | ||
Highrise::Base.user = options[:token] | ||
end | ||
|
||
def require_option!(*names) | ||
names.each do |name| | ||
options[name].blank? and abort "#{name} option required" | ||
end | ||
end | ||
|
||
def log(message) | ||
puts message | ||
end | ||
|
||
def file_transfer | ||
@file_transfer ||= FileTransfer.new(options) | ||
end | ||
|
||
def download_file(*args) | ||
file_transfer.download(*args) | ||
end | ||
|
||
def upload_file(*args) | ||
file_transfer.upload(*args) | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.