targit 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8102f78ea21fde7901014038dc5820e7fdf53aa7
4
- data.tar.gz: 0f84ca138d84ec9db5f3653d02166a070002955e
3
+ metadata.gz: b7944aeedcfafcc3091cb2820616f1dfdea3e55d
4
+ data.tar.gz: b7847bd30f637994224c4f13f10b32d37e66d7b0
5
5
  SHA512:
6
- metadata.gz: c4bee9111217ef63cf5100d2ff65a8e85cd4345107c45209fd0fe55c17f76a43faa93809126322ba94832b8af2509d5103814e62beff880a9ac68c71eb1f7707
7
- data.tar.gz: 9570f197e3b2c24efd5d9abd8f0516a766d9514164be4a1834058ed2e9b71f41fbf839047de89a796cb738d1abaf757d7c2f3a85f14fd75df3d495cab2e9a651
6
+ metadata.gz: 05af5a40ed6f1c51417a17dbee3dd302c9f815368206645d6db8e752719765e72f8c8f5fca5b20eeb44f15bafd282d9cacc1b1005c2095c2572b2eac840b8141
7
+ data.tar.gz: 998408a5a2eeaabf062f35ecb15ee2af42375b56e4331d1581e7f4682cc38d37fa83785c87df5eba576a8a2b313e4316b2ae1b31c2c879a9acc8b96a238b3731
data/lib/targit/asset.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'octokit'
2
2
  require 'octoauth'
3
+ require 'mime-types'
3
4
 
4
5
  module Targit
5
6
  ##
@@ -69,9 +70,16 @@ module Targit
69
70
  end
70
71
 
71
72
  def _upload_options
72
- [:name, :content_type].each_with_object({}) do |option, hash|
73
+ options = [:name, :content_type].each_with_object({}) do |option, hash|
73
74
  hash[option] = @options[option] if @options[option]
74
75
  end
76
+ options[:content_type] ||= guess_type
77
+ options
78
+ end
79
+
80
+ def guess_type
81
+ mime_type = MIME::Types.type_for(@asset).first
82
+ mime_type ? mime_type.content_type : nil
75
83
  end
76
84
  end
77
85
  end
@@ -1,5 +1,5 @@
1
1
  ##
2
2
  # Set the version (needed for Mercenary -v)
3
3
  module Targit
4
- VERSION = '0.0.3'
4
+ VERSION = '0.0.4'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: targit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Les Aker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-29 00:00:00.000000000 Z
11
+ date: 2014-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit