gemfury 0.4.26 → 0.5.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- N2MyNzQzZGQxYTYwNzM1NDY5NzRjYWJmZGE3YTk3MzY2Mzg5ZTg2OA==
4
+ MGE5MzY5NTE3MGFhMjRiMzhjNDk3MzY2MmFiZTZiMTM4OGEzZDkzZA==
5
5
  data.tar.gz: !binary |-
6
- YjEyNmFjZTFkOGExY2YzZGU5NDhlNjYxY2FjZTQyMTU1YWQ1ZDc5Mg==
6
+ ZDg3MWFmZTA2MTViOGYwNTllZjRhZmY5YWViNWVjMTcwOThlNTdmZA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MmQ2ZWM0NGFhZWU4Yjk2NDEwZTY0N2Q4YjIwYTBiMGU1MTgwYTc5NGZlNjQz
10
- MWNiODU2ODg0NTA4MDE5OGY0YWI3NzdlYjYxMDQzNWY3NGNjOWYxOTZkYmFl
11
- MjcxZTQ0NDc0YmE1ODEyZGVlOTJhYjFmZWVhOWE5NjcxMTZiOTc=
9
+ NjU4NTU0ZDExMjgyZjllY2FjZGViNmUzM2FiMzc4N2NlODQ4MGY4YzYwMGEy
10
+ OGM2NGRkMDQyZWNhNzY3ZTFiYzJiZmZjZDAzYzE5Y2Q5MTNmNTIxNGNmOTJm
11
+ MWNkMWVjYTQ3Y2RiZGQzMjFkMTNmOGNhYTZjNWU2YmVlYmUxMDA=
12
12
  data.tar.gz: !binary |-
13
- OWVkMmFiZWNiZGNmZmNjYmE3N2QxMWMxZDhlNzRmM2U0YzUxZDdmZDhmMTI2
14
- NzU0NDViNTY2NzRkMjVkODNmZmRiMWMyZmJhMzFiZGU1YTJhYmEwOTQ3ODI1
15
- YTkwYjE5ODM3YWIzZDY0YTAwMTVkZmM1YTk5ZTUzZWEwNmUzOGI=
13
+ MWM2OTk4M2I2YjE3Y2QxNjNjMzJlMzA5OTE4NTc0Y2RiODNhYWRkMmZiYmM4
14
+ YmQzMzUxMzRhM2ZjZjcyMGY1NmQ2N2Q0MDBjNTQ3MTA1MzhiNTA3ODRlNWE2
15
+ OTRhODA0NWNiZjdhMDJiYjg2ZDk0NTZjYzRlNzU5MGE2OTI3N2Y=
@@ -23,7 +23,8 @@ module Gemfury
23
23
  ensure_ready!(:authorization)
24
24
 
25
25
  # Generate upload link
26
- api2 = connection(:url => self.endpoint2)
26
+ headers = { :accept => "application/vnd.fury.v2+json" }
27
+ api2 = connection(:headers => headers)
27
28
  response = api2.post('uploads')
28
29
  checked_response_body(response)
29
30
 
@@ -97,21 +98,40 @@ module Gemfury
97
98
  checked_response_body(response)
98
99
  end
99
100
 
101
+ # List Git repos for this account
102
+ def git_repos(options = {})
103
+ ensure_ready!(:authorization)
104
+ response = connection.get(git_repo_path, options)
105
+ checked_response_body(response)
106
+ end
107
+
108
+ # Reset repository to initial state
109
+ def git_reset(repo, options = {})
110
+ ensure_ready!(:authorization)
111
+ response = connection.delete(git_repo_path(repo), options)
112
+ checked_response_body(response)
113
+ end
114
+
100
115
  private
101
116
  def escape(str)
102
117
  CGI.escape(str)
103
118
  end
104
119
 
120
+ def git_repo_path(*args)
121
+ rest = args.map { |a| escape(a) }
122
+ ['git/repos', self.account || 'me'].concat(rest).join('/')
123
+ end
124
+
105
125
  def connection(options = {})
