super_test_engine 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae5b0b80edaab4c21262fe966970c17809c3e8236dd1fdcc4f474a4b5ecb0dbd
4
- data.tar.gz: 1d5c5e9659b73677b6ce1bba7169d749410b479adcdbd1c65d67bc8239052c08
3
+ metadata.gz: b36cb5c5cd12cb612d684cfcef77e28eeeb4031df1af9d85064558f5b1fbec4b
4
+ data.tar.gz: 8ec63781d875fe9b8c911346ba5326cc08a79aac643a40879d87e9c8d0c24cb7
5
5
  SHA512:
6
- metadata.gz: 0c4f131d209998de0c6f649e78d9acf4829f9d554735c9aa36f4151ff64ff6ff6be41ea0e75cba07b314674782518ba58987f99ec27a503cc25f50027de39398
7
- data.tar.gz: 448e405d747db1e24d70c2e109a6aa28abf23ac9adb44c602c70550357d2e6d7e5009561b6e66855581206f44033ca5a2204e1825d87e8bfcfd887dd2573c944
6
+ metadata.gz: 71357986a8086fc61d45e05a71c4b3cf09c9fb9362e9613bdae2ce3b0ab898b777007c6299f37623fd4085c91404a7f90fd135000ac0082ff75919d72ddf6fd6
7
+ data.tar.gz: 469d89f814b916bddc3160e55e5a667992ae1d523ada8ce978884844f078d10431bb6474287b19f35e83f639a66c0d513e03dcf8319e5879780d5f1876e3854a
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Deletes the existing test dummy application and recreates it
3
+
4
+ Example:
5
+ rails generate super_test_engine:dummy
6
+
7
+ This will create:
8
+ test/dummy/
@@ -0,0 +1,101 @@
1
+ require "fileutils"
2
+ require "tmpdir"
3
+
4
+ require "rails"
5
+ require "rails/generators/rails/app/app_generator"
6
+ require "rails/generators/rails/plugin/plugin_generator"
7
+ require "generators/super/install/install_generator"
8
+
9
+ Rails::Generators::AppGenerator
10
+
11
+ module Rails
12
+ module Generators
13
+ class AppGenerator
14
+ def valid_const?
15
+ true
16
+ end
17
+ end
18
+
19
+ class PluginGenerator
20
+ def valid_const?
21
+ true
22
+ end
23
+ end
24
+ end
25
+ end
26
+
27
+ module SuperTestEngine
28
+ class DummyGenerator < Rails::Generators::Base
29
+ source_root(File.expand_path("templates", __dir__))
30
+
31
+ def create_new_plugin
32
+ if plugin_name.blank?
33
+ warn "Not currently in a plugin directory"
34
+ exit
35
+ end
36
+
37
+ opts = {
38
+ force: true,
39
+ skip_active_storage: true,
40
+ skip_action_mailer: true,
41
+ skip_action_cable: true,
42
+ skip_puma: true,
43
+ skip_coffee: true,
44
+ database: "sqlite3",
45
+ }
46
+
47
+ Dir.mktmpdir do |dir|
48
+ plugin_path = File.join(dir, plugin_name)
49
+ new_dummy_path = File.join(plugin_path, "test/dummy")
50
+
51
+ invoke(Rails::Generators::PluginGenerator, [plugin_path], opts)
52
+
53
+ inside(new_dummy_path) do
54
+ remove_file(".ruby-version")
55
+ end
56
+
57
+ FileUtils.rm_rf(dummy_path)
58
+ FileUtils.mv(new_dummy_path, dummy_path)
59
+ end
60
+ end
61
+
62
+ def apply_required_changes
63
+ template("db_seeds.rb.tt", File.join(dummy_path, "db/seeds.rb"))
64
+
65
+ insert_into_file(
66
+ File.join(dummy_path, "config/application.rb"),
67
+ %(require "super_test_engine"\n),
68
+ before: "\nmodule Dummy\n"
69
+ )
70
+
71
+ inside(dummy_path) do
72
+ invoke(Super::InstallGenerator, [], {})
73
+ remove_file("app/controllers/admin/")
74
+ remove_file("app/controllers/admin_controller.rb")
75
+ remove_file("app/super/")
76
+ end
77
+
78
+ rake("db:create")
79
+ rake("db:migrate")
80
+ end
81
+
82
+ private
83
+
84
+ def dummy_path
85
+ @dummy_path ||= File.expand_path("test/dummy", destination_root)
86
+ end
87
+
88
+ def plugin_name
89
+ @plugin_name ||=
90
+ begin
91
+ filename = Dir.glob("*.gemspec").first
92
+
93
+ if filename.present?
94
+ File.basename(filename, ".gemspec")
95
+ else
96
+ ""
97
+ end
98
+ end
99
+ end
100
+ end
101
+ end
@@ -0,0 +1 @@
1
+ SuperTestEngine::Engine.load_seed
@@ -1,3 +1,3 @@
1
1
  module SuperTestEngine
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: super_test_engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zach Ahn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-26 00:00:00.000000000 Z
11
+ date: 2019-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -62,10 +62,12 @@ files:
62
62
  - config/routes.rb
63
63
  - db/migrate/20190216224956_create_members.rb
64
64
  - db/seeds.rb
65
+ - lib/generators/super_test_engine/dummy/USAGE
66
+ - lib/generators/super_test_engine/dummy/dummy_generator.rb
67
+ - lib/generators/super_test_engine/dummy/templates/db_seeds.rb.tt
65
68
  - lib/super_test_engine.rb
66
69
  - lib/super_test_engine/engine.rb
67
70
  - lib/super_test_engine/version.rb
68
- - lib/tasks/super_test_engine_tasks.rake
69
71
  - test/fixtures/members.yml
70
72
  homepage:
71
73
  licenses:
@@ -1,4 +0,0 @@
1
- # desc "Explaining what the task does"
2
- # task :super_test_engine do
3
- # # Task goes here
4
- # end