Skip to content

Commit

Permalink
Update application template, finally split toys into gems
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexWayfer committed Aug 2, 2020
1 parent 9752e8a commit f9be9a7
Show file tree
Hide file tree
Showing 119 changed files with 2,291 additions and 1,890 deletions.
24 changes: 18 additions & 6 deletions lib/flame/cli/new/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ class App < Clamp::Command
parameter 'APP_NAME', 'application name'

def execute
@app_name = app_name
@module_name = @app_name.camelize
@short_module_name = @module_name
.split(/([[:upper:]][[:lower:]]*)/).map! { |s| s[0] }.join
initialize_instance_variables

make_dir do
copy_template
Expand All @@ -26,6 +23,17 @@ def execute

private

def initialize_instance_variables
@app_name = app_name

@module_name = @app_name.camelize

@short_module_name =
@module_name.split(/([[:upper:]][[:lower:]]*)/).map! { |s| s[0] }.join

@domain_name = @module_name.downcase
end

def make_dir(&block)
puts "Creating '#{@app_name}' directory..."
FileUtils.mkdir @app_name
Expand All @@ -46,7 +54,7 @@ def clean_dirs

def render_templates
puts 'Replace module names in template...'
Dir.glob('**/*.erb', File::FNM_DOTMATCH).each do |file|
Dir.glob('**/*.erb', File::FNM_DOTMATCH).sort.each do |file|
file_pathname = Pathname.new(file)
basename_pathname = file_pathname.sub_ext('')
puts "- #{basename_pathname}"
Expand All @@ -56,9 +64,13 @@ def render_templates
end
end

PERMISSIONS = {}.freeze

def grant_permissions
return unless PERMISSIONS.any?

puts 'Grant permissions to files...'
File.chmod 0o744, 'server'
PERMISSIONS.each { |file, permissions| File.chmod permissions, file }
end
end
end
Expand Down
Loading

0 comments on commit f9be9a7

Please sign in to comment.