lib/appengine/railtie.rb in appengine-0.3.0 vs lib/appengine/railtie.rb in appengine-0.4.0
- old
+ new
@@ -11,37 +11,79 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
;
-require 'fileutils'
-
module AppEngine
-
- # == AppEngine Rails integration
+ ##
+ # # AppEngine Rails integration
#
# A Railtie providing Rails integration with the Google App Engine runtime
- # environment. Sets up the Rails logger to log to the Google Cloud Console
- # in production.
+ # environment.
#
+ # Specifically:
+ #
+ # * It installs the Stackdriver instrumentation, providing application
+ # diagnostics to the project's Stackdriver account.
+ # * It installs the rake tasks, providing the ability to execute commands
+ # on demand in the production App Engine environment.
+ #
# To use, just include the "appengine" gem in your gemfile, and make sure
# it is required in your config/application.rb (if you are not already
# using Bundler.require).
#
- # === Configuration
+ # ## Configuration
#
- # This is a placeholder for now.
-
+ # You may selectively deactivate features of this Railtie using Rails
+ # configuration keys. For example, to disable rake tasks, include the
+ # following line in one of your Rails configuration files:
+ #
+ # config.appengine.define_tasks = false
+ #
+ # The following configuration keys are supported. Additional keys specific
+ # to the various Stackdriver services may be defined in the individual
+ # libraries.
+ #
+ # ### appengine.define_tasks
+ #
+ # Causes rake tasks to be added to the application. Default is true. Set it
+ # to false to disable App Engine rake tasks.
+ #
+ # ### google_cloud.use_logging
+ #
+ # Activates Stackdriver Logging, collecting Rails logs so they appear on
+ # the Google Cloud console. Default is true. Set it to false to disable
+ # logging instrumentation.
+ #
+ # ### google_cloud.use_error_reporting
+ #
+ # Activates Stackdriver Error Reporting, collecting exceptions so they appear
+ # on the Google Cloud console. Default is true. Set it to false to disable
+ # error instrumentation.
+ #
+ # ### google_cloud.use_trace
+ #
+ # Activates Stackdriver Trace instrumentation, collecting application latency
+ # trace data so it appears on the Google Cloud conosle. Default is true. Set
+ # it to false to disable trace instrumentation.
+ #
+ # ### google_cloud.use_debugger
+ #
+ # Enables the Stackdriver Debugger. Default is true. Set it to false to
+ # disable debugging.
+ #
class Railtie < ::Rails::Railtie
- # :stopdoc:
-
config.appengine = ::ActiveSupport::OrderedOptions.new
+ config.appengine.define_tasks = true
- # :startdoc:
+ rake_tasks do |app|
+ if app.config.appengine.define_tasks
+ require "appengine/tasks"
+ end
+ end
end
-
end