Class: SuperDummyGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/super/test_support/generate_dummy.rb

Instance Method Summary collapse

Instance Method Details

#create_new_pluginObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/super/test_support/generate_dummy.rb', line 30

def create_new_plugin
  if plugin_name.blank?
    warn "Not currently in a plugin directory"
    exit
  end

  opts = {
    force: true,
    skip_active_storage: true,
    skip_action_mailer: true,
    skip_action_mailbox: true,
    skip_action_text: true,
    skip_active_storage: true,
    skip_action_cable: true,
    skip_puma: true,
    skip_coffee: true,
    database: "sqlite3",
  }

  Dir.mktmpdir do |dir|
    plugin_path = File.join(dir, plugin_name)
    generated_dummy_path = File.join(plugin_path, "test/dummy")

    invoke(Rails::Generators::PluginGenerator, [plugin_path], opts)

    inside(generated_dummy_path) do
      remove_file(".ruby-version")
    end

    FileUtils.rm_rf(dummy_path)
    FileUtils.mv(generated_dummy_path, dummy_path)
  end
end

#delete_unnecessary_filesObject



64
65
66
67
68
69
70
71
# File 'lib/super/test_support/generate_dummy.rb', line 64

def delete_unnecessary_files
  inside(dummy_path) do
    remove_file("app/assets/javascripts/cable.js")
    remove_file("app/channels/")
    remove_file("public/apple-touch-icon-precomposed.png")
    remove_file("public/apple-touch-icon.png")
  end
end