@@ -34,62 +34,62 @@ def call(app, context: Context.new(inflector, app), &blk)
34
34
attr_reader :inflector
35
35
36
36
def generate_app ( app , context ) # rubocop:disable Metrics/AbcSize
37
- fs . write ( ".gitignore" , t ( "gitignore.erb" , context ) )
38
- fs . write ( ".env" , t ( "env.erb" , context ) )
37
+ fs . create ( ".gitignore" , t ( "gitignore.erb" , context ) )
38
+ fs . create ( ".env" , t ( "env.erb" , context ) )
39
39
40
- fs . write ( "README.md" , t ( "readme.erb" , context ) )
41
- fs . write ( "Gemfile" , t ( "gemfile.erb" , context ) )
42
- fs . write ( "Rakefile" , t ( "rakefile.erb" , context ) )
43
- fs . write ( "Procfile.dev" , t ( "procfile.erb" , context ) )
44
- fs . write ( "config.ru" , t ( "config_ru.erb" , context ) )
40
+ fs . create ( "README.md" , t ( "readme.erb" , context ) )
41
+ fs . create ( "Gemfile" , t ( "gemfile.erb" , context ) )
42
+ fs . create ( "Rakefile" , t ( "rakefile.erb" , context ) )
43
+ fs . create ( "Procfile.dev" , t ( "procfile.erb" , context ) )
44
+ fs . create ( "config.ru" , t ( "config_ru.erb" , context ) )
45
45
46
- fs . write ( "bin/dev" , file ( "dev" ) )
46
+ fs . create ( "bin/dev" , file ( "dev" ) )
47
47
fs . chmod ( "bin/dev" , 0o755 )
48
48
49
- fs . write ( "config/app.rb" , t ( "app.erb" , context ) )
50
- fs . write ( "config/settings.rb" , t ( "settings.erb" , context ) )
51
- fs . write ( "config/routes.rb" , t ( "routes.erb" , context ) )
52
- fs . write ( "config/puma.rb" , t ( "puma.erb" , context ) )
49
+ fs . create ( "config/app.rb" , t ( "app.erb" , context ) )
50
+ fs . create ( "config/settings.rb" , t ( "settings.erb" , context ) )
51
+ fs . create ( "config/routes.rb" , t ( "routes.erb" , context ) )
52
+ fs . create ( "config/puma.rb" , t ( "puma.erb" , context ) )
53
53
54
- fs . write ( "lib/tasks/.keep" , t ( "keep.erb" , context ) )
55
- fs . write ( "lib/#{ app } /types.rb" , t ( "types.erb" , context ) )
54
+ fs . create ( "lib/tasks/.keep" , t ( "keep.erb" , context ) )
55
+ fs . create ( "lib/#{ app } /types.rb" , t ( "types.erb" , context ) )
56
56
57
- fs . write ( "app/actions/.keep" , t ( "keep.erb" , context ) )
58
- fs . write ( "app/action.rb" , t ( "action.erb" , context ) )
59
- fs . write ( "app/view.rb" , t ( "view.erb" , context ) )
60
- fs . write ( "app/views/helpers.rb" , t ( "helpers.erb" , context ) )
61
- fs . write ( "app/templates/layouts/app.html.erb" , t ( "app_layout.erb" , context ) )
57
+ fs . create ( "app/actions/.keep" , t ( "keep.erb" , context ) )
58
+ fs . create ( "app/action.rb" , t ( "action.erb" , context ) )
59
+ fs . create ( "app/view.rb" , t ( "view.erb" , context ) )
60
+ fs . create ( "app/views/helpers.rb" , t ( "helpers.erb" , context ) )
61
+ fs . create ( "app/templates/layouts/app.html.erb" , t ( "app_layout.erb" , context ) )
62
62
63
63
if context . generate_assets?
64
- fs . write ( "package.json" , t ( "package.json.erb" , context ) )
65
- fs . write ( "config/assets.js" , file ( "assets.js" ) )
66
- fs . write ( "app/assets/js/app.js" , t ( "app_js.erb" , context ) )
67
- fs . write ( "app/assets/css/app.css" , t ( "app_css.erb" , context ) )
68
- fs . write ( "app/assets/images/favicon.ico" , file ( "favicon.ico" ) )
64
+ fs . create ( "package.json" , t ( "package.json.erb" , context ) )
65
+ fs . create ( "config/assets.js" , file ( "assets.js" ) )
66
+ fs . create ( "app/assets/js/app.js" , t ( "app_js.erb" , context ) )
67
+ fs . create ( "app/assets/css/app.css" , t ( "app_css.erb" , context ) )
68
+ fs . create ( "app/assets/images/favicon.ico" , file ( "favicon.ico" ) )
69
69
end
70
70
71
71
if context . generate_db?
72
- fs . write ( "app/db/relation.rb" , t ( "relation.erb" , context ) )
73
- fs . write ( "app/relations/.keep" , t ( "keep.erb" , context ) )
72
+ fs . create ( "app/db/relation.rb" , t ( "relation.erb" , context ) )
73
+ fs . create ( "app/relations/.keep" , t ( "keep.erb" , context ) )
74
74
75
- fs . write ( "app/db/repo.rb" , t ( "repo.erb" , context ) )
76
- fs . write ( "app/repos/.keep" , t ( "keep.erb" , context ) )
75
+ fs . create ( "app/db/repo.rb" , t ( "repo.erb" , context ) )
76
+ fs . create ( "app/repos/.keep" , t ( "keep.erb" , context ) )
77
77
78
- fs . write ( "app/db/struct.rb" , t ( "struct.erb" , context ) )
79
- fs . write ( "app/structs/.keep" , t ( "keep.erb" , context ) )
78
+ fs . create ( "app/db/struct.rb" , t ( "struct.erb" , context ) )
79
+ fs . create ( "app/structs/.keep" , t ( "keep.erb" , context ) )
80
80
81
- fs . write ( "config/db/seeds.rb" , t ( "seeds.erb" , context ) )
82
- fs . write ( "config/db/migrate/.keep" , t ( "keep.erb" , context ) )
81
+ fs . create ( "config/db/seeds.rb" , t ( "seeds.erb" , context ) )
82
+ fs . create ( "config/db/migrate/.keep" , t ( "keep.erb" , context ) )
83
83
84
84
if context . generate_sqlite?
85
- fs . write ( "db/.keep" , t ( "keep.erb" , context ) )
85
+ fs . create ( "db/.keep" , t ( "keep.erb" , context ) )
86
86
end
87
87
end
88
88
89
- fs . write ( "app/operation.rb" , t ( "operation.erb" , context ) )
89
+ fs . create ( "app/operation.rb" , t ( "operation.erb" , context ) )
90
90
91
- fs . write ( "public/404.html" , file ( "404.html" ) )
92
- fs . write ( "public/500.html" , file ( "500.html" ) )
91
+ fs . create ( "public/404.html" , file ( "404.html" ) )
92
+ fs . create ( "public/500.html" , file ( "500.html" ) )
93
93
end
94
94
95
95
def template ( path , context )
0 commit comments