<NME> setup.rb
<BEF> # encoding: utf-8

# This hook will be executed in context of current generator object before templater start to generate new files.
# You can update context hash and register hooks. Don't forget to use merge! instead of merge, because you are
# because you are manipulating with one object, rather than returning new one
# Dir.pwd => empty directory where the project will be located

hook do |generator, context|
  generator.target = "#{generator.target}.ru"
end

<MSG> Use generator.hooks.push instead of Hook.invoke directly

<DFF> @@ -5,6 +5,10 @@
 # because you are manipulating with one object, rather than returning new one
 # Dir.pwd => empty directory where the project will be located
 
+# rango create flat api
+# rango create flat api.ru
 hook do |generator, context|
-  generator.target = "#{generator.target}.ru"
+  unless generator.target.end_with?(".ru")
+    generator.target = "#{generator.target}.ru"
+  end
 end

Use generator.hooks.push instead of Hook.invoke directly