Browse Source

Initial import

master
Peter J. Jones 8 years ago
commit
5bd02f4c41
8 changed files with 249 additions and 0 deletions
  1. 6
    0
      .gitmodules
  2. 31
    0
      LICENSE
  3. 4
    0
      depend/README
  4. 1
    0
      depend/discount
  5. 1
    0
      depend/sqlcipher
  6. 34
    0
      include/orgfu/orgfu.h
  7. 73
    0
      script/depend.rb
  8. 99
    0
      script/license.rb

+ 6
- 0
.gitmodules View File

@@ -0,0 +1,6 @@
[submodule "depend/discount"]
path = depend/discount
url = git://pmade.com/discount
[submodule "depend/sqlcipher"]
path = depend/sqlcipher
url = git://pmade.com/sqlcipher

+ 31
- 0
LICENSE View File

@@ -0,0 +1,31 @@
# License

Copyright (C) 2011 pmade inc. (Peter Jones <pjones@pmade.com>)
All Rights Reserved

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
3. Neither the name of the Author nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.

+ 4
- 0
depend/README View File

@@ -0,0 +1,4 @@
# OrgFu Dependencies

* [SQLite Cipher](http://sqlcipher.net/)
* [Discount](http://www.pell.portland.or.us/~orc/Code/discount/)

+ 1
- 0
depend/discount

@@ -0,0 +1 @@
Subproject commit b9c84032eb7b61891c4f239260b33f21537ca1a0

+ 1
- 0
depend/sqlcipher

@@ -0,0 +1 @@
Subproject commit 3f834ff2d3b336ffd6b7cf9c9b6363acafe5ecf9

+ 34
- 0
include/orgfu/orgfu.h View File

@@ -0,0 +1,34 @@
/*
* Copyright (C) 2011 pmade inc. (Peter Jones <pjones@pmade.com>)
* All Rights Reserved
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name of the Author nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _orgfu_h_
#define _orgfu_h_
#endif

+ 73
- 0
script/depend.rb View File

@@ -0,0 +1,73 @@
#!/usr/bin/env ruby
############################################################################
#
# Copyright (C) 2011 pmade inc. (Peter Jones <pjones@pmade.com>)
# All Rights Reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name of the Author nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
############################################################################
class Command
##############################################################################
DEPEND_DIR = File.expand_path('../depend', File.dirname(__FILE__))
##############################################################################
GIT_REMOTES = {
'discount' => 'http://github.com/Orc/discount.git',
'sqlcipher' => 'https://github.com/sjlombardo/sqlcipher',
}
##############################################################################
GIT_REMOTE_NAME = 'home'
##############################################################################
def run
GIT_REMOTES.each do |dir, remote|
Dir.chdir(File.join(DEPEND_DIR, dir)) {set_git_remote(remote)}
end
end
##############################################################################
private
##############################################################################
def set_git_remote (remote)
@remotes = `git remote`.split(/\s*\n\s*/)
return if @remotes.include?(GIT_REMOTE_NAME)
system('git', 'remote', 'add', GIT_REMOTE_NAME, remote) || raise("git failed")
end
end

################################################################################
begin
Command.new.run
rescue RuntimeError => e
$stderr.puts(File.basename($0) + ": ERROR: #{e}")
exit(1)
end

+ 99
- 0
script/license.rb View File

@@ -0,0 +1,99 @@
#!/usr/bin/env ruby
############################################################################
#
# Copyright (C) 2011 pmade inc. (Peter Jones <pjones@pmade.com>)
# All Rights Reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name of the Author nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
############################################################################
require('ostruct')
require('optparse')

################################################################################
class Command
##############################################################################
LICENSE_FILE = File.expand_path('../LICENSE', File.dirname(__FILE__))
##############################################################################
COMMENTS = {
'C++' => ['/*', ' *', ' */'],
'Ruby' => ['#' * 76 + "\n#", '#', "#\n" + ('#' * 76)],
}
##############################################################################
EXTENSIONS = {
'.h' => 'C++',
'.cxx' => 'C++',
'.rb' => 'Ruby',
}
##############################################################################
DEFAULT_OPTIONS = {
:mode => 'C++',
}
##############################################################################
attr_reader(:options)
##############################################################################
def initialize
@options = OpenStruct.new(DEFAULT_OPTIONS)
@license = File.read(LICENSE_FILE)
@license.sub!(/^.*(Copyright)/m, '\1')
@license = @license.split(/\n/)
OptionParser.new do |p|
p.on('-h', '--help', 'This message') {$stdout.puts(p); exit}
p.on('--mode=MODE', 'Switch to mode MODE') {|m| options.mode = m}
end.parse!(ARGV)
raise("no such mode: #{options.mode}") unless COMMENTS.has_key?(options.mode)
end
##############################################################################
def run
new_file(COMMENTS[options.mode])
end
##############################################################################
def new_file (mode)
$stdout.puts(mode[0])
@license.each {|line| $stdout.puts(mode[1] + ' ' + line)}
$stdout.puts(mode[2])
end
end

################################################################################
begin
Command.new.run
rescue RuntimeError => e
$stderr.puts(File.basename($0) + ": ERROR: #{e}")
exit(1)
end

Loading…
Cancel
Save