hawk 0.1.0 → 0.2.0

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.
data/hawk.gemspec CHANGED
@@ -18,6 +18,5 @@ Gem::Specification.new do |gem|
18
18
  gem.require_paths = ["lib"]
19
19
 
20
20
  gem.add_dependency('aws-sdk', '~> 1.8')
21
- gem.add_dependency('xcodeproj', '~> 0.4')
22
21
  gem.add_dependency('osx-plist', '~> 1.0')
23
22
  end
data/lib/hawk/builder.rb CHANGED
@@ -7,6 +7,22 @@ module Hawk
7
7
  def signing_identity(identity)
8
8
  @signing_identity = identity
9
9
  end
10
+
11
+ def project(project)
12
+ @project = project
13
+ end
14
+
15
+ def workspace(workspace)
16
+ @workspace = workspace
17
+ end
18
+
19
+ def scheme(scheme)
20
+ @scheme = scheme
21
+ end
22
+
23
+ def configuration(configuration)
24
+ @configuration = configuration
25
+ end
10
26
  end
11
27
 
12
28
  def app_name
@@ -59,7 +75,8 @@ module Hawk
59
75
  output_dir = Dir.tmpdir
60
76
 
61
77
  print "Building Xcode project..."
62
- output = `/usr/bin/xcodebuild CONFIGURATION_BUILD_DIR=#{output_dir} 2>&1`
78
+ output = `#{xcode_command} CONFIGURATION_BUILD_DIR=#{output_dir} 2>&1`
79
+
63
80
  if $?.to_i != 0
64
81
  puts "error (text follows)"
65
82
  abort output
@@ -76,7 +93,16 @@ module Hawk
76
93
  end
77
94
 
78
95
  def project_property(prop)
79
- `/usr/bin/xcodebuild -showBuildSettings | grep "\s#{prop} = "`.gsub!(/.* = /, '').chomp
96
+ `#{xcode_command} -showBuildSettings | grep "\s#{prop} = " 2>&1`.gsub!(/.* = /, '').chomp
97
+ end
98
+
99
+ def xcode_command
100
+ options = []
101
+ options << "-project #{@project}" if @project
102
+ options << "-workspace #{@workspace}" if @workspace
103
+ options << "-scheme #{@scheme}" if @scheme
104
+ options << "-configuration #{@configuration || 'Release'}"
105
+ "/usr/bin/xcodebuild #{options.join(' ')}"
80
106
  end
81
107
  end
82
108
  end
@@ -15,7 +15,7 @@ module Hawk
15
15
 
16
16
  private
17
17
  def files
18
- { 'Hawkfile' => ERB.new(File.read(File.join(File.dirname(__FILE__), '..', '..', 'templates', 'Hawkfile.erb'))).result }
18
+ { 'Hawkfile' => File.read(File.join(File.dirname(__FILE__), '..', '..', 'templates', 'Hawkfile')) }
19
19
  end
20
20
 
21
21
  def write_file_if_not_exist(name, contents)
@@ -14,6 +14,10 @@ module Hawk
14
14
  def bucket_name(name)
15
15
  @bucket_name = name
16
16
  end
17
+
18
+ def delete_after(days)
19
+ @delete_after = days
20
+ end
17
21
  end
18
22
 
19
23
  def ipa_url
@@ -43,9 +47,16 @@ module Hawk
43
47
  private
44
48
 
45
49
  def object(name, &block)
46
- s3 = AWS::S3.new(:access_key_id => @access_key_id, :secret_access_key => @secret_access_key)
47
- bucket = s3.buckets.create @bucket_name
48
- obj = bucket.objects[name]
50
+ prefix = "#{app_name}/#{app_version}/"
51
+ if !@bucket
52
+ @s3 ||= AWS::S3.new(:access_key_id => @access_key_id, :secret_access_key => @secret_access_key)
53
+ @bucket = @s3.buckets.create @bucket_name
54
+ @bucket.lifecycle_configuration.update do
55
+ remove_rule prefix
56
+ add_rule prefix, :id => prefix, :expiration_time => (@delete_after || 30)
57
+ end
58
+ end
59
+ obj = @bucket.objects["#{prefix}#{name}"]
49
60
  yield obj
50
61
  obj.acl = :public_read
51
62
  obj.public_url
data/lib/hawk/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Hawk
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -7,6 +7,19 @@
7
7
  #
8
8
  # The signing identity to sign your app with. Defaults to 'iPhone Distribution'
9
9
  #signing_identity 'iPhone Distribution'
10
+ #
11
+ # The project file to load (this is usually found automatically)
12
+ #project 'SampleProject.xcodeproj'
13
+ #
14
+ # The workspace file to use (like project, this is usually found automatically)
15
+ #workspace 'SampleWorkspace.xcworkspace'
16
+ #
17
+ # The scheme to build (required when building a workspace).
18
+ # Run 'xcodebuild --workspace <workspace> -list' to see available schemes
19
+ #scheme 'SampleApplication'
20
+ #
21
+ # The configuration to build. Defaults to 'Release'
22
+ #configuration 'Release'
10
23
 
11
24
  #
12
25
  # AWS Credentials - used to upload your app and associated metadata into S3 so
@@ -15,6 +28,9 @@
15
28
  #access_key_id 'AAAAAAAAAAAAAAAAAAAA'
16
29
  #secret_access_key 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
17
30
  #bucket_name 'mah-bukkit'
31
+ #
32
+ # How many days to wait before deleting the files from S3. Defaults to 30 days
33
+ #delete_after 30
18
34
 
19
35
  #
20
36
  # User list - a list of users to send emails to upon successsful upload of a new
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hawk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-11 00:00:00.000000000 Z
12
+ date: 2013-02-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk
@@ -27,22 +27,6 @@ dependencies:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
29
  version: '1.8'
30
- - !ruby/object:Gem::Dependency
31
- name: xcodeproj
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ~>
36
- - !ruby/object:Gem::Version
37
- version: '0.4'
38
- type: :runtime
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ~>
44
- - !ruby/object:Gem::Version
45
- version: '0.4'
46
30
  - !ruby/object:Gem::Dependency
47
31
  name: osx-plist
48
32
  requirement: !ruby/object:Gem::Requirement
@@ -84,7 +68,7 @@ files:
84
68
  - lib/hawk/notifier.rb
85
69
  - lib/hawk/s3_uploader.rb
86
70
  - lib/hawk/version.rb
87
- - templates/Hawkfile.erb
71
+ - templates/Hawkfile
88
72
  - templates/manifest.plist.erb
89
73
  homepage: http://github.com/mtrudel/hawk
90
74
  licenses: []