Sha256: c3c57a570f14c2e9c2a86ca3dd7ba0fb79c376669725785a43b61b1422ecab50
Contents?: true
Size: 871 Bytes
Versions: 62
Compression:
Stored size: 871 Bytes
Contents
require File.expand_path(File.dirname(__FILE__) + "/lib/insert_commands.rb") class WebtranslateitGenerator < Rails::Generator::Base def add_options!(opt) opt.on('-k', '--api-key=key', String, "Your Web Translate It API key") {|v| options[:api_key] = v} end def manifest if !api_key_configured? && !options[:api_key] puts "You must pass --api-key or create config/translations.yml" exit end record do |m| if options[:api_key] project_details = YAML.load WebTranslateIt::Project.fetch_info(options[:api_key]) m.template '.wti', '.wti', :assigns => { :api_key => options[:api_key], :project => project_details["project"] } m.append_to 'Rakefile', "require 'web_translate_it' rescue LoadError" end end end def api_key_configured? File.exists?('config/translations.yml') end end
Version data entries
62 entries across 62 versions & 1 rubygems