106
126
  options = {
107
127
  :url => self.endpoint,
108
128
  :ssl => { :verify => false },
109
129
  :params => {},
110
130
  :headers => {
111
- :accept => 'application/json',
112
131
  :user_agent => user_agent,
113
- :x_gem_version => Gemfury::VERSION
114
- }
132
+ :x_gem_version => Gemfury::VERSION,
133
+ :accept => self.http_accept || 'application/json',
134
+ }.merge(options.delete(:headers) || {})
115
135
  }.merge(options)
116
136
 
117
137
  if self.user_api_key
@@ -136,6 +136,28 @@ class Gemfury::Command::App < Thor
136
136
  end
137
137
  end
138
138
 
139
+ ### GIT REPOSITORY MANAGEMENT ###
140
+ map "git:list" => 'git_list'
141
+ map "git:reset" => 'git_reset'
142
+
143
+ desc "git:list", "List Git repositories"
144
+ def git_list
145
+ with_checks_and_rescues do
146
+ repos = client.git_repos['repos']
147
+ shell.say "\n*** GEMFURY GIT REPOS ***\n\n"
148
+ names = repos.map { |r| r['name'] }
149
+ names.sort.each { |n| shell.say(n) }
150
+ end
151
+ end
152
+
153
+ desc "git:reset", "Remove a Git repository"
154
+ def git_reset(repo)
155
+ with_checks_and_rescues do
156
+ client.git_reset(repo)
157
+ shell.say "\n*** Yanked #{repo} repository ***\n\n"
158
+ end
159
+ end
160
+
139
161
  private
140
162
  def client
141
163
  opts = {}
@@ -6,20 +6,22 @@ module Gemfury
6
6
  :user_api_key,
7
7
  :adapter,
8
8
  :endpoint,
9
- :endpoint2,
10
9
  :user_agent,
10
+ :http_accept,
11
11
  :account].freeze
12
12
 
13
13
  # The adapter that will be used to connect if none is set
14
14
  DEFAULT_ADAPTER = :net_http
15
15
 
16
16
  # The endpoint that will be used to connect if none is set
17
- DEFAULT_ENDPOINT = 'https://api.fury.io/1/'.freeze
18
- DEFAULT_ENDPOINT2 = 'https://api.fury.io/2/'.freeze
17
+ DEFAULT_ENDPOINT = 'https://api.fury.io/'.freeze
19
18
 
20
19
  # The value sent in the 'User-Agent' header if none is set
21
20
  DEFAULT_USER_AGENT = "Gemfury RubyGem #{Gemfury::VERSION}".freeze
22
21
 
22
+ # The value sent in the 'Accept' header for versioning
23
+ DEFAULT_HTTP_ACCEPT = "application/vnd.fury.v1+json".freeze
24
+
23
25
  # Default user API key
24
26
  DEFAULT_API_KEY = nil
25
27
 
@@ -51,8 +53,8 @@ module Gemfury
51
53
  self.user_api_key = DEFAULT_API_KEY
52
54
  self.adapter = DEFAULT_ADAPTER
53
55
  self.endpoint = DEFAULT_ENDPOINT
54
- self.endpoint2 = DEFAULT_ENDPOINT2
55
56
  self.user_agent = DEFAULT_USER_AGENT
57
+ self.http_accept = DEFAULT_HTTP_ACCEPT
56
58
  self.account = DEFAULT_ACCOUNT
57
59
  self
58
60
  end
@@ -1,3 +1,3 @@
1
1
  module Gemfury
2
- VERSION = '0.4.26'
2
+ VERSION = '0.5.0.beta1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemfury
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.26
4
+ version: 0.5.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Rykov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-10 00:00:00.000000000 Z
11
+ date: 2015-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: highline
@@ -141,9 +141,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
141
141
  version: '0'
142
142
  required_rubygems_version: !ruby/object:Gem::Requirement
143
143
  requirements:
144
- - - ! '>='
144
+ - - ! '>'
145
145
  - !ruby/object:Gem::Version
146
- version: '0'
146
+ version: 1.3.1
147
147
  requirements: []
148
148
  rubyforge_project:
149
149
  rubygems_version: 2.4.5