vendor 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- vendor (0.0.2)
4
+ vendor (0.0.3)
5
+ highline
5
6
  json
6
7
  rake
7
8
  rest-client
@@ -17,13 +18,14 @@ GEM
17
18
  columnize (0.3.4)
18
19
  diff-lcs (1.1.2)
19
20
  fakeweb (1.3.0)
21
+ highline (1.6.2)
20
22
  json (1.6.1)
21
23
  linecache (0.46)
22
24
  rbx-require-relative (> 0.0.4)
23
25
  linecache19 (0.5.12)
24
26
  ruby_core_source (>= 0.1.4)
25
- mime-types (1.16)
26
- rake (0.9.2)
27
+ mime-types (1.17.2)
28
+ rake (0.9.2.2)
27
29
  rbx-require-relative (0.0.5)
28
30
  rest-client (1.6.7)
29
31
  mime-types (>= 1.16)
data/Readme.markdown CHANGED
@@ -122,7 +122,7 @@ Now that you have a packaged library, you can push it to [http://vendorforge.org
122
122
  running:
123
123
 
124
124
  ```bash
125
- $ vendor library publish my_library.vendor
125
+ $ vendor library push my_library.vendor
126
126
  ```
127
127
 
128
128
  ## What about CocoaPods?
data/lib/vendor/api.rb CHANGED
@@ -3,10 +3,16 @@ require 'rest_client'
3
3
  module Vendor
4
4
  module API
5
5
 
6
+ require 'json'
7
+
6
8
  extend self
7
9
 
8
10
  class Error < StandardError; end
9
11
 
12
+ def api_uri
13
+ ENV["API_URI"] || 'http://vendorforge.org'
14
+ end
15
+
10
16
  def api_key(username, password)
11
17
  perform do
12
18
  response = resource(username, password)["users/#{username}/api_key.json"].get
@@ -14,7 +20,7 @@ module Vendor
14
20
  end
15
21
  end
16
22
 
17
- def publish(options)
23
+ def push(options)
18
24
  perform do
19
25
  response = resource["vendors.json"].post :version => { :package => File.new(options[:file]) }, :api_key => options[:api_key]
20
26
  body = JSON.parse(response.body)
@@ -42,7 +48,7 @@ module Vendor
42
48
  end
43
49
 
44
50
  def resource(user = nil, pass = nil)
45
- RestClient::Resource.new(ENV["API_URI"] || 'http://vendorforge.org', :user => user, :password => pass)
51
+ RestClient::Resource.new(api_uri, :user => user, :password => pass)
46
52
  end
47
53
 
48
54
  end
@@ -6,7 +6,7 @@ module Vendor
6
6
 
7
7
  class Library < Thor
8
8
 
9
- desc "init", "Generate a simple vendorspec, placed in the current directory"
9
+ desc "library init", "Generate a simple vendorspec, placed in the current directory"
10
10
  def init
11
11
  # Use the current folder name as the name of the vendorspec
12
12
  name = File.basename(Dir.pwd)
@@ -35,12 +35,12 @@ module Vendor
35
35
  end
36
36
  end
37
37
 
38
- desc "library publish VENDOR_FILE", "Publish a vendor package to vendorforge.org"
39
- def publish(file)
38
+ desc "library push VENDOR_FILE", "Push a vendor package to vendorforge.org"
39
+ def push(file)
40
40
  begin
41
41
  Vendor::CLI::Auth.with_api_key do |api_key|
42
- url = Vendor::API.publish :file => File.expand_path(file), :api_key => api_key
43
- Vendor.ui.success "Successfully published to #{url}"
42
+ url = Vendor::API.push :file => File.expand_path(file), :api_key => api_key
43
+ Vendor.ui.success "Successfully pushed to #{Vendor::API.api_uri}#{url}"
44
44
  end
45
45
  rescue Vendor::API::Error => e
46
46
  Vendor.ui.error "Error: #{e.message}"
@@ -4,6 +4,8 @@ module Vendor
4
4
 
5
5
  module Auth
6
6
 
7
+ require 'highline/import'
8
+
7
9
  extend self
8
10
 
9
11
  def api_key
@@ -16,10 +18,9 @@ module Vendor
16
18
 
17
19
  def fetch_api_key
18
20
  Vendor.ui.warn "Please enter your vendorforge.org login and password"
19
- printf "Login: "
20
- username = STDIN.gets.chomp.strip
21
- printf "Password: "
22
- password = STDIN.gets.chomp.strip
21
+
22
+ username = ask("Login: ")
23
+ password = ask("Password: ") { |q| q.echo = false }
23
24
 
24
25
  Vendor::Config.set(:"credentials.vendorforge_api_key", Vendor::API.api_key(username, password))
25
26
  end
@@ -1,5 +1,5 @@
1
1
  module Vendor
2
2
 
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
 
5
5
  end
@@ -41,10 +41,9 @@ describe Vendor::CLI::Auth do
41
41
  context "#fetch_api_key" do
42
42
 
43
43
  it "should ask for their username and password" do
44
- STDIN.should_receive(:gets).once.ordered.and_return "keithpitt"
45
- STDIN.should_receive(:gets).once.ordered.and_return "password"
44
+ Vendor::CLI::Auth.should_receive(:ask).once.ordered.and_return "keithpitt"
45
+ Vendor::CLI::Auth.should_receive(:ask).once.ordered.and_return "password"
46
46
  Vendor.ui.should_receive(:warn).once
47
- Vendor::CLI::Auth.should_receive(:printf).twice
48
47
 
49
48
  Vendor::CLI::Auth.fetch_api_key.should == "secret"
50
49
  end
data/vendor.gemspec CHANGED
@@ -28,5 +28,6 @@ Gem::Specification.new do |s|
28
28
  s.add_runtime_dependency "thor"
29
29
  s.add_runtime_dependency "rubyzip"
30
30
  s.add_runtime_dependency "rest-client"
31
+ s.add_runtime_dependency "highline"
31
32
 
32
33
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vendor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-11-02 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70306350501080 !ruby/object:Gem::Requirement
16
+ requirement: &70325740905740 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70306350501080
24
+ version_requirements: *70325740905740
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: fakeweb
27
- requirement: &70306350500220 !ruby/object:Gem::Requirement
27
+ requirement: &70325740905100 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70306350500220
35
+ version_requirements: *70325740905100
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: ripl
38
- requirement: &70306350498880 !ruby/object:Gem::Requirement
38
+ requirement: &70325740904480 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70306350498880
46
+ version_requirements: *70325740904480
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rake
49
- requirement: &70306350496500 !ruby/object:Gem::Requirement
49
+ requirement: &70325740904040 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70306350496500
57
+ version_requirements: *70325740904040
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: json
60
- requirement: &70306350495200 !ruby/object:Gem::Requirement
60
+ requirement: &70325740903620 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70306350495200
68
+ version_requirements: *70325740903620
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: thor
71
- requirement: &70306350494060 !ruby/object:Gem::Requirement
71
+ requirement: &70325740903020 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *70306350494060
79
+ version_requirements: *70325740903020
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rubyzip
82
- requirement: &70306350491180 !ruby/object:Gem::Requirement
82
+ requirement: &70325740902400 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *70306350491180
90
+ version_requirements: *70325740902400
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: rest-client
93
- requirement: &70306350490260 !ruby/object:Gem::Requirement
93
+ requirement: &70325740901760 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,7 +98,18 @@ dependencies:
98
98
  version: '0'
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *70306350490260
101
+ version_requirements: *70325740901760
102
+ - !ruby/object:Gem::Dependency
103
+ name: highline
104
+ requirement: &70325740901340 !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ type: :runtime
111
+ prerelease: false
112
+ version_requirements: *70325740901340
102
113
  description: Vendor manages an application's dependencies
103
114
  email:
104
115
  - me@keithpitt.com