Skip to content

Instantly share code, notes, and snippets.

@lmullen lmullen/pull_lists.R forked from aronlindberg/pull_lists
Last active Aug 29, 2015

Embed
What would you like to do?
This file has been truncated, but you can view the full file.
list(structure(list(ok = TRUE, content = list(structure(list(
sha = "2e39d0dbc2e1cccac2f2735fcf4534f9ff2f1e21", filename = "actionpack/lib/action_dispatch/http/url.rb",
status = "modified", additions = 6L, deletions = 4L, changes = 10L,
blob_url = "https://github.com/rails/rails/blob/797b8c2d13593d3c286cb7943c29df6928d397fa/actionpack/lib/action_dispatch/http/url.rb",
raw_url = "https://github.com/rails/rails/raw/797b8c2d13593d3c286cb7943c29df6928d397fa/actionpack/lib/action_dispatch/http/url.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_dispatch/http/url.rb?ref=797b8c2d13593d3c286cb7943c29df6928d397fa",
patch = "@@ -1,7 +1,9 @@\n module ActionDispatch\n module Http\n module URL\n- # Returns the complete \\URL used for this request.\n+ mattr_accessor :tld_length\n+\n+ # Returns the complete URL used for this request.\n def url\n protocol + host_with_port + fullpath\n end\n@@ -85,13 +87,13 @@ def domain(tld_length = 1)\n # returned for \"dev.www.rubyonrails.org\". You can specify a different <tt>tld_length</tt>,\n # such as 2 to catch <tt>[\"www\"]</tt> instead of <tt>[\"www\", \"rubyonrails\"]</tt>\n # in \"www.rubyonrails.co.uk\".\n- def subdomains(tld_length = 1)\n+ def subdomains(tld_length = @@tld_length)\n return [] unless named_host?(host)\n parts = host.split('.')\n parts[0..-(tld_length+2)]\n end\n \n- def subdomain(tld_length = 1)\n+ def subdomain(tld_length = @@tld_length)\n subdomains(tld_length).join('.')\n end\n \n@@ -102,4 +104,4 @@ def named_host?(host)\n end\n end\n end\n-end\n+end\n\\ No newline at end of file"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "c202fee990f930a93453c4ecbea1f37aa716314c",
filename = "actionpack/lib/action_dispatch/railtie.rb", status = "modified",
additions = 10L, deletions = 0L, changes = 10L, blob_url = "https://github.com/rails/rails/blob/797b8c2d13593d3c286cb7943c29df6928d397fa/actionpack/lib/action_dispatch/railtie.rb",
raw_url = "https://github.com/rails/rails/raw/797b8c2d13593d3c286cb7943c29df6928d397fa/actionpack/lib/action_dispatch/railtie.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_dispatch/railtie.rb?ref=797b8c2d13593d3c286cb7943c29df6928d397fa",
patch = "@@ -8,5 +8,15 @@ class Railtie < Rails::Railtie\n config.action_dispatch.ip_spoofing_check = true\n config.action_dispatch.show_exceptions = true\n config.action_dispatch.best_standards_support = true\n+ config.action_dispatch.tld_length = 1\n+\n+ # Prepare dispatcher callbacks and run 'prepare' callbacks\n+ initializer \"action_dispatch.prepare_dispatcher\" do |app|\n+ ActionDispatch::Callbacks.to_prepare { app.routes_reloader.execute_if_updated }\n+ end\n+\n+ initializer \"action_dispatch.configure\" do |app|\n+ ActionDispatch::Http::URL.tld_length = app.config.action_dispatch.tld_length\n+ end\n end\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "a8b8f9377bcd25effd9ed9039f2f039805be92cc",
filename = "actionpack/test/dispatch/request_test.rb", status = "modified",
additions = 5L, deletions = 0L, changes = 5L, blob_url = "https://github.com/rails/rails/blob/797b8c2d13593d3c286cb7943c29df6928d397fa/actionpack/test/dispatch/request_test.rb",
raw_url = "https://github.com/rails/rails/raw/797b8c2d13593d3c286cb7943c29df6928d397fa/actionpack/test/dispatch/request_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/test/dispatch/request_test.rb?ref=797b8c2d13593d3c286cb7943c29df6928d397fa",
patch = "@@ -116,6 +116,9 @@ class RequestTest < ActiveSupport::TestCase\n request = stub_request 'HTTP_HOST' => \"dev.www.rubyonrails.co.uk\"\n assert_equal %w( dev www ), request.subdomains(2)\n \n+ request = stub_request 'HTTP_HOST' => \"dev.www.rubyonrails.co.uk\", :tld_length => 2\n+ assert_equal %w( dev www ), request.subdomains\n+\n request = stub_request 'HTTP_HOST' => \"foobar.foobar.com\"\n assert_equal %w( foobar ), request.subdomains\n \n@@ -472,7 +475,9 @@ class RequestTest < ActiveSupport::TestCase\n def stub_request(env = {})\n ip_spoofing_check = env.key?(:ip_spoofing_check) ? env.delete(:ip_spoofing_check) : true\n ip_app = ActionDispatch::RemoteIp.new(Proc.new { }, ip_spoofing_check, @trusted_proxies)\n+ tld_length = env.key?(:tld_length) ? env.delete(:tld_length) : 1\n ip_app.call(env)\n+ ActionDispatch::Http::URL.tld_length = tld_length\n ActionDispatch::Request.new(env)\n end\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "61340e82c3b40dfd2d36fe56b637b1ee115fa227",
filename = "railties/test/application/initializers/frameworks_test.rb",
status = "modified", additions = 7L, deletions = 0L, changes = 7L,
blob_url = "https://github.com/rails/rails/blob/797b8c2d13593d3c286cb7943c29df6928d397fa/railties/test/application/initializers/frameworks_test.rb",
raw_url = "https://github.com/rails/rails/raw/797b8c2d13593d3c286cb7943c29df6928d397fa/railties/test/application/initializers/frameworks_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/application/initializers/frameworks_test.rb?ref=797b8c2d13593d3c286cb7943c29df6928d397fa",
patch = "@@ -65,6 +65,13 @@ def notify\n assert_equal [\"notify\"], Foo.action_methods\n end\n \n+ # AD\n+ test \"action_dispatch extensions are applied to ActionDispatch\" do\n+ add_to_config \"config.action_dispatch.tld_length = 2\"\n+ require \"#{app_path}/config/environment\"\n+ assert_equal 2, ActionDispatch::Http::URL.tld_length\n+ end\n+\n # AS\n test \"if there's no config.active_support.bare, all of ActiveSupport is required\" do\n use_frameworks []"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:49 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 17:09:37 GMT",
etag = "\"91171a34e18c793751e06b8975ae762a\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248121:54D9023D",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "d594a23ec74671eba905bf91ef329026"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "9504661c0e0c578fb9808b10a5e8e5fbdff6c543", filename = "railties/Rakefile",
status = "modified", additions = 3L, deletions = 2L, changes = 5L,
blob_url = "https://github.com/rails/rails/blob/6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da/railties/Rakefile",
raw_url = "https://github.com/rails/rails/raw/6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da/railties/Rakefile",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/Rakefile?ref=6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da",
patch = "@@ -45,8 +45,9 @@ task :generate_guides do\n ruby \"guides/rails_guides.rb\"\n end\n \n-task :update_prototype_ujs do\n- system \"curl http://github.com/rails/prototype-ujs/raw/master/src/rails.js > lib/rails/generators/rails/app/templates/public/javascripts/rails.js\"\n+task :update_ujs do\n+ system \"curl http://github.com/rails/prototype-ujs/raw/master/src/rails.js > lib/rails/generators/rails/app/templates/public/javascripts/prototype_ujs.js\"\n+ system \"curl http://github.com/rails/jquery-ujs/raw/master/src/rails.js > lib/rails/generators/rails/app/templates/public/javascripts/jquery_ujs.js\"\n end\n \n # Validate guides -------------------------------------------------------------------------"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "279ffec1a2147f040bc7367730a66cb7c8e896df",
filename = "railties/lib/rails/generators/rails/app/app_generator.rb",
status = "modified", additions = 26L, deletions = 8L, changes = 34L,
blob_url = "https://github.com/rails/rails/blob/6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da/railties/lib/rails/generators/rails/app/app_generator.rb",
raw_url = "https://github.com/rails/rails/raw/6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da/railties/lib/rails/generators/rails/app/app_generator.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/app/app_generator.rb?ref=6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da",
patch = "@@ -111,12 +111,22 @@ def stylesheets\n end\n \n def javascripts\n- unless options[:skip_prototype]\n- directory \"public/javascripts\"\n- else\n- empty_directory_with_gitkeep \"public/javascripts\"\n- create_file \"public/javascripts/application.js\"\n+ empty_directory \"public/javascripts\"\n+ \n+ unless options[:skip_javascript]\n+ copy_file \"public/javascripts/#{@options[:javascript]}.js\"\n+ \n+ copy_file \"public/javascripts/#{@options[:javascript]}_ujs.js\", \"public/javascripts/rails.js\"\n+ copy_file \"public/javascripts/#{@options[:javascript]}_ujs.js\", \"public/javascripts/rails.js\"\n+ \n+ if options[:prototype]\n+ copy_file \"public/javascripts/controls.js\"\n+ copy_file \"public/javascripts/dragdrop.js\"\n+ copy_file \"public/javascripts/effects.js\"\n+ end\n end\n+ \n+ copy_file \"public/javascripts/application.js\"\n end\n \n def script\n@@ -155,6 +165,7 @@ module Generators\n \n class AppGenerator < Base\n DATABASES = %w( mysql oracle postgresql sqlite3 frontbase ibm_db )\n+ JAVASCRIPTS = %w( prototype jquery )\n \n attr_accessor :rails_template\n add_shebang_option!\n@@ -164,6 +175,9 @@ class AppGenerator < Base\n class_option :database, :type => :string, :aliases => \"-d\", :default => \"sqlite3\",\n :desc => \"Preconfigure for selected database (options: #{DATABASES.join('/')})\"\n \n+ class_option :javascript, :type => :string, :aliases => \"-j\", :default => \"prototype\",\n+ :desc => \"Preconfigure for selected javascript library (options: #{JAVASCRIPTS.join('/')})\"\n+\n class_option :builder, :type => :string, :aliases => \"-b\",\n :desc => \"Path to an application builder (can be a filesystem path or URL)\"\n \n@@ -185,8 +199,8 @@ class AppGenerator < Base\n class_option :skip_test_unit, :type => :boolean, :aliases => \"-T\", :default => false,\n :desc => \"Skip Test::Unit files\"\n \n- class_option :skip_prototype, :type => :boolean, :aliases => \"-J\", :default => false,\n- :desc => \"Skip Prototype files\"\n+ class_option :skip_javascript, :type => :boolean, :aliases => \"-J\", :default => false,\n+ :desc => \"Skip javascript files\"\n \n class_option :skip_git, :type => :boolean, :aliases => \"-G\", :default => false,\n :desc => \"Skip Git ignores and keeps\"\n@@ -208,6 +222,10 @@ def initialize(*args)\n if !options[:skip_active_record] && !DATABASES.include?(options[:database])\n raise Error, \"Invalid value for --database option. Supported for preconfiguration are: #{DATABASES.join(\", \")}.\"\n end\n+ \n+ if !options[:skip_javascript] && !JAVASCRIPTS.include?(options[:javascript])\n+ raise Error, \"Invalid value for --javascript option. Supported for preconfiguration are: #{JAVASCRIPTS.join(\", \")}.\"\n+ end\n end\n \n def create_root\n@@ -272,7 +290,7 @@ def create_public_stylesheets_files\n build(:stylesheets)\n end\n \n- def create_prototype_files\n+ def create_javascript_files\n build(:javascripts)\n end\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "00a23a7b89c29131b7751825950737e8e75b10cb",
filename = "railties/lib/rails/generators/rails/app/templates/config/application.rb",
status = "modified", additions = 3L, deletions = 1L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da/railties/lib/rails/generators/rails/app/templates/config/application.rb",
raw_url = "https://github.com/rails/rails/raw/6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da/railties/lib/rails/generators/rails/app/templates/config/application.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/app/templates/config/application.rb?ref=6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da",
patch = "@@ -40,8 +40,10 @@ class Application < Rails::Application\n # config.i18n.default_locale = :de\n \n # JavaScript files you want as :defaults (application.js is always included).\n-<% if options[:skip_prototype] -%>\n+<% if options[:skip_javascript] -%>\n config.action_view.javascript_expansions[:defaults] = %w()\n+<% elsif options[:javascript] == 'jquery' -%>\n+ config.action_view.javascript_expansions[:defaults] = %w(jquery rails)\n <% else -%>\n # config.action_view.javascript_expansions[:defaults] = %w(jquery rails)\n <% end -%>"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "109701084e4bd6790b286efedd86fac1f828a839",
filename = "railties/lib/rails/generators/rails/app/templates/public/javascripts/jquery.js",
status = "added", additions = 6078L, deletions = 0L, changes = 6078L,
blob_url = "https://github.com/rails/rails/blob/6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da/railties/lib/rails/generators/rails/app/templates/public/javascripts/jquery.js",
raw_url = "https://github.com/rails/rails/raw/6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da/railties/lib/rails/generators/rails/app/templates/public/javascripts/jquery.js",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/app/templates/public/javascripts/jquery.js?ref=6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url")), structure(list(sha = "776588addc1e5df5f4cf3f3cbd44b205354e395b",
filename = "railties/lib/rails/generators/rails/app/templates/public/javascripts/jquery_ujs.js",
status = "added", additions = 132L, deletions = 0L, changes = 132L,
blob_url = "https://github.com/rails/rails/blob/6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da/railties/lib/rails/generators/rails/app/templates/public/javascripts/jquery_ujs.js",
raw_url = "https://github.com/rails/rails/raw/6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da/railties/lib/rails/generators/rails/app/templates/public/javascripts/jquery_ujs.js",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/app/templates/public/javascripts/jquery_ujs.js?ref=6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da",
patch = "@@ -0,0 +1,132 @@\n+jQuery(function ($) {\r\n+ var csrf_token = $('meta[name=csrf-token]').attr('content'),\r\n+ csrf_param = $('meta[name=csrf-param]').attr('content');\r\n+\r\n+ $.fn.extend({\r\n+ /**\r\n+ * Triggers a custom event on an element and returns the event result\r\n+ * this is used to get around not being able to ensure callbacks are placed\r\n+ * at the end of the chain.\r\n+ *\r\n+ * TODO: deprecate with jQuery 1.4.2 release, in favor of subscribing to our\r\n+ * own events and placing ourselves at the end of the chain.\r\n+ */\r\n+ triggerAndReturn: function (name, data) {\r\n+ var event = new $.Event(name);\r\n+ this.trigger(event, data);\r\n+\r\n+ return event.result !== false;\r\n+ },\r\n+\r\n+ /**\r\n+ * Handles execution of remote calls firing overridable events along the way\r\n+ */\r\n+ callRemote: function () {\r\n+ var el = this,\r\n+ method = el.attr('method') || el.attr('data-method') || 'GET',\r\n+ url = el.attr('action') || el.attr('href'),\r\n+ dataType = el.attr('data-type') || 'script';\r\n+\r\n+ if (url === undefined) {\r\n+ throw \"No URL specified for remote call (action or href must be present).\";\r\n+ } else {\r\n+ if (el.triggerAndReturn('ajax:before')) {\r\n+ var data = el.is('form') ? el.serializeArray() : [];\r\n+ $.ajax({\r\n+ url: url,\r\n+ data: data,\r\n+ dataType: dataType,\r\n+ type: method.toUpperCase(),\r\n+ beforeSend: function (xhr) {\r\n+ el.trigger('ajax:loading', xhr);\r\n+ },\r\n+ success: function (data, status, xhr) {\r\n+ el.trigger('ajax:success', [data, status, xhr]);\r\n+ },\r\n+ complete: function (xhr) {\r\n+ el.trigger('ajax:complete', xhr);\r\n+ },\r\n+ error: function (xhr, status, error) {\r\n+ el.trigger('ajax:failure', [xhr, status, error]);\r\n+ }\r\n+ });\r\n+ }\r\n+\r\n+ el.trigger('ajax:after');\r\n+ }\r\n+ }\r\n+ });\r\n+\r\n+ /**\r\n+ * confirmation handler\r\n+ */\r\n+ $('a[data-confirm],input[data-confirm]').live('click', function () {\r\n+ var el = $(this);\r\n+ if (el.triggerAndReturn('confirm')) {\r\n+ if (!confirm(el.attr('data-confirm'))) {\r\n+ return false;\r\n+ }\r\n+ }\r\n+ });\r\n+\r\n+\r\n+ /**\r\n+ * remote handlers\r\n+ */\r\n+ $('form[data-remote]').live('submit', function (e) {\r\n+ $(this).callRemote();\r\n+ e.preventDefault();\r\n+ });\r\n+\r\n+ $('a[data-remote],input[data-remote]').live('click', function (e) {\r\n+ $(this).callRemote();\r\n+ e.preventDefault();\r\n+ });\r\n+\r\n+ $('a[data-method]:not([data-remote])').live('click', function (e){\r\n+ var link = $(this),\r\n+ href = link.attr('href'),\r\n+ method = link.attr('data-method'),\r\n+ form = $('<form method=\"post\" action=\"'+href+'\"></form>'),\r\n+ metadata_input = '<input name=\"_method\" value=\"'+method+'\" type=\"hidden\" />';\r\n+\r\n+ if (csrf_param != null && csrf_token != null) {\r\n+ metadata_input += '<input name=\"'+csrf_param+'\" value=\"'+csrf_token+'\" type=\"hidden\" />';\r\n+ }\r\n+\r\n+ form.hide()\r\n+ .append(metadata_input)\r\n+ .appendTo('body');\r\n+\r\n+ e.preventDefault();\r\n+ form.submit();\r\n+ });\r\n+\r\n+ /**\r\n+ * disable-with handlers\r\n+ */\r\n+ var disable_with_input_selector = 'input[data-disable-with]';\r\n+ var disable_with_form_remote_selector = 'form[data-remote]:has(' + disable_with_input_selector + ')';\r\n+ var disable_with_form_not_remote_selector = 'form:not([data-remote]):has(' + disable_with_input_selector + ')';\r\n+\r\n+ var disable_with_input_function = function () {\r\n+ $(this).find(disable_with_input_selector).each(function () {\r\n+ var input = $(this);\r\n+ input.data('enable-with', input.val())\r\n+ .attr('value', input.attr('data-disable-with'))\r\n+ .attr('disabled', 'disabled');\r\n+ });\r\n+ };\r\n+\r\n+ $(disable_with_form_remote_selector).live('ajax:before', disable_with_input_function);\r\n+ $(disable_with_form_not_remote_selector).live('submit', disable_with_input_function);\r\n+\r\n+ $(disable_with_form_remote_selector).live('ajax:complete', function () {\r\n+ $(this).find(disable_with_input_selector).each(function () {\r\n+ var input = $(this);\r\n+ input.removeAttr('disabled')\r\n+ .val(input.data('enable-with'));\r\n+ });\r\n+ });\r\n+\r\n+});\r"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "fc69f93c583d1585e5f899d1cb8af31fb08edd18",
filename = "railties/lib/rails/generators/rails/app/templates/public/javascripts/prototype_ujs.js",
status = "renamed", additions = 44L, deletions = 41L, changes = 85L,
blob_url = "https://github.com/rails/rails/blob/6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da/railties/lib/rails/generators/rails/app/templates/public/javascripts/prototype_ujs.js",
raw_url = "https://github.com/rails/rails/raw/6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da/railties/lib/rails/generators/rails/app/templates/public/javascripts/prototype_ujs.js",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/app/templates/public/javascripts/prototype_ujs.js?ref=6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da",
patch = "@@ -14,33 +14,33 @@\n }\n \n function isForm(element) {\n- return Object.isElement(element) && element.nodeName.toUpperCase() == 'FORM'\n+ return Object.isElement(element) && element.nodeName.toUpperCase() == 'FORM';\n }\n \n function isInput(element) {\n if (Object.isElement(element)) {\n- var name = element.nodeName.toUpperCase()\n- return name == 'INPUT' || name == 'SELECT' || name == 'TEXTAREA'\n+ var name = element.nodeName.toUpperCase();\n+ return name == 'INPUT' || name == 'SELECT' || name == 'TEXTAREA';\n }\n- else return false\n+ else return false;\n }\n \n var submitBubbles = isEventSupported('submit'),\n- changeBubbles = isEventSupported('change')\n+ changeBubbles = isEventSupported('change');\n \n if (!submitBubbles || !changeBubbles) {\n // augment the Event.Handler class to observe custom events when needed\n Event.Handler.prototype.initialize = Event.Handler.prototype.initialize.wrap(\n function(init, element, eventName, selector, callback) {\n- init(element, eventName, selector, callback)\n+ init(element, eventName, selector, callback);\n // is the handler being attached to an element that doesn't support this event?\n if ( (!submitBubbles && this.eventName == 'submit' && !isForm(this.element)) ||\n (!changeBubbles && this.eventName == 'change' && !isInput(this.element)) ) {\n // \"submit\" => \"emulated:submit\"\n- this.eventName = 'emulated:' + this.eventName\n+ this.eventName = 'emulated:' + this.eventName;\n }\n }\n- )\n+ );\n }\n \n if (!submitBubbles) {\n@@ -49,26 +49,26 @@\n // special handler for the real \"submit\" event (one-time operation)\n if (!form.retrieve('emulated:submit')) {\n form.on('submit', function(submitEvent) {\n- var emulated = form.fire('emulated:submit', submitEvent, true)\n+ var emulated = form.fire('emulated:submit', submitEvent, true);\n // if custom event received preventDefault, cancel the real one too\n- if (emulated.returnValue === false) submitEvent.preventDefault()\n- })\n- form.store('emulated:submit', true)\n+ if (emulated.returnValue === false) submitEvent.preventDefault();\n+ });\n+ form.store('emulated:submit', true);\n }\n- })\n+ });\n }\n \n if (!changeBubbles) {\n // discover form inputs on the page\n- document.on('focusin', 'input, select, texarea', function(focusEvent, input) {\n+ document.on('focusin', 'input, select, textarea', function(focusEvent, input) {\n // special handler for real \"change\" events\n if (!input.retrieve('emulated:change')) {\n input.on('change', function(changeEvent) {\n- input.fire('emulated:change', changeEvent, true)\n- })\n- input.store('emulated:change', true)\n+ input.fire('emulated:change', changeEvent, true);\n+ });\n+ input.store('emulated:change', true);\n }\n- })\n+ });\n }\n \n function handleRemote(element) {\n@@ -80,7 +80,10 @@\n if (element.tagName.toLowerCase() === 'form') {\n method = element.readAttribute('method') || 'post';\n url = element.readAttribute('action');\n- params = element.serialize();\n+ // serialize the form with respect to the submit button that was pressed\n+ params = element.serialize({ submit: element.retrieve('rails:submit-button') });\n+ // clear the pressed submit button information\n+ element.store('rails:submit-button', null);\n } else {\n method = element.readAttribute('data-method') || 'get';\n url = element.readAttribute('href');\n@@ -100,6 +103,10 @@\n element.fire(\"ajax:after\");\n }\n \n+ function insertHiddenField(form, name, value) {\n+ form.insert(new Element('input', { type: 'hidden', name: name, value: value }));\n+ }\n+\n function handleMethod(element) {\n var method = element.readAttribute('data-method'),\n url = element.readAttribute('href'),\n@@ -110,15 +117,11 @@\n element.parentNode.insert(form);\n \n if (method !== 'post') {\n- var field = new Element('input', { type: 'hidden', name: '_method', value: method });\n- form.insert(field);\n+ insertHiddenField(form, '_method', method);\n }\n \n if (csrf_param) {\n- var param = csrf_param.readAttribute('content'),\n- token = csrf_token.readAttribute('content'),\n- field = new Element('input', { type: 'hidden', name: param, value: token });\n- form.insert(field);\n+ insertHiddenField(form, csrf_param.readAttribute('content'), csrf_token.readAttribute('content'));\n }\n \n form.submit();\n@@ -142,34 +145,34 @@\n event.stop();\n });\n \n+ document.on(\"click\", \"form input[type=submit]\", function(event, button) {\n+ // register the pressed submit button\n+ event.findElement('form').store('rails:submit-button', button.name || false);\n+ });\n+\n document.on(\"submit\", function(event) {\n- var element = event.findElement(),\n- message = element.readAttribute('data-confirm');\n+ var form = event.findElement(),\n+ message = form.readAttribute('data-confirm');\n+\n if (message && !confirm(message)) {\n event.stop();\n return false;\n }\n \n- var inputs = element.select(\"input[type=submit][data-disable-with]\");\n- inputs.each(function(input) {\n- input.disabled = true;\n- input.writeAttribute('data-original-value', input.value);\n- input.value = input.readAttribute('data-disable-with');\n+ form.select('input[type=submit][data-disable-with]').each(function(input) {\n+ input.store('rails:original-value', input.getValue());\n+ input.disable().setValue(input.readAttribute('data-disable-with'));\n });\n \n- var element = event.findElement(\"form[data-remote]\");\n- if (element) {\n- handleRemote(element);\n+ if (form.readAttribute('data-remote')) {\n+ handleRemote(form);\n event.stop();\n }\n });\n \n- document.on(\"ajax:after\", \"form\", function(event, element) {\n- var inputs = element.select(\"input[type=submit][disabled=true][data-disable-with]\");\n- inputs.each(function(input) {\n- input.value = input.readAttribute('data-original-value');\n- input.removeAttribute('data-original-value');\n- input.disabled = false;\n+ document.on(\"ajax:after\", \"form\", function(event, form) {\n+ form.select('input[type=submit][data-disable-with]').each(function(input) {\n+ input.setValue(input.retrieve('rails:original-value')).enable();\n });\n });\n })();"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "5222b7bf502c51052827c50ac296ff0950649356",
filename = "railties/lib/rails/tasks/framework.rake", status = "modified",
additions = 1L, deletions = 1L, changes = 2L, blob_url = "https://github.com/rails/rails/blob/6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da/railties/lib/rails/tasks/framework.rake",
raw_url = "https://github.com/rails/rails/raw/6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da/railties/lib/rails/tasks/framework.rake",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/tasks/framework.rake?ref=6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da",
patch = "@@ -60,7 +60,7 @@ namespace :rails do\n \n # desc \"Update Prototype javascripts from your current rails install\"\n task :javascripts do\n- invoke_from_app_generator :create_prototype_files\n+ invoke_from_app_generator :create_javascript_files\n end\n \n # desc \"Adds new scripts to the application script/ directory\""), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "dd3cf7593c0a9d3f3ee118904ae55c47974c248b",
filename = "railties/test/generators/app_generator_test.rb",
status = "modified", additions = 24L, deletions = 4L, changes = 28L,
blob_url = "https://github.com/rails/rails/blob/6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da/railties/test/generators/app_generator_test.rb",
raw_url = "https://github.com/rails/rails/raw/6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da/railties/test/generators/app_generator_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/generators/app_generator_test.rb?ref=6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da",
patch = "@@ -180,14 +180,34 @@ def test_prototype_and_test_unit_are_added_by_default\n assert_file \"public/javascripts/rails.js\"\n assert_file \"test\"\n end\n-\n- def test_prototype_and_test_unit_are_skipped_if_required\n- run_generator [destination_root, \"--skip-prototype\", \"--skip-test-unit\"]\n+ \n+ def test_test_unit_is_skipped_if_required\n+ run_generator [destination_root, \"--skip-test-unit\"]\n+ assert_no_file \"test\" \n+ end\n+ \n+ def test_javascript_is_skipped_if_required\n+ run_generator [destination_root, \"--skip-javascript\"]\n assert_file \"config/application.rb\", /^\\s+config\\.action_view\\.javascript_expansions\\[:defaults\\]\\s+=\\s+%w\\(\\)/\n assert_file \"public/javascripts/application.js\"\n assert_no_file \"public/javascripts/prototype.js\"\n assert_no_file \"public/javascripts/rails.js\"\n- assert_no_file \"test\"\n+ end\n+ \n+ def test_config_prototype_javascript_library\n+ run_generator [destination_root, \"-j\", \"prototype\"]\n+ assert_file \"config/application.rb\", /#\\s+config\\.action_view\\.javascript_expansions\\[:defaults\\]\\s+=\\s+%w\\(jquery rails\\)/\n+ assert_file \"public/javascripts/application.js\"\n+ assert_file \"public/javascripts/prototype.js\"\n+ assert_file \"public/javascripts/rails.js\", /prototype/\n+ end\n+ \n+ def test_config_jquery_javascript_library\n+ run_generator [destination_root, \"-j\", \"jquery\"]\n+ assert_file \"config/application.rb\", /^\\s+config\\.action_view\\.javascript_expansions\\[:defaults\\]\\s+=\\s+%w\\(jquery rails\\)/\n+ assert_file \"public/javascripts/application.js\"\n+ assert_file \"public/javascripts/jquery.js\"\n+ assert_file \"public/javascripts/rails.js\", /jQuery/\n end\n \n def test_shebang_is_added_to_rails_file"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:49 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 15:26:06 GMT",
etag = "\"34f42df892310dfeb7ebc0815d9ee365\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F24815D:54D9023D",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "2811da37fbdda4367181b328b22b2499"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "3fa46d0f430fb33e20c88e6a4fc5cabf81e08d04", filename = "actionpack/lib/action_view/base.rb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/26991bb5508311a85fcc6fb469bf73924190ff5e/actionpack/lib/action_view/base.rb",
raw_url = "https://github.com/rails/rails/raw/26991bb5508311a85fcc6fb469bf73924190ff5e/actionpack/lib/action_view/base.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_view/base.rb?ref=26991bb5508311a85fcc6fb469bf73924190ff5e",
patch = "@@ -153,7 +153,7 @@ module ActionView #:nodoc:\n #\n # This refreshes the sidebar, removes a person element and highlights the user list.\n #\n- # See the ActionView::Helpers::PrototypeHelper::GeneratorMethods documentation for more details.\n+ # See the ActionView::Helpers::PrototypeHelper::JavaScriptGenerator::GeneratorMethods documentation for more details.\n class Base\n module Subclasses\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "cd3a3eac802b37426c86121d5c414ea552d60213",
filename = "actionpack/lib/action_view/helpers/javascript_helper.rb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/26991bb5508311a85fcc6fb469bf73924190ff5e/actionpack/lib/action_view/helpers/javascript_helper.rb",
raw_url = "https://github.com/rails/rails/raw/26991bb5508311a85fcc6fb469bf73924190ff5e/actionpack/lib/action_view/helpers/javascript_helper.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_view/helpers/javascript_helper.rb?ref=26991bb5508311a85fcc6fb469bf73924190ff5e",
patch = "@@ -65,7 +65,7 @@ def escape_javascript(javascript)\n # //]]>\n # </script>\n #\n- # +html_options+ may be a hash of attributes for the <tt><script></tt>\n+ # +html_options+ may be a hash of attributes for the <tt>\\<script></tt>\n # tag. Example:\n # javascript_tag \"alert('All is good')\", :defer => 'defer'\n # # => <script defer=\"defer\" type=\"text/javascript\">alert('All is good')</script>"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "300207dfac52867bad5e3220e4850cafed87e550",
filename = "actionpack/lib/action_view/helpers/prototype_helper.rb",
status = "modified", additions = 4L, deletions = 4L, changes = 8L,
blob_url = "https://github.com/rails/rails/blob/26991bb5508311a85fcc6fb469bf73924190ff5e/actionpack/lib/action_view/helpers/prototype_helper.rb",
raw_url = "https://github.com/rails/rails/raw/26991bb5508311a85fcc6fb469bf73924190ff5e/actionpack/lib/action_view/helpers/prototype_helper.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_view/helpers/prototype_helper.rb?ref=26991bb5508311a85fcc6fb469bf73924190ff5e",
patch = "@@ -161,7 +161,7 @@ def include_helpers_from_context\n \n # JavaScriptGenerator generates blocks of JavaScript code that allow you\n # to change the content and presentation of multiple DOM elements. Use\n- # this in your Ajax response bodies, either in a <tt><script></tt> tag\n+ # this in your Ajax response bodies, either in a <tt>\\<script></tt> tag\n # or as plain JavaScript sent with a Content-type of \"text/javascript\".\n #\n # Create new instances with PrototypeHelper#update_page or with\n@@ -224,7 +224,7 @@ def include_helpers_from_context\n #\n # You can also use PrototypeHelper#update_page_tag instead of\n # PrototypeHelper#update_page to wrap the generated JavaScript in a\n- # <tt><script></tt> tag.\n+ # <tt>\\<script></tt> tag.\n module GeneratorMethods\n def to_s #:nodoc:\n (@lines * $/).tap do |javascript|\n@@ -583,10 +583,10 @@ def update_page(&block)\n end\n \n # Works like update_page but wraps the generated JavaScript in a\n- # <tt><script></tt> tag. Use this to include generated JavaScript in an\n+ # <tt>\\<script></tt> tag. Use this to include generated JavaScript in an\n # ERb template. See JavaScriptGenerator for more information.\n #\n- # +html_options+ may be a hash of <tt><script></tt> attributes to be\n+ # +html_options+ may be a hash of <tt>\\<script></tt> attributes to be\n # passed to ActionView::Helpers::JavaScriptHelper#javascript_tag.\n def update_page_tag(html_options = {}, &block)\n javascript_tag update_page(&block), html_options"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "0168233fce8eebda82e512f6754b0174be75f7e5",
filename = "activemodel/lib/active_model/validator.rb", status = "modified",
additions = 2L, deletions = 2L, changes = 4L, blob_url = "https://github.com/rails/rails/blob/26991bb5508311a85fcc6fb469bf73924190ff5e/activemodel/lib/active_model/validator.rb",
raw_url = "https://github.com/rails/rails/raw/26991bb5508311a85fcc6fb469bf73924190ff5e/activemodel/lib/active_model/validator.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activemodel/lib/active_model/validator.rb?ref=26991bb5508311a85fcc6fb469bf73924190ff5e",
patch = "@@ -7,7 +7,7 @@ module ActiveModel #:nodoc:\n # == Active Model Validator\n #\n # A simple base class that can be used along with\n- # +ActiveModel::Validations::ClassMethods.validates_with+\n+ # ActiveModel::Validations::ClassMethods.validates_with\n #\n # class Person\n # include ActiveModel::Validations\n@@ -42,7 +42,7 @@ module ActiveModel #:nodoc:\n # end\n # end\n #\n- # To cause a validation error, you must add to the <tt>record<tt>'s errors directly\n+ # To cause a validation error, you must add to the <tt>record</tt>'s errors directly\n # from within the validators message\n #\n # class MyValidator < ActiveModel::Validator"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:49 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Thu, 05 Feb 2015 09:53:39 GMT",
etag = "\"8d50433e568129400307b982ad572718\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F24817B:54D9023D",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "474556b853193c38f1b14328ce2d1b7d"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "97363c8003c94cb8c6e9545d1e111df3df07d5c6", filename = "activerecord/lib/active_record/nested_attributes.rb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/f13a5674885f3d3388b5bc03a11c33f46866216b/activerecord/lib/active_record/nested_attributes.rb",
raw_url = "https://github.com/rails/rails/raw/f13a5674885f3d3388b5bc03a11c33f46866216b/activerecord/lib/active_record/nested_attributes.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/nested_attributes.rb?ref=f13a5674885f3d3388b5bc03a11c33f46866216b",
patch = "@@ -323,7 +323,7 @@ def assign_nested_attributes_for_one_to_one_association(association_name, attrib\n (options[:update_only] || record.id.to_s == attributes['id'].to_s)\n assign_to_or_mark_for_destruction(record, attributes, options[:allow_destroy])\n \n- elsif attributes['id']\n+ elsif not attributes['id'].blank?\n existing_record = self.class.reflect_on_association(association_name).klass.find(attributes['id'])\n assign_to_or_mark_for_destruction(existing_record, attributes, options[:allow_destroy])\n self.send(association_name.to_s+'=', existing_record)"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "7efd75e5cd7b0f3ade766012521b6dbe31b5b845",
filename = "activerecord/test/cases/nested_attributes_test.rb",
status = "modified", additions = 9L, deletions = 0L, changes = 9L,
blob_url = "https://github.com/rails/rails/blob/f13a5674885f3d3388b5bc03a11c33f46866216b/activerecord/test/cases/nested_attributes_test.rb",
raw_url = "https://github.com/rails/rails/raw/f13a5674885f3d3388b5bc03a11c33f46866216b/activerecord/test/cases/nested_attributes_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/nested_attributes_test.rb?ref=f13a5674885f3d3388b5bc03a11c33f46866216b",
patch = "@@ -114,6 +114,15 @@ def test_reject_if_with_indifferent_keys\n pirate.ship_attributes = { :name => 'Hello Pearl' }\n assert_difference('Ship.count') { pirate.save! }\n end\n+ \n+ def test_reject_if_with_blank_nested_attributes_id\n+ # When using a select list to choose an existing 'ship' id, with :include_blank => true\n+ Pirate.accepts_nested_attributes_for :ship, :reject_if => proc {|attributes| attributes[:id].blank? }\n+\n+ pirate = Pirate.new(:catchphrase => \"Stop wastin' me time\")\n+ pirate.ship_attributes = { :id => \"\" }\n+ assert_nothing_raised(ActiveRecord::RecordNotFound) { pirate.save! }\n+ end\n end\n \n class TestNestedAttributesOnAHasOneAssociation < ActiveRecord::TestCase"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:49 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 17:55:55 GMT",
etag = "\"197c397a18b1324c2f19e872e6b67aa2\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F24819E:54D9023D",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "4c8b2d4732c413f4b9aefe394bd65569"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "d13e7f69e44a8f6b4d2a66a34b1a22cce9074416", filename = "actionpack/lib/action_view/helpers/cache_helper.rb",
status = "modified", additions = 2L, deletions = 2L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/8efd79d33be99e67fa40904e06e400877737704b/actionpack/lib/action_view/helpers/cache_helper.rb",
raw_url = "https://github.com/rails/rails/raw/8efd79d33be99e67fa40904e06e400877737704b/actionpack/lib/action_view/helpers/cache_helper.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_view/helpers/cache_helper.rb?ref=8efd79d33be99e67fa40904e06e400877737704b",
patch = "@@ -46,8 +46,8 @@ def cache(name = {}, options = nil, &block)\n private\n # TODO: Create an object that has caching read/write on it\n def fragment_for(name = {}, options = nil, &block) #:nodoc:\n- if controller.fragment_exist?(name, options)\n- controller.read_fragment(name, options)\n+ if fragment = controller.read_fragment(name, options)\n+ fragment\n else\n # VIEW TODO: Make #capture usable outside of ERB\n # This dance is needed because Builder can't use capture"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "3c581719f80e63f2d16c8730eb3dff0fd3fbfbb7",
filename = "actionpack/test/controller/log_subscriber_test.rb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/8efd79d33be99e67fa40904e06e400877737704b/actionpack/test/controller/log_subscriber_test.rb",
raw_url = "https://github.com/rails/rails/raw/8efd79d33be99e67fa40904e06e400877737704b/actionpack/test/controller/log_subscriber_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/test/controller/log_subscriber_test.rb?ref=8efd79d33be99e67fa40904e06e400877737704b",
patch = "@@ -135,7 +135,7 @@ def test_with_fragment_cache\n wait\n \n assert_equal 4, logs.size\n- assert_match /Exist fragment\\? views\\/foo/, logs[1]\n+ assert_match /Read fragment views\\/foo/, logs[1]\n assert_match /Write fragment views\\/foo/, logs[2]\n ensure\n @controller.config.perform_caching = true"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:49 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 14:13:33 GMT",
etag = "\"dd791c266be9ea9c6b1791dc18c38524\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F2481C3:54D9023D",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "dc1ce2bfb41810a06c705e83b388572d"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "fc2abacb6d61ff4a65a043101a016124943d9122", filename = "activemodel/lib/active_model/naming.rb",
status = "modified", additions = 3L, deletions = 2L, changes = 5L,
blob_url = "https://github.com/rails/rails/blob/5a91f2e10fb7418371649046e1ac9343cb24a16a/activemodel/lib/active_model/naming.rb",
raw_url = "https://github.com/rails/rails/raw/5a91f2e10fb7418371649046e1ac9343cb24a16a/activemodel/lib/active_model/naming.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activemodel/lib/active_model/naming.rb?ref=5a91f2e10fb7418371649046e1ac9343cb24a16a",
patch = "@@ -1,4 +1,5 @@\n require 'active_support/inflector'\n+require 'active_support/core_ext/hash/except'\n \n module ActiveModel\n class Name < String\n@@ -35,10 +36,10 @@ def human(options={})\n klass.model_name.i18n_key\n end\n \n- defaults << options.delete(:default) if options[:default]\n+ defaults << options[:default] if options[:default]\n defaults << @human\n \n- options.reverse_merge! :scope => [@klass.i18n_scope, :models], :count => 1, :default => defaults\n+ options = {:scope => [@klass.i18n_scope, :models], :count => 1, :default => defaults}.merge(options.except(:default))\n I18n.translate(defaults.shift, options)\n end\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "40ce4c0e2d0fb011406e435e2b9675b0bcd52ea8",
filename = "activemodel/test/cases/naming_test.rb", status = "modified",
additions = 4L, deletions = 0L, changes = 4L, blob_url = "https://github.com/rails/rails/blob/5a91f2e10fb7418371649046e1ac9343cb24a16a/activemodel/test/cases/naming_test.rb",
raw_url = "https://github.com/rails/rails/raw/5a91f2e10fb7418371649046e1ac9343cb24a16a/activemodel/test/cases/naming_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activemodel/test/cases/naming_test.rb?ref=5a91f2e10fb7418371649046e1ac9343cb24a16a",
patch = "@@ -28,6 +28,10 @@ def test_collection\n def test_partial_path\n assert_equal 'post/track_backs/track_back', @model_name.partial_path\n end\n+\n+ def test_human\n+ assert_equal 'Track back', @model_name.human\n+ end\n end\n \n class NamingWithNamespacedModelInIsolatedNamespaceTest < ActiveModel::TestCase"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "ac2e56321eae532d866dfb257a8d35cebffa2d6d",
filename = "activemodel/test/cases/translation_test.rb",
status = "modified", additions = 6L, deletions = 0L, changes = 6L,
blob_url = "https://github.com/rails/rails/blob/5a91f2e10fb7418371649046e1ac9343cb24a16a/activemodel/test/cases/translation_test.rb",
raw_url = "https://github.com/rails/rails/raw/5a91f2e10fb7418371649046e1ac9343cb24a16a/activemodel/test/cases/translation_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activemodel/test/cases/translation_test.rb?ref=5a91f2e10fb7418371649046e1ac9343cb24a16a",
patch = "@@ -46,5 +46,11 @@ def test_translated_model_names_with_ancestors_fallback\n I18n.backend.store_translations 'en', :activemodel => {:models => {:person => 'person model'} }\n assert_equal 'person model', Child.model_name.human\n end\n+\n+ def test_human_does_not_modify_options\n+ options = {:default => 'person model'}\n+ Person.model_name.human(options)\n+ assert_equal({:default => 'person model'}, options)\n+ end\n end\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:49 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 18:28:59 GMT",
etag = "\"21f6d4d31ca3162000eacf0ec6c5c1e2\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F2481DE:54D9023D",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "318e55760cf7cdb40e61175a4d36cd32"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "0db83d1f6bc36c6a09ae5a1ef985632a040bb2a8", filename = "activeresource/lib/active_resource/associations.rb",
status = "added", additions = 233L, deletions = 0L, changes = 233L,
blob_url = "https://github.com/rails/rails/blob/eb5e3c32f7de136bedf08d571a8dce936541f60c/activeresource/lib/active_resource/associations.rb",
raw_url = "https://github.com/rails/rails/raw/eb5e3c32f7de136bedf08d571a8dce936541f60c/activeresource/lib/active_resource/associations.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activeresource/lib/active_resource/associations.rb?ref=eb5e3c32f7de136bedf08d571a8dce936541f60c",
patch = "@@ -0,0 +1,233 @@\n+require 'active_resource/associations/association_collection'\n+\n+module ActiveResource\n+ module Associations\n+\n+ # Active Resource Associations works in the same way than Active Record\n+ # associations, it follows the same coventions and method names.\n+ # At the moment it support only one-to-one and one-to-many associations,\n+ # many-to-many associations are not implemented yet.\n+ #\n+ # An example of use:\n+ #\n+ # class Project < ActiveRecord::Base\n+ # self.site = \"http://37s.sunrise.i:3000\"\n+ #\n+ # belongs_to :portfolio\n+ # has_one :project_manager\n+ # has_many :milestones\n+ # end\n+ #\n+ # The project class now has the following methods in order to manipulate the relationships:\n+ # * <tt>Project#portfolio, Project#portfolio=(portfolio), Project#portfolio.nil?</tt>\n+ # * <tt>Project#project_manager, Project#project_manager=(project_manager), Project#project_manager.nil?,</tt>\n+ # * <tt>Project#milestones.empty?, Project#milestones.size, Project#milestones, Project#milestones<<(milestone), Project#milestone.delete(milestone)</tt>\n+ #\n+ #\n+ # == Auto-generated methods\n+ #\n+ # === Singular associations (one-to-one)\n+ # | | belongs_to |\n+ # generated methods | belongs_to | :polymorphic | has_one\n+ # ----------------------------------+------------+--------------+---------\n+ # other | X | X | X\n+ # other=(other) | X | X | X\n+ #\n+ # ===Collection associations (one-to-many)\n+ #\n+ # generated methods (only one-to-many)\n+ # --------------------------\n+ # others\n+ # others=[other,other]\n+ # others<<\n+ # others.size\n+ # others.length\n+ # others.empty?\n+ # others.clear\n+ # others.delete(other)\n+ #\n+ # === One-to-one\n+ #\n+ # Use has_one in the base, and belongs_to in the associated model.\n+ #\n+ # class ProjectManager < ActiveResource::Base\n+ # self.site = \"http://37s.sunrise.i:3000\"\n+ # belongs_to :project\n+ # end\n+ #\n+ # class Project < ActiveResource::Base\n+ # self.site = \"http://37s.sunrise.i:3000\"\n+ # has_one :project_manager\n+ # end\n+ #\n+ # @project = Project.find(1)\n+ # @project.project_manager = ProjectManager.find(3)\n+ # @project.project_manager #=> #<ProjectManager:0x7fb91bb05708 @persisted=true,\n+ # @attributes={\"name\"=>\"David\", \"project_id\"=>1, \"id\"=>5}, @prefix_options={}>\n+ #\n+ #\n+ # === One-to-many\n+ #\n+ # Use has_many in the base, and belongs_to in the associated model.\n+ #\n+ # class Project < ActiveResource::Base\n+ # self.site = \"http://37s.sunrise.i:3000\"\n+ # has_many :milestones\n+ # end\n+ #\n+ # class Milestone < ActiveResource::Base\n+ # self.site = \"http://37s.sunrise.i:3000\"\n+ # end\n+ #\n+ # @milestone = Milestone.find(2)\n+ # @project = Project.find(1)\n+ # @project.milestones << @milestone\n+ #\n+ # This will set the @milestone.milestone_id to @project.id\n+ # and save @milestone, then when you call @project.milestones\n+ # will return an AssociationCollection list with the recently milestone added\n+ # included.\n+ #\n+ # @project.milestones #=>[#<Milestone:0x7f8b3134ac88 @persisted=true,\n+ # @attributes={\"title\"=>\"pre\", \"project_id\"=>nil, \"id\"=>1},\n+ # @prefix_options={}>, #<Milestone:0x7f8b31324768 @errors=#<OrderedHash {}>,\n+ # @validation_context=nil, @persisted=true, @attributes={\"title\"=>\"rc other\",\n+ # \"project_id\"=>nil, \"id\"=>2}, @remote_errors=nil, @prefix_options={}>]\n+ #\n+ #\n+ # === Collections\n+ #\n+ # * Adding an object to a collection (+has_many+) automatically saves that resource.\n+ #\n+ # === Cache\n+ #\n+ # * Every association set an instance variable over the base resource and works\n+ # with a simple cache that keep the result of the last fetched resource\n+ # unless you specifically instructed not to.\n+ #\n+ # project.milestones # fetches milestones resources\n+ # project.milestones.size # uses the milestone cache\n+ # project.milestones.empty? # uses the milestone cache\n+ # project.milestones(true).size # fetches milestones from the database\n+ # project.milestones # uses the milestone cache\n+ #\n+ def self.included(klass)\n+ klass.send :include, InstanceMethods\n+ klass.extend ClassMethods\n+ end\n+\n+ module InstanceMethods\n+ def set_resource_instance_variable(resource, force_reload = false)\n+ if !instance_variable_defined?(\"@#{resource}\") or force_reload\n+ instance_variable_set(\"@#{resource}\", yield)\n+ end\n+ instance_variable_get(\"@#{resource}\")\n+ end\n+ end\n+\n+ module ClassMethods\n+\n+ def options(association, resource)\n+ o = { :klass => klass_for(association, resource) }\n+ o[:host_klass] = self\n+\n+ case association\n+ when :has_many\n+ o[:association_col] = o[:host_klass].to_s.singularize\n+ when :belongs_to\n+ o[:association_col] = o[:klass]\n+ when :has_one\n+ o[:association_col] = o[:host_klass].to_s\n+ end\n+ o[:association_col] = \"#{o[:association_col].underscore}_id\".to_sym\n+ o\n+ end\n+\n+ def klass_for(association, resource)\n+ resource = resource.to_s\n+ resource = resource.singularize if association == :has_many\n+ resource.camelize\n+ end\n+\n+ def has_one(resource, opts = {})\n+ o = options(:has_one, resource)\n+\n+ # Define accessor method for resource\n+ #\n+ define_method(resource) do |*force_reload|\n+ force_reload = force_reload.first || false\n+\n+ set_resource_instance_variable(resource, force_reload) do\n+ o[:klass].constantize.find(:first, :params => { o[:association_col] => id })\n+ end\n+ end\n+\n+ # Define writter method for resource\n+ #\n+ define_method(\"#{resource}=\") do |new_resource|\n+ if send(resource).blank?\n+ new_resource.send(\"#{o[:association_col]}=\", id)\n+ instance_variable_set(\"@#{resource}\", new_resource.save)\n+ else\n+ instance_variable_get(\"@#{resource}\").send(:update_attribute, o[:association_col], id)\n+ end\n+ end\n+ end\n+\n+ def belongs_to(resource, opts = {})\n+ o = options(:belongs_to, resource)\n+\n+ # Define accessor method for resource\n+ #\n+ define_method(resource) do |*force_reload|\n+ force_reload = force_reload.first || false\n+\n+ association_col = send o[:association_col]\n+ return nil if association_col.nil?\n+ set_resource_instance_variable(resource, force_reload){\n+ o[:klass].constantize.find(association_col)\n+ }\n+ end\n+\n+ # Define writter method for resource\n+ #\n+ define_method(\"#{resource}=\") do |new_resource|\n+ if send(o[:association_col]) != new_resource.id\n+ send \"#{o[:association_col]}=\", new_resource.id\n+ end\n+ instance_variable_set(\"@#{resource}\", new_resource)\n+ end\n+ end\n+\n+ def has_many(resource, opts = {})\n+ o = options(:has_many, resource)\n+\n+ # Define accessor method for resource\n+ #\n+ define_method(resource) do |*force_reload|\n+ force_reload = force_reload.first || false\n+\n+ set_resource_instance_variable(resource, force_reload) {\n+ result = o[:klass].constantize.find(:all,\n+ :params => { o[:association_col] => id }) || []\n+\n+ AssociationCollection.new result, self, o[:association_col]\n+ }\n+ end\n+\n+ define_method(\"#{resource}=\") do |new_collection|\n+ collection = send(resource)\n+ to_remove = collection - new_collection\n+ to_remove.each{|m| collection.delete(m)}\n+\n+ # FIXME should call the old clear\n+ collection.clear\n+ # FIXME Is this needed?\n+ collection.concat new_collection\n+ end\n+ end\n+\n+ end\n+ end\n+\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "3795aa51f6b0e4a4e0feb16725a0ce072c1f97e7",
filename = "activeresource/lib/active_resource/associations/association_collection.rb",
status = "added", additions = 31L, deletions = 0L, changes = 31L,
blob_url = "https://github.com/rails/rails/blob/eb5e3c32f7de136bedf08d571a8dce936541f60c/activeresource/lib/active_resource/associations/association_collection.rb",
raw_url = "https://github.com/rails/rails/raw/eb5e3c32f7de136bedf08d571a8dce936541f60c/activeresource/lib/active_resource/associations/association_collection.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activeresource/lib/active_resource/associations/association_collection.rb?ref=eb5e3c32f7de136bedf08d571a8dce936541f60c",
patch = "@@ -0,0 +1,31 @@\n+module ActiveResource\n+ module Associations\n+\n+ class AssociationCollection < Array\n+\n+ def initialize(array, host_resource, association_col)\n+ @host_resource = host_resource\n+ @association_col = association_col\n+ self.concat array\n+ end\n+\n+ def <<(member)\n+ member.send \"#{@association_col}=\", @host_resource.id\n+ member.save\n+ super(member)\n+ end\n+\n+ def delete(member)\n+ member.send \"#{@association_col}=\", nil\n+ member.save\n+ super(member)\n+ end\n+\n+ def clear\n+ self.each{|member| delete(member)}\n+ super\n+ end\n+\n+ end\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "75e95dbdd2a15d0716f9501e35566621d6ec921d",
filename = "activeresource/lib/active_resource/base.rb",
status = "modified", additions = 2L, deletions = 1L, changes = 3L,
blob_url = "https://github.com/rails/rails/blob/eb5e3c32f7de136bedf08d571a8dce936541f60c/activeresource/lib/active_resource/base.rb",
raw_url = "https://github.com/rails/rails/raw/eb5e3c32f7de136bedf08d571a8dce936541f60c/activeresource/lib/active_resource/base.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activeresource/lib/active_resource/base.rb?ref=eb5e3c32f7de136bedf08d571a8dce936541f60c",
patch = "@@ -18,6 +18,7 @@\n require 'active_resource/formats'\n require 'active_resource/schema'\n require 'active_resource/log_subscriber'\n+require 'active_resource/associations'\n \n module ActiveResource\n # ActiveResource::Base is the main class for mapping RESTful resources as models in a Rails application.\n@@ -262,7 +263,7 @@ class Base\n # :singleton-method:\n # The logger for diagnosing and tracing Active Resource calls.\n cattr_accessor :logger\n-\n+ include Associations\n class << self\n # Creates a schema for this resource - setting the attributes that are\n # known prior to fetching an instance from the remote system."), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "17e9c5cfd4bf05d5514b1b3513b4ef1808814c5f",
filename = "activeresource/test/cases/associations_test.rb",
status = "added", additions = 144L, deletions = 0L, changes = 144L,
blob_url = "https://github.com/rails/rails/blob/eb5e3c32f7de136bedf08d571a8dce936541f60c/activeresource/test/cases/associations_test.rb",
raw_url = "https://github.com/rails/rails/raw/eb5e3c32f7de136bedf08d571a8dce936541f60c/activeresource/test/cases/associations_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activeresource/test/cases/associations_test.rb?ref=eb5e3c32f7de136bedf08d571a8dce936541f60c",
patch = "@@ -0,0 +1,144 @@\n+require 'abstract_unit'\n+require \"fixtures/project\"\n+\n+class ProjectManager < ActiveResource::Base\n+ self.site = \"http://37s.sunrise.i:3000\"\n+ belongs_to :project\n+end\n+\n+class Project < ActiveResource::Base\n+ self.site = \"http://37s.sunrise.i:3000\"\n+ has_one :project_manager\n+ has_many :milestones\n+end\n+\n+class Milestone < ActiveResource::Base\n+ self.site = \"http://37s.sunrise.i:3000\"\n+end\n+\n+@project = { :id => 1, :name => \"Rails\"}\n+@other_project = { :id => 2, :name => \"Ruby\"}\n+@project_manager = {:id => 5, :name => \"David\", :project_id =>1}\n+@other_project_manager = {:id => 6, :name => \"John\", :project_id => nil}\n+@project_managers = [@project_manager]\n+@milestone = { :id => 1, :title => \"pre\", :project_id => nil}\n+@other_milestone = { :id => 2, :title => \"rc other\", :project_id => nil}\n+\n+ActiveResource::HttpMock.respond_to do |mock|\n+ mock.get \"/projects/.xml\", {}, @project.to_xml(:root => 'project')\n+ mock.get \"/projects/1.xml\", {}, @project.to_xml(:root => 'project')\n+ mock.get \"/projects/2.xml\", {}, @other_project.to_xml(:root => 'project')\n+ mock.get \"/project_managers/5.xml\", {}, @project_manager.to_xml(:root => 'project_manager')\n+ mock.get \"/project_managers/6.xml\", {}, @other_project_manager.to_xml(:root => 'project_manager')\n+ mock.get \"/project_managers.xml?project_id=1\", {}, @project_managers.to_xml\n+ mock.get \"/project_managers.xml?project_id=2\", {}, [].to_xml\n+ mock.get \"/milestones.xml\", {}, [@milestone].to_xml\n+ mock.get \"/milestones.xml?project_id=2\", {}, [].to_xml\n+ mock.get \"/milestones.xml?project_id=1\", {}, [@milestone].to_xml\n+ mock.put \"/project_managers/6.xml\", {}, nil, 204\n+ mock.put \"/milestones/2.xml\", {}, nil, 204\n+ mock.put \"/milestones/1.xml\", {}, nil, 204\n+ mock.get \"/milestones/1.xml\", {}, @milestone.to_xml(:root => 'milestone')\n+ mock.get \"/milestones/2.xml\", {}, @other_milestone.to_xml(:root => 'milestone')\n+end\n+\n+class AssociationsTest < Test::Unit::TestCase\n+\n+ def setup\n+ @project = Project.find(1)\n+ @other_project = Project.find(2)\n+ @project_manager = ProjectManager.find(5)\n+ @other_project_manager = ProjectManager.find(6)\n+ @milestone = Milestone.find(1)\n+ @other_milestone = Milestone.find(2)\n+ end\n+\n+ #----------------------------------------------------------------------\n+ # has_one association\n+ #----------------------------------------------------------------------\n+\n+ def test_has_one_should_add_a_resource_accessor\n+ assert @project.respond_to? :project_manager\n+ end\n+\n+ def test_has_one_accessor_should_return_the_associated_project_manager\n+ assert_equal @project_manager, @project.project_manager\n+ end\n+\n+ def test_has_one_accessor_should_return_nil_when_the_does_not_has_an_associated_resource\n+ assert_nil @other_project.project_manager\n+ end\n+\n+ def test_has_one_should_assign_a_new_project_manager_when_it_does_not_has_a_project_manager\n+ @other_project.project_manager = @other_project_manager\n+ assert_equal @other_project.id, @other_project_manager.project_id\n+ end\n+\n+ #----------------------------------------------------------------------\n+ # belogns_to association\n+ #----------------------------------------------------------------------\n+\n+ def test_belongs_to_should_add_a_resource_accessor\n+ assert @project_manager.respond_to? :project\n+ end\n+\n+ def test_belongs_to_accessor_should_return_the_associated_project\n+ assert_equal @project, @project_manager.project\n+ end\n+\n+ def test_belongs_to_accessor_should_return_nil_when_the_does_not_has_an_associated_resource\n+ assert_nil @other_project_manager.project\n+ end\n+\n+ def test_has_one_should_assign_a_new_project_manager_when_it_does_not_has_a_project_manager\n+ @other_project_manager.project = @other_project\n+ assert_equal @other_project_manager.project_id, @other_project.id\n+ end\n+\n+ #----------------------------------------------------------------------\n+ # has_many association\n+ #----------------------------------------------------------------------\n+\n+ def test_has_many_should_add_a_resource_accessor\n+ assert @project.respond_to? :milestones\n+ end\n+\n+ def test_has_many_accessor_should_return_the_an_array_with_the_associated_milestones\n+ assert_equal [@milestone], @project.milestones\n+ end\n+\n+ def test_has_many_accessor_should_return_the_an_empty_array_when_it_does_not_has_milestones\n+ assert_equal [], @other_project.milestones\n+ end\n+\n+ def test_has_many_accessor_should_return_the_an_array_including_the_added_obj\n+ @project.milestones << @other_milestone\n+ assert_equal @other_milestone.project_id, @project.id\n+ end\n+\n+ def test_has_many_accessor_should_return_the_an_array_without_including_the_deleted_obj\n+ @project.milestones << @other_milestone\n+ @project.milestones.delete(@other_milestone)\n+ assert_nil @other_milestone.project_id\n+ end\n+\n+ def test_has_many_accessor_should_return_the_an_empty_array_after_clear\n+ @project.milestones << @other_milestone\n+ @project.milestones.clear\n+\n+ assert_equal [], @project.milestones\n+ end\n+\n+ def test_has_many_accessor_should_return_the_new_array_after_assign\n+ @project.milestones = [@other_milestone]\n+ assert_equal [@other_milestone], @project.milestones\n+\n+ @project.milestones = []\n+ assert_equal [], @project.milestones\n+\n+ @project.milestones = [@milestone, @other_milestone]\n+ assert_equal [@milestone, @other_milestone], @project.milestones\n+ end\n+\n+end\n+"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "a57139e2c7fb0ca24c75b2f4182927b97a75696a",
filename = "activeresource/test/fixtures/project.rb", status = "modified",
additions = 4L, deletions = 0L, changes = 4L, blob_url = "https://github.com/rails/rails/blob/eb5e3c32f7de136bedf08d571a8dce936541f60c/activeresource/test/fixtures/project.rb",
raw_url = "https://github.com/rails/rails/raw/eb5e3c32f7de136bedf08d571a8dce936541f60c/activeresource/test/fixtures/project.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activeresource/test/fixtures/project.rb?ref=eb5e3c32f7de136bedf08d571a8dce936541f60c",
patch = "@@ -2,6 +2,9 @@\n class Project < ActiveResource::Base\n self.site = \"http://37s.sunrise.i:3000\"\n \n+ #----------------------------------------------------------------------\n+ # validations\n+ #\n validates_presence_of :name\n validate :description_greater_than_three_letters\n \n@@ -18,6 +21,7 @@ def description_greater_than_three_letters\n def name\n attributes['name'] || nil\n end\n+\n def description\n attributes['description'] || nil\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:50 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Sat, 07 Feb 2015 22:15:47 GMT",
etag = "\"ffb145adc3f356a5ebbe502e30f6673e\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F2481F6:54D9023D",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "a241e1a8264a6ace03db946c85b92db3"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "8379f6a66f22ffc620f64e3b07afa0b874e6569e", filename = "activerecord/lib/active_record.rb",
status = "modified", additions = 1L, deletions = 0L, changes = 1L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -79,6 +79,7 @@ module ActiveRecord\n autoload :Timestamp\n autoload :Transactions\n autoload :Validations\n+ autoload :IdentityMap\n end\n \n module Coders"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "2eb431dfeca763e31bdca957dd1aa516985fab51",
filename = "activerecord/lib/active_record/associations/association.rb",
status = "modified", additions = 17L, deletions = 1L, changes = 18L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/associations/association.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/associations/association.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/associations/association.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -24,6 +24,7 @@ class Association #:nodoc:\n def initialize(owner, reflection)\n reflection.check_validity!\n \n+ @target = nil\n @owner, @reflection = owner, reflection\n @updated = false\n \n@@ -42,6 +43,7 @@ def aliased_table_name\n # Resets the \\loaded flag to +false+ and sets the \\target to +nil+.\n def reset\n @loaded = false\n+ IdentityMap.remove(@target) if IdentityMap.enabled? && @target\n @target = nil\n end\n \n@@ -141,7 +143,17 @@ def target_scope\n # ActiveRecord::RecordNotFound is rescued within the method, and it is\n # not reraised. The proxy is \\reset and +nil+ is the return value.\n def load_target\n- @target = find_target if find_target?\n+ if find_target?\n+ begin\n+ if IdentityMap.enabled? && association_class && association_class.respond_to?(:base_class)\n+ @target = IdentityMap.get(association_class, @owner[@reflection.foreign_key])\n+ end\n+ rescue NameError\n+ nil\n+ ensure\n+ @target ||= find_target\n+ end\n+ end\n loaded!\n target\n rescue ActiveRecord::RecordNotFound\n@@ -241,6 +253,10 @@ def invertible_for?(record)\n # This is only relevant to certain associations, which is why it returns nil by default.\n def stale_state\n end\n+\n+ def association_class\n+ @reflection.klass\n+ end\n end\n end\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "b711ff35ca6a207ff8d945de6438fe90fc0788f0",
filename = "activerecord/lib/active_record/associations/class_methods/join_dependency.rb",
status = "modified", additions = 2L, deletions = 2L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/associations/class_methods/join_dependency.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/associations/class_methods/join_dependency.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/associations/class_methods/join_dependency.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -187,8 +187,8 @@ def construct(parent, associations, join_parts, row)\n construct(parent, association, join_parts, row)\n end\n when Hash\n- associations.sort_by { |k,_| k.to_s }.each do |name, assoc|\n- association = construct(parent, name, join_parts, row)\n+ associations.sort_by { |k,_| k.to_s }.each do |association_name, assoc|\n+ association = construct(parent, association_name, join_parts, row)\n construct(association, assoc, join_parts, row) if association\n end\n else"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "3eff3d54e31f8761b7c87feaa53b1aafc93a0c7a",
filename = "activerecord/lib/active_record/attribute_methods/dirty.rb",
status = "modified", additions = 5L, deletions = 0L, changes = 5L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/attribute_methods/dirty.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/attribute_methods/dirty.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/attribute_methods/dirty.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -22,6 +22,8 @@ def save(*) #:nodoc:\n if status = super\n @previously_changed = changes\n @changed_attributes.clear\n+ elsif IdentityMap.enabled?\n+ IdentityMap.remove(self)\n end\n status\n end\n@@ -32,6 +34,9 @@ def save!(*) #:nodoc:\n @previously_changed = changes\n @changed_attributes.clear\n end\n+ rescue\n+ IdentityMap.remove(self) if IdentityMap.enabled?\n+ raise\n end\n \n # <tt>reload</tt> the record and clears changed attributes."), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "476598bf88dff1a55bc7b086ff4cc12071bf90c9",
filename = "activerecord/lib/active_record/autosave_association.rb",
status = "modified", additions = 26L, deletions = 3L, changes = 29L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/autosave_association.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/autosave_association.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/autosave_association.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -140,6 +140,23 @@ def #{type}(name, options = {})\n CODE\n end\n \n+ def define_non_cyclic_method(name, reflection, &block)\n+ define_method(name) do |*args|\n+ result = true; @_already_called ||= {}\n+ # Loop prevention for validation of associations\n+ unless @_already_called[[name, reflection.name]]\n+ begin\n+ @_already_called[[name, reflection.name]]=true\n+ result = instance_eval(&block)\n+ ensure\n+ @_already_called[[name, reflection.name]]=false\n+ end\n+ end\n+\n+ result\n+ end\n+ end\n+\n # Adds validation and save callbacks for the association as specified by\n # the +reflection+.\n #\n@@ -160,7 +177,7 @@ def add_autosave_association_callbacks(reflection)\n if collection\n before_save :before_save_collection_association\n \n- define_method(save_method) { save_collection_association(reflection) }\n+ define_non_cyclic_method(save_method, reflection) { save_collection_association(reflection) }\n # Doesn't use after_save as that would save associations added in after_create/after_update twice\n after_create save_method\n after_update save_method\n@@ -178,7 +195,7 @@ def add_autosave_association_callbacks(reflection)\n after_create save_method\n after_update save_method\n else\n- define_method(save_method) { save_belongs_to_association(reflection) }\n+ define_non_cyclic_method(save_method, reflection) { save_belongs_to_association(reflection) }\n before_save save_method\n end\n end\n@@ -186,7 +203,7 @@ def add_autosave_association_callbacks(reflection)\n \n if reflection.validate? && !method_defined?(validation_method)\n method = (collection ? :validate_collection_association : :validate_single_association)\n- define_method(validation_method) { send(method, reflection) }\n+ define_non_cyclic_method(validation_method, reflection) { send(method, reflection) }\n validate validation_method\n end\n end\n@@ -303,6 +320,7 @@ def save_collection_association(reflection)\n autosave = reflection.options[:autosave]\n \n if records = associated_records_to_validate_or_save(association, @new_record_before_save, autosave)\n+ begin\n records.each do |record|\n next if record.destroyed?\n \n@@ -322,6 +340,11 @@ def save_collection_association(reflection)\n \n raise ActiveRecord::Rollback unless saved\n end\n+ rescue\n+ records.each {|x| IdentityMap.remove(x) } if IdentityMap.enabled?\n+ raise\n+ end\n+\n end\n \n # reconstruct the scope now that we know the owner's id"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "01f5f4eccd276b0c257f66e16cfc784545ad9cea",
filename = "activerecord/lib/active_record/base.rb", status = "modified",
additions = 26L, deletions = 4L, changes = 30L, blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/base.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/base.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/base.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -819,6 +819,10 @@ def ===(object)\n object.is_a?(self)\n end\n \n+ def symbolized_base_class\n+ @symbolized_base_class ||= base_class.to_s.to_sym\n+ end\n+\n # Returns the base AR subclass that this class descends from. If A\n # extends AR::Base, A.base_class will return A. If B descends from A\n # through some arbitrarily deep hierarchy, B.base_class will return A.\n@@ -913,10 +917,25 @@ def _load(data)\n # Finder methods must instantiate through this method to work with the\n # single-table inheritance model that makes it possible to create\n # objects of different types from the same table.\n- def instantiate(record) # :nodoc:\n- model = find_sti_class(record[inheritance_column]).allocate\n- model.init_with('attributes' => record)\n- model\n+ def instantiate(record)\n+ sti_class = find_sti_class(record[inheritance_column])\n+ record_id = sti_class.primary_key && record[sti_class.primary_key]\n+\n+ if ActiveRecord::IdentityMap.enabled? && record_id\n+ if (column = sti_class.columns_hash[sti_class.primary_key]) && column.number?\n+ record_id = record_id.to_i\n+ end\n+ if instance = IdentityMap.get(sti_class, record_id)\n+ instance.reinit_with('attributes' => record)\n+ else\n+ instance = sti_class.allocate.init_with('attributes' => record)\n+ IdentityMap.add(instance)\n+ end\n+ else\n+ instance = sti_class.allocate.init_with('attributes' => record)\n+ end\n+\n+ instance\n end\n \n private\n@@ -1467,6 +1486,8 @@ def init_with(coder)\n @new_record = false\n run_callbacks :find\n run_callbacks :initialize\n+\n+ self\n end\n \n # Specifies how the record is dumped by +Marshal+.\n@@ -1933,6 +1954,7 @@ def clear_timestamp_attributes\n include ActiveModel::MassAssignmentSecurity\n include Callbacks, ActiveModel::Observing, Timestamp\n include Associations, AssociationPreload, NamedScope\n+ include IdentityMap\n include ActiveModel::SecurePassword\n \n # AutosaveAssociation needs to be included before Transactions, because we want"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "7839f038488247c9f8fdce5dcde12c42c1c70c26",
filename = "activerecord/lib/active_record/counter_cache.rb",
status = "modified", additions = 2L, deletions = 0L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/counter_cache.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/counter_cache.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/counter_cache.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -74,6 +74,8 @@ def update_counters(id, counters)\n \"#{quoted_column} = COALESCE(#{quoted_column}, 0) #{operator} #{value.abs}\"\n end\n \n+ IdentityMap.remove_by_id(symbolized_base_class, id) if IdentityMap.enabled?\n+\n update_all(updates.join(', '), primary_key => id )\n end\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "d523c643ba250d15db0dfdc9dc86c467dc630f16",
filename = "activerecord/lib/active_record/fixtures.rb",
status = "modified", additions = 3L, deletions = 1L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/fixtures.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/fixtures.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/fixtures.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -887,7 +887,9 @@ def setup_fixture_accessors(fixture_names = nil)\n @fixture_cache[fixture_name].delete(fixture) if force_reload\n \n if @loaded_fixtures[fixture_name][fixture.to_s]\n- @fixture_cache[fixture_name][fixture] ||= @loaded_fixtures[fixture_name][fixture.to_s].find\n+ ActiveRecord::IdentityMap.without do\n+ @fixture_cache[fixture_name][fixture] ||= @loaded_fixtures[fixture_name][fixture.to_s].find\n+ end\n else\n raise StandardError, \"No fixture with name '#{fixture}' found for table '#{fixture_name}'\"\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "d18b2b0a5413c730d31f9bd9b520a17652d6d39d",
filename = "activerecord/lib/active_record/identity_map.rb",
status = "added", additions = 102L, deletions = 0L, changes = 102L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/identity_map.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/identity_map.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/identity_map.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -0,0 +1,102 @@\n+module ActiveRecord\n+ # = Active Record Identity Map\n+ #\n+ # Ensures that each object gets loaded only once by keeping every loaded\n+ # object in a map. Looks up objects using the map when referring to them.\n+ #\n+ # More information on Identity Map pattern:\n+ # http://www.martinfowler.com/eaaCatalog/identityMap.html\n+ #\n+ # == Configuration\n+ #\n+ # In order to enable IdentityMap, set <tt>config.active_record.identity_map = true</tt>\n+ # in your <tt>config/application.rb</tt> file.\n+ #\n+ # IdentityMap is disabled by default.\n+ #\n+ module IdentityMap\n+ extend ActiveSupport::Concern\n+\n+ class << self\n+ def enabled=(flag)\n+ Thread.current[:identity_map_enabled] = flag\n+ end\n+\n+ def enabled\n+ Thread.current[:identity_map_enabled]\n+ end\n+ alias enabled? enabled\n+\n+ def repository\n+ Thread.current[:identity_map] ||= Hash.new { |h,k| h[k] = {} }\n+ end\n+\n+ def use\n+ old, self.enabled = enabled, true\n+\n+ yield if block_given?\n+ ensure\n+ self.enabled = old\n+ clear\n+ end\n+\n+ def without\n+ old, self.enabled = enabled, false\n+\n+ yield if block_given?\n+ ensure\n+ self.enabled = old\n+ end\n+\n+ def get(klass, primary_key)\n+ obj = repository[klass.symbolized_base_class][primary_key]\n+ obj.is_a?(klass) ? obj : nil\n+ end\n+\n+ def add(record)\n+ repository[record.class.symbolized_base_class][record.id] = record\n+ end\n+\n+ def remove(record)\n+ repository[record.class.symbolized_base_class].delete(record.id)\n+ end\n+\n+ def remove_by_id(symbolized_base_class, id)\n+ repository[symbolized_base_class].delete(id)\n+ end\n+\n+ def clear\n+ repository.clear\n+ end\n+ end\n+\n+ # Reinitialize an Identity Map model object from +coder+.\n+ # +coder+ must contain the attributes necessary for initializing an empty\n+ # model object.\n+ def reinit_with(coder)\n+ @attributes_cache = {}\n+ dirty = @changed_attributes.keys\n+ @attributes.update(coder['attributes'].except(*dirty))\n+ @changed_attributes.update(coder['attributes'].slice(*dirty))\n+ @changed_attributes.delete_if{|k,v| v.eql? @attributes[k]}\n+\n+ set_serialized_attributes\n+\n+ run_callbacks :find\n+\n+ self\n+ end\n+\n+ class Middleware\n+ def initialize(app)\n+ @app = app\n+ end\n+\n+ def call(env)\n+ ActiveRecord::IdentityMap.use do\n+ @app.call(env)\n+ end\n+ end\n+ end\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "522c0cfc9f14ce950a55602a643d2cd72d13b00e",
filename = "activerecord/lib/active_record/nested_attributes.rb",
status = "modified", additions = 10L, deletions = 3L, changes = 13L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/nested_attributes.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/nested_attributes.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/nested_attributes.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -403,7 +403,12 @@ def assign_nested_attributes_for_collection_association(association_name, attrib\n unless reject_new_record?(association_name, attributes)\n association.build(attributes.except(*UNASSIGNABLE_KEYS))\n end\n-\n+ elsif existing_records.count == 0 #Existing record but not yet associated\n+ existing_record = self.class.reflect_on_association(association_name).klass.find(attributes['id'])\n+ if !call_reject_if(association_name, attributes)\n+ association.send(:add_record_to_target_with_callbacks, existing_record) if !association.loaded?\n+ assign_to_or_mark_for_destruction(existing_record, attributes, options[:allow_destroy])\n+ end\n elsif existing_record = existing_records.detect { |record| record.id.to_s == attributes['id'].to_s }\n unless association.loaded? || call_reject_if(association_name, attributes)\n # Make sure we are operating on the actual object which is in the association's\n@@ -415,10 +420,12 @@ def assign_nested_attributes_for_collection_association(association_name, attrib\n else\n association.add_to_target(existing_record)\n end\n- end\n \n- assign_to_or_mark_for_destruction(existing_record, attributes, options[:allow_destroy])\n+ end\n \n+ if !call_reject_if(association_name, attributes)\n+ assign_to_or_mark_for_destruction(existing_record, attributes, options[:allow_destroy])\n+ end\n else\n raise_nested_attributes_record_not_found(association_name, attributes['id'])\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "df7b22080c879cb4419bc5e1d72bd2f14f095d33",
filename = "activerecord/lib/active_record/persistence.rb",
status = "modified", additions = 12L, deletions = 2L, changes = 14L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/persistence.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/persistence.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/persistence.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -64,7 +64,10 @@ def save!(*)\n # callbacks, Observer methods, or any <tt>:dependent</tt> association\n # options, use <tt>#destroy</tt>.\n def delete\n- self.class.delete(id) if persisted?\n+ if persisted?\n+ self.class.delete(id)\n+ IdentityMap.remove(self) if IdentityMap.enabled?\n+ end\n @destroyed = true\n freeze\n end\n@@ -73,6 +76,7 @@ def delete\n # that no changes should be made (since they can't be persisted).\n def destroy\n if persisted?\n+ IdentityMap.remove(self) if IdentityMap.enabled?\n self.class.unscoped.where(self.class.arel_table[self.class.primary_key].eq(id)).delete_all\n end\n \n@@ -196,7 +200,12 @@ def toggle!(attribute)\n def reload(options = nil)\n clear_aggregation_cache\n clear_association_cache\n- @attributes.update(self.class.unscoped { self.class.find(self.id, options) }.instance_variable_get('@attributes'))\n+\n+ IdentityMap.without do\n+ fresh_object = self.class.unscoped { self.class.find(self.id, options) }\n+ @attributes.update(fresh_object.instance_variable_get('@attributes'))\n+ end\n+\n @attributes_cache = {}\n self\n end\n@@ -275,6 +284,7 @@ def create\n \n self.id ||= new_id\n \n+ IdentityMap.add(self) if IdentityMap.enabled?\n @new_record = false\n id\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "cace6f0cc02b7c0f6e3938c60bc8a6f7e27cd65f",
filename = "activerecord/lib/active_record/railtie.rb", status = "modified",
additions = 5L, deletions = 0L, changes = 5L, blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/railtie.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/railtie.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/railtie.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -43,6 +43,11 @@ class Railtie < Rails::Railtie\n ActiveSupport.on_load(:active_record) { self.logger ||= ::Rails.logger }\n end\n \n+ initializer \"active_record.identity_map\" do |app|\n+ config.app_middleware.insert_after \"::ActionDispatch::Callbacks\",\n+ \"ActiveRecord::IdentityMap::Middleware\" if config.active_record.delete(:identity_map)\n+ end\n+\n initializer \"active_record.set_configs\" do |app|\n ActiveSupport.on_load(:active_record) do\n app.config.active_record.each do |k,v|"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "cb684c1109537b7d8a01db7bb6f4d11171284c84",
filename = "activerecord/lib/active_record/relation.rb",
status = "modified", additions = 7L, deletions = 1L, changes = 8L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/relation.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/relation.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/relation.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -81,7 +81,13 @@ def respond_to?(method, include_private = false)\n def to_a\n return @records if loaded?\n \n- @records = eager_loading? ? find_with_associations : @klass.find_by_sql(arel.to_sql, @bind_values)\n+ @records = if @readonly_value.nil? && !@klass.locking_enabled?\n+ eager_loading? ? find_with_associations : @klass.find_by_sql(arel.to_sql, @bind_values)\n+ else\n+ IdentityMap.without do\n+ eager_loading? ? find_with_associations : @klass.find_by_sql(arel.to_sql, @bind_values)\n+ end\n+ end\n \n preload = @preload_values\n preload += @includes_values unless eager_loading?"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "4e711c4884a07450f1f68890a13832dafb4986ab",
filename = "activerecord/lib/active_record/test_case.rb",
status = "modified", additions = 10L, deletions = 0L, changes = 10L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/test_case.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/test_case.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/test_case.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -3,6 +3,16 @@ module ActiveRecord\n #\n # Defines some test assertions to test against SQL queries.\n class TestCase < ActiveSupport::TestCase #:nodoc:\n+ setup :cleanup_identity_map\n+\n+ def setup\n+ cleanup_identity_map\n+ end\n+\n+ def cleanup_identity_map\n+ ActiveRecord::IdentityMap.clear\n+ end\n+\n def assert_date_from_db(expected, actual, message = nil)\n # SybaseAdapter doesn't have a separate column type just for dates,\n # so the time is in the string and incorrectly formatted"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "60d4c256c4ae3c9ce26e93f757bd70cff68825f6",
filename = "activerecord/lib/active_record/transactions.rb",
status = "modified", additions = 1L, deletions = 0L, changes = 1L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/transactions.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/transactions.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/transactions.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -251,6 +251,7 @@ def rollback_active_record_state!\n remember_transaction_record_state\n yield\n rescue Exception\n+ IdentityMap.remove(self) if IdentityMap.enabled?\n restore_transaction_record_state\n raise\n ensure"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "eb3f8143e7da73d16101f35942c60bff42f4f322",
filename = "activerecord/test/cases/adapters/mysql/connection_test.rb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/adapters/mysql/connection_test.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/adapters/mysql/connection_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/adapters/mysql/connection_test.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -102,7 +102,7 @@ def test_exec_typecasts_bind_vals\n end\n \n # Test that MySQL allows multiple results for stored procedures\n- if Mysql.const_defined?(:CLIENT_MULTI_RESULTS)\n+ if defined?(Mysql) && Mysql.const_defined?(:CLIENT_MULTI_RESULTS)\n def test_multi_results\n rows = ActiveRecord::Base.connection.select_rows('CALL ten();')\n assert_equal 10, rows[0][0].to_i, \"ten() did not return 10 as expected: #{rows.inspect}\""), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "d75791cab98c18182c07fd4b3955259693780a4f",
filename = "activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb",
status = "modified", additions = 1L, deletions = 0L, changes = 1L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -27,6 +27,7 @@ def test_class_names\n post = Namespaced::Post.find_by_title( 'Great stuff', :include => :tagging )\n assert_nil post.tagging\n \n+ ActiveRecord::IdentityMap.clear\n ActiveRecord::Base.store_full_sti_class = true\n post = Namespaced::Post.find_by_title( 'Great stuff', :include => :tagging )\n assert_instance_of Tagging, post.tagging"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "ca71cd8ed3a7abe796aeff404d3d56470d15392c",
filename = "activerecord/test/cases/associations/eager_test.rb",
status = "modified", additions = 7L, deletions = 7L, changes = 14L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/associations/eager_test.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/associations/eager_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/associations/eager_test.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -185,7 +185,7 @@ def test_finding_with_includes_on_has_one_assocation_with_same_include_includes_\n author = authors(:david)\n post = author.post_about_thinking_with_last_comment\n last_comment = post.last_comment\n- author = assert_queries(3) { Author.find(author.id, :include => {:post_about_thinking_with_last_comment => :last_comment})} # find the author, then find the posts, then find the comments\n+ author = assert_queries(ActiveRecord::IdentityMap.enabled? ? 2 : 3) { Author.find(author.id, :include => {:post_about_thinking_with_last_comment => :last_comment})} # find the author, then find the posts, then find the comments\n assert_no_queries do\n assert_equal post, author.post_about_thinking_with_last_comment\n assert_equal last_comment, author.post_about_thinking_with_last_comment.last_comment\n@@ -196,7 +196,7 @@ def test_finding_with_includes_on_belongs_to_association_with_same_include_inclu\n post = posts(:welcome)\n author = post.author\n author_address = author.author_address\n- post = assert_queries(3) { Post.find(post.id, :include => {:author_with_address => :author_address}) } # find the post, then find the author, then find the address\n+ post = assert_queries(ActiveRecord::IdentityMap.enabled? ? 2 : 3) { Post.find(post.id, :include => {:author_with_address => :author_address}) } # find the post, then find the author, then find the address\n assert_no_queries do\n assert_equal author, post.author_with_address\n assert_equal author_address, post.author_with_address.author_address\n@@ -817,18 +817,18 @@ def test_eager_loading_with_conditions_on_joined_table_preloads\n assert_equal [posts(:welcome)], posts\n assert_equal authors(:david), assert_no_queries { posts[0].author}\n \n- posts = assert_queries(2) do\n+ posts = assert_queries(ActiveRecord::IdentityMap.enabled? ? 1 : 2) do\n Post.find(:all, :select => 'distinct posts.*', :include => :author, :joins => [:comments], :conditions => \"comments.body like 'Thank you%'\", :order => 'posts.id')\n end\n assert_equal [posts(:welcome)], posts\n assert_equal authors(:david), assert_no_queries { posts[0].author}\n \n- posts = assert_queries(2) do\n+ posts = assert_queries(ActiveRecord::IdentityMap.enabled? ? 1 : 2) do\n Post.find(:all, :include => :author, :joins => {:taggings => :tag}, :conditions => \"tags.name = 'General'\", :order => 'posts.id')\n end\n assert_equal posts(:welcome, :thinking), posts\n \n- posts = assert_queries(2) do\n+ posts = assert_queries(ActiveRecord::IdentityMap.enabled? ? 1 : 2) do\n Post.find(:all, :include => :author, :joins => {:taggings => {:tag => :taggings}}, :conditions => \"taggings_tags.super_tag_id=2\", :order => 'posts.id')\n end\n assert_equal posts(:welcome, :thinking), posts\n@@ -842,7 +842,7 @@ def test_eager_loading_with_conditions_on_string_joined_table_preloads\n assert_equal [posts(:welcome)], posts\n assert_equal authors(:david), assert_no_queries { posts[0].author}\n \n- posts = assert_queries(2) do\n+ posts = assert_queries(ActiveRecord::IdentityMap.enabled? ? 1 : 2) do\n Post.find(:all, :select => 'distinct posts.*', :include => :author, :joins => [\"INNER JOIN comments on comments.post_id = posts.id\"], :conditions => \"comments.body like 'Thank you%'\", :order => 'posts.id')\n end\n assert_equal [posts(:welcome)], posts\n@@ -931,7 +931,7 @@ def test_preloading_empty_belongs_to\n def test_preloading_empty_belongs_to_polymorphic\n t = Tagging.create!(:taggable_type => 'Post', :taggable_id => Post.maximum(:id) + 1, :tag => tags(:general))\n \n- tagging = assert_queries(2) { Tagging.preload(:taggable).find(t.id) }\n+ tagging = assert_queries(ActiveRecord::IdentityMap.enabled? ? 1 : 2) { Tagging.preload(:taggable).find(t.id) }\n assert_no_queries { assert_nil tagging.taggable }\n end\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "bfc5ddc74783e8d77ab5367aa035e66b63eda5a9",
filename = "activerecord/test/cases/associations/has_one_through_associations_test.rb",
status = "modified", additions = 2L, deletions = 2L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/associations/has_one_through_associations_test.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/associations/has_one_through_associations_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/associations/has_one_through_associations_test.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -88,12 +88,12 @@ def test_has_one_through_with_conditions_eager_loading\n # conditions on the through table\n assert_equal clubs(:moustache_club), Member.find(@member.id, :include => :favourite_club).favourite_club\n memberships(:membership_of_favourite_club).update_attribute(:favourite, false)\n- assert_equal nil, Member.find(@member.id, :include => :favourite_club).favourite_club\n+ assert_equal nil, Member.find(@member.id, :include => :favourite_club).reload.favourite_club\n \n # conditions on the source table\n assert_equal clubs(:moustache_club), Member.find(@member.id, :include => :hairy_club).hairy_club\n clubs(:moustache_club).update_attribute(:name, \"Association of Clean-Shaven Persons\")\n- assert_equal nil, Member.find(@member.id, :include => :hairy_club).hairy_club\n+ assert_equal nil, Member.find(@member.id, :include => :hairy_club).reload.hairy_club\n end\n \n def test_has_one_through_polymorphic_with_source_type"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "9b8635774c1ec53591653d0f80d226972ab7c7d2",
filename = "activerecord/test/cases/associations/identity_map_test.rb",
status = "added", additions = 137L, deletions = 0L, changes = 137L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/associations/identity_map_test.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/associations/identity_map_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/associations/identity_map_test.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -0,0 +1,137 @@\n+require \"cases/helper\"\n+require 'models/author'\n+require 'models/post'\n+\n+if ActiveRecord::IdentityMap.enabled?\n+class InverseHasManyIdentityMapTest < ActiveRecord::TestCase\n+ fixtures :authors, :posts\n+\n+ def test_parent_instance_should_be_shared_with_every_child_on_find\n+ m = Author.first\n+ is = m.posts\n+ is.each do |i|\n+ assert_equal m.name, i.author.name, \"Name of man should be the same before changes to parent instance\"\n+ m.name = 'Bongo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to parent instance\"\n+ i.author.name = 'Mungo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to child-owned instance\"\n+ end\n+ end\n+\n+ def test_parent_instance_should_be_shared_with_eager_loaded_children\n+ m = Author.find(:first, :include => :posts)\n+ is = m.posts\n+ is.each do |i|\n+ assert_equal m.name, i.author.name, \"Name of man should be the same before changes to parent instance\"\n+ m.name = 'Bongo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to parent instance\"\n+ i.author.name = 'Mungo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to child-owned instance\"\n+ end\n+\n+ m = Author.find(:first, :include => :posts, :order => 'posts.id')\n+ is = m.posts\n+ is.each do |i|\n+ assert_equal m.name, i.author.name, \"Name of man should be the same before changes to parent instance\"\n+ m.name = 'Bongo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to parent instance\"\n+ i.author.name = 'Mungo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to child-owned instance\"\n+ end\n+ end\n+\n+ def test_parent_instance_should_be_shared_with_newly_built_child\n+ m = Author.first\n+ i = m.posts.build(:title => 'Industrial Revolution Re-enactment', :body => 'Lorem ipsum')\n+ assert_not_nil i.author\n+ assert_equal m.name, i.author.name, \"Name of man should be the same before changes to parent instance\"\n+ m.name = 'Bongo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to parent instance\"\n+ i.author.name = 'Mungo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to just-built-child-owned instance\"\n+ end\n+\n+ def test_parent_instance_should_be_shared_with_newly_block_style_built_child\n+ m = Author.first\n+ i = m.posts.build {|ii| ii.title = 'Industrial Revolution Re-enactment'; ii.body = 'Lorem ipsum'}\n+ assert_not_nil i.title, \"Child attributes supplied to build via blocks should be populated\"\n+ assert_not_nil i.author\n+ assert_equal m.name, i.author.name, \"Name of man should be the same before changes to parent instance\"\n+ m.name = 'Bongo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to parent instance\"\n+ i.author.name = 'Mungo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to just-built-child-owned instance\"\n+ end\n+\n+ def test_parent_instance_should_be_shared_with_newly_created_child\n+ m = Author.first\n+ i = m.posts.create(:title => 'Industrial Revolution Re-enactment', :body => 'Lorem ipsum')\n+ assert_not_nil i.author\n+ assert_equal m.name, i.author.name, \"Name of man should be the same before changes to parent instance\"\n+ m.name = 'Bongo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to parent instance\"\n+ i.author.name = 'Mungo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to newly-created-child-owned instance\"\n+ end\n+\n+ def test_parent_instance_should_be_shared_with_newly_created_via_bang_method_child\n+ m = Author.first\n+ i = m.posts.create!(:title => 'Industrial Revolution Re-enactment', :body => 'Lorem ipsum')\n+ assert_not_nil i.author\n+ assert_equal m.name, i.author.name, \"Name of man should be the same before changes to parent instance\"\n+ m.name = 'Bongo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to parent instance\"\n+ i.author.name = 'Mungo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to newly-created-child-owned instance\"\n+ end\n+\n+ def test_parent_instance_should_be_shared_with_newly_block_style_created_child\n+ m = Author.first\n+ i = m.posts.create {|ii| ii.title = 'Industrial Revolution Re-enactment'; ii.body = 'Lorem ipsum'}\n+ assert_not_nil i.title, \"Child attributes supplied to create via blocks should be populated\"\n+ assert_not_nil i.author\n+ assert_equal m.name, i.author.name, \"Name of man should be the same before changes to parent instance\"\n+ m.name = 'Bongo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to parent instance\"\n+ i.author.name = 'Mungo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to newly-created-child-owned instance\"\n+ end\n+\n+ def test_parent_instance_should_be_shared_with_poked_in_child\n+ m = Author.first\n+ i = Post.create(:title => 'Industrial Revolution Re-enactment', :body => 'Lorem ipsum')\n+ m.posts << i\n+ assert_not_nil i.author\n+ assert_equal m.name, i.author.name, \"Name of man should be the same before changes to parent instance\"\n+ m.name = 'Bongo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to parent instance\"\n+ i.author.name = 'Mungo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to newly-created-child-owned instance\"\n+ end\n+\n+ def test_parent_instance_should_be_shared_with_replaced_via_accessor_children\n+ m = Author.first\n+ i = Post.new(:title => 'Industrial Revolution Re-enactment', :body => 'Lorem ipsum')\n+ m.posts = [i]\n+ assert_same m, i.author\n+ assert_not_nil i.author\n+ assert_equal m.name, i.author.name, \"Name of man should be the same before changes to parent instance\"\n+ m.name = 'Bongo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to parent instance\"\n+ i.author.name = 'Mungo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to replaced-child-owned instance\"\n+ end\n+\n+ def test_parent_instance_should_be_shared_with_replaced_via_method_children\n+ m = Author.first\n+ i = Post.new(:title => 'Industrial Revolution Re-enactment', :body => 'Lorem ipsum')\n+ m.posts = [i]\n+ assert_not_nil i.author\n+ assert_equal m.name, i.author.name, \"Name of man should be the same before changes to parent instance\"\n+ m.name = 'Bongo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to parent instance\"\n+ i.author.name = 'Mungo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to replaced-child-owned instance\"\n+ end\n+end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "6d7f905dc548059d849548a78a9c4d4ced78a215",
filename = "activerecord/test/cases/associations/join_model_test.rb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/associations/join_model_test.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/associations/join_model_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/associations/join_model_test.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -88,7 +88,7 @@ def test_polymorphic_has_many_going_through_join_model_with_include_on_source_re\n \n def test_polymorphic_has_many_going_through_join_model_with_custom_select_and_joins\n assert_equal tags(:general), tag = posts(:welcome).tags.add_joins_and_select.first\n- tag.author_id\n+ assert_nothing_raised(NoMethodError) { tag.author_id }\n end\n \n def test_polymorphic_has_many_going_through_join_model_with_custom_foreign_key"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "ca59b3d6de7fcab9fe608c4b22558324d4078118",
filename = "activerecord/test/cases/autosave_association_test.rb",
status = "modified", additions = 3L, deletions = 2L, changes = 5L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/autosave_association_test.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/autosave_association_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/autosave_association_test.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -585,7 +585,7 @@ def test_a_marked_for_destruction_record_should_not_be_be_marked_after_reload\n @pirate.ship.mark_for_destruction\n \n assert !@pirate.reload.marked_for_destruction?\n- assert !@pirate.ship.marked_for_destruction?\n+ assert !@pirate.ship.reload.marked_for_destruction?\n end\n \n # has_one\n@@ -1311,6 +1311,7 @@ class TestAutosaveAssociationValidationsOnAHasOneAssociation < ActiveRecord::Tes\n def setup\n @pirate = Pirate.create(:catchphrase => \"Don' botharrr talkin' like one, savvy?\")\n @pirate.create_ship(:name => 'titanic')\n+ super\n end\n \n test \"should automatically validate associations with :validate => true\" do\n@@ -1319,7 +1320,7 @@ def setup\n assert !@pirate.valid?\n end\n \n- test \"should not automatically validate associations without :validate => true\" do\n+ test \"should not automatically asd validate associations without :validate => true\" do\n assert @pirate.valid?\n @pirate.non_validated_ship.name = ''\n assert @pirate.valid?"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "fd20f1b120b8db1adba7e2f26449e845b331d42f",
filename = "activerecord/test/cases/helper.rb", status = "modified",
additions = 11L, deletions = 1L, changes = 12L, blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/helper.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/helper.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/helper.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -11,7 +11,14 @@\n \n require 'active_record'\n require 'active_support/dependencies'\n-require 'connection'\n+begin\n+ require 'connection'\n+rescue LoadError\n+ # If we cannot load connection we assume that driver was not loaded for this test case, so we load sqlite3 as default one.\n+ # This allows for running separate test cases by simply running test file.\n+ connection_type = defined?(JRUBY_VERSION) ? 'jdbc' : 'native'\n+ require \"test/connections/#{connection_type}_sqlite3/connection\"\n+end\n \n # Show backtraces for deprecated behavior for quicker cleanup.\n ActiveSupport::Deprecation.debug = true\n@@ -19,6 +26,9 @@\n # Quote \"type\" if it's a reserved word for the current connection.\n QUOTED_TYPE = ActiveRecord::Base.connection.quote_column_name('type')\n \n+# Enable Identity Map for testing\n+ActiveRecord::IdentityMap.enabled = (ENV['IM'] == \"false\" ? false : true)\n+\n def current_adapter?(*types)\n types.any? do |type|\n ActiveRecord::ConnectionAdapters.const_defined?(type) &&"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "d98638ab7306d82cbc68cfe5db283dafbacdd443",
filename = "activerecord/test/cases/identity_map_test.rb",
status = "added", additions = 402L, deletions = 0L, changes = 402L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/identity_map_test.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/identity_map_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/identity_map_test.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -0,0 +1,402 @@\n+require \"cases/helper\"\n+require 'models/developer'\n+require 'models/project'\n+require 'models/company'\n+require 'models/topic'\n+require 'models/reply'\n+require 'models/computer'\n+require 'models/customer'\n+require 'models/order'\n+require 'models/post'\n+require 'models/author'\n+require 'models/tag'\n+require 'models/tagging'\n+require 'models/comment'\n+require 'models/sponsor'\n+require 'models/member'\n+require 'models/essay'\n+require 'models/subscriber'\n+require \"models/pirate\"\n+require \"models/bird\"\n+require \"models/parrot\"\n+\n+if ActiveRecord::IdentityMap.enabled?\n+class IdentityMapTest < ActiveRecord::TestCase\n+ fixtures :accounts, :companies, :developers, :projects, :topics,\n+ :developers_projects, :computers, :authors, :author_addresses,\n+ :posts, :tags, :taggings, :comments, :subscribers\n+\n+ ##############################################################################\n+ # Basic tests checking if IM is functioning properly on basic find operations#\n+ ##############################################################################\n+\n+ def test_find_id\n+ assert_same(Client.find(3), Client.find(3))\n+ end\n+\n+ def test_find_id_without_identity_map\n+ ActiveRecord::IdentityMap.without do\n+ assert_not_same(Client.find(3), Client.find(3))\n+ end\n+ end\n+\n+ def test_find_id_use_identity_map\n+ ActiveRecord::IdentityMap.enabled = false\n+ ActiveRecord::IdentityMap.use do\n+ assert_same(Client.find(3), Client.find(3))\n+ end\n+ ActiveRecord::IdentityMap.enabled = true\n+ end\n+\n+ def test_find_pkey\n+ assert_same(\n+ Subscriber.find('swistak'),\n+ Subscriber.find('swistak')\n+ )\n+ end\n+\n+ def test_find_by_id\n+ assert_same(\n+ Client.find_by_id(3),\n+ Client.find_by_id(3)\n+ )\n+ end\n+\n+ def test_find_by_string_and_numeric_id\n+ assert_same(\n+ Client.find_by_id(\"3\"),\n+ Client.find_by_id(3)\n+ )\n+ end\n+\n+ def test_find_by_pkey\n+ assert_same(\n+ Subscriber.find_by_nick('swistak'),\n+ Subscriber.find_by_nick('swistak')\n+ )\n+ end\n+\n+ def test_find_first_id\n+ assert_same(\n+ Client.find(:first, :conditions => {:id => 1}),\n+ Client.find(:first, :conditions => {:id => 1})\n+ )\n+ end\n+\n+ def test_find_first_pkey\n+ assert_same(\n+ Subscriber.find(:first, :conditions => {:nick => 'swistak'}),\n+ Subscriber.find(:first, :conditions => {:nick => 'swistak'})\n+ )\n+ end\n+\n+ ##############################################################################\n+ # Tests checking if IM is functioning properly on more advanced finds #\n+ # and associations #\n+ ##############################################################################\n+\n+ def test_owner_object_is_associated_from_identity_map\n+ post = Post.find(1)\n+ comment = post.comments.first\n+\n+ assert_no_queries do\n+ comment.post\n+ end\n+ assert_same post, comment.post\n+ end\n+\n+ def test_associated_object_are_assigned_from_identity_map\n+ post = Post.find(1)\n+\n+ post.comments.each do |comment|\n+ assert_same post, comment.post\n+ assert_equal post.object_id, comment.post.object_id\n+ end\n+ end\n+\n+ def test_creation\n+ t1 = Topic.create(\"title\" => \"t1\")\n+ t2 = Topic.find(t1.id)\n+ assert_same(t1, t2)\n+ end\n+\n+ ##############################################################################\n+ # Tests checking dirty attribute behaviour with IM #\n+ ##############################################################################\n+\n+ def test_loading_new_instance_should_not_update_dirty_attributes\n+ swistak = Subscriber.find(:first, :conditions => {:nick => 'swistak'})\n+ swistak.name = \"Swistak Sreberkowiec\"\n+ assert_equal([\"name\"], swistak.changed)\n+ assert_equal({\"name\" => [\"Marcin Raczkowski\", \"Swistak Sreberkowiec\"]}, swistak.changes)\n+\n+ s = Subscriber.find('swistak')\n+\n+ assert swistak.name_changed?\n+ assert_equal(\"Swistak Sreberkowiec\", swistak.name)\n+ end\n+\n+ def test_loading_new_instance_should_change_dirty_attribute_original_value\n+ swistak = Subscriber.find(:first, :conditions => {:nick => 'swistak'})\n+ swistak.name = \"Swistak Sreberkowiec\"\n+\n+ Subscriber.update_all({:name => \"Raczkowski Marcin\"}, {:name => \"Marcin Raczkowski\"})\n+\n+ s = Subscriber.find('swistak')\n+\n+ assert_equal({'name' => [\"Raczkowski Marcin\", \"Swistak Sreberkowiec\"]}, swistak.changes)\n+ assert_equal(\"Swistak Sreberkowiec\", swistak.name)\n+ end\n+\n+ def test_loading_new_instance_should_remove_dirt\n+ swistak = Subscriber.find(:first, :conditions => {:nick => 'swistak'})\n+ swistak.name = \"Swistak Sreberkowiec\"\n+\n+ assert_equal({\"name\" => [\"Marcin Raczkowski\", \"Swistak Sreberkowiec\"]}, swistak.changes)\n+\n+ Subscriber.update_all({:name => \"Swistak Sreberkowiec\"}, {:name => \"Marcin Raczkowski\"})\n+\n+ s = Subscriber.find('swistak')\n+\n+ assert_equal(\"Swistak Sreberkowiec\", swistak.name)\n+ assert_equal({}, swistak.changes)\n+ assert !swistak.name_changed?\n+ end\n+\n+ def test_has_many_associations\n+ pirate = Pirate.create!(:catchphrase => \"Don' botharrr talkin' like one, savvy?\")\n+ pirate.birds.create!(:name => 'Posideons Killer')\n+ pirate.birds.create!(:name => 'Killer bandita Dionne')\n+\n+ posideons, killer = pirate.birds\n+\n+ pirate.reload\n+\n+ pirate.birds_attributes = [{ :id => posideons.id, :name => 'Grace OMalley' }]\n+ assert_equal 'Grace OMalley', pirate.birds.to_a.find { |r| r.id == posideons.id }.name\n+ end\n+\n+ def test_changing_associations\n+ post1 = Post.create(\"title\" => \"One post\", \"body\" => \"Posting...\")\n+ post2 = Post.create(\"title\" => \"Another post\", \"body\" => \"Posting... Again...\")\n+ comment = Comment.new(\"body\" => \"comment\")\n+\n+ comment.post = post1\n+ assert comment.save\n+\n+ assert_same(post1.comments.first, comment)\n+\n+ comment.post = post2\n+ assert comment.save\n+\n+ assert_same(post2.comments.first, comment)\n+ assert_equal(0, post1.comments.size)\n+ end\n+\n+ def test_im_with_polymorphic_has_many_going_through_join_model_with_custom_select_and_joins\n+ tag = posts(:welcome).tags.first\n+ tag_with_joins_and_select = posts(:welcome).tags.add_joins_and_select.first\n+ assert_same(tag, tag_with_joins_and_select)\n+ assert_nothing_raised(NoMethodError, \"Joins/select was not loaded\") { tag.author_id }\n+ end\n+\n+ ##############################################################################\n+ # Tests checking Identity Map behaviour with preloaded associations, joins, #\n+ # includes etc. #\n+ ##############################################################################\n+\n+ def test_find_with_preloaded_associations\n+ assert_queries(2) do\n+ posts = Post.preload(:comments)\n+ assert posts.first.comments.first\n+ end\n+\n+ # With IM we'll retrieve post object from previous query, it'll have comments\n+ # already preloaded from first call\n+ assert_queries(1) do\n+ posts = Post.preload(:comments).to_a\n+ assert posts.first.comments.first\n+ end\n+\n+ assert_queries(2) do\n+ posts = Post.preload(:author)\n+ assert posts.first.author\n+ end\n+\n+ # With IM we'll retrieve post object from previous query, it'll have comments\n+ # already preloaded from first call\n+ assert_queries(1) do\n+ posts = Post.preload(:author).to_a\n+ assert posts.first.author\n+ end\n+\n+ assert_queries(1) do\n+ posts = Post.preload(:author, :comments).to_a\n+ assert posts.first.author\n+ assert posts.first.comments.first\n+ end\n+ end\n+\n+ def test_find_with_included_associations\n+ assert_queries(2) do\n+ posts = Post.includes(:comments)\n+ assert posts.first.comments.first\n+ end\n+\n+ assert_queries(1) do\n+ posts = Post.scoped.includes(:comments)\n+ assert posts.first.comments.first\n+ end\n+\n+ assert_queries(2) do\n+ posts = Post.includes(:author)\n+ assert posts.first.author\n+ end\n+\n+ assert_queries(1) do\n+ posts = Post.includes(:author, :comments).to_a\n+ assert posts.first.author\n+ assert posts.first.comments.first\n+ end\n+ end\n+\n+ def test_eager_loading_with_conditions_on_joined_table_preloads\n+ posts = Post.find(:all, :select => 'distinct posts.*', :include => :author, :joins => [:comments], :conditions => \"comments.body like 'Thank you%'\", :order => 'posts.id')\n+ assert_equal [posts(:welcome)], posts\n+ assert_equal authors(:david), assert_no_queries { posts[0].author}\n+ assert_same posts.first.author, Author.first\n+\n+ posts = Post.find(:all, :select => 'distinct posts.*', :include => :author, :joins => [:comments], :conditions => \"comments.body like 'Thank you%'\", :order => 'posts.id')\n+ assert_equal [posts(:welcome)], posts\n+ assert_equal authors(:david), assert_no_queries { posts[0].author}\n+ assert_same posts.first.author, Author.first\n+\n+ posts = Post.find(:all, :include => :author, :joins => {:taggings => :tag}, :conditions => \"tags.name = 'General'\", :order => 'posts.id')\n+ assert_equal posts(:welcome, :thinking), posts\n+ assert_same posts.first.author, Author.first\n+\n+ posts = Post.find(:all, :include => :author, :joins => {:taggings => {:tag => :taggings}}, :conditions => \"taggings_tags.super_tag_id=2\", :order => 'posts.id')\n+ assert_equal posts(:welcome, :thinking), posts\n+ assert_same posts.first.author, Author.first\n+ end\n+\n+ def test_eager_loading_with_conditions_on_string_joined_table_preloads\n+ posts = assert_queries(2) do\n+ Post.find(:all, :select => 'distinct posts.*', :include => :author, :joins => \"INNER JOIN comments on comments.post_id = posts.id\", :conditions => \"comments.body like 'Thank you%'\", :order => 'posts.id')\n+ end\n+ assert_equal [posts(:welcome)], posts\n+ assert_equal authors(:david), assert_no_queries { posts[0].author}\n+\n+ posts = assert_queries(1) do\n+ Post.find(:all, :select => 'distinct posts.*', :include => :author, :joins => [\"INNER JOIN comments on comments.post_id = posts.id\"], :conditions => \"comments.body like 'Thank you%'\", :order => 'posts.id')\n+ end\n+ assert_equal [posts(:welcome)], posts\n+ assert_equal authors(:david), assert_no_queries { posts[0].author}\n+ end\n+\n+ ##############################################################################\n+ # Behaviour releated to saving failures\n+ ##############################################################################\n+\n+ def test_reload_object_if_save_failed\n+ developer = Developer.first\n+ developer.salary = 0\n+\n+ assert !developer.save\n+\n+ same_developer = Developer.first\n+\n+ assert_not_same developer, same_developer\n+ assert_not_equal 0, same_developer.salary\n+ assert_not_equal developer.salary, same_developer.salary\n+ end\n+\n+ def test_reload_object_if_forced_save_failed\n+ developer = Developer.first\n+ developer.salary = 0\n+\n+ assert_raise(ActiveRecord::RecordInvalid) { developer.save! }\n+\n+ same_developer = Developer.first\n+\n+ assert_not_same developer, same_developer\n+ assert_not_equal 0, same_developer.salary\n+ assert_not_equal developer.salary, same_developer.salary\n+ end\n+\n+ def test_reload_object_if_update_attributes_fails\n+ developer = Developer.first\n+ developer.salary = 0\n+\n+ assert !developer.update_attributes(:salary => 0)\n+\n+ same_developer = Developer.first\n+\n+ assert_not_same developer, same_developer\n+ assert_not_equal 0, same_developer.salary\n+ assert_not_equal developer.salary, same_developer.salary\n+ end\n+\n+ ##############################################################################\n+ # Behaviour of readonly, forzen, destroyed\n+ ##############################################################################\n+\n+ def test_find_using_identity_map_respects_readonly_when_loading_associated_object_first\n+ author = Author.first\n+ readonly_comment = author.readonly_comments.first\n+\n+ comment = Comment.first\n+ assert !comment.readonly?\n+\n+ assert readonly_comment.readonly?\n+\n+ assert_raise(ActiveRecord::ReadOnlyRecord) {readonly_comment.save}\n+ assert comment.save\n+ end\n+\n+ def test_find_using_identity_map_respects_readonly\n+ comment = Comment.first\n+ assert !comment.readonly?\n+\n+ author = Author.first\n+ readonly_comment = author.readonly_comments.first\n+\n+ assert readonly_comment.readonly?\n+\n+ assert_raise(ActiveRecord::ReadOnlyRecord) {readonly_comment.save}\n+ assert comment.save\n+ end\n+\n+ def test_find_using_select_and_identity_map\n+ author_id, author = Author.select('id').first, Author.first\n+\n+ assert_equal author_id, author\n+ assert_same author_id, author\n+ assert_not_nil author.name\n+\n+ post, post_id = Post.first, Post.select('id').first\n+\n+ assert_equal post_id, post\n+ assert_same post_id, post\n+ assert_not_nil post.title\n+ end\n+\n+# Currently AR is not allowing changing primary key (see Persistence#update)\n+# So we ignore it. If this changes, this test needs to be uncommented.\n+# def test_updating_of_pkey\n+# assert client = Client.find(3),\n+# client.update_attribute(:id, 666)\n+#\n+# assert Client.find(666)\n+# assert_same(client, Client.find(666))\n+#\n+# s = Subscriber.find_by_nick('swistak')\n+# assert s.update_attribute(:nick, 'swistakTheJester')\n+# assert_equal('swistakTheJester', s.nick)\n+#\n+# assert stj = Subscriber.find_by_nick('swistakTheJester')\n+# assert_same(s, stj)\n+# end\n+\n+end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "37bbb17e747d5fce9ac0ad7db583c4c578293364",
filename = "activerecord/test/cases/relations_test.rb", status = "modified",
additions = 9L, deletions = 7L, changes = 16L, blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/relations_test.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/relations_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/relations_test.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -285,7 +285,7 @@ def test_find_with_preloaded_associations\n assert posts.first.comments.first\n end\n \n- assert_queries(2) do\n+ assert_queries(ActiveRecord::IdentityMap.enabled? ? 1 : 2) do\n posts = Post.preload(:comments).to_a\n assert posts.first.comments.first\n end\n@@ -295,12 +295,12 @@ def test_find_with_preloaded_associations\n assert posts.first.author\n end\n \n- assert_queries(2) do\n+ assert_queries(ActiveRecord::IdentityMap.enabled? ? 1 : 2) do\n posts = Post.preload(:author).to_a\n assert posts.first.author\n end\n \n- assert_queries(3) do\n+ assert_queries(ActiveRecord::IdentityMap.enabled? ? 1 : 3) do\n posts = Post.preload(:author, :comments).to_a\n assert posts.first.author\n assert posts.first.comments.first\n@@ -313,7 +313,7 @@ def test_find_with_included_associations\n assert posts.first.comments.first\n end\n \n- assert_queries(2) do\n+ assert_queries(ActiveRecord::IdentityMap.enabled? ? 1 : 2) do\n posts = Post.scoped.includes(:comments)\n assert posts.first.comments.first\n end\n@@ -323,7 +323,7 @@ def test_find_with_included_associations\n assert posts.first.author\n end\n \n- assert_queries(3) do\n+ assert_queries(ActiveRecord::IdentityMap.enabled? ? 1 : 3) do\n posts = Post.includes(:author, :comments).to_a\n assert posts.first.author\n assert posts.first.comments.first\n@@ -603,8 +603,10 @@ def test_relation_merging_with_locks\n end\n \n def test_relation_merging_with_preload\n- [Post.scoped.merge(Post.preload(:author)), Post.preload(:author).merge(Post.scoped)].each do |posts|\n- assert_queries(2) { assert posts.first.author }\n+ ActiveRecord::IdentityMap.without do\n+ [Post.scoped.merge(Post.preload(:author)), Post.preload(:author).merge(Post.scoped)].each do |posts|\n+ assert_queries(2) { assert posts.first.author }\n+ end\n end\n end\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "c6a8c2fa240f08135f12dec045b0d7d36cb36a62",
filename = "activerecord/test/fixtures/subscribers.yml",
status = "modified", additions = 4L, deletions = 0L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/fixtures/subscribers.yml",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/fixtures/subscribers.yml",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/fixtures/subscribers.yml?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -5,3 +5,7 @@ first:\n second:\n nick: webster132\n name: David Heinemeier Hansson\n+\n+thrid:\n+ nick: swistak\n+ name: Marcin Raczkowski\n\\ No newline at end of file"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "b7f64af3395d199511f1a6a62cb1b6b0b138e73d",
filename = "railties/lib/rails/generators/rails/app/templates/config/application.rb",
status = "modified", additions = 5L, deletions = 0L, changes = 5L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/railties/lib/rails/generators/rails/app/templates/config/application.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/railties/lib/rails/generators/rails/app/templates/config/application.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/app/templates/config/application.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -57,5 +57,10 @@ class Application < Rails::Application\n \n # Configure sensitive parameters which will be filtered from the log file.\n config.filter_parameters += [:password]\n+\n+<% unless options[:skip_active_record] -%>\n+ # Enable IdentityMap for Active Record, to disable set to false or remove the line below.\n+ config.active_record.identity_map = true\n+<% end -%>\n end\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "00029e627e32dfe0cb20a6ad6c77c7b4e559b846",
filename = "railties/lib/rails/test_help.rb", status = "modified",
additions = 4L, deletions = 0L, changes = 4L, blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/railties/lib/rails/test_help.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/railties/lib/rails/test_help.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/test_help.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -19,6 +19,10 @@\n class ActiveSupport::TestCase\n include ActiveRecord::TestFixtures\n self.fixture_path = \"#{Rails.root}/test/fixtures/\"\n+\n+ setup do\n+ ActiveRecord::IdentityMap.clear\n+ end\n end\n \n ActionDispatch::IntegrationTest.fixture_path = ActiveSupport::TestCase.fixture_path"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "19311a7fa0fdd422ae11d77a07ab2256f96c89a3",
filename = "railties/test/application/initializers/frameworks_test.rb",
status = "modified", additions = 2L, deletions = 2L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/railties/test/application/initializers/frameworks_test.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/railties/test/application/initializers/frameworks_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/application/initializers/frameworks_test.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -1,7 +1,7 @@\n require \"isolation/abstract_unit\"\n \n module ApplicationTests\n- class FrameworlsTest < Test::Unit::TestCase\n+ class FrameworksTest < Test::Unit::TestCase\n include ActiveSupport::Testing::Isolation\n \n def setup\n@@ -166,7 +166,7 @@ def from_bar_helper\n \n require \"#{app_path}/config/environment\"\n \n- expects = [ActiveRecord::ConnectionAdapters::ConnectionManagement, ActiveRecord::QueryCache, ActiveRecord::SessionStore]\n+ expects = [ActiveRecord::IdentityMap::Middleware, ActiveRecord::ConnectionAdapters::ConnectionManagement, ActiveRecord::QueryCache, ActiveRecord::SessionStore]\n middleware = Rails.application.config.middleware.map { |m| m.klass }\n assert_equal expects, middleware & expects\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "d88bd05a74eac831ac77e1bf220c01865514f981",
filename = "railties/test/application/middleware_test.rb",
status = "modified", additions = 7L, deletions = 0L, changes = 7L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/railties/test/application/middleware_test.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/railties/test/application/middleware_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/application/middleware_test.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -29,6 +29,7 @@ def app\n \"Rack::Sendfile\",\n \"ActionDispatch::Reloader\",\n \"ActionDispatch::Callbacks\",\n+ \"ActiveRecord::IdentityMap::Middleware\",\n \"ActiveRecord::ConnectionAdapters::ConnectionManagement\",\n \"ActiveRecord::QueryCache\",\n \"ActionDispatch::Cookies\",\n@@ -56,6 +57,7 @@ def app\n boot!\n assert !middleware.include?(\"ActiveRecord::ConnectionAdapters::ConnectionManagement\")\n assert !middleware.include?(\"ActiveRecord::QueryCache\")\n+ assert !middleware.include?(\"ActiveRecord::IdentityMap::Middleware\")\n end\n \n test \"removes lock if allow concurrency is set\" do\n@@ -112,6 +114,11 @@ def app\n assert_equal \"Rack::Runtime\", middleware.fourth\n end\n \n+ test \"identity map is inserted\" do\n+ boot!\n+ assert_equal \"ActiveRecord::IdentityMap::Middleware\", middleware[9]\n+ end\n+\n test \"insert middleware before\" do\n add_to_config \"config.middleware.insert_before ActionDispatch::Static, Rack::Config\"\n boot!"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "c5b1cb9a8044e54db8aad3d01fc98ba8028731e5",
filename = "railties/test/isolation/abstract_unit.rb", status = "modified",
additions = 8L, deletions = 0L, changes = 8L, blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/railties/test/isolation/abstract_unit.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/railties/test/isolation/abstract_unit.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/isolation/abstract_unit.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -215,6 +215,13 @@ def add_to_config(str)\n end\n end\n \n+ def remove_from_config(str)\n+ file = \"#{app_path}/config/application.rb\"\n+ contents = File.read(file)\n+ contents.sub!(/#{str}/, \"\")\n+ File.open(file, \"w+\") { |f| f.puts contents }\n+ end\n+\n def app_file(path, contents)\n FileUtils.mkdir_p File.dirname(\"#{app_path}/#{path}\")\n File.open(\"#{app_path}/#{path}\", 'w') do |f|\n@@ -231,6 +238,7 @@ def use_frameworks(arr)\n :activemodel,\n :activerecord,\n :activeresource] - arr\n+ remove_from_config \"config.active_record.identity_map = true\" if to_remove.include? :activerecord\n $:.reject! {|path| path =~ %r'/(#{to_remove.join('|')})/' }\n end\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:50 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Thu, 05 Feb 2015 21:27:09 GMT",
etag = "\"125fc950f6f43ba07e21e56cb9456618\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248218:54D9023E",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "b0ef53392caa42315c6206737946d931"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "a9d64cd0478b5462a73f51e573954003b7eea656", filename = "actionpack/lib/action_dispatch/http/cache.rb",
status = "modified", additions = 18L, deletions = 24L, changes = 42L,
blob_url = "https://github.com/rails/rails/blob/a4c88e369d0d0e0185df4bf370ceb31539bb4a82/actionpack/lib/action_dispatch/http/cache.rb",
raw_url = "https://github.com/rails/rails/raw/a4c88e369d0d0e0185df4bf370ceb31539bb4a82/actionpack/lib/action_dispatch/http/cache.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_dispatch/http/cache.rb?ref=a4c88e369d0d0e0185df4bf370ceb31539bb4a82",
patch = "@@ -43,16 +43,11 @@ module Response\n \n def initialize(*)\n status, header, body = super\n-\n- @cache_control = {}\n- @etag = self[\"ETag\"]\n-\n- if cache_control = self[\"Cache-Control\"]\n- cache_control.split(/,\\s*/).each do |segment|\n- first, last = segment.split(\"=\")\n- @cache_control[first.to_sym] = last || true\n- end\n- end\n+ \n+ self[\"Cache-Control\"].split(/,\\s*/).each do |segment|\n+ first, last = segment.split(\"=\")\n+ cache_control[first.to_sym] = last || true\n+ end if self[\"Cache-Control\"]\n end\n \n def last_modified\n@@ -70,22 +65,23 @@ def last_modified=(utc_time)\n end\n \n def etag\n- @etag\n- end\n-\n- def etag?\n- @etag\n+ @etag ||= self[\"ETag\"]\n end\n+ alias_method :etag?, :etag\n \n def etag=(etag)\n key = ActiveSupport::Cache.expand_cache_key(etag)\n @etag = self[\"ETag\"] = %(\"#{Digest::MD5.hexdigest(key)}\")\n end\n+ \n+ def cache_control\n+ @cache_control ||= {}\n+ end\n \n private\n \n def handle_conditional_get!\n- if etag? || last_modified? || !@cache_control.empty?\n+ if etag? || last_modified? || !cache_control.empty?\n set_conditional_cache_control!\n end\n end\n@@ -95,20 +91,18 @@ def handle_conditional_get!\n def set_conditional_cache_control!\n return if self[\"Cache-Control\"].present?\n \n- control = @cache_control\n-\n- if control.empty?\n+ if cache_control.empty?\n headers[\"Cache-Control\"] = DEFAULT_CACHE_CONTROL\n- elsif @cache_control[:no_cache]\n+ elsif cache_control[:no_cache]\n headers[\"Cache-Control\"] = \"no-cache\"\n else\n- extras = control[:extras]\n- max_age = control[:max_age]\n+ extras = cache_control[:extras]\n+ max_age = cache_control[:max_age]\n \n options = []\n options << \"max-age=#{max_age.to_i}\" if max_age\n- options << (control[:public] ? \"public\" : \"private\")\n- options << \"must-revalidate\" if control[:must_revalidate]\n+ options << (cache_control[:public] ? \"public\" : \"private\")\n+ options << \"must-revalidate\" if cache_control[:must_revalidate]\n options.concat(extras) if extras\n \n headers[\"Cache-Control\"] = options.join(\", \")"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:50 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 17:44:50 GMT",
etag = "\"254223848cdeb97763cacd05ce94f3fe\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248236:54D9023E",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "a30e6f9aa7cf5731b87dfb3b9992202d"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "dfe255ad7cc7f812e24148bcee5620a61362fd71", filename = "activerecord/lib/active_record/railtie.rb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/activerecord/lib/active_record/railtie.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/activerecord/lib/active_record/railtie.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/railtie.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -14,7 +14,7 @@ class Railtie < Rails::Railtie\n config.active_record = ActiveSupport::OrderedOptions.new\n \n config.app_generators.orm :active_record, :migration => true,\n- :timestamps => true\n+ :timestamps => true\n \n config.app_middleware.insert_after \"::ActionDispatch::Callbacks\",\n \"ActiveRecord::QueryCache\""), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "fd1cda991e169d88b18b67bb09f92ed8baf39e7c",
filename = "activesupport/lib/active_support/core_ext/hash.rb",
status = "modified", additions = 1L, deletions = 0L, changes = 1L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/activesupport/lib/active_support/core_ext/hash.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/activesupport/lib/active_support/core_ext/hash.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activesupport/lib/active_support/core_ext/hash.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -1,5 +1,6 @@\n require 'active_support/core_ext/hash/conversions'\n require 'active_support/core_ext/hash/deep_merge'\n+require 'active_support/core_ext/hash/deep_dup'\n require 'active_support/core_ext/hash/diff'\n require 'active_support/core_ext/hash/except'\n require 'active_support/core_ext/hash/indifferent_access'"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "447142605c7d80df6e2d747d2d2de4f3fdb836c5",
filename = "activesupport/lib/active_support/core_ext/hash/deep_dup.rb",
status = "added", additions = 11L, deletions = 0L, changes = 11L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/activesupport/lib/active_support/core_ext/hash/deep_dup.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/activesupport/lib/active_support/core_ext/hash/deep_dup.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activesupport/lib/active_support/core_ext/hash/deep_dup.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,11 @@\n+class Hash\n+ # Returns a deep copy of hash.\n+ def deep_dup\n+ duplicate = self.dup\n+ duplicate.each_pair do |k,v|\n+ tv = duplicate[k]\n+ duplicate[k] = tv.is_a?(Hash) && v.is_a?(Hash) ? tv.deep_dup : v\n+ end\n+ duplicate\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "bfcfddad47d2d8a6960d4abd9a24b727c37d1240",
filename = "activesupport/test/core_ext/hash_ext_test.rb",
status = "modified", additions = 15L, deletions = 0L, changes = 15L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/activesupport/test/core_ext/hash_ext_test.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/activesupport/test/core_ext/hash_ext_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activesupport/test/core_ext/hash_ext_test.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -316,6 +316,21 @@ def test_deep_merge_on_indifferent_access\n assert_equal expected, hash_1\n end\n \n+ def test_deep_dup\n+ hash = { :a => { :b => 'b' } }\n+ dup = hash.deep_dup\n+ dup[:a][:c] = 'c'\n+ assert_equal nil, hash[:a][:c]\n+ assert_equal 'c', dup[:a][:c]\n+ end\n+\n+ def test_deep_dup_initialize\n+ zero_hash = Hash.new 0\n+ hash = { :a => zero_hash }\n+ dup = hash.deep_dup\n+ assert_equal 0, dup[:a][44]\n+ end\n+\n def test_store_on_indifferent_access\n hash = HashWithIndifferentAccess.new\n hash.store(:test1, 1)"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "c8d70d8ffa43c568181885ca77b9ccaacc22d8e7",
filename = "railties/lib/rails/cli.rb", status = "modified",
additions = 6L, deletions = 1L, changes = 7L, blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/cli.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/cli.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/cli.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -11,4 +11,9 @@\n require 'rails/ruby_version_check'\n Signal.trap(\"INT\") { puts; exit }\n \n-require 'rails/commands/application'\n+if ARGV.first == 'plugin'\n+ ARGV.shift\n+ require 'rails/commands/plugin_new'\n+else\n+ require 'rails/commands/application'\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "00a7e30902e1a2162bfcb9fe379d0c5ef96b7232",
filename = "railties/lib/rails/commands/plugin_new.rb", status = "added",
additions = 16L, deletions = 0L, changes = 16L, blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/commands/plugin_new.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/commands/plugin_new.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/commands/plugin_new.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,16 @@\n+require 'rails/version'\n+if %w(--version -v).include? ARGV.first\n+ puts \"Rails #{Rails::VERSION::STRING}\"\n+ exit(0)\n+end\n+\n+if ARGV.first != \"new\"\n+ ARGV[0] = \"--help\"\n+else\n+ ARGV.shift\n+end\n+\n+require 'rails/generators'\n+require 'rails/generators/rails/plugin_new/plugin_new_generator'\n+\n+Rails::Generators::PluginNewGenerator.start"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "66fab0a760e1830cdb1572086ecaadbc6b10e2b3",
filename = "railties/lib/rails/configuration.rb", status = "modified",
additions = 8L, deletions = 0L, changes = 8L, blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/configuration.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/configuration.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/configuration.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -1,5 +1,6 @@\n require 'active_support/deprecation'\n require 'active_support/ordered_options'\n+require 'active_support/core_ext/hash/deep_dup'\n require 'rails/paths'\n require 'rails/rack'\n \n@@ -51,6 +52,13 @@ def initialize\n @colorize_logging = true\n end\n \n+ def initialize_copy(source)\n+ @aliases = @aliases.deep_dup\n+ @options = @options.deep_dup\n+ @fallbacks = @fallbacks.deep_dup\n+ @templates = @templates.dup\n+ end\n+\n def method_missing(method, *args)\n method = method.to_s.sub(/=$/, '').to_sym\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "4f458b0aeeff6f3b276d91e7bff15d1fe5ab1831",
filename = "railties/lib/rails/engine/configuration.rb",
status = "modified", additions = 1L, deletions = 0L, changes = 1L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/engine/configuration.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/engine/configuration.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/engine/configuration.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -10,6 +10,7 @@ class Configuration < ::Rails::Railtie::Configuration\n def initialize(root=nil)\n super()\n @root = root\n+ @generators = app_generators.dup\n end\n \n # Returns the middleware stack for the engine."), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "f5c626553c6eddd736f9cf7fc2570c1ae0bed8d0",
filename = "railties/lib/rails/generators/app_base.rb", status = "added",
additions = 176L, deletions = 0L, changes = 176L, blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/app_base.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/app_base.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/app_base.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,176 @@\n+require 'digest/md5'\n+require 'active_support/secure_random'\n+require 'rails/version' unless defined?(Rails::VERSION)\n+require 'rbconfig'\n+require 'open-uri'\n+require 'uri'\n+\n+module Rails\n+ module Generators\n+ class AppBase < Base\n+ DATABASES = %w( mysql oracle postgresql sqlite3 frontbase ibm_db )\n+ JAVASCRIPTS = %w( prototype jquery )\n+\n+ attr_accessor :rails_template\n+ add_shebang_option!\n+\n+ argument :app_path, :type => :string\n+\n+ def self.add_shared_options_for(name)\n+ class_option :builder, :type => :string, :aliases => \"-b\",\n+ :desc => \"Path to a #{name} builder (can be a filesystem path or URL)\"\n+\n+ class_option :template, :type => :string, :aliases => \"-m\",\n+ :desc => \"Path to an #{name} template (can be a filesystem path or URL)\"\n+\n+ class_option :skip_gemfile, :type => :boolean, :default => false,\n+ :desc => \"Don't create a Gemfile\"\n+\n+ class_option :skip_git, :type => :boolean, :aliases => \"-G\", :default => false,\n+ :desc => \"Skip Git ignores and keeps\"\n+\n+ class_option :skip_active_record, :type => :boolean, :aliases => \"-O\", :default => false,\n+ :desc => \"Skip Active Record files\"\n+\n+ class_option :database, :type => :string, :aliases => \"-d\", :default => \"sqlite3\",\n+ :desc => \"Preconfigure for selected database (options: #{DATABASES.join('/')})\"\n+\n+ class_option :javascript, :type => :string, :aliases => \"-j\", :default => \"prototype\",\n+ :desc => \"Preconfigure for selected javascript library (options: #{JAVASCRIPTS.join('/')})\"\n+\n+ class_option :skip_javascript, :type => :boolean, :aliases => \"-J\", :default => false,\n+ :desc => \"Skip javascript files\"\n+\n+ class_option :dev, :type => :boolean, :default => false,\n+ :desc => \"Setup the #{name} with Gemfile pointing to your Rails checkout\"\n+\n+ class_option :edge, :type => :boolean, :default => false,\n+ :desc => \"Setup the #{name} with Gemfile pointing to Rails repository\"\n+\n+ class_option :skip_test_unit, :type => :boolean, :aliases => \"-T\", :default => false,\n+ :desc => \"Skip Test::Unit files\"\n+\n+ class_option :help, :type => :boolean, :aliases => \"-h\", :group => :rails,\n+ :desc => \"Show this help message and quit\"\n+ end\n+\n+ def initialize(*args)\n+ @original_wd = Dir.pwd\n+\n+ super\n+ end\n+\n+ protected\n+\n+ def builder\n+ @builder ||= begin\n+ if path = options[:builder]\n+ if URI(path).is_a?(URI::HTTP)\n+ contents = open(path, \"Accept\" => \"application/x-thor-template\") {|io| io.read }\n+ else\n+ contents = open(File.expand_path(path, @original_wd)) {|io| io.read }\n+ end\n+\n+ prok = eval(\"proc { #{contents} }\", TOPLEVEL_BINDING, path, 1)\n+ instance_eval(&prok)\n+ end\n+\n+ builder_class = get_builder_class\n+ builder_class.send(:include, ActionMethods)\n+ builder_class.new(self)\n+ end\n+ end\n+\n+ def build(meth, *args)\n+ builder.send(meth, *args) if builder.respond_to?(meth)\n+ end\n+\n+ def create_root\n+ self.destination_root = File.expand_path(app_path, destination_root)\n+ valid_const?\n+\n+ empty_directory '.'\n+ set_default_accessors!\n+ FileUtils.cd(destination_root) unless options[:pretend]\n+ end\n+\n+ def apply_rails_template\n+ apply rails_template if rails_template\n+ rescue Thor::Error, LoadError, Errno::ENOENT => e\n+ raise Error, \"The template [#{rails_template}] could not be loaded. Error: #{e}\"\n+ end\n+\n+ def set_default_accessors!\n+ self.rails_template = case options[:template]\n+ when /^http:\\/\\//\n+ options[:template]\n+ when String\n+ File.expand_path(options[:template], Dir.pwd)\n+ else\n+ options[:template]\n+ end\n+ end\n+\n+ def database_gemfile_entry\n+ entry = \"\"\n+ unless options[:skip_active_record]\n+ entry = \"gem '#{gem_for_database}'\"\n+ entry << \", :require => '#{require_for_database}'\" if require_for_database\n+ end\n+ entry\n+ end\n+\n+ def rails_gemfile_entry\n+ if options.dev?\n+ <<-GEMFILE\n+gem 'rails', :path => '#{Rails::Generators::RAILS_DEV_PATH}'\n+gem 'arel', :git => 'git://github.com/rails/arel.git'\n+gem \"rack\", :git => \"git://github.com/rack/rack.git\"\n+ GEMFILE\n+ elsif options.edge?\n+ <<-GEMFILE\n+gem 'rails', :git => 'git://github.com/rails/rails.git'\n+gem 'arel', :git => 'git://github.com/rails/arel.git'\n+gem \"rack\", :git => \"git://github.com/rack/rack.git\"\n+ GEMFILE\n+ else\n+ <<-GEMFILE\n+gem 'rails', '#{Rails::VERSION::STRING}'\n+\n+# Bundle edge Rails instead:\n+# gem 'rails', :git => 'git://github.com/rails/rails.git'\n+# gem 'arel', :git => 'git://github.com/rails/arel.git'\n+# gem \"rack\", :git => \"git://github.com/rack/rack.git\"\n+ GEMFILE\n+ end\n+ end\n+\n+ def gem_for_database\n+ # %w( mysql oracle postgresql sqlite3 frontbase ibm_db )\n+ case options[:database]\n+ when \"oracle\" then \"ruby-oci8\"\n+ when \"postgresql\" then \"pg\"\n+ when \"sqlite3\" then \"sqlite3-ruby\"\n+ when \"frontbase\" then \"ruby-frontbase\"\n+ when \"mysql\" then \"mysql2\"\n+ else options[:database]\n+ end\n+ end\n+\n+ def require_for_database\n+ case options[:database]\n+ when \"sqlite3\" then \"sqlite3\"\n+ end\n+ end\n+\n+ def bundle_if_dev_or_edge\n+ bundle_command = File.basename(Thor::Util.ruby_command).sub(/ruby/, 'bundle')\n+ run \"#{bundle_command} install\" if dev_or_edge?\n+ end\n+\n+ def dev_or_edge?\n+ options.dev? || options.edge?\n+ end\n+ end\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "c8ee939ad79202d9c6a6073c4a8d3dd02b643a2c",
filename = "railties/lib/rails/generators/erb/scaffold/templates/_form.html.erb",
status = "modified", additions = 2L, deletions = 0L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/erb/scaffold/templates/_form.html.erb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/erb/scaffold/templates/_form.html.erb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/erb/scaffold/templates/_form.html.erb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -1,3 +1,4 @@\n+<% without_namespacing do -%>\n <%%= form_for(@<%= singular_table_name %>) do |f| %>\n <%% if @<%= singular_table_name %>.errors.any? %>\n <div id=\"error_explanation\">\n@@ -21,3 +22,4 @@\n <%%= f.submit %>\n </div>\n <%% end %>\n+<% end -%>"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "d1bfcbc429966ab063825199fc35f38e8f9e6cf4",
filename = "railties/lib/rails/generators/erb/scaffold/templates/edit.html.erb",
status = "modified", additions = 2L, deletions = 0L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/erb/scaffold/templates/edit.html.erb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/erb/scaffold/templates/edit.html.erb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/erb/scaffold/templates/edit.html.erb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -1,6 +1,8 @@\n+<% without_namespacing do -%>\n <h1>Editing <%= singular_table_name %></h1>\n \n <%%= render 'form' %>\n \n <%%= link_to 'Show', @<%= singular_table_name %> %> |\n <%%= link_to 'Back', <%= index_helper %>_path %>\n+<% end -%>"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "435d126ee4d3f1991cfc1b7b1760a47808f21e85",
filename = "railties/lib/rails/generators/erb/scaffold/templates/index.html.erb",
status = "modified", additions = 2L, deletions = 0L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/erb/scaffold/templates/index.html.erb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/erb/scaffold/templates/index.html.erb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/erb/scaffold/templates/index.html.erb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -1,3 +1,4 @@\n+<% without_namespacing do -%>\n <h1>Listing <%= plural_table_name %></h1>\n \n <table>\n@@ -25,3 +26,4 @@\n <br />\n \n <%%= link_to 'New <%= human_name %>', new_<%= singular_table_name %>_path %>\n+<% end -%>"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "fe4d0971c4b1d7acd37fb14c3ebd36971ccd03c8",
filename = "railties/lib/rails/generators/erb/scaffold/templates/new.html.erb",
status = "modified", additions = 2L, deletions = 0L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/erb/scaffold/templates/new.html.erb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/erb/scaffold/templates/new.html.erb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/erb/scaffold/templates/new.html.erb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -1,5 +1,7 @@\n+<% without_namespacing do -%>\n <h1>New <%= singular_table_name %></h1>\n \n <%%= render 'form' %>\n \n <%%= link_to 'Back', <%= index_helper %>_path %>\n+<% end -%>"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "bc3a87b99fd38d3f4c4d2c932c73f0c1f1cfb1ff",
filename = "railties/lib/rails/generators/erb/scaffold/templates/show.html.erb",
status = "modified", additions = 2L, deletions = 0L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/erb/scaffold/templates/show.html.erb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/erb/scaffold/templates/show.html.erb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/erb/scaffold/templates/show.html.erb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -1,3 +1,4 @@\n+<% without_namespacing do -%>\n <p id=\"notice\"><%%= notice %></p>\n \n <% for attribute in attributes -%>\n@@ -10,3 +11,4 @@\n \n <%%= link_to 'Edit', edit_<%= singular_table_name %>_path(@<%= singular_table_name %>) %> |\n <%%= link_to 'Back', <%= index_helper %>_path %>\n+<% end -%>"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "badf981d057d94ed7027d5afa047192cc96032e9",
filename = "railties/lib/rails/generators/named_base.rb",
status = "modified", additions = 7L, deletions = 1L, changes = 8L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/named_base.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/named_base.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/named_base.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -30,9 +30,15 @@ def module_namespacing(&block)\n end\n end\n \n+ def without_namespacing(&block)\n+ inside_namespace do\n+ concat(capture(&block))\n+ end\n+ end\n+\n def indent(content, multiplier = 2)\n spaces = \" \" * multiplier\n- content.each_line.map {|line| \"#{spaces}#{line}\" }.join(\"\\n\")\n+ content = content.each_line.map {|line| \"#{spaces}#{line}\" }.join\n end\n \n def wrap_with_namespace(content)"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "ef1eb8d23738dfa38f7ea8f0ac8ac07bd319fe55",
filename = "railties/lib/rails/generators/rails/app/app_generator.rb",
status = "modified", additions = 10L, deletions = 127L, changes = 137L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/app/app_generator.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/app/app_generator.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/app/app_generator.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -1,9 +1,4 @@\n-require 'digest/md5'\n-require 'active_support/secure_random'\n-require 'rails/version' unless defined?(Rails::VERSION)\n-require 'rbconfig'\n-require 'open-uri'\n-require 'uri'\n+require 'rails/generators/app_base'\n \n module Rails\n module ActionMethods\n@@ -158,60 +153,16 @@ module Generators\n RESERVED_NAMES = %w[application destroy benchmarker profiler\n plugin runner test]\n \n- class AppGenerator < Base\n- DATABASES = %w( mysql oracle postgresql sqlite3 frontbase ibm_db )\n- JAVASCRIPTS = %w( prototype jquery )\n-\n- attr_accessor :rails_template\n- add_shebang_option!\n-\n- argument :app_path, :type => :string\n-\n- class_option :database, :type => :string, :aliases => \"-d\", :default => \"sqlite3\",\n- :desc => \"Preconfigure for selected database (options: #{DATABASES.join('/')})\"\n-\n- class_option :javascript, :type => :string, :aliases => \"-j\", :default => \"prototype\",\n- :desc => \"Preconfigure for selected javascript library (options: #{JAVASCRIPTS.join('/')})\"\n-\n- class_option :builder, :type => :string, :aliases => \"-b\",\n- :desc => \"Path to an application builder (can be a filesystem path or URL)\"\n-\n- class_option :template, :type => :string, :aliases => \"-m\",\n- :desc => \"Path to an application template (can be a filesystem path or URL)\"\n-\n- class_option :dev, :type => :boolean, :default => false,\n- :desc => \"Setup the application with Gemfile pointing to your Rails checkout\"\n-\n- class_option :edge, :type => :boolean, :default => false,\n- :desc => \"Setup the application with Gemfile pointing to Rails repository\"\n-\n- class_option :skip_gemfile, :type => :boolean, :default => false,\n- :desc => \"Don't create a Gemfile\"\n-\n- class_option :skip_active_record, :type => :boolean, :aliases => \"-O\", :default => false,\n- :desc => \"Skip Active Record files\"\n-\n- class_option :skip_test_unit, :type => :boolean, :aliases => \"-T\", :default => false,\n- :desc => \"Skip Test::Unit files\"\n-\n- class_option :skip_javascript, :type => :boolean, :aliases => \"-J\", :default => false,\n- :desc => \"Skip javascript files\"\n-\n- class_option :skip_git, :type => :boolean, :aliases => \"-G\", :default => false,\n- :desc => \"Skip Git ignores and keeps\"\n+ class AppGenerator < AppBase\n+ add_shared_options_for \"application\"\n \n # Add bin/rails options\n class_option :version, :type => :boolean, :aliases => \"-v\", :group => :rails,\n :desc => \"Show Rails version number and quit\"\n \n- class_option :help, :type => :boolean, :aliases => \"-h\", :group => :rails,\n- :desc => \"Show this help message and quit\"\n-\n def initialize(*args)\n raise Error, \"Options should be given after the application name. For details run: rails --help\" if args[0].blank?\n \n- @original_wd = Dir.pwd\n-\n super\n \n if !options[:skip_active_record] && !DATABASES.include?(options[:database])\n@@ -223,14 +174,7 @@ def initialize(*args)\n end\n end\n \n- def create_root\n- self.destination_root = File.expand_path(app_path, destination_root)\n- valid_app_const?\n-\n- empty_directory '.'\n- set_default_accessors!\n- FileUtils.cd(destination_root) unless options[:pretend]\n- end\n+ public_task :create_root\n \n def create_root_files\n build(:readme)\n@@ -309,16 +253,7 @@ def finish_template\n build(:leftovers)\n end\n \n- def apply_rails_template\n- apply rails_template if rails_template\n- rescue Thor::Error, LoadError, Errno::ENOENT => e\n- raise Error, \"The template [#{rails_template}] could not be loaded. Error: #{e}\"\n- end\n-\n- def bundle_if_dev_or_edge\n- bundle_command = File.basename(Thor::Util.ruby_command).sub(/ruby/, 'bundle')\n- run \"#{bundle_command} install\" if dev_or_edge?\n- end\n+ public_task :apply_rails_template, :bundle_if_dev_or_edge\n \n protected\n \n@@ -326,40 +261,6 @@ def self.banner\n \"rails new #{self.arguments.map(&:usage).join(' ')} [options]\"\n end\n \n- def builder\n- @builder ||= begin\n- if path = options[:builder]\n- if URI(path).is_a?(URI::HTTP)\n- contents = open(path, \"Accept\" => \"application/x-thor-template\") {|io| io.read }\n- else\n- contents = open(File.expand_path(path, @original_wd)) {|io| io.read }\n- end\n-\n- prok = eval(\"proc { #{contents} }\", TOPLEVEL_BINDING, path, 1)\n- instance_eval(&prok)\n- end\n-\n- builder_class = defined?(::AppBuilder) ? ::AppBuilder : Rails::AppBuilder\n- builder_class.send(:include, ActionMethods)\n- builder_class.new(self)\n- end\n- end\n-\n- def build(meth, *args)\n- builder.send(meth, *args) if builder.respond_to?(meth)\n- end\n-\n- def set_default_accessors!\n- self.rails_template = case options[:template]\n- when /^http:\\/\\//\n- options[:template]\n- when String\n- File.expand_path(options[:template], Dir.pwd)\n- else\n- options[:template]\n- end\n- end\n-\n # Define file as an alias to create_file for backwards compatibility.\n def file(*args, &block)\n create_file(*args, &block)\n@@ -388,7 +289,7 @@ def app_const\n @app_const ||= \"#{app_const_base}::Application\"\n end\n \n- def valid_app_const?\n+ def valid_const?\n if app_const =~ /^\\d/\n raise Error, \"Invalid application name #{app_name}. Please give a name which does not start with numbers.\"\n elsif RESERVED_NAMES.include?(app_name)\n@@ -402,28 +303,6 @@ def app_secret\n ActiveSupport::SecureRandom.hex(64)\n end\n \n- def dev_or_edge?\n- options.dev? || options.edge?\n- end\n-\n- def gem_for_database\n- # %w( mysql oracle postgresql sqlite3 frontbase ibm_db )\n- case options[:database]\n- when \"oracle\" then \"ruby-oci8\"\n- when \"postgresql\" then \"pg\"\n- when \"sqlite3\" then \"sqlite3-ruby\"\n- when \"frontbase\" then \"ruby-frontbase\"\n- when \"mysql\" then \"mysql2\"\n- else options[:database]\n- end\n- end\n-\n- def require_for_database\n- case options[:database]\n- when \"sqlite3\" then \"sqlite3\"\n- end\n- end\n-\n def mysql_socket\n @mysql_socket ||= [\n \"/tmp/mysql.sock\", # default\n@@ -442,6 +321,10 @@ def empty_directory_with_gitkeep(destination, config = {})\n empty_directory(destination, config)\n create_file(\"#{destination}/.gitkeep\") unless options[:skip_git]\n end\n+\n+ def get_builder_class\n+ defined?(::AppBuilder) ? ::AppBuilder : Rails::AppBuilder\n+ end\n end\n end\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "86b9e8f40c4a7c75abf1999d902a553522e5f0aa",
filename = "railties/lib/rails/generators/rails/app/templates/Gemfile",
status = "modified", additions = 2L, deletions = 19L, changes = 21L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/app/templates/Gemfile",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/app/templates/Gemfile",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/app/templates/Gemfile?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -1,25 +1,8 @@\n source 'http://rubygems.org'\n \n-<%- if options.dev? -%>\n-gem 'rails', :path => '<%= Rails::Generators::RAILS_DEV_PATH %>'\n-gem 'arel', :git => 'git://github.com/rails/arel.git'\n-gem \"rack\", :git => \"git://github.com/rack/rack.git\"\n-<%- elsif options.edge? -%>\n-gem 'rails', :git => 'git://github.com/rails/rails.git'\n-gem 'arel', :git => 'git://github.com/rails/arel.git'\n-gem \"rack\", :git => \"git://github.com/rack/rack.git\"\n-<%- else -%>\n-gem 'rails', '<%= Rails::VERSION::STRING %>'\n+<%= rails_gemfile_entry -%>\n \n-# Bundle edge Rails instead:\n-# gem 'rails', :git => 'git://github.com/rails/rails.git'\n-# gem 'arel', :git => 'git://github.com/rails/arel.git'\n-# gem \"rack\", :git => \"git://github.com/rack/rack.git\"\n-<%- end -%>\n-\n-<% unless options[:skip_active_record] -%>\n-gem '<%= gem_for_database %>'<% if require_for_database %>, :require => '<%= require_for_database %>'<% end %>\n-<% end -%>\n+<%= database_gemfile_entry -%>\n \n # Use unicorn as the web server\n # gem 'unicorn'"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "9a7bf9f396439ea67fdbd9e62cbbf9b3d0b4a4f1",
filename = "railties/lib/rails/generators/rails/plugin_new/USAGE",
status = "added", additions = 10L, deletions = 0L, changes = 10L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/USAGE",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/USAGE",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/USAGE?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,10 @@\n+Description:\n+ The 'rails plugin new' command creates a skeleton for developing any\n+ kind of Rails extension with ability to run tests using dummy Rails\n+ application.\n+\n+Example:\n+ rails plugin new ~/Code/Ruby/blog\n+\n+ This generates a skeletal Rails plugin in ~/Code/Ruby/blog.\n+ See the README in the newly created plugin to get going."), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "8fac6fc70a72f6cc668293b9300409fce6bd737b",
filename = "railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb",
status = "added", additions = 246L, deletions = 0L, changes = 246L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,246 @@\n+require 'active_support/core_ext/hash/slice'\n+require \"rails/generators/rails/app/app_generator\"\n+\n+module Rails\n+ class PluginBuilder\n+ def rakefile\n+ template \"Rakefile\"\n+ end\n+\n+ def app\n+ directory \"app\" if options[:mountable]\n+ end\n+\n+ def readme\n+ copy_file \"README.rdoc\"\n+ end\n+\n+ def gemfile\n+ template \"Gemfile\"\n+ end\n+\n+ def license\n+ template \"MIT-LICENSE\"\n+ end\n+\n+ def gemspec\n+ template \"%name%.gemspec\"\n+ end\n+\n+ def gitignore\n+ copy_file \"gitignore\", \".gitignore\"\n+ end\n+\n+ def lib\n+ template \"lib/%name%.rb\"\n+ template \"lib/tasks/%name%_tasks.rake\"\n+ if full?\n+ template \"lib/%name%/engine.rb\"\n+ end\n+ end\n+\n+ def config\n+ template \"config/routes.rb\" if mountable?\n+ end\n+\n+ def test\n+ template \"test/test_helper.rb\"\n+ template \"test/%name%_test.rb\"\n+ append_file \"Rakefile\", <<-EOF\n+#{rakefile_test_tasks}\n+\n+task :default => :test\n+ EOF\n+ if full?\n+ template \"test/integration/navigation_test.rb\"\n+ end\n+ end\n+\n+ def generate_test_dummy(force = false)\n+ opts = (options || {}).slice(:skip_active_record, :skip_javascript, :database, :javascript)\n+ opts[:force] = force\n+\n+ invoke Rails::Generators::AppGenerator,\n+ [ File.expand_path(dummy_path, destination_root) ], opts\n+ end\n+\n+ def test_dummy_config\n+ template \"rails/boot.rb\", \"#{dummy_path}/config/boot.rb\", :force => true\n+ template \"rails/application.rb\", \"#{dummy_path}/config/application.rb\", :force => true\n+ if mountable?\n+ template \"rails/routes.rb\", \"#{dummy_path}/config/routes.rb\", :force => true\n+ end\n+ end\n+\n+ def test_dummy_clean\n+ inside dummy_path do\n+ remove_file \".gitignore\"\n+ remove_file \"db/seeds.rb\"\n+ remove_file \"doc\"\n+ remove_file \"Gemfile\"\n+ remove_file \"lib/tasks\"\n+ remove_file \"public/images/rails.png\"\n+ remove_file \"public/index.html\"\n+ remove_file \"public/robots.txt\"\n+ remove_file \"README\"\n+ remove_file \"test\"\n+ remove_file \"vendor\"\n+ end\n+ end\n+\n+ def script(force = false)\n+ directory \"script\", :force => force do |content|\n+ \"#{shebang}\\n\" + content\n+ end\n+ chmod \"script\", 0755, :verbose => false\n+ end\n+ end\n+\n+ module Generators\n+ class PluginNewGenerator < AppBase\n+ add_shared_options_for \"plugin\"\n+\n+ alias_method :plugin_path, :app_path\n+\n+ class_option :dummy_path, :type => :string, :default => \"test/dummy\",\n+ :desc => \"Create dummy application at given path\"\n+\n+ class_option :full, :type => :boolean, :default => false,\n+ :desc => \"Generate rails engine with integration tests\"\n+\n+ class_option :mountable, :type => :boolean, :default => false,\n+ :desc => \"Generate mountable isolated application\"\n+\n+ def initialize(*args)\n+ raise Error, \"Options should be given after the plugin name. For details run: rails plugin --help\" if args[0].blank?\n+\n+ super\n+ end\n+\n+ public_task :create_root\n+\n+ def create_root_files\n+ build(:readme)\n+ build(:rakefile)\n+ build(:gemspec)\n+ build(:license)\n+ build(:gitignore) unless options[:skip_git]\n+ build(:gemfile) unless options[:skip_gemfile]\n+ end\n+\n+ def create_app_files\n+ build(:app)\n+ end\n+\n+ def create_config_files\n+ build(:config)\n+ end\n+\n+ def create_lib_files\n+ build(:lib)\n+ end\n+\n+ def create_script_files\n+ build(:script)\n+ end\n+\n+ def create_test_files\n+ build(:test) unless options[:skip_test_unit]\n+ end\n+\n+ def create_test_dummy_files\n+ return if options[:skip_test_unit]\n+ create_dummy_app\n+ end\n+\n+ def finish_template\n+ build(:leftovers)\n+ end\n+\n+ public_task :apply_rails_template, :bundle_if_dev_or_edge\n+\n+ protected\n+ def create_dummy_app(path = nil)\n+ dummy_path(path) if path\n+\n+ say_status :vendor_app, dummy_path\n+ mute do\n+ build(:generate_test_dummy)\n+ store_application_definition!\n+ build(:test_dummy_config)\n+ build(:test_dummy_clean)\n+ # ensure that script/rails has proper dummy_path\n+ build(:script, true)\n+ end\n+ end\n+\n+ def full?\n+ options[:full] || options[:mountable]\n+ end\n+\n+ def mountable?\n+ options[:mountable]\n+ end\n+\n+ def self.banner\n+ \"rails plugin new #{self.arguments.map(&:usage).join(' ')} [options]\"\n+ end\n+\n+ def name\n+ @name ||= File.basename(destination_root)\n+ end\n+\n+ def camelized\n+ @camelized ||= name.gsub(/\\W/, '_').squeeze('_').camelize\n+ end\n+\n+ def valid_const?\n+ if camelized =~ /^\\d/\n+ raise Error, \"Invalid plugin name #{name}. Please give a name which does not start with numbers.\"\n+ elsif RESERVED_NAMES.include?(name)\n+ raise Error, \"Invalid plugin name #{name}. Please give a name which does not match one of the reserved rails words.\"\n+ elsif Object.const_defined?(camelized)\n+ raise Error, \"Invalid plugin name #{name}, constant #{camelized} is already in use. Please choose another application name.\"\n+ end\n+ end\n+\n+ def application_definition\n+ @application_definition ||= begin\n+\n+ dummy_application_path = File.expand_path(\"#{dummy_path}/config/application.rb\", destination_root)\n+ unless options[:pretend] || !File.exists?(dummy_application_path)\n+ contents = File.read(dummy_application_path)\n+ contents[(contents.index(\"module Dummy\"))..-1]\n+ end\n+ end\n+ end\n+ alias :store_application_definition! :application_definition\n+\n+ def get_builder_class\n+ defined?(::PluginBuilder) ? ::PluginBuilder : Rails::PluginBuilder\n+ end\n+\n+ def rakefile_test_tasks\n+ <<-RUBY\n+require 'rake/testtask'\n+\n+Rake::TestTask.new(:test) do |t|\n+ t.libs << 'lib'\n+ t.libs << 'test'\n+ t.pattern = 'test/**/*_test.rb'\n+ t.verbose = false\n+end\n+ RUBY\n+ end\n+\n+ def dummy_path(path = nil)\n+ @dummy_path = path if path\n+ @dummy_path || options[:dummy_path]\n+ end\n+\n+ def mute(&block)\n+ shell.mute(&block)\n+ end\n+ end\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "3d9bfb22c70ad7df180d7f069f88a262bb98252e",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/%name%.gemspec",
status = "added", additions = 9L, deletions = 0L, changes = 9L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/%25name%25.gemspec",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/%25name%25.gemspec",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/%25name%25.gemspec?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,9 @@\n+# Provide a simple gemspec so you can easily use your\n+# project in your rails apps through git.\n+Gem::Specification.new do |s|\n+ s.name = \"<%= name %>\"\n+ s.summary = \"Insert <%= camelized %> summary.\"\n+ s.description = \"Insert <%= camelized %> description.\"\n+ s.files = Dir[\"lib/**/*\"] + [\"MIT-LICENSE\", \"Rakefile\", \"README.rdoc\"]\n+ s.version = \"0.0.1\"\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "29900c93dc0feb2486112745029b7b8fb2ba68c8",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/Gemfile",
status = "added", additions = 11L, deletions = 0L, changes = 11L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/Gemfile",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/Gemfile",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/Gemfile?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,11 @@\n+source \"http://rubygems.org\"\n+\n+<%= rails_gemfile_entry -%>\n+\n+<% if full? -%>\n+<%= database_gemfile_entry -%>\n+<% end -%>\n+\n+if RUBY_VERSION < '1.9'\n+ gem \"ruby-debug\", \">= 0.10.3\"\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "d7a9109894a692147dc33e29af73a2a2291c371e",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/MIT-LICENSE",
status = "added", additions = 20L, deletions = 0L, changes = 20L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/MIT-LICENSE",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/MIT-LICENSE",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/MIT-LICENSE?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,20 @@\n+Copyright <%= Date.today.year %> YOURNAME\n+\n+Permission is hereby granted, free of charge, to any person obtaining\n+a copy of this software and associated documentation files (the\n+\"Software\"), to deal in the Software without restriction, including\n+without limitation the rights to use, copy, modify, merge, publish,\n+distribute, sublicense, and/or sell copies of the Software, and to\n+permit persons to whom the Software is furnished to do so, subject to\n+the following conditions:\n+\n+The above copyright notice and this permission notice shall be\n+included in all copies or substantial portions of the Software.\n+\n+THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "301d647731ec91c8819756b8d880730979390815",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/README.rdoc",
status = "added", additions = 3L, deletions = 0L, changes = 3L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/README.rdoc",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/README.rdoc",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/README.rdoc?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,3 @@\n+= <%= camelized %>\n+\n+This project rocks and uses MIT-LICENSE.\n\\ No newline at end of file"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "88f50f9f046ad978f82642b7de61eae9527eecbd",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/Rakefile",
status = "added", additions = 18L, deletions = 0L, changes = 18L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/Rakefile",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/Rakefile",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/Rakefile?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,18 @@\n+# encoding: UTF-8\n+require 'rubygems'\n+begin\n+ require 'bundler/setup'\n+rescue LoadError\n+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'\n+end\n+\n+require 'rake'\n+require 'rake/rdoctask'\n+\n+Rake::RDocTask.new(:rdoc) do |rdoc|\n+ rdoc.rdoc_dir = 'rdoc'\n+ rdoc.title = '<%= camelized %>'\n+ rdoc.options << '--line-numbers' << '--inline-source'\n+ rdoc.rdoc_files.include('README.rdoc')\n+ rdoc.rdoc_files.include('lib/**/*.rb')\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "f225bc9f7ffc9a3ef429804ea40ecff1d3549931",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/app/controllers/%name%/application_controller.rb.tt",
status = "added", additions = 4L, deletions = 0L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/app/controllers/%25name%25/application_controller.rb.tt",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/app/controllers/%25name%25/application_controller.rb.tt",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/app/controllers/%25name%25/application_controller.rb.tt?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,4 @@\n+module <%= camelized %>\n+ class ApplicationController < ActiveController::Base\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "40ae9f52c27ad7a7fd65e18094b7346d20e8a054",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/app/helpers/%name%/application_helper.rb.tt",
status = "added", additions = 4L, deletions = 0L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/app/helpers/%25name%25/application_helper.rb.tt",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/app/helpers/%25name%25/application_helper.rb.tt",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/app/helpers/%25name%25/application_helper.rb.tt?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,4 @@\n+module <%= camelized %>\n+ module ApplicationHelper\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "42ddf380d8c57458f795e008ac3d4a9fcc123031",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/config/routes.rb",
status = "added", additions = 3L, deletions = 0L, changes = 3L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/config/routes.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/config/routes.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/config/routes.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,3 @@\n+<%= camelized %>::Engine.routes.draw do\n+\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "1463de6dfb5941fd3fd54a9bd0b5c23f3ffe6c1c",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/gitignore",
status = "added", additions = 6L, deletions = 0L, changes = 6L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/gitignore",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/gitignore",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/gitignore?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,6 @@\n+.bundle/\n+log/*.log\n+pkg/\n+test/dummy/db/*.sqlite3\n+test/dummy/log/*.log\n+test/dummy/tmp/\n\\ No newline at end of file"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "2d3bdc510c50d7965a59fad75b7869f8accdf389",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/lib/%name%.rb",
status = "added", additions = 6L, deletions = 0L, changes = 6L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/lib/%25name%25.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/lib/%25name%25.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/lib/%25name%25.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,6 @@\n+<% if full? -%>\n+require \"<%= name %>/engine\"\n+\n+<% end -%>\n+module <%= camelized %>\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "9600ee0c3fdf04200667323af4e797e88014e713",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/lib/%name%/engine.rb",
status = "added", additions = 7L, deletions = 0L, changes = 7L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/lib/%25name%25/engine.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/lib/%25name%25/engine.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/lib/%25name%25/engine.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,7 @@\n+module <%= camelized %>\n+ class Engine < Rails::Engine\n+<% if mountable? -%>\n+ isolate_namespace <%= camelized %>\n+<% end -%>\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "7121f5ae23b10cb673aa0729eb0be0687524e919",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/lib/tasks/%name%_tasks.rake",
status = "added", additions = 4L, deletions = 0L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/lib/tasks/%25name%25_tasks.rake",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/lib/tasks/%25name%25_tasks.rake",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/lib/tasks/%25name%25_tasks.rake?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,4 @@\n+# desc \"Explaining what the task does\"\n+# task :<%= name %> do\n+# # Task goes here\n+# end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "8b68280a5e3fee896a3b310934cff156a649331c",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/rails/application.rb",
status = "added", additions = 16L, deletions = 0L, changes = 16L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/rails/application.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/rails/application.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/rails/application.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,16 @@\n+require File.expand_path('../boot', __FILE__)\n+\n+<% unless options[:skip_active_record] -%>\n+require 'rails/all'\n+<% else -%>\n+# require \"active_record/railtie\"\n+require \"action_controller/railtie\"\n+require \"action_mailer/railtie\"\n+require \"active_resource/railtie\"\n+require \"rails/test_unit/railtie\"\n+<% end -%>\n+\n+Bundler.require\n+require \"<%= name %>\"\n+\n+<%= application_definition %>"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "eba068137040ef8ed142c71a48b0c14eb41d6575",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/rails/boot.rb",
status = "added", additions = 10L, deletions = 0L, changes = 10L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/rails/boot.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/rails/boot.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/rails/boot.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,10 @@\n+require 'rubygems'\n+gemfile = File.expand_path('../../../../Gemfile', __FILE__)\n+\n+if File.exist?(gemfile)\n+ ENV['BUNDLE_GEMFILE'] = gemfile\n+ require 'bundler'\n+ Bundler.setup\n+end\n+\n+$:.unshift File.expand_path('../../../../lib', __FILE__)\n\\ No newline at end of file"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "730ee31c3d5ae8aa02073874bb758d96ebbedd8b",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/rails/routes.rb",
status = "added", additions = 4L, deletions = 0L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/rails/routes.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/rails/routes.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/rails/routes.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,4 @@\n+Rails.application.routes.draw do\n+\n+ mount <%= camelized %>::Engine => \"/<%= name %>\"\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "ebd5a77dd535be641ce6430df25ed27e8ec08ba1",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/script/rails.tt",
status = "added", additions = 5L, deletions = 0L, changes = 5L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/script/rails.tt",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/script/rails.tt",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/script/rails.tt?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,5 @@\n+#!/usr/bin/env ruby\n+# This command will automatically be run when you run \"rails\" with Rails 3 gems installed from the root of your application.\n+\n+ENGINE_PATH = File.expand_path('../..', __FILE__)\n+load File.expand_path('../../<%= dummy_path %>/script/rails', __FILE__)"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "0a8bbd4aaf441e8123f29fc54a2cd997b3453769",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/test/%name%_test.rb",
status = "added", additions = 7L, deletions = 0L, changes = 7L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/test/%25name%25_test.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/test/%25name%25_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/test/%25name%25_test.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,7 @@\n+require 'test_helper'\n+\n+class <%= camelized %>Test < ActiveSupport::TestCase\n+ test \"truth\" do\n+ assert_kind_of Module, <%= camelized %>\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "d06fe7cbd094a51bc2f067b9deadeab57212389a",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/test/integration/navigation_test.rb",
status = "added", additions = 11L, deletions = 0L, changes = 11L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/test/integration/navigation_test.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/test/integration/navigation_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/test/integration/navigation_test.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,11 @@\n+require 'test_helper'\n+\n+class NavigationTest < ActionDispatch::IntegrationTest\n+ fixtures :all\n+\n+ # Replace this with your real tests.\n+ test \"the truth\" do\n+ assert true\n+ end\n+end\n+"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "dbcaf6b92fb8f837b5b6f4bdc48e52454c54ec37",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/test/test_helper.rb",
status = "added", additions = 17L, deletions = 0L, changes = 17L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/test/test_helper.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/test/test_helper.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/test/test_helper.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,17 @@\n+# Configure Rails Envinronment\n+ENV[\"RAILS_ENV\"] = \"test\"\n+\n+require File.expand_path(\"../dummy/config/environment.rb\", __FILE__)\n+require \"rails/test_help\"\n+\n+Rails.backtrace_cleaner.remove_silencers!\n+\n+<% if full? && !options[:skip_active_record] -%>\n+# Run any available migration from application\n+ActiveRecord::Migrator.migrate File.expand_path(\"../dummy/db/migrate/\", __FILE__)\n+# and from engine\n+ActiveRecord::Migrator.migrate File.expand_path(\"../../db/migrate/\", __FILE__)\n+<% end -%>\n+\n+# Load support files\n+Dir[\"#{File.dirname(__FILE__)}/support/**/*.rb\"].each { |f| require f }"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "c7345f3cfbf03bde4815db8d406708005d72efd7",
filename = "railties/lib/rails/generators/rails/resource/resource_generator.rb",
status = "modified", additions = 2L, deletions = 2L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/resource/resource_generator.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/resource/resource_generator.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/resource/resource_generator.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -16,9 +16,9 @@ class ResourceGenerator < ModelGenerator #metagenerator\n \n def add_resource_route\n return if options[:actions].present?\n- route_config = class_path.collect{|namespace| \"namespace :#{namespace} do \" }.join(\" \")\n+ route_config = regular_class_path.collect{|namespace| \"namespace :#{namespace} do \" }.join(\" \")\n route_config << \"resources :#{file_name.pluralize}\"\n- route_config << \" end\" * class_path.size\n+ route_config << \" end\" * regular_class_path.size\n route route_config\n end\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "b5317a055b3ca016d56fa995a1a14c58fbeb8f82",
filename = "railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb",
status = "modified", additions = 2L, deletions = 0L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -1,3 +1,4 @@\n+<% module_namespacing do -%>\n class <%= controller_class_name %>Controller < ApplicationController\n # GET <%= route_url %>\n # GET <%= route_url %>.xml\n@@ -81,3 +82,4 @@ def destroy\n end\n end\n end\n+<% end -%>"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "c9e70468a1bbe77f7af564a671c9e6807c828f4e",
filename = "railties/lib/rails/generators/resource_helpers.rb",
status = "modified", additions = 2L, deletions = 2L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/resource_helpers.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/resource_helpers.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/resource_helpers.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -34,7 +34,7 @@ def initialize(*args) #:nodoc:\n attr_reader :controller_name\n \n def controller_class_path\n- @class_path\n+ class_path\n end\n \n def controller_file_name\n@@ -46,7 +46,7 @@ def controller_file_path\n end\n \n def controller_class_name\n- @controller_class_name ||= (controller_class_path + [controller_file_name]).map!{ |m| m.camelize }.join('::')\n+ (controller_class_path + [controller_file_name]).map!{ |m| m.camelize }.join('::')\n end\n \n def controller_i18n_scope"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "964d59d84c66b74a5a576b5b8bf4b6c0780b784e",
filename = "railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb",
status = "modified", additions = 2L, deletions = 0L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -1,5 +1,6 @@\n require 'test_helper'\n \n+<% module_namespacing do -%>\n class <%= controller_class_name %>ControllerTest < ActionController::TestCase\n setup do\n @<%= singular_table_name %> = <%= table_name %>(:one)\n@@ -47,3 +48,4 @@ class <%= controller_class_name %>ControllerTest < ActionController::TestCase\n assert_redirected_to <%= index_helper %>_path\n end\n end\n+<% end -%>"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = NULL,
filename = "railties/test/fixtures/lib/app_builders/empty_builder.rb",
status = "renamed", additions = 0L, deletions = 0L, changes = 0L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/fixtures/lib/app_builders/empty_builder.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/fixtures/lib/app_builders/empty_builder.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/fixtures/lib/app_builders/empty_builder.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url")), structure(list(sha = "993d3a2aa2766bf0f55eae21635af65480eb58d1",
filename = "railties/test/fixtures/lib/app_builders/simple_builder.rb",
status = "added", additions = 7L, deletions = 0L, changes = 7L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/fixtures/lib/app_builders/simple_builder.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/fixtures/lib/app_builders/simple_builder.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/fixtures/lib/app_builders/simple_builder.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,7 @@\n+class AppBuilder\n+ def gitignore\n+ create_file \".gitignore\", <<-R.strip\n+foobar\n+ R\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "cb50be01cb6c16edf0f6190d4e9491c18277faf0",
filename = "railties/test/fixtures/lib/app_builders/tweak_builder.rb",
status = "added", additions = 7L, deletions = 0L, changes = 7L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/fixtures/lib/app_builders/tweak_builder.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/fixtures/lib/app_builders/tweak_builder.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/fixtures/lib/app_builders/tweak_builder.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,7 @@\n+class AppBuilder < Rails::AppBuilder\n+ def gitignore\n+ create_file \".gitignore\", <<-R.strip\n+foobar\n+ R\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "e4378bbd1a51aef9b4d1f5bfdb64e683a87bedf6",
filename = "railties/test/fixtures/lib/create_test_dummy_template.rb",
status = "added", additions = 1L, deletions = 0L, changes = 1L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/fixtures/lib/create_test_dummy_template.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/fixtures/lib/create_test_dummy_template.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/fixtures/lib/create_test_dummy_template.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1 @@\n+create_dummy_app(\"spec/dummy\")"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "5c5607621c8f723eca5455da8c7e36e241a01260",
filename = "railties/test/fixtures/lib/plugin_builders/empty_builder.rb",
status = "added", additions = 2L, deletions = 0L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/fixtures/lib/plugin_builders/empty_builder.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/fixtures/lib/plugin_builders/empty_builder.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/fixtures/lib/plugin_builders/empty_builder.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,2 @@\n+class PluginBuilder\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "08f6c5535da5f6d8aa5aa3a7b3ff00aac3f598cc",
filename = "railties/test/fixtures/lib/plugin_builders/simple_builder.rb",
status = "added", additions = 7L, deletions = 0L, changes = 7L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/fixtures/lib/plugin_builders/simple_builder.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/fixtures/lib/plugin_builders/simple_builder.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/fixtures/lib/plugin_builders/simple_builder.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,7 @@\n+class PluginBuilder\n+ def gitignore\n+ create_file \".gitignore\", <<-R.strip\n+foobar\n+ R\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "aa18c7ddaa67b053e75ba0ffafc239c6fe33fc8c",
filename = "railties/test/fixtures/lib/plugin_builders/spec_builder.rb",
status = "added", additions = 19L, deletions = 0L, changes = 19L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/fixtures/lib/plugin_builders/spec_builder.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/fixtures/lib/plugin_builders/spec_builder.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/fixtures/lib/plugin_builders/spec_builder.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,19 @@\n+class PluginBuilder < Rails::PluginBuilder\n+ def test\n+ create_file \"spec/spec_helper.rb\"\n+ append_file \"Rakefile\", <<-EOF\n+# spec tasks in rakefile\n+\n+task :default => :spec\n+ EOF\n+ end\n+\n+ def generate_test_dummy\n+ dummy_path(\"spec/dummy\")\n+ super\n+ end\n+\n+ def skip_test_unit?\n+ true\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "1e801409a43ccb1f11d28b8e8161c89cd2d28642",
filename = "railties/test/fixtures/lib/plugin_builders/tweak_builder.rb",
status = "added", additions = 7L, deletions = 0L, changes = 7L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/fixtures/lib/plugin_builders/tweak_builder.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/fixtures/lib/plugin_builders/tweak_builder.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/fixtures/lib/plugin_builders/tweak_builder.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,7 @@\n+class PluginBuilder < Rails::PluginBuilder\n+ def gitignore\n+ create_file \".gitignore\", <<-R.strip\n+foobar\n+ R\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "47dcdc0d96af8cc4959d090875f0f3b65b123a77",
filename = "railties/test/fixtures/lib/simple_builder.rb",
status = "removed", additions = 0L, deletions = 7L, changes = 7L,
blob_url = "https://github.com/rails/rails/blob/d446392f76c063d9f04396a1d3ca9e314a521671/railties/test/fixtures/lib/simple_builder.rb",
raw_url = "https://github.com/rails/rails/raw/d446392f76c063d9f04396a1d3ca9e314a521671/railties/test/fixtures/lib/simple_builder.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/fixtures/lib/simple_builder.rb?ref=d446392f76c063d9f04396a1d3ca9e314a521671",
patch = "@@ -1,7 +0,0 @@\n-class AppBuilder\n- def configru\n- create_file \"config.ru\", <<-R.strip\n-run proc { |env| [200, { \"Content-Type\" => \"text/html\" }, [\"Hello World\"]] }\n- R\n- end\n-end\n\\ No newline at end of file"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "eed20ecc9b88a7818db27969967b9a148b61230e",
filename = "railties/test/fixtures/lib/tweak_builder.rb",
status = "removed", additions = 0L, deletions = 7L, changes = 7L,
blob_url = "https://github.com/rails/rails/blob/d446392f76c063d9f04396a1d3ca9e314a521671/railties/test/fixtures/lib/tweak_builder.rb",
raw_url = "https://github.com/rails/rails/raw/d446392f76c063d9f04396a1d3ca9e314a521671/railties/test/fixtures/lib/tweak_builder.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/fixtures/lib/tweak_builder.rb?ref=d446392f76c063d9f04396a1d3ca9e314a521671",
patch = "@@ -1,7 +0,0 @@\n-class AppBuilder < Rails::AppBuilder\n- def configru\n- create_file \"config.ru\", <<-R.strip\n-run proc { |env| [200, { \"Content-Type\" => \"text/html\" }, [\"Hello World\"]] }\n- R\n- end\n-end\n\\ No newline at end of file"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "6b2026ad0c4b1651459c1df439f536aa62f46ad2",
filename = "railties/test/generators/app_generator_test.rb",
status = "modified", additions = 12L, deletions = 146L, changes = 158L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/generators/app_generator_test.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/generators/app_generator_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/generators/app_generator_test.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -1,6 +1,7 @@\n require 'abstract_unit'\n require 'generators/generators_test_helper'\n require 'rails/generators/rails/app/app_generator'\n+require 'generators/shared_generator_tests.rb'\n \n DEFAULT_APP_FILES = %w(\n .gitignore\n@@ -40,36 +41,10 @@\n class AppGeneratorTest < Rails::Generators::TestCase\n include GeneratorsTestHelper\n arguments [destination_root]\n+ include SharedGeneratorTests\n \n- def setup\n- Rails.application = TestApp::Application\n- super\n- Rails::Generators::AppGenerator.instance_variable_set('@desc', nil)\n- @bundle_command = File.basename(Thor::Util.ruby_command).sub(/ruby/, 'bundle')\n- \n- Kernel::silence_warnings do\n- Thor::Base.shell.send(:attr_accessor, :always_force)\n- @shell = Thor::Base.shell.new\n- @shell.send(:always_force=, true)\n- end\n- end\n-\n- def teardown\n- super\n- Rails::Generators::AppGenerator.instance_variable_set('@desc', nil)\n- Rails.application = TestApp::Application.instance\n- end\n-\n- def test_application_skeleton_is_created\n- run_generator\n-\n- DEFAULT_APP_FILES.each{ |path| assert_file path }\n- end\n-\n- def test_application_generate_pretend\n- run_generator [\"testapp\", \"--pretend\"]\n-\n- DEFAULT_APP_FILES.each{ |path| assert_no_file path }\n+ def default_files\n+ ::DEFAULT_APP_FILES\n end\n \n def test_application_controller_and_layout_files\n@@ -78,36 +53,11 @@ def test_application_controller_and_layout_files\n assert_no_file \"public/stylesheets/application.css\"\n end\n \n- def test_options_before_application_name_raises_an_error\n- content = capture(:stderr){ run_generator([\"--skip-active-record\", destination_root]) }\n- assert_equal \"Options should be given after the application name. For details run: rails --help\\n\", content\n- end\n-\n- def test_name_collision_raises_an_error\n- reserved_words = %w[application destroy plugin runner test]\n- reserved_words.each do |reserved|\n- content = capture(:stderr){ run_generator [File.join(destination_root, reserved)] }\n- assert_equal \"Invalid application name #{reserved}. Please give a name which does not match one of the reserved rails words.\\n\", content\n- end\n- end\n-\n- def test_invalid_database_option_raises_an_error\n- content = capture(:stderr){ run_generator([destination_root, \"-d\", \"unknown\"]) }\n- assert_match /Invalid value for \\-\\-database option/, content\n- end\n-\n def test_invalid_application_name_raises_an_error\n content = capture(:stderr){ run_generator [File.join(destination_root, \"43-things\")] }\n assert_equal \"Invalid application name 43-things. Please give a name which does not start with numbers.\\n\", content\n end\n \n- def test_application_name_raises_an_error_if_name_already_used_constant\n- %w{ String Hash Class Module Set Symbol }.each do |ruby_class|\n- content = capture(:stderr){ run_generator [File.join(destination_root, ruby_class)] }\n- assert_equal \"Invalid application name #{ruby_class}, constant #{ruby_class} is already in use. Please choose another application name.\\n\", content\n- end\n- end\n-\n def test_invalid_application_name_is_fixed\n run_generator [File.join(destination_root, \"things-43\")]\n assert_file \"things-43/config/environment.rb\", /Things43::Application\\.initialize!/\n@@ -188,11 +138,6 @@ def test_prototype_and_test_unit_are_added_by_default\n assert_file \"test\"\n end\n \n- def test_test_unit_is_skipped_if_required\n- run_generator [destination_root, \"--skip-test-unit\"]\n- assert_no_file \"test\" \n- end\n- \n def test_javascript_is_skipped_if_required\n run_generator [destination_root, \"--skip-javascript\"]\n assert_file \"config/application.rb\", /^\\s+config\\.action_view\\.javascript_expansions\\[:defaults\\]\\s+=\\s+%w\\(\\)/\n@@ -217,36 +162,11 @@ def test_config_jquery_javascript_library\n assert_file \"public/javascripts/rails.js\", /jQuery/\n end\n \n- def test_shebang_is_added_to_rails_file\n- run_generator [destination_root, \"--ruby\", \"foo/bar/baz\"]\n- assert_file \"script/rails\", /#!foo\\/bar\\/baz/\n- end\n-\n- def test_shebang_when_is_the_same_as_default_use_env\n- run_generator [destination_root, \"--ruby\", Thor::Util.ruby_command]\n- assert_file \"script/rails\", /#!\\/usr\\/bin\\/env/\n- end\n-\n def test_template_from_dir_pwd\n FileUtils.cd(Rails.root)\n assert_match /It works from file!/, run_generator([destination_root, \"-m\", \"lib/template.rb\"])\n end\n \n- def test_template_raises_an_error_with_invalid_path\n- content = capture(:stderr){ run_generator([destination_root, \"-m\", \"non/existant/path\"]) }\n- assert_match /The template \\[.*\\] could not be loaded/, content\n- assert_match /non\\/existant\\/path/, content\n- end\n-\n- def test_template_is_executed_when_supplied\n- path = \"http://gist.github.com/103208.txt\"\n- template = %{ say \"It works!\" }\n- template.instance_eval \"def read; self; end\" # Make the string respond to read\n-\n- generator([destination_root], :template => path).expects(:open).with(path, 'Accept' => 'application/x-thor-template').returns(template)\n- assert_match /It works!/, silence(:stdout){ generator.invoke_all }\n- end\n-\n def test_usage_read_from_file\n File.expects(:read).returns(\"USAGE FROM FILE\")\n assert_equal \"USAGE FROM FILE\", Rails::Generators::AppGenerator.desc\n@@ -266,19 +186,6 @@ def test_file_is_added_for_backwards_compatibility\n assert_file 'lib/test_file.rb', 'heres test data'\n end\n \n- def test_dev_option\n- generator([destination_root], :dev => true).expects(:run).with(\"#{@bundle_command} install\")\n- silence(:stdout){ generator.invoke_all }\n- rails_path = File.expand_path('../../..', Rails.root)\n- assert_file 'Gemfile', /^gem\\s+[\"']rails[\"'],\\s+:path\\s+=>\\s+[\"']#{Regexp.escape(rails_path)}[\"']$/\n- end\n-\n- def test_edge_option\n- generator([destination_root], :edge => true).expects(:run).with(\"#{@bundle_command} install\")\n- silence(:stdout){ generator.invoke_all }\n- assert_file 'Gemfile', /^gem\\s+[\"']rails[\"'],\\s+:git\\s+=>\\s+[\"']#{Regexp.escape(\"git://github.com/rails/rails.git\")}[\"']$/\n- end\n-\n protected\n \n def action(*args, &block)\n@@ -292,62 +199,21 @@ class CustomAppGeneratorTest < Rails::Generators::TestCase\n tests Rails::Generators::AppGenerator\n \n arguments [destination_root]\n+ include SharedCustomGeneratorTests\n \n- def setup\n- Rails.application = TestApp::Application\n- super\n- Rails::Generators::AppGenerator.instance_variable_set('@desc', nil)\n- @bundle_command = File.basename(Thor::Util.ruby_command).sub(/ruby/, 'bundle')\n- end\n-\n- def teardown\n- super\n- Rails::Generators::AppGenerator.instance_variable_set('@desc', nil)\n- Object.class_eval { remove_const :AppBuilder if const_defined?(:AppBuilder) }\n- Rails.application = TestApp::Application.instance\n- end\n-\n- def test_builder_option_with_empty_app_builder\n- FileUtils.cd(Rails.root)\n- run_generator([destination_root, \"-b\", \"#{Rails.root}/lib/empty_builder.rb\"])\n- DEFAULT_APP_FILES.each{ |path| assert_no_file path }\n- end\n-\n- def test_builder_option_with_simple_app_builder\n- FileUtils.cd(Rails.root)\n- run_generator([destination_root, \"-b\", \"#{Rails.root}/lib/simple_builder.rb\"])\n- (DEFAULT_APP_FILES - ['config.ru']).each{ |path| assert_no_file path }\n- assert_file \"config.ru\", %[run proc { |env| [200, { \"Content-Type\" => \"text/html\" }, [\"Hello World\"]] }]\n- end\n-\n- def test_builder_option_with_relative_path\n- here = File.expand_path(File.dirname(__FILE__))\n- FileUtils.cd(here)\n- run_generator([destination_root, \"-b\", \"../fixtures/lib/simple_builder.rb\"])\n- (DEFAULT_APP_FILES - ['config.ru']).each{ |path| assert_no_file path }\n- assert_file \"config.ru\", %[run proc { |env| [200, { \"Content-Type\" => \"text/html\" }, [\"Hello World\"]] }]\n+protected\n+ def default_files\n+ ::DEFAULT_APP_FILES\n end\n \n- def test_builder_option_with_tweak_app_builder\n- FileUtils.cd(Rails.root)\n- run_generator([destination_root, \"-b\", \"#{Rails.root}/lib/tweak_builder.rb\"])\n- DEFAULT_APP_FILES.each{ |path| assert_file path }\n- assert_file \"config.ru\", %[run proc { |env| [200, { \"Content-Type\" => \"text/html\" }, [\"Hello World\"]] }]\n+ def builders_dir\n+ \"app_builders\"\n end\n \n- def test_builder_option_with_http\n- path = \"http://gist.github.com/103208.txt\"\n- template = \"class AppBuilder; end\"\n- template.instance_eval \"def read; self; end\" # Make the string respond to read\n-\n- generator([destination_root], :builder => path).expects(:open).with(path, 'Accept' => 'application/x-thor-template').returns(template)\n- capture(:stdout) { generator.invoke_all }\n-\n- DEFAULT_APP_FILES.each{ |path| assert_no_file path }\n+ def builder_class\n+ :AppBuilder\n end\n \n-protected\n-\n def action(*args, &block)\n silence(:stdout){ generator.send(*args, &block) }\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "d61a02d32fb98cf08cd4322a406a8a70d4f53c39",
filename = "railties/test/generators/namespaced_generators_test.rb",
status = "modified", additions = 153L, deletions = 0L, changes = 153L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/generators/namespaced_generators_test.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/generators/namespaced_generators_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/generators/namespaced_generators_test.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -3,6 +3,7 @@\n require 'rails/generators/rails/model/model_generator'\n require 'rails/generators/rails/observer/observer_generator'\n require 'rails/generators/mailer/mailer_generator'\n+require 'rails/generators/rails/scaffold/scaffold_generator'\n \n class NamespacedGeneratorTestCase < Rails::Generators::TestCase\n def setup\n@@ -202,3 +203,155 @@ def test_invokes_default_template_engine_even_with_no_action\n assert_file \"app/views/test_app/notifier\"\n end\n end\n+\n+class NamespacedScaffoldGeneratorTest < NamespacedGeneratorTestCase\n+ include GeneratorsTestHelper\n+ arguments %w(product_line title:string price:integer)\n+ tests Rails::Generators::ScaffoldGenerator\n+\n+ setup :copy_routes\n+\n+ def test_scaffold_on_invoke\n+ run_generator\n+\n+ # Model\n+ assert_file \"app/models/test_app/product_line.rb\", /module TestApp\\n class ProductLine < ActiveRecord::Base/\n+ assert_file \"test/unit/test_app/product_line_test.rb\", /module TestApp\\n class ProductLineTest < ActiveSupport::TestCase/\n+ assert_file \"test/fixtures/test_app/product_lines.yml\"\n+ assert_migration \"db/migrate/create_test_app_product_lines.rb\"\n+\n+ # Route\n+ assert_file \"config/routes.rb\" do |route|\n+ assert_match(/resources :product_lines$/, route)\n+ end\n+\n+ # Controller\n+ assert_file \"app/controllers/test_app/product_lines_controller.rb\" do |content|\n+ assert_match(/module TestApp\\n class ProductLinesController < ApplicationController/, content)\n+ end\n+\n+ assert_file \"test/functional/test_app/product_lines_controller_test.rb\",\n+ /module TestApp\\n class ProductLinesControllerTest < ActionController::TestCase/\n+\n+ # Views\n+ %w(\n+ index\n+ edit\n+ new\n+ show\n+ _form\n+ ).each { |view| assert_file \"app/views/test_app/product_lines/#{view}.html.erb\" }\n+ assert_no_file \"app/views/layouts/test_app/product_lines.html.erb\"\n+\n+ # Helpers\n+ assert_file \"app/helpers/test_app/product_lines_helper.rb\"\n+ assert_file \"test/unit/helpers/test_app/product_lines_helper_test.rb\"\n+\n+ # Stylesheets\n+ assert_file \"public/stylesheets/scaffold.css\"\n+ end\n+\n+ def test_scaffold_on_revoke\n+ run_generator\n+ run_generator [\"product_line\"], :behavior => :revoke\n+\n+ # Model\n+ assert_no_file \"app/models/test_app/product_line.rb\"\n+ assert_no_file \"test/unit/test_app/product_line_test.rb\"\n+ assert_no_file \"test/fixtures/test_app/product_lines.yml\"\n+ assert_no_migration \"db/migrate/create_test_app_product_lines.rb\"\n+\n+ # Route\n+ assert_file \"config/routes.rb\" do |route|\n+ assert_no_match(/resources :product_lines$/, route)\n+ end\n+\n+ # Controller\n+ assert_no_file \"app/controllers/test_app/product_lines_controller.rb\"\n+ assert_no_file \"test/functional/test_app/product_lines_controller_test.rb\"\n+\n+ # Views\n+ assert_no_file \"app/views/test_app/product_lines\"\n+ assert_no_file \"app/views/test_app/layouts/product_lines.html.erb\"\n+\n+ # Helpers\n+ assert_no_file \"app/helpers/test_app/product_lines_helper.rb\"\n+ assert_no_file \"test/unit/helpers/test_app/product_lines_helper_test.rb\"\n+\n+ # Stylesheets (should not be removed)\n+ assert_file \"public/stylesheets/scaffold.css\"\n+ end\n+\n+ def test_scaffold_with_namespace_on_invoke\n+ run_generator [ \"admin/role\", \"name:string\", \"description:string\" ]\n+\n+ # Model\n+ assert_file \"app/models/test_app/admin.rb\", /module TestApp\\n module Admin/\n+ assert_file \"app/models/test_app/admin/role.rb\", /module TestApp\\n class Admin::Role < ActiveRecord::Base/\n+ assert_file \"test/unit/test_app/admin/role_test.rb\", /module TestApp\\n class Admin::RoleTest < ActiveSupport::TestCase/\n+ assert_file \"test/fixtures/test_app/admin/roles.yml\"\n+ assert_migration \"db/migrate/create_test_app_admin_roles.rb\"\n+\n+ # Route\n+ assert_file \"config/routes.rb\" do |route|\n+ assert_match(/namespace :admin do resources :roles end$/, route)\n+ end\n+\n+ # Controller\n+ assert_file \"app/controllers/test_app/admin/roles_controller.rb\" do |content|\n+ assert_match(/module TestApp\\n class Admin::RolesController < ApplicationController/, content)\n+ end\n+\n+ assert_file \"test/functional/test_app/admin/roles_controller_test.rb\",\n+ /module TestApp\\n class Admin::RolesControllerTest < ActionController::TestCase/\n+\n+ # Views\n+ %w(\n+ index\n+ edit\n+ new\n+ show\n+ _form\n+ ).each { |view| assert_file \"app/views/test_app/admin/roles/#{view}.html.erb\" }\n+ assert_no_file \"app/views/layouts/admin/roles.html.erb\"\n+\n+ # Helpers\n+ assert_file \"app/helpers/test_app/admin/roles_helper.rb\"\n+ assert_file \"test/unit/helpers/test_app/admin/roles_helper_test.rb\"\n+\n+ # Stylesheets\n+ assert_file \"public/stylesheets/scaffold.css\"\n+ end\n+\n+ def test_scaffold_with_namespace_on_revoke\n+ run_generator [ \"admin/role\", \"name:string\", \"description:string\" ]\n+ run_generator [ \"admin/role\" ], :behavior => :revoke\n+\n+ # Model\n+ assert_file \"app/models/test_app/admin.rb\"\t# ( should not be remove )\n+ assert_no_file \"app/models/test_app/admin/role.rb\"\n+ assert_no_file \"test/unit/test_app/admin/role_test.rb\"\n+ assert_no_file \"test/fixtures/test_app/admin/roles.yml\"\n+ assert_no_migration \"db/migrate/create_test_app_admin_roles.rb\"\n+\n+ # Route\n+ assert_file \"config/routes.rb\" do |route|\n+ assert_no_match(/namespace :admin do resources :roles end$/, route)\n+ end\n+\n+ # Controller\n+ assert_no_file \"app/controllers/test_app/admin/roles_controller.rb\"\n+ assert_no_file \"test/functional/test_app/admin/roles_controller_test.rb\"\n+\n+ # Views\n+ assert_no_file \"app/views/test_app/admin/roles\"\n+ assert_no_file \"app/views/layouts/test_app/admin/roles.html.erb\"\n+\n+ # Helpers\n+ assert_no_file \"app/helpers/test_app/admin/roles_helper.rb\"\n+ assert_no_file \"test/unit/helpers/test_app/admin/roles_helper_test.rb\"\n+\n+ # Stylesheets (should not be removed)\n+ assert_file \"public/stylesheets/scaffold.css\"\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "8dc5ca90bae3fd821b509c303437669ee13f5035",
filename = "railties/test/generators/plugin_new_generator_test.rb",
status = "added", additions = 192L, deletions = 0L, changes = 192L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/generators/plugin_new_generator_test.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/generators/plugin_new_generator_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/generators/plugin_new_generator_test.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,192 @@\n+require 'abstract_unit'\n+require 'generators/generators_test_helper'\n+require 'rails/generators/rails/plugin_new/plugin_new_generator'\n+require 'generators/shared_generator_tests.rb'\n+\n+DEFAULT_PLUGIN_FILES = %w(\n+ .gitignore\n+ Gemfile\n+ Rakefile\n+ bukkits.gemspec\n+ MIT-LICENSE\n+ lib\n+ lib/bukkits.rb\n+ lib/tasks/bukkits_tasks.rake\n+ script/rails\n+ test/bukkits_test.rb\n+ test/test_helper.rb\n+ test/dummy\n+)\n+\n+\n+class PluginNewGeneratorTest < Rails::Generators::TestCase\n+ include GeneratorsTestHelper\n+ destination File.join(Rails.root, \"tmp/bukkits\")\n+ arguments [destination_root]\n+ include SharedGeneratorTests\n+\n+ def default_files\n+ ::DEFAULT_PLUGIN_FILES\n+ end\n+\n+ def test_invalid_plugin_name_raises_an_error\n+ content = capture(:stderr){ run_generator [File.join(destination_root, \"43-things\")] }\n+ assert_equal \"Invalid plugin name 43-things. Please give a name which does not start with numbers.\\n\", content\n+ end\n+\n+ def test_invalid_plugin_name_is_fixed\n+ run_generator [File.join(destination_root, \"things-43\")]\n+ assert_file \"things-43/lib/things-43.rb\", /module Things43/\n+ end\n+\n+ def test_generating_test_files\n+ run_generator\n+ assert_file \"test/test_helper.rb\"\n+ assert_file \"test/bukkits_test.rb\", /assert_kind_of Module, Bukkits/\n+ end\n+\n+ def test_generating_test_files_in_full_mode\n+ run_generator [destination_root, \"--full\"]\n+ assert_directory \"test/integration/\"\n+\n+ assert_file \"test/integration/navigation_test.rb\", /ActionDispatch::IntegrationTest/\n+ end\n+\n+ def test_ensure_that_plugin_options_are_not_passed_to_app_generator\n+ FileUtils.cd(Rails.root)\n+ assert_no_match /It works from file!.*It works_from_file/, run_generator([destination_root, \"-m\", \"lib/template.rb\"])\n+ end\n+\n+ def test_ensure_that_test_dummy_can_be_generated_from_a_template\n+ FileUtils.cd(Rails.root)\n+ run_generator([destination_root, \"-m\", \"lib/create_test_dummy_template.rb\", \"--skip-test-unit\"])\n+ assert_file \"spec/dummy\"\n+ assert_no_file \"test\"\n+ end\n+\n+ def test_database_entry_is_assed_by_default_in_full_mode\n+ run_generator([destination_root, \"--full\"])\n+ assert_file \"test/dummy/config/database.yml\", /sqlite/\n+ assert_file \"Gemfile\", /^gem\\s+[\"']sqlite3-ruby[\"'],\\s+:require\\s+=>\\s+[\"']sqlite3[\"']$/\n+ end\n+\n+ def test_config_another_database\n+ run_generator([destination_root, \"-d\", \"mysql\", \"--full\"])\n+ assert_file \"test/dummy/config/database.yml\", /mysql/\n+ assert_file \"Gemfile\", /^gem\\s+[\"']mysql2[\"']$/\n+ end\n+\n+ def test_active_record_is_removed_from_frameworks_if_skip_active_record_is_given\n+ run_generator [destination_root, \"--skip-active-record\"]\n+ assert_file \"test/dummy/config/application.rb\", /#\\s+require\\s+[\"']active_record\\/railtie[\"']/\n+ end\n+\n+ def test_ensure_that_skip_active_record_option_is_passed_to_app_generator\n+ run_generator [destination_root, \"--skip_active_record\"]\n+ assert_no_file \"test/dummy/config/database.yml\"\n+ assert_no_match /ActiveRecord/, File.read(File.join(destination_root, \"test/test_helper.rb\"))\n+ end\n+\n+ def test_ensure_that_database_option_is_passed_to_app_generator\n+ run_generator [destination_root, \"--database\", \"postgresql\"]\n+ assert_file \"test/dummy/config/database.yml\", /postgres/\n+ end\n+\n+ def test_ensure_that_javascript_option_is_passed_to_app_generator\n+ run_generator [destination_root, \"--javascript\", \"jquery\"]\n+ assert_file \"test/dummy/public/javascripts/jquery.js\"\n+ end\n+\n+ def test_ensure_that_skip_javascript_option_is_passed_to_app_generator\n+ run_generator [destination_root, \"--skip_javascript\"]\n+ assert_no_file \"test/dummy/public/javascripts/prototype.js\"\n+ end\n+\n+ def test_template_from_dir_pwd\n+ FileUtils.cd(Rails.root)\n+ assert_match /It works from file!/, run_generator([destination_root, \"-m\", \"lib/template.rb\"])\n+ end\n+\n+ def test_ensure_that_tests_works\n+ run_generator\n+ FileUtils.cd destination_root\n+ `bundle install`\n+ assert_match /1 tests, 1 assertions, 0 failures, 0 errors/, `bundle exec rake test`\n+ end\n+\n+ def test_ensure_that_tests_works_in_full_mode\n+ run_generator [destination_root, \"--full\"]\n+ FileUtils.cd destination_root\n+ `bundle install`\n+ assert_match /2 tests, 2 assertions, 0 failures, 0 errors/, `bundle exec rake test`\n+ end\n+\n+ def test_creating_engine_in_full_mode\n+ run_generator [destination_root, \"--full\"]\n+ assert_file \"lib/bukkits/engine.rb\", /module Bukkits\\n class Engine < Rails::Engine\\n end\\nend/\n+ assert_file \"lib/bukkits.rb\", /require \"bukkits\\/engine\"/\n+ end\n+\n+ def test_being_quiet_while_creating_dummy_application\n+ assert_no_match /create\\s+config\\/application.rb/, run_generator\n+ end\n+\n+ def test_create_mountable_application_with_mountable_option\n+ run_generator [destination_root, \"--mountable\"]\n+ assert_file \"config/routes.rb\", /Bukkits::Engine.routes.draw do/\n+ assert_file \"lib/bukkits/engine.rb\", /isolate_namespace Bukkits/\n+ assert_file \"test/dummy/config/routes.rb\", /mount Bukkits::Engine => \"\\/bukkits\"/\n+ assert_file \"app/controllers/bukkits/application_controller.rb\", /module Bukkits\\n class ApplicationController < ActiveController::Base/\n+ assert_file \"app/helpers/bukkits/application_helper.rb\", /module Bukkits\\n module ApplicationHelper/\n+ end\n+\n+ def test_passing_dummy_path_as_a_parameter\n+ run_generator [destination_root, \"--dummy_path\", \"spec/dummy\"]\n+ assert_file \"spec/dummy\"\n+ assert_file \"spec/dummy/config/application.rb\"\n+ assert_no_file \"test/dummy\"\n+ end\n+\n+protected\n+\n+ def action(*args, &block)\n+ silence(:stdout){ generator.send(*args, &block) }\n+ end\n+\n+end\n+\n+class CustomPluginGeneratorTest < Rails::Generators::TestCase\n+ include GeneratorsTestHelper\n+ tests Rails::Generators::PluginNewGenerator\n+\n+ destination File.join(Rails.root, \"tmp/bukkits\")\n+ arguments [destination_root]\n+ include SharedCustomGeneratorTests\n+\n+ def test_overriding_test_framework\n+ FileUtils.cd(destination_root)\n+ run_generator([destination_root, \"-b\", \"#{Rails.root}/lib/plugin_builders/spec_builder.rb\"])\n+ assert_file 'spec/spec_helper.rb'\n+ assert_file 'spec/dummy'\n+ assert_file 'Rakefile', /task :default => :spec/\n+ assert_file 'Rakefile', /# spec tasks in rakefile/\n+ assert_file 'script/rails', %r{spec/dummy}\n+ end\n+\n+protected\n+ def default_files\n+ ::DEFAULT_PLUGIN_FILES\n+ end\n+\n+ def builder_class\n+ :PluginBuilder\n+ end\n+\n+ def builders_dir\n+ \"plugin_builders\"\n+ end\n+\n+ def action(*args, &block)\n+ silence(:stdout){ generator.send(*args, &block) }\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "d117656fbdfa48b64525f768126a0e0ba32cc68f",
filename = "railties/test/generators/shared_generator_tests.rb",
status = "added", additions = 187L, deletions = 0L, changes = 187L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/generators/shared_generator_tests.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/generators/shared_generator_tests.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/generators/shared_generator_tests.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,187 @@\n+module SharedGeneratorTests\n+ def setup\n+ Rails.application = TestApp::Application\n+ super\n+ Rails::Generators::AppGenerator.instance_variable_set('@desc', nil)\n+ @bundle_command = File.basename(Thor::Util.ruby_command).sub(/ruby/, 'bundle')\n+\n+ Kernel::silence_warnings do\n+ Thor::Base.shell.send(:attr_accessor, :always_force)\n+ @shell = Thor::Base.shell.new\n+ @shell.send(:always_force=, true)\n+ end\n+ end\n+\n+ def teardown\n+ super\n+ Rails::Generators::AppGenerator.instance_variable_set('@desc', nil)\n+ Rails.application = TestApp::Application.instance\n+ end\n+\n+ def test_skeleton_is_created\n+ run_generator\n+\n+ default_files.each{ |path| assert_file path }\n+ end\n+\n+ def test_plugin_new_generate_pretend\n+ run_generator [\"testapp\", \"--pretend\"]\n+\n+ default_files.each{ |path| assert_no_file path }\n+ end\n+\n+ def test_invalid_database_option_raises_an_error\n+ content = capture(:stderr){ run_generator([destination_root, \"-d\", \"unknown\"]) }\n+ assert_match /Invalid value for \\-\\-database option/, content\n+ end\n+\n+ def test_test_unit_is_skipped_if_required\n+ run_generator [destination_root, \"--skip-test-unit\"]\n+ assert_no_file \"test\"\n+ end\n+\n+ def test_options_before_application_name_raises_an_error\n+ content = capture(:stderr){ run_generator([\"--pretend\", destination_root]) }\n+ assert_match /Options should be given after the \\w+ name. For details run: rails( plugin)? --help\\n/, content\n+ end\n+\n+ def test_name_collision_raises_an_error\n+ reserved_words = %w[application destroy plugin runner test]\n+ reserved_words.each do |reserved|\n+ content = capture(:stderr){ run_generator [File.join(destination_root, reserved)] }\n+ assert_match /Invalid \\w+ name #{reserved}. Please give a name which does not match one of the reserved rails words.\\n/, content\n+ end\n+ end\n+\n+ def test_name_raises_an_error_if_name_already_used_constant\n+ %w{ String Hash Class Module Set Symbol }.each do |ruby_class|\n+ content = capture(:stderr){ run_generator [File.join(destination_root, ruby_class)] }\n+ assert_match /Invalid \\w+ name #{ruby_class}, constant #{ruby_class} is already in use. Please choose another \\w+ name.\\n/, content\n+ end\n+ end\n+\n+ def test_shebang_is_added_to_rails_file\n+ run_generator [destination_root, \"--ruby\", \"foo/bar/baz\"]\n+ assert_file \"script/rails\", /#!foo\\/bar\\/baz/\n+ end\n+\n+ def test_shebang_when_is_the_same_as_default_use_env\n+ run_generator [destination_root, \"--ruby\", Thor::Util.ruby_command]\n+ assert_file \"script/rails\", /#!\\/usr\\/bin\\/env/\n+ end\n+\n+ def test_template_raises_an_error_with_invalid_path\n+ content = capture(:stderr){ run_generator([destination_root, \"-m\", \"non/existant/path\"]) }\n+ assert_match /The template \\[.*\\] could not be loaded/, content\n+ assert_match /non\\/existant\\/path/, content\n+ end\n+\n+ def test_template_is_executed_when_supplied\n+ path = \"http://gist.github.com/103208.txt\"\n+ template = %{ say \"It works!\" }\n+ template.instance_eval \"def read; self; end\" # Make the string respond to read\n+\n+ generator([destination_root], :template => path).expects(:open).with(path, 'Accept' => 'application/x-thor-template').returns(template)\n+ assert_match /It works!/, silence(:stdout){ generator.invoke_all }\n+ end\n+\n+ def test_dev_option\n+ generator([destination_root], :dev => true).expects(:run).with(\"#{@bundle_command} install\")\n+ silence(:stdout){ generator.invoke_all }\n+ rails_path = File.expand_path('../../..', Rails.root)\n+ assert_file 'Gemfile', /^gem\\s+[\"']rails[\"'],\\s+:path\\s+=>\\s+[\"']#{Regexp.escape(rails_path)}[\"']$/\n+ end\n+\n+ def test_edge_option\n+ generator([destination_root], :edge => true).expects(:run).with(\"#{@bundle_command} install\")\n+ silence(:stdout){ generator.invoke_all }\n+ assert_file 'Gemfile', %r{^gem\\s+[\"']rails[\"'],\\s+:git\\s+=>\\s+[\"']#{Regexp.escape(\"git://github.com/rails/rails.git\")}[\"']$}\n+ end\n+\n+ def test_template_raises_an_error_with_invalid_path\n+ content = capture(:stderr){ run_generator([destination_root, \"-m\", \"non/existant/path\"]) }\n+ assert_match /The template \\[.*\\] could not be loaded/, content\n+ assert_match /non\\/existant\\/path/, content\n+ end\n+\n+ def test_template_is_executed_when_supplied\n+ path = \"http://gist.github.com/103208.txt\"\n+ template = %{ say \"It works!\" }\n+ template.instance_eval \"def read; self; end\" # Make the string respond to read\n+\n+ generator([destination_root], :template => path).expects(:open).with(path, 'Accept' => 'application/x-thor-template').returns(template)\n+ assert_match /It works!/, silence(:stdout){ generator.invoke_all }\n+ end\n+\n+ def test_dev_option\n+ generator([destination_root], :dev => true).expects(:run).with(\"#{@bundle_command} install\")\n+ silence(:stdout){ generator.invoke_all }\n+ rails_path = File.expand_path('../../..', Rails.root)\n+ assert_file 'Gemfile', /^gem\\s+[\"']rails[\"'],\\s+:path\\s+=>\\s+[\"']#{Regexp.escape(rails_path)}[\"']$/\n+ end\n+\n+ def test_edge_option\n+ generator([destination_root], :edge => true).expects(:run).with(\"#{@bundle_command} install\")\n+ silence(:stdout){ generator.invoke_all }\n+ assert_file 'Gemfile', %r{^gem\\s+[\"']rails[\"'],\\s+:git\\s+=>\\s+[\"']#{Regexp.escape(\"git://github.com/rails/rails.git\")}[\"']$}\n+ end\n+end\n+\n+module SharedCustomGeneratorTests\n+ def setup\n+ Rails.application = TestApp::Application\n+ super\n+ Rails::Generators::AppGenerator.instance_variable_set('@desc', nil)\n+ @bundle_command = File.basename(Thor::Util.ruby_command).sub(/ruby/, 'bundle')\n+ end\n+\n+ def teardown\n+ super\n+ Rails::Generators::AppGenerator.instance_variable_set('@desc', nil)\n+ Object.class_eval do\n+ remove_const :AppBuilder if const_defined?(:AppBuilder)\n+ remove_const :PluginBuilder if const_defined?(:PluginBuilder)\n+ end\n+ Rails.application = TestApp::Application.instance\n+ end\n+\n+ def test_builder_option_with_empty_app_builder\n+ FileUtils.cd(destination_root)\n+ run_generator([destination_root, \"-b\", \"#{Rails.root}/lib/#{builders_dir}/empty_builder.rb\"])\n+ default_files.each{ |path| assert_no_file path }\n+ end\n+\n+ def test_builder_option_with_simple_plugin_builder\n+ FileUtils.cd(destination_root)\n+ run_generator([destination_root, \"-b\", \"#{Rails.root}/lib/#{builders_dir}/simple_builder.rb\"])\n+ (default_files - ['.gitignore']).each{ |path| assert_no_file path }\n+ assert_file \".gitignore\", \"foobar\"\n+ end\n+\n+ def test_builder_option_with_relative_path\n+ here = File.expand_path(File.dirname(__FILE__))\n+ FileUtils.cd(here)\n+ run_generator([destination_root, \"-b\", \"../fixtures/lib/#{builders_dir}/simple_builder.rb\"])\n+ FileUtils.cd(destination_root)\n+ (default_files - ['.gitignore']).each{ |path| assert_no_file path }\n+ assert_file \".gitignore\", \"foobar\"\n+ end\n+\n+ def test_builder_option_with_tweak_plugin_builder\n+ FileUtils.cd(destination_root)\n+ run_generator([destination_root, \"-b\", \"#{Rails.root}/lib/#{builders_dir}/tweak_builder.rb\"])\n+ default_files.each{ |path| assert_file path }\n+ assert_file \".gitignore\", \"foobar\"\n+ end\n+\n+ def test_builder_option_with_http\n+ path = \"http://gist.github.com/103208.txt\"\n+ template = \"class #{builder_class}; end\"\n+ template.instance_eval \"def read; self; end\" # Make the string respond to read\n+\n+ generator([destination_root], :builder => path).expects(:open).with(path, 'Accept' => 'application/x-thor-template').returns(template)\n+ capture(:stdout) { generator.invoke_all }\n+\n+ default_files.each{ |path| assert_no_file path }\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "822be24ef1bceea7487a9b6f22bd1a791a655ad3",
filename = "railties/test/railties/engine_test.rb", status = "modified",
additions = 20L, deletions = 0L, changes = 20L, blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/railties/engine_test.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/railties/engine_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/railties/engine_test.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -685,5 +685,25 @@ class Engine < ::Rails::Engine\n assert_equal :haml , generators[:template_engine]\n assert_equal :rspec , generators[:test_framework]\n end\n+\n+ test \"engine should get default generators with ability to overwrite them\" do\n+ @plugin.write \"lib/bukkits.rb\", <<-RUBY\n+ module Bukkits\n+ class Engine < ::Rails::Engine\n+ config.generators.test_framework :rspec\n+ end\n+ end\n+ RUBY\n+\n+ boot_rails\n+ require \"#{rails_root}/config/environment\"\n+\n+ generators = Bukkits::Engine.config.generators.options[:rails]\n+ assert_equal :active_record, generators[:orm]\n+ assert_equal :rspec , generators[:test_framework]\n+\n+ app_generators = Rails.application.config.generators.options[:rails]\n+ assert_equal :test_unit , app_generators[:test_framework]\n+ end\n end\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:50 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 12:00:46 GMT",
etag = "\"fab27acc7abf6b88c394e10940d198b1\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248254:54D9023E",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "065b43cd9674091fec48a221b420fbb3"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "9d05c7e6ee1f75f34fe9f63a267776a6794e6111", filename = "actionpack/lib/action_dispatch/http/mime_negotiation.rb",
status = "modified", additions = 7L, deletions = 3L, changes = 10L,
blob_url = "https://github.com/rails/rails/blob/153ea94ada1895ae5ac89955c9aa6a9bd1f9eb17/actionpack/lib/action_dispatch/http/mime_negotiation.rb",
raw_url = "https://github.com/rails/rails/raw/153ea94ada1895ae5ac89955c9aa6a9bd1f9eb17/actionpack/lib/action_dispatch/http/mime_negotiation.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_dispatch/http/mime_negotiation.rb?ref=153ea94ada1895ae5ac89955c9aa6a9bd1f9eb17",
patch = "@@ -22,10 +22,14 @@ def content_type\n # Returns the accepted MIME type for the request.\n def accepts\n @env[\"action_dispatch.request.accepts\"] ||= begin\n- header = @env['HTTP_ACCEPT'].to_s.strip\n+ header = @env['HTTP_ACCEPT']\n \n- if header.empty?\n- [content_mime_type]\n+ if header.blank?\n+ if xhr?\n+ [content_mime_type]\n+ else\n+ ['*/*']# Mime::ALL\n+ end\n else\n Mime::Type.parse(header)\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:50 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Sun, 08 Feb 2015 12:59:15 GMT",
etag = "\"113435674dd95556fdc93f2bdb82d9ac\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F24827B:54D9023E",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "139317cebd6caf9cd03889139437f00b"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "82134a06d40c6934bd44f2c3b4ad2cd4c262d624", filename = "activerecord/CHANGELOG",
status = "modified", additions = 8L, deletions = 1L, changes = 9L,
blob_url = "https://github.com/rails/rails/blob/23613eb6fe1064d80eba9db59e1e4f9e4bbb4e1b/activerecord/CHANGELOG",
raw_url = "https://github.com/rails/rails/raw/23613eb6fe1064d80eba9db59e1e4f9e4bbb4e1b/activerecord/CHANGELOG",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/CHANGELOG?ref=23613eb6fe1064d80eba9db59e1e4f9e4bbb4e1b",
patch = "@@ -45,7 +45,14 @@ IrreversibleMigration exception will be raised when going down.\n \n [Aaron Patterson]\n \n-*Rails 3.0.2 (unreleased)*\n+*Rails 3.0.3 (November 16, 2010)*\n+\n+* Support find by class like this: Post.where(:name => Post)\n+\n+\n+*Rails 3.0.2 (November 15, 2010)*\n+\n+* Dramatic speed increase (see: http://engineering.attinteractive.com/2010/10/arel-two-point-ohhhhh-yaaaaaa/) [Aaron Patterson]\n \n * reorder is deprecated in favor of except(:order).order(...) [Santiago Pastorino]\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:50 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 18:28:37 GMT",
etag = "\"bbb6b6053ff9ba3098f91c8e9ef10c89\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F24829D:54D9023E",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "474556b853193c38f1b14328ce2d1b7d"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "5eb1071ba2df7a152d1bad661203e364e42cf891", filename = "activerecord/lib/active_record/association_preload.rb",
status = "modified", additions = 2L, deletions = 2L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/30cf3cc8dbc6a920ae24a88f7cf59d55656a8e1d/activerecord/lib/active_record/association_preload.rb",
raw_url = "https://github.com/rails/rails/raw/30cf3cc8dbc6a920ae24a88f7cf59d55656a8e1d/activerecord/lib/active_record/association_preload.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/association_preload.rb?ref=30cf3cc8dbc6a920ae24a88f7cf59d55656a8e1d",
patch = "@@ -391,9 +391,9 @@ def in_or_equals_for_ids(ids)\n # Some databases impose a limit on the number of ids in a list (in Oracle its 1000)\n # Make several smaller queries if necessary or make one query if the adapter supports it\n def associated_records(ids)\n- max_ids_in_a_list = connection.ids_in_list_limit || ids.size\n+ in_clause_length = connection.in_clause_length || ids.size\n records = []\n- ids.each_slice(max_ids_in_a_list) do |some_ids|\n+ ids.each_slice(in_clause_length) do |some_ids|\n records += yield(some_ids)\n end\n records"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "29ac9341ecf3216888f6a813ed90a9fe4ffd6436",
filename = "activerecord/lib/active_record/connection_adapters/abstract/database_limits.rb",
status = "modified", additions = 2L, deletions = 2L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/30cf3cc8dbc6a920ae24a88f7cf59d55656a8e1d/activerecord/lib/active_record/connection_adapters/abstract/database_limits.rb",
raw_url = "https://github.com/rails/rails/raw/30cf3cc8dbc6a920ae24a88f7cf59d55656a8e1d/activerecord/lib/active_record/connection_adapters/abstract/database_limits.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/connection_adapters/abstract/database_limits.rb?ref=30cf3cc8dbc6a920ae24a88f7cf59d55656a8e1d",
patch = "@@ -37,9 +37,9 @@ def columns_per_multicolumn_index\n 16\n end\n \n- # the maximum number of elements in an IN (x,y,z) clause\n+ # the maximum number of elements in an IN (x,y,z) clause. nil means no limit\n def in_clause_length\n- 65535\n+ nil\n end\n \n # the maximum length of an SQL query"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "f3fba9a3a96d9f05858fdfdd08f4e8d756c2939c",
filename = "activerecord/lib/active_record/connection_adapters/abstract_adapter.rb",
status = "modified", additions = 0L, deletions = 5L, changes = 5L,
blob_url = "https://github.com/rails/rails/blob/30cf3cc8dbc6a920ae24a88f7cf59d55656a8e1d/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb",
raw_url = "https://github.com/rails/rails/raw/30cf3cc8dbc6a920ae24a88f7cf59d55656a8e1d/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb?ref=30cf3cc8dbc6a920ae24a88f7cf59d55656a8e1d",
patch = "@@ -91,11 +91,6 @@ def prefetch_primary_key?(table_name = nil)\n false\n end\n \n- # Does this adapter restrict the number of ids you can use in a list. Oracle has a limit of 1000.\n- def ids_in_list_limit\n- nil\n- end\n-\n # QUOTING ==================================================\n \n # Override to return the quoted table name. Defaults to column quoting."), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "ea86ac29d07cb8b361226a42d4bffe4a56f62e35",
filename = "activerecord/test/cases/associations/eager_test.rb",
status = "modified", additions = 7L, deletions = 7L, changes = 14L,
blob_url = "https://github.com/rails/rails/blob/30cf3cc8dbc6a920ae24a88f7cf59d55656a8e1d/activerecord/test/cases/associations/eager_test.rb",
raw_url = "https://github.com/rails/rails/raw/30cf3cc8dbc6a920ae24a88f7cf59d55656a8e1d/activerecord/test/cases/associations/eager_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/associations/eager_test.rb?ref=30cf3cc8dbc6a920ae24a88f7cf59d55656a8e1d",
patch = "@@ -80,31 +80,31 @@ def test_duplicate_middle_objects\n end\n \n def test_preloading_has_many_in_multiple_queries_with_more_ids_than_database_can_handle\n- Post.connection.expects(:ids_in_list_limit).at_least_once.returns(5)\n+ Post.connection.expects(:in_clause_length).at_least_once.returns(5)\n posts = Post.find(:all, :include=>:comments)\n assert_equal 7, posts.size\n end\n \n def test_preloading_has_many_in_one_queries_when_database_has_no_limit_on_ids_it_can_handle\n- Post.connection.expects(:ids_in_list_limit).at_least_once.returns(nil)\n+ Post.connection.expects(:in_clause_length).at_least_once.returns(nil)\n posts = Post.find(:all, :include=>:comments)\n assert_equal 7, posts.size\n end\n \n def test_preloading_habtm_in_multiple_queries_with_more_ids_than_database_can_handle\n- Post.connection.expects(:ids_in_list_limit).at_least_once.returns(5)\n+ Post.connection.expects(:in_clause_length).at_least_once.returns(5)\n posts = Post.find(:all, :include=>:categories)\n assert_equal 7, posts.size\n end\n \n def test_preloading_habtm_in_one_queries_when_database_has_no_limit_on_ids_it_can_handle\n- Post.connection.expects(:ids_in_list_limit).at_least_once.returns(nil)\n+ Post.connection.expects(:in_clause_length).at_least_once.returns(nil)\n posts = Post.find(:all, :include=>:categories)\n assert_equal 7, posts.size\n end\n \n def test_load_associated_records_in_one_query_when_adapter_has_no_limit\n- Post.connection.expects(:ids_in_list_limit).at_least_once.returns(nil)\n+ Post.connection.expects(:in_clause_length).at_least_once.returns(nil)\n Post.expects(:i_was_called).with([1,2,3,4,5,6,7]).returns([1])\n associated_records = Post.send(:associated_records, [1,2,3,4,5,6,7]) do |some_ids|\n Post.i_was_called(some_ids)\n@@ -113,7 +113,7 @@ def test_load_associated_records_in_one_query_when_adapter_has_no_limit\n end\n \n def test_load_associated_records_in_several_queries_when_many_ids_passed\n- Post.connection.expects(:ids_in_list_limit).at_least_once.returns(5)\n+ Post.connection.expects(:in_clause_length).at_least_once.returns(5)\n Post.expects(:i_was_called).with([1,2,3,4,5]).returns([1])\n Post.expects(:i_was_called).with([6,7]).returns([6])\n associated_records = Post.send(:associated_records, [1,2,3,4,5,6,7]) do |some_ids|\n@@ -123,7 +123,7 @@ def test_load_associated_records_in_several_queries_when_many_ids_passed\n end\n \n def test_load_associated_records_in_one_query_when_a_few_ids_passed\n- Post.connection.expects(:ids_in_list_limit).at_least_once.returns(5)\n+ Post.connection.expects(:in_clause_length).at_least_once.returns(5)\n Post.expects(:i_was_called).with([1,2,3]).returns([1])\n associated_records = Post.send(:associated_records, [1,2,3]) do |some_ids|\n Post.i_was_called(some_ids)"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:50 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Fri, 06 Feb 2015 00:49:15 GMT",
etag = "\"12bfef8ab49af5b2a2267f4e11c882c0\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F2482BA:54D9023E",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "76d9828c7e4f1d910f7ba069e90ce976"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "1f3c770c77b7a32efd73bcdc44bda5a59c85b8c5", filename = "Rakefile",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/a6dbd4b26f43528a52466b935acd1bc03708eb6c/Rakefile",
raw_url = "https://github.com/rails/rails/raw/a6dbd4b26f43528a52466b935acd1bc03708eb6c/Rakefile",
contents_url = "https://api.github.com/repos/rails/rails/contents/Rakefile?ref=a6dbd4b26f43528a52466b935acd1bc03708eb6c",
patch = "@@ -1,7 +1,7 @@\n+#!/usr/bin/env rake\n gem 'rdoc', '>= 2.5.10'\n require 'rdoc'\n \n-require 'rake'\n require 'rdoc/task'\n require 'net/http'\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "123ef9bbbf7617ced4e83711b79e9bf8bc070b9c",
filename = "actionmailer/Rakefile", status = "modified",
additions = 1L, deletions = 1L, changes = 2L, blob_url = "https://github.com/rails/rails/blob/a6dbd4b26f43528a52466b935acd1bc03708eb6c/actionmailer/Rakefile",
raw_url = "https://github.com/rails/rails/raw/a6dbd4b26f43528a52466b935acd1bc03708eb6c/actionmailer/Rakefile",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionmailer/Rakefile?ref=a6dbd4b26f43528a52466b935acd1bc03708eb6c",
patch = "@@ -1,4 +1,4 @@\n-require 'rake'\n+#!/usr/bin/env rake\n require 'rake/testtask'\n require 'rake/packagetask'\n require 'rake/gempackagetask'"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "9030db9f7a7dc63e568f7c30c86c0f7ef0d638f4",
filename = "actionpack/Rakefile", status = "modified", additions = 1L,
deletions = 1L, changes = 2L, blob_url = "https://github.com/rails/rails/blob/a6dbd4b26f43528a52466b935acd1bc03708eb6c/actionpack/Rakefile",
raw_url = "https://github.com/rails/rails/raw/a6dbd4b26f43528a52466b935acd1bc03708eb6c/actionpack/Rakefile",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/Rakefile?ref=a6dbd4b26f43528a52466b935acd1bc03708eb6c",
patch = "@@ -1,4 +1,4 @@\n-require 'rake'\n+#!/usr/bin/env rake\n require 'rake/testtask'\n require 'rake/packagetask'\n require 'rake/gempackagetask'"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = NULL,
filename = "activemodel/Rakefile", status = "changed", additions = 0L,
deletions = 0L, changes = 0L, blob_url = "https://github.com/rails/rails/blob/a6dbd4b26f43528a52466b935acd1bc03708eb6c/activemodel/Rakefile",
raw_url = "https://github.com/rails/rails/raw/a6dbd4b26f43528a52466b935acd1bc03708eb6c/activemodel/Rakefile",
contents_url = "https://api.github.com/repos/rails/rails/contents/activemodel/Rakefile?ref=a6dbd4b26f43528a52466b935acd1bc03708eb6c"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url")), structure(list(sha = "f9b77c1799c308a2893735c27033a7b839a1ace4",
filename = "activerecord/Rakefile", status = "modified",
additions = 1L, deletions = 1L, changes = 2L, blob_url = "https://github.com/rails/rails/blob/a6dbd4b26f43528a52466b935acd1bc03708eb6c/activerecord/Rakefile",
raw_url = "https://github.com/rails/rails/raw/a6dbd4b26f43528a52466b935acd1bc03708eb6c/activerecord/Rakefile",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/Rakefile?ref=a6dbd4b26f43528a52466b935acd1bc03708eb6c",
patch = "@@ -1,4 +1,4 @@\n-require 'rake'\n+#!/usr/bin/env rake\n require 'rake/testtask'\n require 'rake/packagetask'\n require 'rake/gempackagetask'"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "cf01bc1389f6dbd11912c36a89626a7658e68c23",
filename = "activeresource/Rakefile", status = "modified",
additions = 1L, deletions = 1L, changes = 2L, blob_url = "https://github.com/rails/rails/blob/a6dbd4b26f43528a52466b935acd1bc03708eb6c/activeresource/Rakefile",
raw_url = "https://github.com/rails/rails/raw/a6dbd4b26f43528a52466b935acd1bc03708eb6c/activeresource/Rakefile",
contents_url = "https://api.github.com/repos/rails/rails/contents/activeresource/Rakefile?ref=a6dbd4b26f43528a52466b935acd1bc03708eb6c",
patch = "@@ -1,4 +1,4 @@\n-require 'rake'\n+#!/usr/bin/env rake\n require 'rake/testtask'\n require 'rake/packagetask'\n require 'rake/gempackagetask'"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = NULL,
filename = "activesupport/Rakefile", status = "changed",
additions = 0L, deletions = 0L, changes = 0L, blob_url = "https://github.com/rails/rails/blob/a6dbd4b26f43528a52466b935acd1bc03708eb6c/activesupport/Rakefile",
raw_url = "https://github.com/rails/rails/raw/a6dbd4b26f43528a52466b935acd1bc03708eb6c/activesupport/Rakefile",
contents_url = "https://api.github.com/repos/rails/rails/contents/activesupport/Rakefile?ref=a6dbd4b26f43528a52466b935acd1bc03708eb6c"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url")), structure(list(sha = "5137bee761ef83b41412da1ebf4c3282adb74ca5",
filename = "railties/Rakefile", status = "modified", additions = 1L,
deletions = 1L, changes = 2L, blob_url = "https://github.com/rails/rails/blob/a6dbd4b26f43528a52466b935acd1bc03708eb6c/railties/Rakefile",
raw_url = "https://github.com/rails/rails/raw/a6dbd4b26f43528a52466b935acd1bc03708eb6c/railties/Rakefile",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/Rakefile?ref=a6dbd4b26f43528a52466b935acd1bc03708eb6c",
patch = "@@ -1,4 +1,4 @@\n-require 'rake'\n+#!/usr/bin/env rake\n require 'rake/testtask'\n require 'rake/gempackagetask'\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "4dc1023f1f3eacf04735f2c1bba46b5969fc3465",
filename = "railties/lib/rails/generators/rails/app/templates/Rakefile",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/a6dbd4b26f43528a52466b935acd1bc03708eb6c/railties/lib/rails/generators/rails/app/templates/Rakefile",
raw_url = "https://github.com/rails/rails/raw/a6dbd4b26f43528a52466b935acd1bc03708eb6c/railties/lib/rails/generators/rails/app/templates/Rakefile",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/app/templates/Rakefile?ref=a6dbd4b26f43528a52466b935acd1bc03708eb6c",
patch = "@@ -1,7 +1,7 @@\n+#!/usr/bin/env rake\n # Add your own tasks in files placed in lib/tasks ending in .rake,\n # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.\n \n require File.expand_path('../config/application', __FILE__)\n-require 'rake'\n \n <%= app_const %>.load_tasks"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "77149ae3519986b3841e332f80d51d8cddbad377",
filename = "railties/lib/rails/generators/rails/plugin/templates/Rakefile.tt",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/a6dbd4b26f43528a52466b935acd1bc03708eb6c/railties/lib/rails/generators/rails/plugin/templates/Rakefile.tt",
raw_url = "https://github.com/rails/rails/raw/a6dbd4b26f43528a52466b935acd1bc03708eb6c/railties/lib/rails/generators/ra