diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2018-09-17 16:30:33 -0700 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2018-09-17 16:30:33 -0700 |
commit | 4ab739a72a30911e8a72abeb19428434cbc03a2e (patch) | |
tree | 0cd18a0d172b8bf644eaed6235452baa9b8910d9 /lib | |
download | rails-4ab739a72a30911e8a72abeb19428434cbc03a2e.tar.gz rails-4ab739a72a30911e8a72abeb19428434cbc03a2e.tar.bz2 rails-4ab739a72a30911e8a72abeb19428434cbc03a2e.zip |
Skeleton
Diffstat (limited to 'lib')
-rw-r--r-- | lib/action_mailbox.rb | 7 | ||||
-rw-r--r-- | lib/action_mailbox/base.rb | 2 | ||||
-rw-r--r-- | lib/action_mailbox/engine.rb | 14 | ||||
-rw-r--r-- | lib/action_mailbox/version.rb | 3 | ||||
-rw-r--r-- | lib/tasks/action_mailbox.rake | 30 |
5 files changed, 56 insertions, 0 deletions
diff --git a/lib/action_mailbox.rb b/lib/action_mailbox.rb new file mode 100644 index 0000000000..c4ed71d5cc --- /dev/null +++ b/lib/action_mailbox.rb @@ -0,0 +1,7 @@ +require "action_mailbox/engine" + +module ActionMailbox + extend ActiveSupport::Autoload + + autoload :Base +end diff --git a/lib/action_mailbox/base.rb b/lib/action_mailbox/base.rb new file mode 100644 index 0000000000..75098875eb --- /dev/null +++ b/lib/action_mailbox/base.rb @@ -0,0 +1,2 @@ +class ActionMailbox::Base +end diff --git a/lib/action_mailbox/engine.rb b/lib/action_mailbox/engine.rb new file mode 100644 index 0000000000..92852a0fa3 --- /dev/null +++ b/lib/action_mailbox/engine.rb @@ -0,0 +1,14 @@ +require "rails/engine" + +module ActionMailbox + class Engine < Rails::Engine + isolate_namespace ActionMailbox + config.eager_load_namespaces << ActionMailbox + + initializer "action_mailbox.config" do + config.after_initialize do |app| + # Configure + end + end + end +end diff --git a/lib/action_mailbox/version.rb b/lib/action_mailbox/version.rb new file mode 100644 index 0000000000..23c615dbbd --- /dev/null +++ b/lib/action_mailbox/version.rb @@ -0,0 +1,3 @@ +module ActionMailbox + VERSION = '0.1.0' +end diff --git a/lib/tasks/action_mailbox.rake b/lib/tasks/action_mailbox.rake new file mode 100644 index 0000000000..58dd59d9eb --- /dev/null +++ b/lib/tasks/action_mailbox.rake @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +namespace :action_mailbox do + # Prevent migration installation task from showing up twice. + Rake::Task["install:migrations"].clear_comments + + desc "Copy over the migration and fixtures" + task install: %w( environment active_storage:install copy_migration copy_fixtures ) + + task :copy_migration do + if Rake::Task.task_defined?("action_mailbox:install:migrations") + Rake::Task["action_mailbox:install:migrations"].invoke + else + Rake::Task["app:action_mailbox:install:migrations"].invoke + end + end + + FIXTURE_TEMPLATE_PATH = File.expand_path("../templates/fixtures.yml", __dir__) + FIXTURE_APP_DIR_PATH = Rails.root.join("test/fixtures/action_mailbox") + FIXTURE_APP_PATH = FIXTURE_APP_DIR_PATH.join("inbound_emails.yml") + + task :copy_fixtures do + if File.exist?(FIXTURE_APP_PATH) + puts "Won't copy Action Mailbox fixtures as it already exists" + else + FileUtils.mkdir FIXTURE_APP_DIR_PATH + FileUtils.cp FIXTURE_TEMPLATE_PATH, FIXTURE_APP_PATH + end + end +end |