apprunway 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Jack Danger Canty
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,7 @@
1
+ = apprunway
2
+
3
+ Description goes here.
4
+
5
+ == Copyright
6
+
7
+ Copyright (c) 2009 Jack Danger Canty. See LICENSE for details.
@@ -0,0 +1,56 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "apprunway"
8
+ gem.summary = %Q{Convert any rack-capable application to run on Google's App Engine}
9
+ gem.email = "gitcommit@6brand.com"
10
+ gem.homepage = "http://github.com/JackDanger/apprunway"
11
+ gem.authors = ["Jack Danger Canty"]
12
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
13
+ end
14
+
15
+ rescue LoadError
16
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
17
+ end
18
+
19
+ require 'rake/testtask'
20
+ Rake::TestTask.new(:test) do |test|
21
+ test.libs << 'lib' << 'test'
22
+ test.pattern = 'test/**/*_test.rb'
23
+ test.verbose = true
24
+ end
25
+
26
+ begin
27
+ require 'rcov/rcovtask'
28
+ Rcov::RcovTask.new do |test|
29
+ test.libs << 'test'
30
+ test.pattern = 'test/**/*_test.rb'
31
+ test.verbose = true
32
+ end
33
+ rescue LoadError
34
+ task :rcov do
35
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
36
+ end
37
+ end
38
+
39
+
40
+ task :default => :test
41
+
42
+ require 'rake/rdoctask'
43
+ Rake::RDocTask.new do |rdoc|
44
+ if File.exist?('VERSION.yml')
45
+ config = YAML.load(File.read('VERSION.yml'))
46
+ version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
47
+ else
48
+ version = ""
49
+ end
50
+
51
+ rdoc.rdoc_dir = 'rdoc'
52
+ rdoc.title = "apprunway #{version}"
53
+ rdoc.rdoc_files.include('README*')
54
+ rdoc.rdoc_files.include('lib/**/*.rb')
55
+ end
56
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.3
@@ -0,0 +1,55 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{apprunway}
5
+ s.version = "0.0.3"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Jack Danger Canty"]
9
+ s.date = %q{2009-06-06}
10
+ s.default_executable = %q{apprunway}
11
+ s.email = %q{gitcommit@6brand.com}
12
+ s.executables = ["apprunway"]
13
+ s.extra_rdoc_files = [
14
+ "LICENSE",
15
+ "README.rdoc"
16
+ ]
17
+ s.files = [
18
+ ".document",
19
+ ".gitignore",
20
+ "LICENSE",
21
+ "README.rdoc",
22
+ "Rakefile",
23
+ "VERSION",
24
+ "apprunway.gemspec",
25
+ "bin/apprunway",
26
+ "lib/apprunway.rb",
27
+ "lib/frameworks/rails/config.ru",
28
+ "lib/frameworks/sinatra/appengine-web.xml",
29
+ "lib/frameworks/sinatra/config.ru",
30
+ "lib/frameworks/sinatra/config/warble.rb",
31
+ "lib/jruby-complete.sh",
32
+ "lib/tasks/apprunway.rake",
33
+ "test/apprunway_test.rb",
34
+ "test/test_helper.rb"
35
+ ]
36
+ s.homepage = %q{http://github.com/JackDanger/apprunway}
37
+ s.rdoc_options = ["--charset=UTF-8"]
38
+ s.require_paths = ["lib"]
39
+ s.rubygems_version = %q{1.3.3}
40
+ s.summary = %q{Convert any rack-capable application to run on Google's App Engine}
41
+ s.test_files = [
42
+ "test/apprunway_test.rb",
43
+ "test/test_helper.rb"
44
+ ]
45
+
46
+ if s.respond_to? :specification_version then
47
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
48
+ s.specification_version = 3
49
+
50
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
51
+ else
52
+ end
53
+ else
54
+ end
55
+ end
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ if destination = ARGV[0]
4
+ # require the rake tasks
5
+ File.open(File.join(destination, 'Rakefile'), 'a') {|f| f.write "\nrequire 'rubygems'\nrequire 'apprunway'\n" }
6
+ `cd #{destination} && rake appengine:prepare`
7
+ $stdout.puts "
8
+ You'll need the App Engine Java SDK to deploy to Google's App Engine
9
+ Install it with the following command (from within your app)
10
+ rake appengine:install_sdk
11
+ Or, if you have it already on your hard drive somewhere, set
12
+ ENV['APPENGINE_JAVA_SDK_INSTALL']=\"/../to/appengine-java-sdk-1.2.1/\"
13
+ at the top of your Rakefile
14
+ "
15
+ else
16
+ $stderr.puts "Usage: apprunway target_app_directory"
17
+ end
@@ -0,0 +1,95 @@
1
+ load File.join(File.dirname(__FILE__), 'tasks', 'apprunway.rake')
2
+
3
+ module Apprunway
4
+ def self.system(cmd)
5
+ $stderr.puts cmd
6
+ super "#{cmd} 1>&2"
7
+ end
8
+ module Install
9
+ extend self
10
+ def framework
11
+ require 'fileutils'
12
+ sources = Dir.glob(File.dirname(__FILE__) +
13
+ "/frameworks/#{Framework.detect}/*")
14
+ sources.each do |source|
15
+ begin
16
+ puts "copying #{source} -> ./"
17
+ FileUtils.cp_r source, "./"
18
+ rescue
19
+ end
20
+ end
21
+ end
22
+
23
+ def jruby_gems
24
+ JRuby.cmd "-S gem install rake warbler"
25
+ end
26
+
27
+ def jruby_jar
28
+ system File.join(File.dirname(__FILE__), 'jruby-complete.sh')
29
+ end
30
+
31
+ def jruby_rack_jar
32
+ system "mkdir -p lib"
33
+ system "curl http://kenai.com/downloads/jruby-rack/jruby-rack-0.9.4.jar -o ./lib/jruby-rack-0.9.4.jar"
34
+ end
35
+ end
36
+ module JRuby
37
+ extend self
38
+ def dir
39
+ File.join("./vendor/jruby/", '')
40
+ end
41
+
42
+ def cmd(str = '')
43
+ system dir + "bin/jruby #{str}"
44
+ end
45
+
46
+ def compile
47
+ cmd "-S warble"
48
+ end
49
+
50
+ def install
51
+ system "mkdir -p #{dir.chomp('jruby/')}"
52
+ system "git clone git://github.com/jruby/jruby.git #{dir}"
53
+ system "rake -f #{dir}Rakefile build"
54
+ end
55
+ end
56
+
57
+ module SDK
58
+ extend self
59
+ def dir
60
+ File.join(ENV['APPENGINE_JAVA_SDK_INSTALL'] || default_dir, '')
61
+ end
62
+
63
+ def default_dir
64
+ "~/.appengine-java-sdk-1.2.1/"
65
+ end
66
+
67
+ def cmd(str = '')
68
+ system "#{dir}bin/appcfg.sh #{str}"
69
+ end
70
+
71
+ def install
72
+ end
73
+
74
+ def deploy
75
+ cmd "update ./tmp/war"
76
+ end
77
+
78
+ def run_local
79
+ system "#{dir}bin/dev_appserver.sh tmp/war"
80
+ end
81
+ end
82
+
83
+ module Framework
84
+ def self.detect
85
+ ENV['FRAMEWORK'] ||
86
+ if system 'grep Rails */*'
87
+ 'rails'
88
+ elsif system 'grep Sinatra *'
89
+ 'sinatra'
90
+ else
91
+ 'rack'
92
+ end
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+ require 'sinatra'
3
+
4
+ root_dir = File.dirname(__FILE__)
5
+
6
+ set :environment, :production
7
+ set :root, root_dir
8
+ set :app_file, File.join(root_dir, 'app.rb')
9
+ disable :run
10
+
11
+ require 'app'
12
+
13
+ run Sinatra::Application
@@ -0,0 +1,21 @@
1
+ <appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
2
+ <application>YOUR-APPLICATION-ID</application>
3
+ <version>1</version>
4
+ <static-files />
5
+ <resource-files />
6
+ <sessions-enabled>false</sessions-enabled>
7
+ <system-properties>
8
+ <property name="jruby.management.enabled" value="false" />
9
+ <property name="os.arch" value="" />
10
+ <property name="jruby.compile.mode" value="JIT"/> <!-- JIT|FORCE|OFF -->
11
+ <property name="jruby.compile.fastest" value="true"/>
12
+ <property name="jruby.compile.frameless" value="true"/>
13
+ <property name="jruby.compile.positionless" value="true"/>
14
+ <property name="jruby.compile.threadless" value="false"/>
15
+ <property name="jruby.compile.fastops" value="false"/>
16
+ <property name="jruby.compile.fastcase" value="false"/>
17
+ <property name="jruby.compile.chainsize" value="500"/>
18
+ <property name="jruby.compile.lazyHandles" value="false"/>
19
+ <property name="jruby.compile.peephole" value="true"/>
20
+ </system-properties>
21
+ </appengine-web-app>
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+ require 'sinatra'
3
+
4
+ root_dir = File.dirname(__FILE__)
5
+
6
+ set :environment, :production
7
+ set :root, root_dir
8
+ set :app_file, File.join(root_dir, 'app.rb')
9
+ disable :run
10
+
11
+ require 'app'
12
+
13
+ run Sinatra::Application
@@ -0,0 +1,95 @@
1
+ # Disable automatic framework detection by uncommenting/setting to false
2
+ # Warbler.framework_detection = false
3
+
4
+ # Warbler web application assembly configuration file
5
+ Warbler::Config.new do |config|
6
+ # Temporary directory where the application is staged
7
+ # config.staging_dir = "tmp/war"
8
+
9
+ # Application directories to be included in the webapp.
10
+ config.dirs = %w(lib public views)
11
+
12
+ # Additional files/directories to include, above those in config.dirs
13
+ # config.includes = FileList["db"]
14
+ config.includes = FileList["appengine-web.xml", "app.rb", "config.ru"]
15
+ # Additional files/directories to exclude
16
+ # config.excludes = FileList["lib/tasks/*"]
17
+
18
+ # Additional Java .jar files to include. Note that if .jar files are placed
19
+ # in lib (and not otherwise excluded) then they need not be mentioned here.
20
+ # JRuby and JRuby-Rack are pre-loaded in this list. Be sure to include your
21
+ # own versions if you directly set the value
22
+ # config.java_libs += FileList["lib/java/*.jar"]
23
+
24
+ # Loose Java classes and miscellaneous files to be placed in WEB-INF/classes.
25
+ # config.java_classes = FileList["target/classes/**.*"]
26
+
27
+ # One or more pathmaps defining how the java classes should be copied into
28
+ # WEB-INF/classes. The example pathmap below accompanies the java_classes
29
+ # configuration above. See http://rake.rubyforge.org/classes/String.html#M000017
30
+ # for details of how to specify a pathmap.
31
+ # config.pathmaps.java_classes << "%{target/classes/,}p"
32
+
33
+ # Gems to be included. You need to tell Warbler which gems your application needs
34
+ # so that they can be packaged in the war file.
35
+ # The Rails gems are included by default unless the vendor/rails directory is present.
36
+ # config.gems += ["activerecord-jdbcmysql-adapter", "jruby-openssl"]
37
+ # config.gems << "tzinfo"
38
+ config.gems = ['sinatra']
39
+
40
+ # Uncomment this if you don't want to package rails gem.
41
+ # config.gems -= ["rails"]
42
+
43
+ # The most recent versions of gems are used.
44
+ # You can specify versions of gems by using a hash assignment:
45
+ # config.gems["rails"] = "2.0.2"
46
+
47
+ # You can also use regexps or Gem::Dependency objects for flexibility or
48
+ # fine-grained control.
49
+ # config.gems << /^merb-/
50
+ # config.gems << Gem::Dependency.new("merb-core", "= 0.9.3")
51
+
52
+ # Include gem dependencies not mentioned specifically
53
+ config.gem_dependencies = true
54
+
55
+ # Files to be included in the root of the webapp. Note that files in public
56
+ # will have the leading 'public/' part of the path stripped during staging.
57
+ # config.public_html = FileList["public/**/*", "doc/**/*"]
58
+
59
+ # Pathmaps for controlling how public HTML files are copied into the .war
60
+ # config.pathmaps.public_html = ["%{public/,}p"]
61
+
62
+ # Name of the war file (without the .war) -- defaults to the basename
63
+ # of RAILS_ROOT
64
+ config.war_name = "test"
65
+
66
+ # Name of the MANIFEST.MF template for the war file. Defaults to the
67
+ # MANIFEST.MF normally generated by `jar cf`.
68
+ # config.manifest_file = "config/MANIFEST.MF"
69
+
70
+ # Value of RAILS_ENV for the webapp -- default as shown below
71
+ # config.webxml.rails.env = ENV['RAILS_ENV'] || 'production'
72
+
73
+ # Application booter to use, one of :rack, :rails, or :merb. (Default :rails)
74
+ # config.webxml.booter = :rack
75
+ config.webxml.booter = :rack
76
+
77
+ # When using the :rack booter, "Rackup" script to use.
78
+ # The script is evaluated in a Rack::Builder to load the application.
79
+ # Examples:
80
+ # config.webxml.rackup = %{require './lib/demo'; run Rack::Adapter::Camping.new(Demo)}
81
+ # config.webxml.rackup = require 'cgi' && CGI::escapeHTML(File.read("config.ru"))
82
+
83
+ # Control the pool of Rails runtimes. Leaving unspecified means
84
+ # the pool will grow as needed to service requests. It is recommended
85
+ # that you fix these values when running a production server!
86
+ # config.webxml.jruby.min.runtimes = 2
87
+ # config.webxml.jruby.max.runtimes = 4
88
+ config.webxml.jruby.min.runtimes = 1
89
+ config.webxml.jruby.max.runtimes = 1
90
+ config.webxml.jruby.init.serial = true
91
+
92
+ # JNDI data source name
93
+ # config.webxml.jndi = 'jdbc/rails'
94
+ config.java_libs = []
95
+ end
@@ -0,0 +1,28 @@
1
+ mkdir -p lib
2
+ # install jruby-complete.jar to ./lib
3
+ curl http://dist.codehaus.org/jruby/current/jruby-complete-1.3.0.jar -o lib/jruby-complete.jar
4
+ # split up the jruby-complete.jar:
5
+ # (borrowed from Ola Bini)
6
+ cd lib
7
+ rm -rf jruby-core.jar
8
+ rm -rf ruby-stdlib.jar
9
+ rm -rf tmp_unpack
10
+ mkdir tmp_unpack
11
+ cd tmp_unpack
12
+ jar xf ../jruby-complete.jar
13
+ cd ..
14
+ mkdir jruby-core
15
+ mv tmp_unpack/org jruby-core/
16
+ mv tmp_unpack/com jruby-core/
17
+ mv tmp_unpack/jline jruby-core/
18
+ mv tmp_unpack/jay jruby-core/
19
+ mv tmp_unpack/jruby jruby-core/
20
+ cd jruby-core
21
+ jar cf ../jruby-core.jar .
22
+ cd ../tmp_unpack
23
+ jar cf ../ruby-stdlib.jar .
24
+ cd ..
25
+ rm -rf jruby-core
26
+ rm -rf tmp_unpack
27
+ rm -rf jruby-complete.jar
28
+ cd ..
@@ -0,0 +1,43 @@
1
+ require 'apprunway'
2
+ namespace :appengine do
3
+
4
+ task :safe do
5
+ Rake.application.options.trace = true
6
+ $trace = true
7
+ end
8
+
9
+ desc "Deploy your application to Google's App Engine"
10
+ task :deploy => :compile do
11
+ Apprunway::SDK.deploy
12
+ end
13
+
14
+ desc "Run your application via the App Engine SDK locally"
15
+ task :local => :safe do
16
+ Apprunway::SDK.run_local
17
+ end
18
+
19
+ desc "Re-download the App Engine SDK and install it to your home directory"
20
+ task :install_sdk => :safe do
21
+ Apprunway::SDK.install
22
+ end
23
+
24
+ desc "vendor and configure JRuby with the required gems"
25
+ task :jruby_install => :safe do
26
+ unless File.directory?("vendor/jruby") || ENV['force']
27
+ Apprunway::JRuby.install
28
+ end
29
+ end
30
+
31
+ desc "Compile the application into a warfile"
32
+ task :compile => :jruby_install do
33
+ Apprunway::JRuby.compile
34
+ end
35
+
36
+ desc "Prepare the application directory for the first time"
37
+ task :prepare => :jruby_install do
38
+ Apprunway::Install.jruby_gems
39
+ Apprunway::Install.jruby_jar
40
+ Apprunway::Install.jruby_rack_jar
41
+ Apprunway::Install.framework
42
+ end
43
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class ApprunwayTest < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'shoulda'
4
+
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
7
+ require 'apprunway'
8
+
9
+ class Test::Unit::TestCase
10
+ end
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: apprunway
3
+ version: !ruby/object:Gem::Version
4
+ hash: 25
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 3
10
+ version: 0.0.3
11
+ platform: ruby
12
+ authors:
13
+ - Jack Danger Canty
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-04-29 00:00:00 -07:00
19
+ default_executable: apprunway
20
+ dependencies: []
21
+
22
+ description:
23
+ email: gitcommit@6brand.com
24
+ executables:
25
+ - apprunway
26
+ extensions: []
27
+
28
+ extra_rdoc_files:
29
+ - LICENSE
30
+ - README.rdoc
31
+ files:
32
+ - .document
33
+ - LICENSE
34
+ - README.rdoc
35
+ - Rakefile
36
+ - VERSION
37
+ - apprunway.gemspec
38
+ - bin/apprunway
39
+ - lib/apprunway.rb
40
+ - lib/frameworks/rails/config.ru
41
+ - lib/frameworks/sinatra/appengine-web.xml
42
+ - lib/frameworks/sinatra/config.ru
43
+ - lib/frameworks/sinatra/config/warble.rb
44
+ - lib/jruby-complete.sh
45
+ - lib/tasks/apprunway.rake
46
+ - test/apprunway_test.rb
47
+ - test/test_helper.rb
48
+ has_rdoc: true
49
+ homepage: http://github.com/JackDanger/apprunway
50
+ licenses: []
51
+
52
+ post_install_message:
53
+ rdoc_options: []
54
+
55
+ require_paths:
56
+ - lib
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ hash: 3
63
+ segments:
64
+ - 0
65
+ version: "0"
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ hash: 3
72
+ segments:
73
+ - 0
74
+ version: "0"
75
+ requirements: []
76
+
77
+ rubyforge_project:
78
+ rubygems_version: 1.4.2
79
+ signing_key:
80
+ specification_version: 3
81
+ summary: Convert any rack-capable application to run on Google's App Engine
82
+ test_files:
83
+ - test/apprunway_test.rb
84
+ - test/test_helper.rb