Class: Charyf::Generators::AppGenerator

Inherits:
AppBase show all
Defined in:
lib/charyf/utils/generators/app/app_generator.rb

Overview

:nodoc:

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AppBase

add_shared_options_for, strict_args_position

Methods inherited from Base

class_option, desc, desc_file, hide!, hook_for, inherited, namespace, source_root

Methods included from Actions

#add_source, #after_bundle, #environment, #gem, #gem_group, #git

Constructor Details

#initialize(*args) ⇒ AppGenerator

Returns a new instance of AppGenerator.



118
119
120
121
122
123
124
# File 'lib/charyf/utils/generators/app/app_generator.rb', line 118

def initialize(*args)
  super
  if options[:lib]
    self.options = options.merge(skip_git: true).freeze
  end

end

Class Method Details



186
187
188
# File 'lib/charyf/utils/generators/app/app_generator.rb', line 186

def self.banner
  "charyf new #{arguments.map(&:usage).join(' ')} [options] \n"
end

Instance Method Details

#create_app_filesObject



156
157
158
# File 'lib/charyf/utils/generators/app/app_generator.rb', line 156

def create_app_files
  build(:app)
end

#create_bin_filesObject



160
161
162
# File 'lib/charyf/utils/generators/app/app_generator.rb', line 160

def create_bin_files
  build(:bin)
end

#create_config_filesObject



164
165
166
# File 'lib/charyf/utils/generators/app/app_generator.rb', line 164

def create_config_files
  build(:config)
end

#create_lib_filesObject



168
169
170
# File 'lib/charyf/utils/generators/app/app_generator.rb', line 168

def create_lib_files
  build(:lib)
end

#create_log_filesObject



172
173
174
# File 'lib/charyf/utils/generators/app/app_generator.rb', line 172

def create_log_files
  build(:log)
end

#create_root_filesObject



129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/charyf/utils/generators/app/app_generator.rb', line 129

def create_root_files
  build(:readme)
  build(:gitignore)   unless options[:skip_git]
  build(:version_control)


  unless options[:skip_gemfile]
    if options[:lib]

      begin
        # Temporary change root
        self.destination_root = File.expand_path('..', destination_root)
        if File.exist?(File.join(destination_root, 'Gemfile'))
          build(:update_gemfile)
        else
          build(:gemfile)
        end
      ensure
        self.destination_root = File.expand_path('charyf', destination_root)
      end

    else
      build(:gemfile)
    end
  end
end

#create_tmp_filesObject



176
177
178
# File 'lib/charyf/utils/generators/app/app_generator.rb', line 176

def create_tmp_files
  build(:tmp)
end

#run_after_bundle_callbacksObject



182
183
184
# File 'lib/charyf/utils/generators/app/app_generator.rb', line 182

def run_after_bundle_callbacks
  @after_bundle_callbacks.each(&:call)
end