warbler 1.3.8 → 1.4.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. data/.gitignore +1 -0
  2. data/.travis.yml +3 -0
  3. data/Gemfile +1 -1
  4. data/History.txt +14 -0
  5. data/README.rdoc +13 -0
  6. data/ext/WarMain.java +34 -17
  7. data/ext/WarblerJar.java +3 -2
  8. data/integration/gem-initializer/pom.xml +39 -0
  9. data/integration/pom.xml +134 -0
  10. data/integration/rails4_test/pom.xml +57 -0
  11. data/integration/rails4_test/src/main/ruby/Gemfile +44 -0
  12. data/integration/rails4_test/src/main/ruby/README.rdoc +28 -0
  13. data/integration/rails4_test/src/main/ruby/Rakefile +6 -0
  14. data/integration/rails4_test/src/main/ruby/app/assets/javascripts/application.js +16 -0
  15. data/integration/rails4_test/src/main/ruby/app/assets/javascripts/posts.js.coffee +3 -0
  16. data/integration/rails4_test/src/main/ruby/app/assets/stylesheets/application.css +13 -0
  17. data/integration/rails4_test/src/main/ruby/app/assets/stylesheets/posts.css.scss +3 -0
  18. data/integration/rails4_test/src/main/ruby/app/assets/stylesheets/scaffolds.css.scss +69 -0
  19. data/integration/rails4_test/src/main/ruby/app/controllers/application_controller.rb +5 -0
  20. data/integration/rails4_test/src/main/ruby/app/controllers/concerns/.keep +0 -0
  21. data/integration/rails4_test/src/main/ruby/app/controllers/posts_controller.rb +74 -0
  22. data/integration/rails4_test/src/main/ruby/app/helpers/application_helper.rb +2 -0
  23. data/integration/rails4_test/src/main/ruby/app/helpers/posts_helper.rb +2 -0
  24. data/integration/rails4_test/src/main/ruby/app/mailers/.keep +0 -0
  25. data/integration/rails4_test/src/main/ruby/app/models/.keep +0 -0
  26. data/integration/rails4_test/src/main/ruby/app/models/concerns/.keep +0 -0
  27. data/integration/rails4_test/src/main/ruby/app/models/post.rb +2 -0
  28. data/integration/rails4_test/src/main/ruby/app/views/layouts/application.html.erb +14 -0
  29. data/integration/rails4_test/src/main/ruby/app/views/posts/_form.html.erb +29 -0
  30. data/integration/rails4_test/src/main/ruby/app/views/posts/edit.html.erb +6 -0
  31. data/integration/rails4_test/src/main/ruby/app/views/posts/index.html.erb +31 -0
  32. data/integration/rails4_test/src/main/ruby/app/views/posts/index.json.jbuilder +4 -0
  33. data/integration/rails4_test/src/main/ruby/app/views/posts/new.html.erb +5 -0
  34. data/integration/rails4_test/src/main/ruby/app/views/posts/show.html.erb +19 -0
  35. data/integration/rails4_test/src/main/ruby/app/views/posts/show.json.jbuilder +1 -0
  36. data/integration/rails4_test/src/main/ruby/config.ru +4 -0
  37. data/integration/rails4_test/src/main/ruby/config/application.rb +23 -0
  38. data/integration/rails4_test/src/main/ruby/config/boot.rb +4 -0
  39. data/integration/rails4_test/src/main/ruby/config/database.yml +20 -0
  40. data/integration/rails4_test/src/main/ruby/config/environment.rb +5 -0
  41. data/integration/rails4_test/src/main/ruby/config/environments/development.rb +29 -0
  42. data/integration/rails4_test/src/main/ruby/config/environments/production.rb +80 -0
  43. data/integration/rails4_test/src/main/ruby/config/environments/test.rb +36 -0
  44. data/integration/rails4_test/src/main/ruby/config/initializers/backtrace_silencers.rb +7 -0
  45. data/integration/rails4_test/src/main/ruby/config/initializers/filter_parameter_logging.rb +4 -0
  46. data/integration/rails4_test/src/main/ruby/config/initializers/inflections.rb +16 -0
  47. data/integration/rails4_test/src/main/ruby/config/initializers/mime_types.rb +5 -0
  48. data/integration/rails4_test/src/main/ruby/config/initializers/secret_token.rb +12 -0
  49. data/integration/rails4_test/src/main/ruby/config/initializers/session_store.rb +3 -0
  50. data/integration/rails4_test/src/main/ruby/config/initializers/wrap_parameters.rb +14 -0
  51. data/integration/rails4_test/src/main/ruby/config/locales/en.yml +23 -0
  52. data/integration/rails4_test/src/main/ruby/config/routes.rb +51 -0
  53. data/integration/rails4_test/src/main/ruby/config/warble.rb +4 -0
  54. data/integration/rails4_test/src/main/ruby/db/development.sqlite3 +0 -0
  55. data/integration/rails4_test/src/main/ruby/db/migrate/20130502003552_create_posts.rb +11 -0
  56. data/integration/rails4_test/src/main/ruby/db/production.sqlite3 +0 -0
  57. data/integration/rails4_test/src/main/ruby/db/schema.rb +24 -0
  58. data/integration/rails4_test/src/main/ruby/db/seeds.rb +7 -0
  59. data/integration/rails4_test/src/main/ruby/lib/assets/.keep +0 -0
  60. data/integration/rails4_test/src/main/ruby/lib/tasks/.keep +0 -0
  61. data/integration/rails4_test/src/main/ruby/public/404.html +58 -0
  62. data/integration/rails4_test/src/main/ruby/public/422.html +58 -0
  63. data/integration/rails4_test/src/main/ruby/public/500.html +57 -0
  64. data/integration/rails4_test/src/main/ruby/public/favicon.ico +0 -0
  65. data/integration/rails4_test/src/main/ruby/public/robots.txt +5 -0
  66. data/integration/rails4_test/src/main/ruby/test/controllers/.keep +0 -0
  67. data/integration/rails4_test/src/main/ruby/test/controllers/posts_controller_test.rb +49 -0
  68. data/integration/rails4_test/src/main/ruby/test/fixtures/.keep +0 -0
  69. data/integration/rails4_test/src/main/ruby/test/fixtures/posts.yml +11 -0
  70. data/integration/rails4_test/src/main/ruby/test/helpers/.keep +0 -0
  71. data/integration/rails4_test/src/main/ruby/test/helpers/posts_helper_test.rb +4 -0
  72. data/integration/rails4_test/src/main/ruby/test/integration/.keep +0 -0
  73. data/integration/rails4_test/src/main/ruby/test/mailers/.keep +0 -0
  74. data/integration/rails4_test/src/main/ruby/test/models/.keep +0 -0
  75. data/integration/rails4_test/src/main/ruby/test/models/post_test.rb +7 -0
  76. data/integration/rails4_test/src/main/ruby/test/test_helper.rb +15 -0
  77. data/integration/rails4_test/src/main/ruby/vendor/assets/javascripts/.keep +0 -0
  78. data/integration/rails4_test/src/main/ruby/vendor/assets/stylesheets/.keep +0 -0
  79. data/integration/rails4_test/src/test/java/org/jruby/warbler/Rails4AppTestIT.java +37 -0
  80. data/integration/runnable_test/pom.xml +105 -0
  81. data/integration/runnable_test/src/main/ruby/Rakefile +4 -0
  82. data/integration/runnable_test/src/main/ruby/config.ru +1 -0
  83. data/integration/runnable_test/src/main/ruby/config/warble.rb +9 -0
  84. data/integration/runnable_test/src/test/java/org/jruby/warbler/RunnableWarTestIT.java +22 -0
  85. data/integration/simple_rack_test/pom.xml +56 -0
  86. data/integration/simple_rack_test/src/main/ruby/config.ru +1 -0
  87. data/integration/simple_rack_test/src/main/ruby/config/warble.rb +4 -0
  88. data/integration/simple_rack_test/src/test/java/org/jruby/warbler/AppTestIT.java +36 -0
  89. data/lib/warbler.rb +2 -1
  90. data/lib/warbler/application.rb +5 -1
  91. data/lib/warbler/config.rb +15 -2
  92. data/lib/warbler/executable_helper.rb +25 -0
  93. data/lib/warbler/gems.rb +39 -0
  94. data/lib/warbler/jar.rb +11 -25
  95. data/lib/warbler/scripts/rails.rb +11 -0
  96. data/lib/warbler/templates/war.erb +10 -2
  97. data/lib/warbler/traits.rb +5 -2
  98. data/lib/warbler/traits/gemspec.rb +13 -4
  99. data/lib/warbler/traits/nogemspec.rb +2 -1
  100. data/lib/warbler/traits/rails.rb +25 -7
  101. data/lib/warbler/version.rb +1 -1
  102. data/lib/warbler_jar.jar +0 -0
  103. data/spec/sample_jar/bin/another_jar +5 -0
  104. data/spec/spec_helper.rb +2 -2
  105. data/spec/warbler/bundler_spec.rb +18 -33
  106. data/spec/warbler/config_spec.rb +2 -2
  107. data/spec/warbler/jar_spec.rb +176 -40
  108. data/warble.rb +9 -2
  109. data/warbler.gemspec +2 -2
  110. metadata +175 -9
