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.



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

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

end

Class Method Details



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

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

Instance Method Details

#create_app_filesObject



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

def create_app_files
  build(:app)
end

#create_bin_filesObject



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

def create_bin_files
  build(:bin)
end

#create_config_filesObject



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

def create_config_files
  build(:config)
end

#create_lib_filesObject



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

def create_lib_files
  build(:lib)
end

#create_log_filesObject



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

def create_log_files
  build(:log)
end

#create_root_filesObject



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
155
# File 'lib/charyf/utils/generators/app/app_generator.rb', line 130

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



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

def create_tmp_files
  build(:tmp)
end

#run_after_bundle_callbacksObject



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

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