require "open-uri" class DangoGenerator < Rails::Generator::NamedBase # ~ 引数・オプションの解釈と初期化 ~ # def initialize(runtime_args, runtime_options = {}) #p runtime_args # super # end def manifest record do |m| # p methods # p instance_variables # p name # p class_name # dangoの初期設定 # if class_name == "init" # 起動スクリプト m.template "script/dango_server" , "script/dango_server" # crossdomain.xml m.template "public/crossdomain.xml" , "public/crossdomain.xml" # vendorプラグイン m.directory 'vendor/plugins/dango/lib' m.template "lib/dango_monitor_client.rb" , "vendor/plugins/dango/lib/dango_monitor_client.rb" m.template "lib/dango_controller_plugin.rb" , "vendor/plugins/dango/lib/dango_controller_plugin.rb" m.directory 'vendor/plugins/dango/tasks' m.template "tasks/dango.rake" , "vendor/plugins/dango/tasks/dango.rake" # dangoフォルダ内 m.directory 'dango/server' m.template "dango/server/99_dango_server.rb" , "dango/server/99_dango_server.rb" # dangoのclient_swf m.directory 'dango/client_swf' m.template "dango/client_swf/DangoConfig.as" , "dango/client_swf/DangoConfig.as" # dangoコンフィグ m.directory 'config/dango' %w( development.yml test.yml production.yml system_message.yml ).each do |as3_file| m.template "config/dango/#{as3_file}", "config/dango/#{as3_file}" end # dangoのas3ライブラリ m.directory 'dango/client_swf/org/rubyforge/dango' %w( DangoClientFramework.as DangoError.as DangoErrorCode.as DangoErrorEvent.as DangoReceiveEvent.as DangoURLLoader.as DangoURLLoaderEvent.as DangoUtil.as ).each do |as3_file| m.template "as3/org/rubyforge/dango/#{as3_file}", "dango/client_swf/org/rubyforge/dango/#{as3_file}" end # http://code.google.com/p/as3corelib/のインポート %w( as3corelib-readme.txt as3corelib-license.txt com/adobe/crypto/MD5.as com/adobe/crypto/SHA1.as com/adobe/crypto/SHA224.as com/adobe/crypto/SHA256.as com/adobe/crypto/WSSEUsernameToken.as com/adobe/errors/IllegalStateError.as com/adobe/images/BitString.as com/adobe/images/JPGEncoder.as com/adobe/images/PNGEncoder.as com/adobe/net/DynamicURLLoader.as com/adobe/net/IURIResolver.as com/adobe/net/URI.as com/adobe/net/URIEncodingBitmap.as com/adobe/net/proxies/RFC2817Socket.as com/adobe/serialization/json/JSON.as com/adobe/serialization/json/JSONDecoder.as com/adobe/serialization/json/JSONEncoder.as com/adobe/serialization/json/JSONParseError.as com/adobe/serialization/json/JSONToken.as com/adobe/serialization/json/JSONTokenizer.as com/adobe/serialization/json/JSONTokenType.as com/adobe/utils/ArrayUtil.as com/adobe/utils/DateUtil.as com/adobe/utils/DictionaryUtil.as com/adobe/utils/IntUtil.as com/adobe/utils/NumberFormatter.as com/adobe/utils/StringUtil.as com/adobe/utils/XMLUtil.as com/adobe/webapis/ServiceBase.as com/adobe/webapis/URLLoaderBase.as com/adobe/webapis/events/ServiceEvent.as ).each do |as3corelib_file| m.directory File.dirname("dango/client_swf/#{as3corelib_file}") m.template "as3/#{as3corelib_file}", "dango/client_swf/#{as3corelib_file}" end # end end # puts "completed to dango_generator" end # end manifest attr_accessor :controller_class_name end