inline_forms_installer 7.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +7 -0
  2. data/bin/inline_forms +3 -0
  3. data/inline_forms_installer.gemspec +24 -0
  4. data/lib/inline_forms_installer/app_template.rb +15 -0
  5. data/lib/inline_forms_installer/creator.rb +127 -0
  6. data/lib/inline_forms_installer/installer_core.rb +889 -0
  7. data/lib/inline_forms_installer/version.rb +7 -0
  8. data/lib/inline_forms_installer.rb +34 -0
  9. data/lib/installer_templates/capistrano/Capfile +39 -0
  10. data/lib/installer_templates/capistrano/deploy.rb +59 -0
  11. data/lib/installer_templates/capistrano/production.rb +7 -0
  12. data/lib/installer_templates/dartsass/devise_main.scss +2 -0
  13. data/lib/installer_templates/dartsass/inline_forms_dartsass_builds.rb +14 -0
  14. data/lib/installer_templates/dartsass/inline_forms_main.scss +2 -0
  15. data/lib/installer_templates/example_app_tests/test/example_app/example_integration_test_case.rb +36 -0
  16. data/lib/installer_templates/example_app_tests/test/integration/example_app_apartment_field_turbo_test.rb +73 -0
  17. data/lib/installer_templates/example_app_tests/test/integration/example_app_apartment_name_list_test.rb +73 -0
  18. data/lib/installer_templates/example_app_tests/test/integration/example_app_apartment_name_required_test.rb +21 -0
  19. data/lib/installer_templates/example_app_tests/test/integration/example_app_apartment_opening_date_test.rb +49 -0
  20. data/lib/installer_templates/example_app_tests/test/integration/example_app_apartment_photos_pagination_test.rb +440 -0
  21. data/lib/installer_templates/example_app_tests/test/integration/example_app_apartment_row_turbo_test.rb +103 -0
  22. data/lib/installer_templates/example_app_tests/test/integration/example_app_apartment_top_level_new_test.rb +70 -0
  23. data/lib/installer_templates/example_app_tests/test/integration/example_app_apartment_top_level_pagination_test.rb +40 -0
  24. data/lib/installer_templates/example_app_tests/test/integration/example_app_apartment_versions_turbo_test.rb +120 -0
  25. data/lib/installer_templates/example_app_tests/test/integration/example_app_guest_access_test.rb +21 -0
  26. data/lib/installer_templates/example_app_tests/test/integration/example_app_photo_revert_test.rb +94 -0
  27. data/lib/installer_templates/example_app_tests/test/integration/example_app_photos_test.rb +22 -0
  28. data/lib/installer_templates/example_app_tests/test/integration/example_app_routing_test.rb +15 -0
  29. data/lib/installer_templates/example_app_tests/test/integration/example_app_turbo_layout_test.rb +25 -0
  30. data/lib/installer_templates/example_app_tests/test/integration/example_app_validation_hints_test.rb +40 -0
  31. data/lib/installer_templates/example_app_tests/test/models/example_app_apartment_name_validation_test.rb +16 -0
  32. data/lib/installer_templates/example_app_tests/test/models/example_app_apartment_photo_test.rb +26 -0
  33. data/lib/installer_templates/example_app_tests/test/models/example_app_paper_trail_changeset_test.rb +78 -0
  34. data/lib/installer_templates/example_app_tests/test/models/example_app_plain_text_rich_text_edge_cases_test.rb +46 -0
  35. data/lib/installer_templates/example_app_views/apartments/name_list.html.erb +26 -0
  36. data/lib/installer_templates/example_app_views/inline_forms/_header.html.erb +45 -0
  37. data/lib/installer_templates/unicorn/production.rb +39 -0
  38. metadata +120 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4f8e3a2820c839b5fb67dece7b04f1e24197a5e52fdef3d4644d92bb1335dcc3
