build_47 0.1.5

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.
Files changed (3) hide show
  1. data/bin/build_47 +43 -0
  2. data/lib/build_47.rb +25 -0
  3. metadata +65 -0
data/bin/build_47 ADDED
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'optparse'
4
+ require 'build_47'
5
+
6
+ # replace me with https://github.com/visionmedia/commander !
7
+ options = {}
8
+ OptionParser.new do |opts|
9
+ opts.on("-t", "--token TOKEN", "Require processor class name") do |t|
10
+ options[:token] = t
11
+ end
12
+ opts.on("-a", "--app_id id", "App's ID") do |t|
13
+ options[:app_id] = t
14
+ end
15
+ opts.on("-e", "--environment ENVIRONMENT", "Select environment -- Test or Production") do |t|
16
+ options[:environment] = t
17
+ end
18
+ opts.on("-p", "--platform PLATFORM", "Require platform, such as iOS or Android") do |t|
19
+ options[:platform] = t
20
+ end
21
+ opts.on("-f", "--file FULL PATH", "full path to file for uploading") do |t|
22
+ options[:path] = t
23
+ end
24
+ opts.on("-r", "--release_notes RELEASE NOTES", "release notes -- not required") do |t|
25
+ options[:notes] = t
26
+ end
27
+ end.parse!
28
+
29
+ options[:environment] ||= 'Production'
30
+ options[:platform] ||= 'iOS'
31
+ options[:notes] ||= 'none'
32
+
33
+ puts "you must provide a path to a particular build file" if options[:path].nil?
34
+ puts "you must provide a token (i.e. -t <token>). You can find this for your account in the App47 dashbard)" if options[:token].nil?
35
+ puts "you must provide an App Id (i.e. -a <app_id>). You can find this for your account in the App47 dashbard)" if options[:app_id].nil?
36
+
37
+ if( !options[:path].nil? && !options[:token].nil? && !options[:app_id].nil? )
38
+ build = Build47.new(options[:token])
39
+ build.push(options[:app_id], options[:platform], options[:environment], options[:path], options[:notes])
40
+ else
41
+ puts "i.e build_47 -t 'some token' -a some app_id -f path_to_file"
42
+ puts "default arguments are -e Production -p iOS -r notes so if you want to push to Test or declare this as an Android build, use those flags."
43
+ end
data/lib/build_47.rb ADDED
@@ -0,0 +1,25 @@
1
+ require 'rest_client'
2
+
3
+ class Build47
4
+
5
+ def initialize(account_token)
6
+ @token = account_token
7
+ end
8
+
9
+ def push(app_id, platform, env, file_path, release_notes)
10
+ build_doc = {
11
+ :build => {
12
+ :platform => platform,
13
+ :environment => env,
14
+ :upload => File.new(file_path),
15
+ :build_file => file_path.split('/')[-1],
16
+ :release_notes => release_notes
17
+ }
18
+ }
19
+ response = RestClient.post "https://cirrus.app47.com/api/apps/#{app_id}/builds", build_doc, {"X-Token"=> @token, :accept => :json}
20
+ puts "response code: #{response.code}"
21
+ end
22
+
23
+ end
24
+
25
+
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: build_47
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.1.5
6
+ platform: ruby
7
+ authors:
8
+ - Andrew Glover
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2012-07-11 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rest-client
17
+ prerelease: false
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.6.0
24
+ type: :runtime
25
+ version_requirements: *id001
26
+ description: A simple Ruby utility for pushing builds to App47
27
+ email: aglover@app47.com
28
+ executables:
29
+ - build_47
30
+ extensions: []
31
+
32
+ extra_rdoc_files: []
33
+
34
+ files:
35
+ - lib/build_47.rb
36
+ - bin/build_47
37
+ homepage: https://github.com/App47/build_47
38
+ licenses: []
39
+
40
+ post_install_message:
41
+ rdoc_options: []
42
+
43
+ require_paths:
44
+ - lib
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ none: false
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: "0"
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: "0"
57
+ requirements: []
58
+
59
+ rubyforge_project:
60
+ rubygems_version: 1.8.15
61
+ signing_key:
62
+ specification_version: 3
63
+ summary: Pushes an iOS or Android build file to App47 for distribution via an App store.
64
+ test_files: []
65
+