rails_app_generator 0.0.6 → 0.0.7

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: a9db638d5387a342cec3c8ad01cf7aa69298a2e592f005608a603c17ec336b20
4
- data.tar.gz: 192fd7e39c98346954ddb9752fba2c7cd5380e306d07e32b638d8d5c0201a637
3
+ metadata.gz: c7729b3a10ff4b9d4608b9c5cbd2e3fefe036a43b90066b447f4048b252a893b
4
+ data.tar.gz: 02c9a488f5a9296402f5923935fdcd88b69346d8f2337b34dc335640b532cd45
5
5
  SHA512:
6
- metadata.gz: b3d1733fb92b31e44eaaa31cf062038e7f8715cca8adf2e29351e7363e74c24a5ba488186143c803be5d814d17bfcc80b8fa5b945b9bd06cd0e2da966244c065
7
- data.tar.gz: 1f2955850cf06ad10529dc86355f9db15af680bc017284ec01524f3c83c7314cb903b6deff6beefb7673ab78fc2d57152fef36a015d7a7b282df03310509dc24
6
+ metadata.gz: dae7db0f0f6c5656253178dc635e141cd84289fab9d5c7bd621e337732d14f752969902df3e8458fbf43c8ff6239e79fb2d8f077a023ba1e6cb8ae539a5f6070
7
+ data.tar.gz: d14b704ed3d27d52f85bfd36e07be35490fb0c42f05a182504073c0fbcc59a5d27511a2ce59dfa54209438d449472ac3d71e28687c2e04d8cd7e3f3d9dc25c7d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## [0.0.6](https://github.com/klueless-io/rails_app_generator/compare/v0.0.5...v0.0.6) (2022-07-21)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add a bunch of addons ([b781af6](https://github.com/klueless-io/rails_app_generator/commit/b781af66d7fe7d7dcd2550577166213deefc06c6))
7
+ * add a bunch of addons ([d9a85b7](https://github.com/klueless-io/rails_app_generator/commit/d9a85b7b32c2c25577d98b4b3be9aab7947ff6e9))
8
+ * update template paths in app_generator ([9b28a5e](https://github.com/klueless-io/rails_app_generator/commit/9b28a5ee58535a761581e619eb01dc3059a79948))
9
+
1
10
  ## [0.0.5](https://github.com/klueless-io/rails_app_generator/compare/v0.0.4...v0.0.5) (2022-07-19)
2
11
 
3
12
 
File without changes
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'pry'
4
+
5
+ # after_bundle do
6
+ # setup_rails.after_bundle
7
+ # end
8
+
9
+ add_scaffold('post', 'title', 'content:text')
10
+ add_scaffold('book', 'title', 'content:text')
11
+ # add_resource("comment", "post:references", 'content:text')
12
+ # add_mailer("posts", "submitted", "broken")
data/exe/rag ADDED
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'pathname'
5
+ require 'pry'
6
+
7
+ source_path = File.expand_path("#{Pathname.new(__FILE__).dirname}/../lib")
8
+ $LOAD_PATH << source_path
9
+
10
+ require 'rails_app_generator'
11
+
12
+ if ARGV.empty?
13
+ puts 'Please provide a profile for the new application'
14
+ puts
15
+ puts 'See --help for more info'
16
+ exit 0
17
+ elsif %w[-v --version].include? ARGV[0]
18
+ puts RailsAppGenerator::VERSION
19
+ exit 0
20
+ end
21
+
22
+ profile_path = File.expand_path("#{Pathname.new(__FILE__).dirname}/../profiles")
23
+ profile_name = ARGV[0]
24
+ profile_name += '.json' unless profile_name.end_with?('.json')
25
+ profile_file = File.join(profile_path, profile_name)
26
+
27
+ if File.exist?(profile_file)
28
+ puts "Using profile #{profile_file}"
29
+
30
+ profile = JSON.parse(File.read(profile_file), symbolize_names: true)
31
+ args = profile[:args]
32
+ opts = profile[:opts]
33
+ rails_options = RailsAppGenerator::RailsOptions.new(opts)
34
+
35
+ instance = RailsAppGenerator::Starter.new(args)
36
+ FileUtils.rm_rf(instance.target_path)
37
+ instance.start(rails_options)
38
+ else
39
+ puts "Profile #{profile_file} not found"
40
+ exit 1
41
+ end
@@ -66,7 +66,6 @@ module RailsAppGenerator
66
66
  protected
67
67
 
68
68
  def depends_on(*addon)
69
- puts addon
70
69
  @dependencies = addon.map(&:to_sym)
71
70
  end
72
71
  end
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsAppGenerator
4
+ # The application builder allows you to override elements of the application
5
+ # generator without being forced to reverse the operations of the default generator.
4
6
  class AppBuilder < Rails::AppBuilder
5
7
  # def bin
6
8
  # super
@@ -13,9 +15,9 @@ module RailsAppGenerator
13
15
  # RailsAppGenerator::AddOns::Credentials.apply
14
16
  # end
15
17
 
16
- # def readme
17
- # template 'README.md.erb', 'README.md'
18
- # end
18
+ def readme
19
+ template 'README.md.erb', 'README.md'
20
+ end
19
21
 
20
22
  # def ruby_version
21
23
  # RailsAppGenerator::AddOns::RubyVersion.new(Context.new(options)).apply
@@ -22,8 +22,8 @@ module RailsAppGenerator
22
22
  class_option :add_services , type: :boolean, default: false
23
23
  class_option :add_sidekiq , type: :boolean, default: false
24
24
  class_option :add_views , type: :boolean, default: false
25
- class_option :add_errors , type: :boolean, default: false
26
- class_option :add_scaffold , type: :boolean, default: false
25
+ class_option :add_errors , type: :boolean, default: false
26
+ class_option :add_scaffold , type: :boolean, default: false
27
27
  class_option :add_factory_bot , type: :boolean, default: false
28
28
  class_option :add_shoulda , type: :boolean, default: false
29
29
 
@@ -141,15 +141,15 @@ module RailsAppGenerator
141
141
  add_if(:rubocop)
142
142
  end
143
143
 
144
- def create_test_files
145
- return if options[:skip_test]
144
+ # def create_test_files
145
+ # return if options[:skip_test]
146
146
 
147
- super if options[:test] == 'minitest'
147
+ # super if options[:test] == 'minitest'
148
148
 
149
- # puts options[:testing_framework]
149
+ # # puts options[:testing_framework]
150
150
 
151
- # add(:rspec) if options[:testing_framework] == 'rspec'
152
- end
151
+ # # add(:rspec) if options[:testing_framework] == 'rspec'
152
+ # end
153
153
 
154
154
  def finish_template
155
155
  puts 'finish template'
@@ -169,7 +169,16 @@ module RailsAppGenerator
169
169
  # invoke :rails_customization
170
170
  super
171
171
  end
172
+
172
173
  no_commands do
174
+ def add_controller(name, *args)
175
+ generate(:controller, name, *args)
176
+ end
177
+
178
+ def add_scaffold(name, *args)
179
+ generate(:scaffold, name, *args)
180
+ end
181
+
173
182
  def source_paths
174
183
  [
175
184
  context.rails_override_template_path,
@@ -208,5 +217,13 @@ module RailsAppGenerator
208
217
  Dependencies.new(addon, context).satisfied?
209
218
  end
210
219
  end
220
+
221
+ protected
222
+
223
+ # rubocop:disable Naming/AccessorMethodName
224
+ def get_builder_class
225
+ RailsAppGenerator::AppBuilder
226
+ end
227
+ # rubocop:enable Naming/AccessorMethodName
211
228
  end
212
229
  end
@@ -7,7 +7,6 @@ create Gemfile
7
7
  create app
8
8
  create app/assets/config/manifest.js
9
9
  create app/assets/stylesheets/application.css
10
- create app/bob/boblike.txt
11
10
  create app/channels/application_cable/channel.rb
12
11
  create app/channels/application_cable/connection.rb
13
12
  create app/controllers/application_controller.rb
@@ -5,7 +5,7 @@ module RailsAppGenerator
5
5
  # NOTE: Currently you need to register new options in two places
6
6
  # here and in lib/rails_app_generator/app_generator.rb
7
7
 
8
- future_option :template , type: :string # , desc: "Path to some #{name} template (can be a filesystem path or URL)"
8
+ register_option :template , type: :string # , desc: "Path to some #{name} template (can be a filesystem path or URL)"
9
9
  future_option :database , type: :string , default: 'sqlite3' # , desc: "Preconfigure for selected database (options: #{DATABASES.join('/')})"
10
10
  register_option :skip_git , type: :boolean, default: false # , desc: "Skip .gitignore file"
11
11
  future_option :skip_keeps , type: :boolean, default: false # , desc: "Skip source control .keep files"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsAppGenerator
4
- VERSION = '0.0.6'
4
+ VERSION = '0.0.7'
5
5
  end
@@ -17,9 +17,9 @@ require 'rails_app_generator/options/map_option_boolean_flag'
17
17
  require 'rails_app_generator/options/build_option'
18
18
  require 'rails_app_generator/options/options_builder'
19
19
  require 'rails_app_generator/options/rails_options'
20
- require_relative 'rails_app_generator/context'
21
- require_relative 'rails_app_generator/dependencies'
22
- require_relative 'rails_app_generator/add_on'
20
+ require 'rails_app_generator/context'
21
+ require 'rails_app_generator/dependencies'
22
+ require 'rails_app_generator/add_on'
23
23
  Dir[File.join(__dir__, 'rails_app_generator', 'addons', '*.rb')].sort.each { |file| require file }
24
24
  require 'rails_app_generator/app_builder'
25
25
  require 'rails_app_generator/app_generator'
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "rails_app_generator",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "rails_app_generator",
9
- "version": "0.0.6",
9
+ "version": "0.0.7",
10
10
  "devDependencies": {
11
11
  "@klueless-js/semantic-release-rubygem": "github:klueless-js/semantic-release-rubygem",
12
12
  "@semantic-release/changelog": "^6.0.1",
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rails_app_generator",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "Create new Rails Application with custom opinions",
5
5
  "scripts": {
6
6
  "release": "semantic-release"
@@ -0,0 +1,11 @@
1
+ {
2
+ "args": {
3
+ "app_path": "add-some-pages",
4
+ "destination_root": "/Users/davidcruwys/dev/kgems/rails_app_generator/a/rag"
5
+ },
6
+ "opts": {
7
+ "skip_git": true,
8
+ "skip_bundle": true,
9
+ "template": "/Users/davidcruwys/dev/kgems/rails_app_generator/after_templates/test.rb"
10
+ }
11
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "args": {
3
+ "app_path": "bootstrap",
4
+ "destination_root": "/Users/davidcruwys/dev/kgems/rails_app_generator/a/rag"
5
+ },
6
+ "opts": {
7
+ "skip_git": true,
8
+ "css": "bootstrap"
9
+ }
10
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "args": {
3
+ "app_path": "simple",
4
+ "destination_root": "/Users/davidcruwys/dev/kgems/rails_app_generator/a/rag"
5
+ },
6
+ "opts": {
7
+ "skip_git": true,
8
+ "skip_bundle": true
9
+ }
10
+ }
@@ -0,0 +1,43 @@
1
+ # <%= app_name.humanize %>
2
+
3
+ ## Running your App
4
+
5
+ The simplest way to start this up is by using [docker-compose](https://docs.docker.com/compose/):
6
+
7
+ ```bash
8
+ docker-compose up
9
+ ```
10
+
11
+ ```
12
+ rails db:setup
13
+ rails db:migrate
14
+ rails server
15
+ ```
16
+
17
+ Open your browser on [localhost:3000](http://localhost:3000).
18
+
19
+ ## Development
20
+
21
+ This app was generated using [Schienenzeppelin](https://github.com/hschne/schienenzeppelin) - there are tons of little tweaks to simplify your development workflow.
22
+
23
+ For more details refer to the [Documentation](https://github.com/hschne/schienenzeppelin)
24
+
25
+ ## Deployment
26
+
27
+ Deploy this application using Capistrano. Make sure you have a server set up and edit [deploy.rb](./config/deploy.rb) and [config/production.rb](./config/deploy/production.rb).
28
+
29
+ ``` ruby
30
+ # deploy.rb
31
+ set :repo_url, "git@github.com:user/your-project.git"
32
+
33
+ # production.rb
34
+ server "myserver.com", user: "deploy", roles: %w{app db web}
35
+ ```
36
+
37
+ Then run:
38
+
39
+ ```bash
40
+ cap production deploy
41
+ ```
42
+
43
+ For more information on how to prepare a server for deployment you can follow [this guide](https://gorails.com/deploy/ubuntu/20.04).
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_app_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-07-21 00:00:00.000000000 Z
11
+ date: 2022-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bootsnap
@@ -112,7 +112,7 @@ description: " Create new Rails Application with custom opinions\n"
112
112
  email:
113
113
  - david@ideasmen.com.au
114
114
  executables:
115
- - rails_app_generator
115
+ - rag
116
116
  extensions: []
117
117
  extra_rdoc_files: []
118
118
  files:
@@ -130,9 +130,11 @@ files:
130
130
  - LICENSE.txt
131
131
  - README.md
132
132
  - Rakefile
133
+ - after_templates/README.md
134
+ - after_templates/test.rb
133
135
  - bin/console
134
136
  - bin/setup
135
- - exe/rails_app_generator
137
+ - exe/rag
136
138
  - lib/rails_app_generator.rb
137
139
  - lib/rails_app_generator/add_on.rb
138
140
  - lib/rails_app_generator/addons/annotate.rb
@@ -187,7 +189,11 @@ files:
187
189
  - lib/rails_app_generator/version.rb
188
190
  - package-lock.json
189
191
  - package.json
192
+ - profiles/rag-add-some-pages.json
193
+ - profiles/rag-bootstrap.json
194
+ - profiles/rag-simple.json
190
195
  - sig/rails_app_generator.rbs
196
+ - templates/README.md.erb
191
197
  - templates/addons/annotate/auto_annotate_models.rake
192
198
  - templates/addons/continuous_integration/.github/workflows/build.yml.erb
193
199
  - templates/addons/devise/app/views/devise/confirmations/new.html.erb
@@ -1,51 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require 'pathname'
5
-
6
- source_path = File.expand_path("#{Pathname.new(__FILE__).dirname}/../lib")
7
- $LOAD_PATH << source_path
8
-
9
- require 'rails_app_generator'
10
-
11
- # if ARGV.empty?
12
- # puts 'Please provide a path for the new application'
13
- # puts
14
- # puts 'See --help for more info'
15
- # exit 0
16
- # elsif %w[-v --version].include? ARGV[0]
17
- # puts RailsAppGenerator::VERSION
18
- # exit 0
19
- # end
20
-
21
- # templates_root = File.expand_path(File.join('..', 'templates'), File.dirname(__FILE__))
22
- # RailsAppGenerator::AppGenerator.source_root templates_root
23
- # RailsAppGenerator::AppGenerator.source_paths << Rails::Generators::AppGenerator.source_root << templates_root
24
-
25
- # RailsAppGenerator::AppGenerator.start
26
- require 'pry'
27
-
28
- args = {
29
- app_path: 'kw01_bootstrap',
30
- destination_root: '/Users/davidcruwys/dev/kweb'
31
- }
32
- opts = {
33
- skip_git: true,
34
- skip_bundle: false
35
- # css: 'bootstrap'
36
- }
37
-
38
- # RailsAppGenerator::AppGenerator.override_template_path = '/Users/davidcruwys/dev/kgems/rails_app_generator/templates'
39
- # RailsAppGenerator::AppGenerator.addon_template_path = '/Users/davidcruwys/dev/kgems/rails_app_generator/templates/addons/%<addon>'
40
-
41
- instance = RailsAppGenerator::Starter.new(args)
42
- FileUtils.rm_rf(instance.target_path)
43
-
44
- rails_options = RailsAppGenerator::RailsOptions.new(opts)
45
- instance.start(rails_options)
46
-
47
- # system 'gem env'
48
-
49
- # console_output_file = File.expand_path('../../../lib/rails_app_generator/notes/kw01.txt', File.join(File.dirname(__FILE__)))
50
-
51
- # File.write(console_output_file, instance.console_output.split("\n").compact.collect(&:strip).join("\n"))