Sha256: 1b7ae1969ee97d9352c313862550f709b5aa9a6e6a40fdcb7e4ca7bb44bf4c35
Contents?: true
Size: 1.17 KB
Versions: 1
Compression:
Stored size: 1.17 KB
Contents
unless defined?(Motion::Project::Config) raise "This file must be required within a RubyMotion project Rakefile." end class PhraseConfig attr_accessor :auth_token CONFIG_FILE = './app/phrase_config.rb' def initialize(config) @config = config end def auth_token=(auth_token) @auth_token = auth_token create_phrase_config_file end private def create_phrase_config_file return unless @auth_token if config_file_exists? or config_file_content_outdated? File.open(CONFIG_FILE, 'w') { |f| f.write(config_file_content) } end files = @config.files.flatten files << CONFIG_FILE unless files.find { |f| File.expand_path(f) == File.expand_path(CONFIG_FILE) } end def config_file_exists? File.exist?(CONFIG_FILE) end def config_file_content_outdated? File.read(CONFIG_FILE) != config_file_content end def config_file_content content = <<EOF # This file is automatically generated. Do not edit. PHRASE_AUTH_TOKEN = "#{@auth_token}" EOF content end end module Motion module Project class Config variable :phrase def phrase @phrase ||= PhraseConfig.new(self) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
motion-phrase-0.0.2 | lib/motion/project/phrase.rb |