4
+ data.tar.gz: 4f1fb0bd62fa999f8d5c94092ce24f02aa9f39e854e5f84bfe151c3b0ad8b5db
5
+ SHA512:
6
+ metadata.gz: ef80b8f92079b27070b3246ccfea9d9740ba39aded15c8cc5a814a8d792e99c36cca4f7f3bf4884101f4c27dff366ea4b4ae8c20ad1846cc545da7340b0d466d
7
+ data.tar.gz: ca5ce491b22353866f0dd7e92eee93dfdc7baf78d3f9a8e609b6264f0dcd1ac7c5d7f74212900f4d14c5f35562edc8b18cf44d5e2c30f9a8e913e46194d27fe4
data/bin/inline_forms ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require "inline_forms_installer"
3
+ InlineFormsInstaller::Creator.start
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "inline_forms/gem_files"
4
+ require "inline_forms_installer/version"
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "inline_forms_installer"
8
+ s.version = InlineFormsInstaller::VERSION
9
+ s.platform = Gem::Platform::RUBY
10
+ s.authors = ["Ace Suares", "Lemuel Boyce", "Manuel Ortega"]
11
+ s.email = ["ace@suares.com"]
12
+ s.homepage = %q{http://github.com/acesuares/inline_forms}
13
+ s.summary = %q{CLI and Rails app template for generating inline_forms applications.}
14
+ s.description = %q{Installs the `inline_forms` CLI and scaffolds opinionated Rails apps with Devise, CanCan, PaperTrail, and optional example data.}
15
+ s.licenses = ["MIT"]
16
+ s.required_ruby_version = ">= 3.2.0"
17
+
18
+ s.files = InlineFormsGemFiles.gem_files(include_installer: true)
19
+ s.executables = ["inline_forms"]
20
+ s.require_paths = ["lib"]
21
+
22
+ s.add_dependency("rvm", ">= 1.11", "< 2.0")
23
+ s.add_dependency("thor", ">= 1.0", "< 2.0")
24
+ end
@@ -0,0 +1,15 @@
1
+ require "rvm"
2
+
3
+ if RVM.current && ENV["skiprvm"] != "true"
4
+ RVM.chdir(File.expand_path(".")) do
5
+ say "Working directory is #{`pwd`}"
6
+ RVM.use_from_path! "."
7
+ rvm_gemset = %x[rvm current]
8
+ say "RVM GEMSET is now #{rvm_gemset}"
9
+ say "Installing using gemset : #{RVM.current.environment_name}", :green
10
+ end
11
+ else
12
+ say "Installing without RVM", :green
13
+ end
14
+
15
+ apply(File.join(__dir__, "installer_core.rb"))
@@ -0,0 +1,127 @@
1
+ # -*- encoding : utf-8 -*-
2
+ require "securerandom"
3
+ require "thor"
4
+
5
+ module InlineFormsInstaller
6
+ class Creator < Thor
7
+ include Thor::Actions
8
+
9
+ def self.source_root
10
+ gem_root
11
+ end
12
+
13
+ desc "create APP", "create an application with inline_forms v#{InlineFormsInstaller.inline_forms_version}"
14
+ DATABASE_OPTIONS = %w(sqlite mysql)
15
+ method_option :database, :aliases => "-d", :banner => DATABASE_OPTIONS.join("|"), :desc => "specify development database"
16
+ method_option :example, :type => :boolean, :desc => "install the example app. uses sqlite as development database"
17
+ method_option :email, :aliases => "-e", :default => "admin@example.com", :desc => "specify admin email"
18
+ method_option :password, :aliases => "-p", :default => "admin999", :desc => "specify admin password"
19
+ method_option :runtest, :aliases => "--run-test", :default => false, :desc => "run tests"
20
+ method_option :skiprvm, :aliases => "--no-rvm", :type => :boolean, :default => false, :desc => "install inline_forms without RVM"
21
+
22
+ def create(app_name)
23
+ def self.skiprvm
24
+ options[:skiprvm]
25
+ end
26
+
27
+ def self.runtest
28
+ options[:runtest]
29
+ end
30
+
31
+ def self.install_example?
32
+ options[:example]
33
+ end
34
+
35
+ def self.database
36
+ @database ||= options[:database]
37
+ return @database if DATABASE_OPTIONS.include?(@database)
38
+ say "No Database specified please choose one database #{DATABASE_OPTIONS.join(' | ')}", :red
39
+ while !DATABASE_OPTIONS.include?(@database)
40
+ @database = ask "Database: "
41
+ return @database if DATABASE_OPTIONS.include?(@database)
42
+ end
43
+ end
44
+
45
+ def self.using_sqlite?
46
+ database == "sqlite"
47
+ end
48
+
49
+ def self.email
50
+ options[:email]
51
+ end
52
+
53
+ def self.password
54
+ options[:password]
55
+ end
56
+
57
+ if install_example? && !using_sqlite?
58
+ say "--example can only be used with an sqlite development database", :red
59
+ exit 1
60
+ end
61
+
62
+ inline_forms_version = InlineFormsInstaller.inline_forms_version
63
+ say "Creating #{app_name} with inline_forms v#{inline_forms_version} and development database #{database}...", :green
64
+
65
+ regex = /\A[0-9a-zA-Z][0-9a-zA-Z_-]+[0-9a-zA-Z]\Z/
66
+ if !regex.match(app_name)
67
+ say "Error: APP must match #{regex.source}", :red
68
+ exit 1
69
+ end
70
+
71
+ if File.exist?(app_name)
72
+ say "Error: APP exists", :red
73
+ exit 1
74
+ end
75
+
76
+ ruby_version = nil
77
+ require "rvm"
78
+ if RVM.current && !options[:skiprvm]
79
+ say "Installing inline_forms with RVM", :green
80
+ ruby_version = (%x[rvm current]).gsub(/@.*/, "")
81
+ create_file "#{app_name}/.ruby-version", ruby_version
82
+ create_file "#{app_name}/.ruby-gemset", app_name
83
+ else
84
+ say "Installing inline_forms without RVM", :green
85
+ end
86
+
87
+ say "Installing with #{options[:database]}", :green
88
+ empty_directory(app_name)
89
+
90
+ options.each do |k, v|
91
+ ENV[k] = v.to_s
92
+ end
93
+
94
+ ENV["using_sqlite"] = using_sqlite?.to_s
95
+ ENV["database"] = database
96
+ ENV["install_example"] = install_example?.to_s
97
+ ENV["ruby_version"] = ruby_version.to_s
98
+ ENV["inline_forms_version"] = inline_forms_version
99
+ ENV["inline_forms_installer_version"] = InlineFormsInstaller::VERSION
100
+ ENV["INLINE_FORMS_INSTALLER_ROOT"] = InlineFormsInstaller.gem_root
101
+ ENV["INLINE_FORMS_ROOT"] = InlineFormsInstaller.inline_forms_gem_root
102
+
103
+ app_template_file = File.join(__dir__, "app_template.rb")
104
+
105
+ require "rubygems"
106
+ compatible_rails =
107
+ begin
108
+ Gem::Specification
109
+ .find_all_by_name("rails")
110
+ .map(&:version)
111
+ .select { |v| v >= Gem::Version.new("7.1") && v < Gem::Version.new("7.2") }
112
+ .max
113
+ rescue StandardError
114
+ nil
115
+ end
116
+ rails_invocation = compatible_rails ? "rails _#{compatible_rails}_" : "rails"
117
+ say "Generating app with: #{rails_invocation} new ...", :green
118
+
119
+ unless run("#{rails_invocation} new #{app_name} -m #{app_template_file} --skip-bundle --skip-bootsnap --javascript=importmap")
120
+ say "Rails could not create the app '#{app_name}', maybe because it is a reserved word...", :red
121
+ exit 1
122
+ end
123
+ end
124
+ end
125
+ end
126
+
127
+ Signal.trap("INT") { puts; exit }