@@ -0,0 +1,28 @@
1
+ == README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
25
+
26
+
27
+ Please feel free to use a different markup language if you do not plan to run
28
+ <tt>rake doc:app</tt>.
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Rails4App::Application.load_tasks
@@ -0,0 +1,16 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require turbolinks
16
+ //= require_tree .
@@ -0,0 +1,3 @@
1
+ # Place all the behaviors and hooks related to the matching controller here.
2
+ # All this logic will automatically be available in application.js.
3
+ # You can use CoffeeScript in this file: http://coffeescript.org/
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,3 @@
1
+ // Place all the styles related to the Posts controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,69 @@
1
+ body {
2
+ background-color: #fff;
3
+ color: #333;
4
+ font-family: verdana, arial, helvetica, sans-serif;
5
+ font-size: 13px;
6
+ line-height: 18px;
7
+ }
8
+
9
+ p, ol, ul, td {
10
+ font-family: verdana, arial, helvetica, sans-serif;
11
+ font-size: 13px;
12
+ line-height: 18px;
13
+ }
14
+
15
+ pre {
16
+ background-color: #eee;
17
+ padding: 10px;
18
+ font-size: 11px;
19
+ }
20
+
21
+ a {
22
+ color: #000;
23
+ &:visited {
24
+ color: #666;
25
+ }
26
+ &:hover {
27
+ color: #fff;
28
+ background-color: #000;
29
+ }
30
+ }
31
+
32
+ div {
33
+ &.field, &.actions {
34
+ margin-bottom: 10px;
35
+ }
36
+ }
37
+
38
+ #notice {
39
+ color: green;
40
+ }
41
+
42
+ .field_with_errors {
43
+ padding: 2px;
44
+ background-color: red;
45
+ display: table;
46
+ }
47
+
48
+ #error_explanation {
49
+ width: 450px;
50
+ border: 2px solid red;
51
+ padding: 7px;
52
+ padding-bottom: 0;
53
+ margin-bottom: 20px;
54
+ background-color: #f0f0f0;
55
+ h2 {
56
+ text-align: left;
57
+ font-weight: bold;
58
+ padding: 5px 5px 5px 15px;
59
+ font-size: 12px;
60
+ margin: -7px;
61
+ margin-bottom: 0px;
62
+ background-color: #c00;
63
+ color: #fff;
64
+ }
65
+ ul li {
66
+ font-size: 12px;
67
+ list-style: square;
68
+ }
69
+ }
@@ -0,0 +1,5 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
5
+ end
@@ -0,0 +1,74 @@
1
+ class PostsController < ApplicationController
2
+ before_action :set_post, only: [:show, :edit, :update, :destroy]
3
+
4
+ # GET /posts
5
+ # GET /posts.json
6
+ def index
7
+ @posts = Post.all
8
+ end
9
+
10
+ # GET /posts/1
11
+ # GET /posts/1.json
12
+ def show
13
+ end
14
+
15
+ # GET /posts/new
16
+ def new
17
+ @post = Post.new
18
+ end
19
+
20
+ # GET /posts/1/edit
21
+ def edit
22
+ end
23
+
24
+ # POST /posts
25
+ # POST /posts.json
26
+ def create
27
+ @post = Post.new(post_params)
28
+
29
+ respond_to do |format|
30
+ if @post.save
31
+ format.html { redirect_to @post, notice: 'Post was successfully created.' }
32
+ format.json { render action: 'show', status: :created, location: @post }
33
+ else
34
+ format.html { render action: 'new' }
35
+ format.json { render json: @post.errors, status: :unprocessable_entity }
36
+ end
37
+ end
38
+ end
39
+
40
+ # PATCH/PUT /posts/1
41
+ # PATCH/PUT /posts/1.json
42
+ def update
43
+ respond_to do |format|
44
+ if @post.update(post_params)
45
+ format.html { redirect_to @post, notice: 'Post was successfully updated.' }
46
+ format.json { head :no_content }
47
+ else
48
+ format.html { render action: 'edit' }
49
+ format.json { render json: @post.errors, status: :unprocessable_entity }
50
+ end
51
+ end
52
+ end
53
+
54
+ # DELETE /posts/1
55
+ # DELETE /posts/1.json
56
+ def destroy
57
+ @post.destroy
58
+ respond_to do |format|
59
+ format.html { redirect_to posts_url }
60
+ format.json { head :no_content }
61
+ end
62
+ end
63
+
64
+ private
65
+ # Use callbacks to share common setup or constraints between actions.
66
+ def set_post
67
+ @post = Post.find(params[:id])
68
+ end
69
+
70
+ # Never trust parameters from the scary internet, only allow the white list through.
71
+ def post_params
72
+ params.require(:post).permit(:name, :title, :content)
73
+ end
74
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module PostsHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ class Post < ActiveRecord::Base
2
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Rails4App</title>
5
+ <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
6
+ <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,29 @@
1
+ <%= form_for(@post) do |f| %>
2
+ <% if @post.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @post.errors.full_messages.each do |msg| %>
8
+ <li><%= msg %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="field">
15
+ <%= f.label :name %><br>
16
+ <%= f.text_field :name %>
17
+ </div>
18
+ <div class="field">
19
+ <%= f.label :title %><br>
20
+ <%= f.text_field :title %>
21
+ </div>
22
+ <div class="field">
23
+ <%= f.label :content %><br>
24
+ <%= f.text_area :content %>
25
+ </div>
26
+ <div class="actions">
27
+ <%= f.submit %>
28
+ </div>
29
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <h1>Editing post</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Show', @post %> |
6
+ <%= link_to 'Back', posts_path %>
@@ -0,0 +1,31 @@
1
+ <h1>Listing posts</h1>
2
+
3
+ <table>
4
+ <thead>
5
+ <tr>
6
+ <th>Name</th>
7
+ <th>Title</th>
8
+ <th>Content</th>
9
+ <th></th>
10
+ <th></th>
11
+ <th></th>
12
+ </tr>
13
+ </thead>
14
+
15
+ <tbody>
16
+ <% @posts.each do |post| %>
17
+ <tr>
18
+ <td><%= post.name %></td>
19
+ <td><%= post.title %></td>
20
+ <td><%= post.content %></td>
21
+ <td><%= link_to 'Show', post %></td>
22
+ <td><%= link_to 'Edit', edit_post_path(post) %></td>
23
+ <td><%= link_to 'Destroy', post, method: :delete, data: { confirm: 'Are you sure?' } %></td>
24
+ </tr>
25
+ <% end %>
26
+ </tbody>
27
+ </table>
28
+
29
+ <br>
30
+
31
+ <%= link_to 'New Post', new_post_path %>
@@ -0,0 +1,4 @@
1
+ json.array!(@posts) do |post|
2
+ json.extract! post, :name, :title, :content
3
+ json.url post_url(post, format: :json)
4
+ end
@@ -0,0 +1,5 @@
1
+ <h1>New post</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Back', posts_path %>
@@ -0,0 +1,19 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <p>
4
+ <strong>Name:</strong>
5
+ <%= @post.name %>
6
+ </p>
7
+
8
+ <p>
9
+ <strong>Title:</strong>
10
+ <%= @post.title %>
11
+ </p>
12
+
13
+ <p>
14
+ <strong>Content:</strong>
15
+ <%= @post.content %>
16
+ </p>
17
+
18
+ <%= link_to 'Edit', edit_post_path(@post) %> |
19
+ <%= link_to 'Back', posts_path %>
@@ -0,0 +1 @@
1
+ json.extract! @post, :name, :title, :content, :created_at, :updated_at
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Rails.application
@@ -0,0 +1,23 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ # Require the gems listed in Gemfile, including any gems
6
+ # you've limited to :test, :development, or :production.
7
+ Bundler.require(:default, Rails.env)
8
+
9
+ module Rails4App
10
+ class Application < Rails::Application
11
+ # Settings in config/environments/* take precedence over those specified here.
12
+ # Application configuration should go into files in config/initializers
13
+ # -- all .rb files in that directory are automatically loaded.
14
+
15
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
16
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
17
+ # config.time_zone = 'Central Time (US & Canada)'
18
+
19
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
20
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
21
+ # config.i18n.default_locale = :de
22
+ end
23
+ end
@@ -0,0 +1,4 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+
4
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -0,0 +1,20 @@
1
+ # SQLite version 3.x
2
+ # gem 'activerecord-jdbcsqlite3-adapter'
3
+ #
4
+ # Configure Using Gemfile
5
+ # gem 'activerecord-jdbcsqlite3-adapter'
6
+ #
7
+ development:
8
+ adapter: sqlite3
9
+ database: db/development.sqlite3
10
+
11
+ # Warning: The database defined as "test" will be erased and
12
+ # re-generated from your development database when you run "rake".
13
+ # Do not set this db to the same as development or production.
14
+ test:
15
+ adapter: sqlite3
16
+ database: db/test.sqlite3
17
+
18
+ production:
19
+ adapter: sqlite3
20
+ database: db/production.sqlite3
@@ -0,0 +1,5 @@
1
+ # Load the rails application.
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application.
5
+ Rails4App::Application.initialize!