rails_app_generator 0.0.2

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.
@@ -0,0 +1,67 @@
1
+ Usage:
2
+ rails new APP_PATH [options]
3
+
4
+ Options:
5
+ [--skip-namespace], [--no-skip-namespace] # Skip namespace (affects only isolated engines)
6
+ [--skip-collision-check], [--no-skip-collision-check] # Skip collision check
7
+ -r, [--ruby=PATH] # Path to the Ruby binary of your choice
8
+ # Default: /Users/davidcruwys/.asdf/installs/ruby/2.7.6/bin/ruby
9
+ -m, [--template=TEMPLATE] # Path to some application template (can be a filesystem path or URL)
10
+ -d, [--database=DATABASE] # Preconfigure for selected database (options: mysql/postgresql/sqlite3/oracle/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc)
11
+ # Default: sqlite3
12
+ -G, [--skip-git], [--no-skip-git] # Skip .gitignore file
13
+ [--skip-keeps], [--no-skip-keeps] # Skip source control .keep files
14
+ -M, [--skip-action-mailer], [--no-skip-action-mailer] # Skip Action Mailer files
15
+ [--skip-action-mailbox], [--no-skip-action-mailbox] # Skip Action Mailbox gem
16
+ [--skip-action-text], [--no-skip-action-text] # Skip Action Text gem
17
+ -O, [--skip-active-record], [--no-skip-active-record] # Skip Active Record files
18
+ [--skip-active-job], [--no-skip-active-job] # Skip Active Job
19
+ [--skip-active-storage], [--no-skip-active-storage] # Skip Active Storage files
20
+ -C, [--skip-action-cable], [--no-skip-action-cable] # Skip Action Cable files
21
+ -A, [--skip-asset-pipeline], [--no-skip-asset-pipeline] # Indicates when to generate skip asset pipeline
22
+ -a, [--asset-pipeline=ASSET_PIPELINE] # Choose your asset pipeline [options: sprockets (default), propshaft]
23
+ # Default: sprockets
24
+ -J, [--skip-javascript], [--no-skip-javascript] # Skip JavaScript files
25
+ [--skip-hotwire], [--no-skip-hotwire] # Skip Hotwire integration
26
+ [--skip-jbuilder], [--no-skip-jbuilder] # Skip jbuilder gem
27
+ -T, [--skip-test], [--no-skip-test] # Skip test files
28
+ [--skip-system-test], [--no-skip-system-test] # Skip system test files
29
+ [--skip-bootsnap], [--no-skip-bootsnap] # Skip bootsnap gem
30
+ [--dev], [--no-dev] # Set up the application with Gemfile pointing to your Rails checkout
31
+ [--edge], [--no-edge] # Set up the application with Gemfile pointing to Rails repository
32
+ --master, [--main], [--no-main] # Set up the application with Gemfile pointing to Rails repository main branch
33
+ [--rc=RC] # Path to file containing extra configuration options for rails command
34
+ [--no-rc], [--no-no-rc] # Skip loading of extra configuration options from .railsrc file
35
+ [--api], [--no-api] # Preconfigure smaller stack for API only apps
36
+ [--minimal], [--no-minimal] # Preconfigure a minimal rails app
37
+ -j, [--javascript=JAVASCRIPT] # Choose JavaScript approach [options: importmap (default), webpack, esbuild, rollup]
38
+ # Default: importmap
39
+ -c, [--css=CSS] # Choose CSS processor [options: tailwind, bootstrap, bulma, postcss, sass... check https://github.com/rails/cssbundling-rails]
40
+ -B, [--skip-bundle], [--no-skip-bundle] # Don't run bundle install
41
+
42
+ Runtime options:
43
+ -f, [--force] # Overwrite files that already exist
44
+ -p, [--pretend], [--no-pretend] # Run but do not make any changes
45
+ -q, [--quiet], [--no-quiet] # Suppress status output
46
+ -s, [--skip], [--no-skip] # Skip files that already exist
47
+
48
+ Rails options:
49
+ -h, [--help], [--no-help] # Show this help message and quit
50
+ -v, [--version], [--no-version] # Show Rails version number and quit
51
+
52
+ Description:
53
+ The 'rails new' command creates a new Rails application with a default
54
+ directory structure and configuration at the path you specify.
55
+
56
+ You can specify extra command-line arguments to be used every time
57
+ 'rails new' runs in the .railsrc configuration file in your home directory,
58
+ or in $XDG_CONFIG_HOME/rails/railsrc if XDG_CONFIG_HOME is set.
59
+
60
+ Note that the arguments specified in the .railsrc file don't affect the
61
+ defaults values shown above in this help message.
62
+
63
+ Example:
64
+ rails new ~/Code/Ruby/weblog
65
+
66
+ This generates a skeletal Rails installation in ~/Code/Ruby/weblog.
67
+ ➜ rails_app_generator git:(main) ✗
@@ -0,0 +1,133 @@
1
+ BUNDLE-GEM(1) BUNDLE-GEM(1)
2
+
3
+ NAME
4
+ bundle-gem - Generate a project skeleton for creating a rubygem
5
+
6
+ SYNOPSIS
7
+ bundle gem GEM_NAME OPTIONS
8
+
9
+ DESCRIPTION
10
+ Generates a directory named GEM_NAME with a Rakefile, GEM_NAME.gemspec,
11
+ and other supporting files and directories that can be used to develop a
12
+ rubygem with that name.
13
+
14
+ Run rake -T in the resulting project for a list of Rake tasks that can be
15
+ used to test and publish the gem to rubygems.org.
16
+
17
+ The generated project skeleton can be customized with OPTIONS, as
18
+ explained below. Note that these options can also be specified via
19
+ Bundler´s global configuration file using the following names:
20
+
21
+ • gem.coc
22
+
23
+ • gem.mit
24
+
25
+ • gem.test
26
+
27
+
28
+
29
+
30
+ OPTIONS
31
+ --exe or -b or --bin
32
+ Specify that Bundler should create a binary executable (as
33
+ exe/GEM_NAME) in the generated rubygem project. This binary will
34
+ also be added to the GEM_NAME.gemspec manifest. This behavior is
35
+ disabled by default.
36
+
37
+ --no-exe
38
+ Do not create a binary (overrides --exe specified in the global
39
+ config).
40
+
41
+ --coc Add a CODE_OF_CONDUCT.md file to the root of the generated
42
+ project. If this option is unspecified, an interactive prompt will
43
+ be displayed and the answer will be saved in Bundler´s global
44
+ config for future bundle gem use.
45
+
46
+ --no-coc
47
+ Do not create a CODE_OF_CONDUCT.md (overrides --coc specified in
48
+ the global config).
49
+
50
+ --ext Add boilerplate for C extension code to the generated project.
51
+ This behavior is disabled by default.
52
+
53
+ --no-ext
54
+ Do not add C extension code (overrides --ext specified in the
55
+ global config).
56
+
57
+ --mit Add an MIT license to a LICENSE.txt file in the root of the
58
+ generated project. Your name from the global git config is used
59
+ for the copyright statement. If this option is unspecified, an
60
+ interactive prompt will be displayed and the answer will be saved
61
+ in Bundler´s global config for future bundle gem use.
62
+
63
+ --no-mit
64
+ Do not create a LICENSE.txt (overrides --mit specified in the
65
+ global config).
66
+
67
+ -t, --test=minitest, --test=rspec, --test=test-unit
68
+ Specify the test framework that Bundler should use when generating
69
+ the project. Acceptable values are minitest, rspec and test-unit.
70
+ The GEM_NAME.gemspec will be configured and a skeleton test/spec
71
+ directory will be created based on this option. Given no option is
72
+ specified:
73
+
74
+ When Bundler is configured to generate tests, this defaults to
75
+ Bundler´s global config setting gem.test.
76
+
77
+ When Bundler is configured to not generate tests, an interactive
78
+ prompt will be displayed and the answer will be used for the
79
+ current rubygem project.
80
+
81
+ When Bundler is unconfigured, an interactive prompt will be
82
+ displayed and the answer will be saved in Bundler´s global config
83
+ for future bundle gem use.
84
+
85
+ --ci, --ci=github, --ci=travis, --ci=gitlab, --ci=circle
86
+ Specify the continuous integration service that Bundler should use
87
+ when generating the project. Acceptable values are github, travis,
88
+ gitlab and circle. A configuration file will be generated in the
89
+ project directory. Given no option is specified:
90
+
91
+ When Bundler is configured to generate CI files, this defaults to
92
+ Bundler´s global config setting gem.ci.
93
+
94
+ When Bundler is configured to not generate CI files, an
95
+ interactive prompt will be displayed and the answer will be used
96
+ for the current rubygem project.
97
+
98
+ When Bundler is unconfigured, an interactive prompt will be
99
+ displayed and the answer will be saved in Bundler´s global config
100
+ for future bundle gem use.
101
+
102
+ --linter, --linter=rubocop, --linter=standard
103
+ Specify the linter and code formatter that Bundler should add to
104
+ the project´s development dependencies. Acceptable values are
105
+ rubocop and standard. A configuration file will be generated in
106
+ the project directory. Given no option is specified:
107
+
108
+ When Bundler is configured to add a linter, this defaults to
109
+ Bundler´s global config setting gem.linter.
110
+
111
+ When Bundler is configured not to add a linter, an interactive
112
+ prompt will be displayed and the answer will be used for the
113
+ current rubygem project.
114
+
115
+ When Bundler is unconfigured, an interactive prompt will be
116
+ displayed and the answer will be saved in Bundler´s global config
117
+ for future bundle gem use.
118
+
119
+ -e, --edit[=EDITOR]
120
+ Open the resulting GEM_NAME.gemspec in EDITOR, or the default
121
+ editor if not specified. The default is $BUNDLER_EDITOR, $VISUAL,
122
+ or $EDITOR.
123
+
124
+ SEE ALSO
125
+ • bundle config(1) bundle-config.1.html
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+ May 2022 BUNDLE-GEM(1)
@@ -0,0 +1,67 @@
1
+ Usage:
2
+ rails new APP_PATH [options]
3
+
4
+ Options:
5
+ [--skip-namespace], [--no-skip-namespace] # Skip namespace (affects only isolated engines)
6
+ [--skip-collision-check], [--no-skip-collision-check] # Skip collision check
7
+ -r, [--ruby=PATH] # Path to the Ruby binary of your choice
8
+ # Default: /Users/davidcruwys/.asdf/installs/ruby/2.7.6/bin/ruby
9
+ -m, [--template=TEMPLATE] # Path to some application template (can be a filesystem path or URL)
10
+ -d, [--database=DATABASE] # Preconfigure for selected database (options: mysql/postgresql/sqlite3/oracle/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc)
11
+ # Default: sqlite3
12
+ -G, [--skip-git], [--no-skip-git] # Skip .gitignore file
13
+ [--skip-keeps], [--no-skip-keeps] # Skip source control .keep files
14
+ -M, [--skip-action-mailer], [--no-skip-action-mailer] # Skip Action Mailer files
15
+ [--skip-action-mailbox], [--no-skip-action-mailbox] # Skip Action Mailbox gem
16
+ [--skip-action-text], [--no-skip-action-text] # Skip Action Text gem
17
+ -O, [--skip-active-record], [--no-skip-active-record] # Skip Active Record files
18
+ [--skip-active-job], [--no-skip-active-job] # Skip Active Job
19
+ [--skip-active-storage], [--no-skip-active-storage] # Skip Active Storage files
20
+ -C, [--skip-action-cable], [--no-skip-action-cable] # Skip Action Cable files
21
+ -A, [--skip-asset-pipeline], [--no-skip-asset-pipeline] # Indicates when to generate skip asset pipeline
22
+ -a, [--asset-pipeline=ASSET_PIPELINE] # Choose your asset pipeline [options: sprockets (default), propshaft]
23
+ # Default: sprockets
24
+ -J, [--skip-javascript], [--no-skip-javascript] # Skip JavaScript files
25
+ [--skip-hotwire], [--no-skip-hotwire] # Skip Hotwire integration
26
+ [--skip-jbuilder], [--no-skip-jbuilder] # Skip jbuilder gem
27
+ -T, [--skip-test], [--no-skip-test] # Skip test files
28
+ [--skip-system-test], [--no-skip-system-test] # Skip system test files
29
+ [--skip-bootsnap], [--no-skip-bootsnap] # Skip bootsnap gem
30
+ [--dev], [--no-dev] # Set up the application with Gemfile pointing to your Rails checkout
31
+ [--edge], [--no-edge] # Set up the application with Gemfile pointing to Rails repository
32
+ --master, [--main], [--no-main] # Set up the application with Gemfile pointing to Rails repository main branch
33
+ [--rc=RC] # Path to file containing extra configuration options for rails command
34
+ [--no-rc], [--no-no-rc] # Skip loading of extra configuration options from .railsrc file
35
+ [--api], [--no-api] # Preconfigure smaller stack for API only apps
36
+ [--minimal], [--no-minimal] # Preconfigure a minimal rails app
37
+ -j, [--javascript=JAVASCRIPT] # Choose JavaScript approach [options: importmap (default), webpack, esbuild, rollup]
38
+ # Default: importmap
39
+ -c, [--css=CSS] # Choose CSS processor [options: tailwind, bootstrap, bulma, postcss, sass... check https://github.com/rails/cssbundling-rails]
40
+ -B, [--skip-bundle], [--no-skip-bundle] # Don't run bundle install
41
+
42
+ Runtime options:
43
+ -f, [--force] # Overwrite files that already exist
44
+ -p, [--pretend], [--no-pretend] # Run but do not make any changes
45
+ -q, [--quiet], [--no-quiet] # Suppress status output
46
+ -s, [--skip], [--no-skip] # Skip files that already exist
47
+
48
+ Rails options:
49
+ -h, [--help], [--no-help] # Show this help message and quit
50
+ -v, [--version], [--no-version] # Show Rails version number and quit
51
+
52
+ Description:
53
+ The 'rails new' command creates a new Rails application with a default
54
+ directory structure and configuration at the path you specify.
55
+
56
+ You can specify extra command-line arguments to be used every time
57
+ 'rails new' runs in the .railsrc configuration file in your home directory,
58
+ or in $XDG_CONFIG_HOME/rails/railsrc if XDG_CONFIG_HOME is set.
59
+
60
+ Note that the arguments specified in the .railsrc file don't affect the
61
+ defaults values shown above in this help message.
62
+
63
+ Example:
64
+ rails new ~/Code/Ruby/weblog
65
+
66
+ This generates a skeletal Rails installation in ~/Code/Ruby/weblog.
67
+ ➜ rails_app_generator git:(main) ✗
@@ -0,0 +1,84 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails'
4
+
5
+ require 'rails/generators'
6
+ require 'rails/generators/rails/app/app_generator'
7
+ # require 'active_model/railtie'
8
+ # active_record/railtie
9
+ # active_storage/engine
10
+ # action_controller/railtie
11
+ # action_view/railtie
12
+ # action_mailer/railtie
13
+ # active_job/railtie
14
+ # action_cable/engine
15
+ # action_mailbox/engine
16
+ # action_text/engine
17
+ # rails/test_unit/railtie
18
+
19
+ module RailsAppGenerator
20
+ # Starter is a wrapper for Rails::AppGenerator
21
+ #
22
+ # example:
23
+ # RailsAppGenerator::Starter.new.start
24
+ # RailsAppGenerator::Starter.new(app_path: '.', destination_root: Dir.pwd).start
25
+ # RailsAppGenerator::Starter.new(app_path: 'xmen', destination_root: '~/projects_path').start
26
+ # RailsAppGenerator::Starter.new(app_path: '.', destination_root: '~/projects_path/xmen').start
27
+ class Starter
28
+ # include KLog::Logging
29
+
30
+ attr_reader :app_path
31
+ attr_reader :destination_root
32
+ attr_reader :rails_template_path
33
+ attr_reader :custom_template_path
34
+
35
+ def initialize(**args)
36
+ @app_path = args[:app_path] || '.'
37
+ @destination_root = args[:destination_root] || Dir.pwd
38
+ @rails_template_path = args[:rails_template_path] || Rails::Generators::AppGenerator.source_root
39
+ @custom_template_path = args[:custom_template_path] || File.expand_path(File.join(__dir__, '../../templates'))
40
+ end
41
+
42
+ def target_path
43
+ File.expand_path(File.join(destination_root, app_path))
44
+ end
45
+
46
+ def start
47
+ puts "Target path: #{target_path}"
48
+
49
+ RailsAppGenerator::AppGenerator.source_root(rails_template_path)
50
+ RailsAppGenerator::AppGenerator.source_paths << rails_template_path
51
+ RailsAppGenerator::AppGenerator.source_paths << custom_template_path
52
+
53
+ # opts = [
54
+ # '--skip-namespace',
55
+ # '--skip-collision-check',
56
+ # '--skip-git',
57
+ # '--skip-keeps',
58
+ # '--skip-action-mailer',
59
+ # '--skip-action-mailbox',
60
+ # '--skip-action-text',
61
+ # '--skip-active-record',
62
+ # '--skip-active-job',
63
+ # '--skip-active-storage',
64
+ # '--skip-action-cable',
65
+ # '--skip-asset-pipeline',
66
+ # '--skip-javascript',
67
+ # '--skip-hotwire',
68
+ # '--skip-jbuilder',
69
+ # '--skip-test',
70
+ # '--skip-system-test',
71
+ # '--skip-bootsnap',
72
+ # '--skip-bundle'
73
+ # ]
74
+
75
+ opts = [
76
+ '--skip-git',
77
+ '--skip-test',
78
+ '--skip-bundle'
79
+ ]
80
+
81
+ RailsAppGenerator::AppGenerator.start ['.'] + opts, destination_root: destination_root
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RailsAppGenerator
4
+ VERSION = '0.0.2'
5
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ # require 'k_log'
4
+
5
+ require 'rails/command/base'
6
+ require 'rails/generators/app_base'
7
+ require 'rails/generators'
8
+ require 'rails/generators/app_name'
9
+ require 'rails/generators/rails/app/app_generator'
10
+ require 'bundler'
11
+
12
+ require 'rails_app_generator/version'
13
+ require 'rails_app_generator/build_option'
14
+ require 'rails_app_generator/build_options'
15
+ require 'rails_app_generator/starter'
16
+ require 'rails_app_generator/app_builder'
17
+ require 'rails_app_generator/app_generator'
18
+
19
+ # require "rails_app_generator/generators/base"
20
+ # require "rails_app_generator/generators/foo_generator"
21
+ # require "rails_app_generator/generators/advisories_generator"
22
+
23
+ module RailsAppGenerator
24
+ # raise RailsAppGenerator::Error, 'Sample message'
25
+ Error = Class.new(StandardError)
26
+
27
+ # Your code goes here...
28
+ end
29
+
30
+ if ENV.fetch('KLUE_DEBUG', 'false').downcase == 'true'
31
+ namespace = 'RailsAppGenerator::Version'
32
+ file_path = $LOADED_FEATURES.find { |f| f.include?('rails_app_generator/version') }
33
+ version = RailsAppGenerator::VERSION.ljust(9)
34
+ puts "#{namespace.ljust(35)} : #{version.ljust(9)} : #{file_path}"
35
+ end