gemplate 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5cfa31ca7c6d4cef047638c99ac2b6d4f76c604c
4
- data.tar.gz: 0bd90863aa0dd3b0a71cccc59cf4c2eeb32af8d0
3
+ metadata.gz: 098b930c9f8f6688744e981e5595be09eb086d74
4
+ data.tar.gz: 3ebc02d9741640163c69b5810150a253378290bb
5
5
  SHA512:
6
- metadata.gz: 8df0885d39c8e35253a7cc462a39396b2daa5784eb31fb72bc2b5fe6796b15cbda1f37bbd99ab106f763a22e571f9c9ce0c94310a7dfbebe5203eefccded2f6b
7
- data.tar.gz: 4b9dc2259bbe860f85b69df0c23252366f3737b0f7929f41b4d3c1162eefa58f447223c795249be803d9ad68c7793230ce1df8573eb5c7e119f9bc02f88d67e1
6
+ metadata.gz: 1c65c1d2306082769408c83ee8d4bd48fa619998a42df8642cdb7b1081242769da0f648ea5976d8e30d0f9a08467e3974309f831cb01d3cd7ec2b9bf19678bd5
7
+ data.tar.gz: ba4e2d0b933e146736799b1c3b9e91a90ae7a5f9ae8264635c7e814da15c100b7d3c66d8fb3886aabb4e326895f2ec985ba3835472811730a3345a86c468502e
data/bin/gemplate CHANGED
@@ -11,6 +11,9 @@ name = UserInput.new(message: 'Gem name', default: name).ask
11
11
  user = Rugged::Config.global['github.user'] || ENV['USER']
12
12
  user = UserInput.new(message: 'GitHub username', default: user).ask
13
13
 
14
+ org = user
15
+ org = UserInput.new(message: 'GitHub organization', default: org).ask
16
+
14
17
  full_name = Rugged::Config.global['user.name']
15
18
  full_name = UserInput.new(message: 'Full name', default: full_name).ask
16
19
 
@@ -32,6 +35,7 @@ license = UserInput.new(
32
35
  Gemplate.new(
33
36
  name: name,
34
37
  user: user,
38
+ org: org,
35
39
  full_name: full_name,
36
40
  email: email,
37
41
  license: license
data/circle.yml ADDED
@@ -0,0 +1,12 @@
1
+ dependencies:
2
+ override:
3
+ - 'rvm-exec 1.9.3-p551 bundle install'
4
+ - 'rvm-exec 2.0.0-p645 bundle install'
5
+ - 'rvm-exec 2.1.6 bundle install'
6
+ - 'rvm-exec 2.2.2 bundle install'
7
+ test:
8
+ override:
9
+ - 'rvm-exec 1.9.3-p551 bundle exec rake'
10
+ - 'rvm-exec 2.0.0-p645 bundle exec rake'
11
+ - 'rvm-exec 2.1.6 bundle exec rake'
12
+ - 'rvm-exec 2.2.2 bundle exec rake'
data/gemplate.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'gemplate'
3
- s.version = '1.1.0'
3
+ s.version = '1.1.1'
4
4
  s.date = Time.now.strftime('%Y-%m-%d')
5
5
 
6
6
  s.summary = 'Bootstrap tool for making gems'
@@ -16,6 +16,8 @@ Gem::Specification.new do |s|
16
16
 
17
17
  s.add_dependency 'rugged', '~> 0.23.0'
18
18
  s.add_dependency 'userinput', '~> 1.0.0'
19
+ s.add_dependency 'octoauth', '~> 1.3.0'
20
+ s.add_dependency 'octokit', '~> 4.1.0'
19
21
  s.add_dependency 'curb', '~> 0.8.6'
20
22
 
21
23
  s.add_development_dependency 'rubocop', '~> 0.34.0'
@@ -23,4 +25,6 @@ Gem::Specification.new do |s|
23
25
  s.add_development_dependency 'codecov', '~> 0.1.1'
24
26
  s.add_development_dependency 'rspec', '~> 3.3.0'
25
27
  s.add_development_dependency 'fuubar', '~> 2.0.0'
28
+ s.add_development_dependency 'webmock', '~> 1.22.0'
29
+ s.add_development_dependency 'vcr', '~> 2.9.2'
26
30
  end
data/lib/gemplate.rb CHANGED
@@ -2,6 +2,8 @@ require 'rugged'
2
2
  require 'pathname'
3
3
  require 'fileutils'
4
4
  require 'curb'
5
+ require 'octoauth'
6
+ require 'octokit'
5
7
 
6
8
  ##
7
9
  # Bootstrap tool for new gems
@@ -24,9 +26,11 @@ module Gemplate
24
26
  def initialize(params = {})
25
27
  @name = params[:name]
26
28
  @user = params[:user]
29
+ @org = params[:org]
27
30
  @full_name = params[:full_name]
28
31
  @email = params[:email]
29
32
  @license = params[:license]
33
+ @authfile = params[:authfile] || :default
30
34
  end
31
35
 
32
36
  def create
@@ -92,9 +96,21 @@ module Gemplate
92
96
 
93
97
  def make_repo
94
98
  Rugged::Repository.init_at '.'
95
- `git remote add origin "git@github.com:#{@user}/#{@name}"`
99
+ `git remote add origin "git@github.com:#{org || @name}/#{@name}"`
96
100
  `git config branch.master.remote origin`
97
101
  `git config branch.master.merge refs/heads/master`
102
+ github_api.create_repo(@name, organization: org, has_wiki: false)
103
+ end
104
+
105
+ def org
106
+ @org == @name ? nil : @org
107
+ end
108
+
109
+ def github_api
110
+ return @api_client if @api_client
111
+ auth = Octoauth.new note: 'gemplate', scopes: ['repo'], file: @authfile
112
+ auth.save
113
+ @api_client = Octokit::Client.new(access_token: auth.token)
98
114
  end
99
115
  end
100
116
  end
data/spec/creds.yml ADDED
@@ -0,0 +1,2 @@
1
+ ---
2
+ gemplate: sekrit
@@ -0,0 +1,52 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://raw.githubusercontent.com/akerl/licenses/master/MIT-3.txt
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 404
13
+ message: Not Found
14
+ headers:
15
+ Content-Security-Policy:
16
+ - default-src 'none'
17
+ X-Xss-Protection:
18
+ - 1; mode=block
19
+ X-Frame-Options:
20
+ - deny
21
+ X-Content-Type-Options:
22
+ - nosniff
23
+ Strict-Transport-Security:
24
+ - max-age=31536000
25
+ Content-Length:
26
+ - '9'
27
+ Accept-Ranges:
28
+ - bytes
29
+ Date:
30
+ - Sun, 25 Oct 2015 22:52:58 GMT
31
+ Via:
32
+ - 1.1 varnish
33
+ Connection:
34
+ - keep-alive
35
+ X-Cache:
36
+ - MISS
37
+ X-Cache-Hits:
38
+ - '0'
39
+ Vary:
40
+ - Authorization,Accept-Encoding
41
+ Access-Control-Allow-Origin:
42
+ - "*"
43
+ Expires:
44
+ - Sun, 25 Oct 2015 22:57:58 GMT
45
+ Source-Age:
46
+ - '0'
47
+ body:
48
+ encoding: ASCII-8BIT
49
+ string: Not Found
50
+ http_version:
51
+ recorded_at: Sun, 25 Oct 2015 22:52:59 GMT
52
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,149 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://raw.githubusercontent.com/akerl/licenses/master/MIT.txt
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ Content-Security-Policy:
16
+ - default-src 'none'
17
+ X-Xss-Protection:
18
+ - 1; mode=block
19
+ X-Frame-Options:
20
+ - deny
21
+ X-Content-Type-Options:
22
+ - nosniff
23
+ Strict-Transport-Security:
24
+ - max-age=31536000
25
+ Content-Type:
26
+ - text/plain; charset=utf-8
27
+ Cache-Control:
28
+ - max-age=300
29
+ Content-Length:
30
+ - '1085'
31
+ Accept-Ranges:
32
+ - bytes
33
+ Date:
34
+ - Sun, 25 Oct 2015 22:47:58 GMT
35
+ Via:
36
+ - 1.1 varnish
37
+ Connection:
38
+ - keep-alive
39
+ X-Cache:
40
+ - HIT
41
+ X-Cache-Hits:
42
+ - '1'
43
+ Vary:
44
+ - Authorization,Accept-Encoding
45
+ Access-Control-Allow-Origin:
46
+ - "*"
47
+ Expires:
48
+ - Sun, 25 Oct 2015 22:52:58 GMT
49
+ Source-Age:
50
+ - '161'
51
+ body:
52
+ encoding: ASCII-8BIT
53
+ string: |+
54
+ The MIT License (MIT)
55
+
56
+ Copyright (c) CURRENT_YEAR FULL_NAME
57
+
58
+ Permission is hereby granted, free of charge, to any person obtaining a copy
59
+ of this software and associated documentation files (the "Software"), to deal
60
+ in the Software without restriction, including without limitation the rights
61
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
62
+ copies of the Software, and to permit persons to whom the Software is
63
+ furnished to do so, subject to the following conditions:
64
+
65
+ The above copyright notice and this permission notice shall be included in
66
+ all copies or substantial portions of the Software.
67
+
68
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
69
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
70
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
71
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
72
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
73
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
74
+ THE SOFTWARE.
75
+
76
+ http_version:
77
+ recorded_at: Sun, 25 Oct 2015 22:47:59 GMT
78
+ - request:
79
+ method: post
80
+ uri: https://api.github.com/user/repos
81
+ body:
82
+ encoding: UTF-8
83
+ string: '{"has_wiki":false,"name":"gemplate-test"}'
84
+ headers:
85
+ Accept:
86
+ - application/vnd.github.v3+json
87
+ User-Agent:
88
+ - Octokit Ruby Gem 4.1.1
89
+ Content-Type:
90
+ - application/json
91
+ Accept-Encoding:
92
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
93
+ response:
94
+ status:
95
+ code: 201
96
+ message: Created
97
+ headers:
98
+ Server:
99
+ - GitHub.com
100
+ Date:
101
+ - Sun, 25 Oct 2015 22:47:59 GMT
102
+ Content-Type:
103
+ - application/json; charset=utf-8
104
+ Content-Length:
105
+ - '4615'
106
+ Status:
107
+ - 201 Created
108
+ X-Ratelimit-Limit:
109
+ - '5000'
110
+ X-Ratelimit-Remaining:
111
+ - '4874'
112
+ X-Ratelimit-Reset:
113
+ - '1445813888'
114
+ Cache-Control:
115
+ - private, max-age=60, s-maxage=60
116
+ X-Oauth-Scopes:
117
+ - gist, repo, user
118
+ X-Accepted-Oauth-Scopes:
119
+ - public_repo, repo
120
+ Location:
121
+ - https://api.github.com/repos/akerl/gemplate-test
122
+ Vary:
123
+ - Accept, Authorization, Cookie, X-GitHub-OTP
124
+ - Accept-Encoding
125
+ X-Github-Media-Type:
126
+ - github.v3; format=json
127
+ X-Xss-Protection:
128
+ - 1; mode=block
129
+ X-Frame-Options:
130
+ - deny
131
+ Content-Security-Policy:
132
+ - default-src 'none'
133
+ Access-Control-Allow-Credentials:
134
+ - 'true'
135
+ Access-Control-Expose-Headers:
136
+ - ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,
137
+ X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
138
+ Access-Control-Allow-Origin:
139
+ - "*"
140
+ Strict-Transport-Security:
141
+ - max-age=31536000; includeSubdomains; preload
142
+ X-Content-Type-Options:
143
+ - nosniff
144
+ body:
145
+ encoding: UTF-8
146
+ string: '{"id":44933642,"name":"gemplate-test","full_name":"akerl/gemplate-test","owner":{"login":"akerl","id":491209,"avatar_url":"https://avatars.githubusercontent.com/u/491209?v=3","gravatar_id":"","url":"https://api.github.com/users/akerl","html_url":"https://github.com/akerl","followers_url":"https://api.github.com/users/akerl/followers","following_url":"https://api.github.com/users/akerl/following{/other_user}","gists_url":"https://api.github.com/users/akerl/gists{/gist_id}","starred_url":"https://api.github.com/users/akerl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akerl/subscriptions","organizations_url":"https://api.github.com/users/akerl/orgs","repos_url":"https://api.github.com/users/akerl/repos","events_url":"https://api.github.com/users/akerl/events{/privacy}","received_events_url":"https://api.github.com/users/akerl/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/akerl/gemplate-test","description":null,"fork":false,"url":"https://api.github.com/repos/akerl/gemplate-test","forks_url":"https://api.github.com/repos/akerl/gemplate-test/forks","keys_url":"https://api.github.com/repos/akerl/gemplate-test/keys{/key_id}","collaborators_url":"https://api.github.com/repos/akerl/gemplate-test/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/akerl/gemplate-test/teams","hooks_url":"https://api.github.com/repos/akerl/gemplate-test/hooks","issue_events_url":"https://api.github.com/repos/akerl/gemplate-test/issues/events{/number}","events_url":"https://api.github.com/repos/akerl/gemplate-test/events","assignees_url":"https://api.github.com/repos/akerl/gemplate-test/assignees{/user}","branches_url":"https://api.github.com/repos/akerl/gemplate-test/branches{/branch}","tags_url":"https://api.github.com/repos/akerl/gemplate-test/tags","blobs_url":"https://api.github.com/repos/akerl/gemplate-test/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/akerl/gemplate-test/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/akerl/gemplate-test/git/refs{/sha}","trees_url":"https://api.github.com/repos/akerl/gemplate-test/git/trees{/sha}","statuses_url":"https://api.github.com/repos/akerl/gemplate-test/statuses/{sha}","languages_url":"https://api.github.com/repos/akerl/gemplate-test/languages","stargazers_url":"https://api.github.com/repos/akerl/gemplate-test/stargazers","contributors_url":"https://api.github.com/repos/akerl/gemplate-test/contributors","subscribers_url":"https://api.github.com/repos/akerl/gemplate-test/subscribers","subscription_url":"https://api.github.com/repos/akerl/gemplate-test/subscription","commits_url":"https://api.github.com/repos/akerl/gemplate-test/commits{/sha}","git_commits_url":"https://api.github.com/repos/akerl/gemplate-test/git/commits{/sha}","comments_url":"https://api.github.com/repos/akerl/gemplate-test/comments{/number}","issue_comment_url":"https://api.github.com/repos/akerl/gemplate-test/issues/comments{/number}","contents_url":"https://api.github.com/repos/akerl/gemplate-test/contents/{+path}","compare_url":"https://api.github.com/repos/akerl/gemplate-test/compare/{base}...{head}","merges_url":"https://api.github.com/repos/akerl/gemplate-test/merges","archive_url":"https://api.github.com/repos/akerl/gemplate-test/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/akerl/gemplate-test/downloads","issues_url":"https://api.github.com/repos/akerl/gemplate-test/issues{/number}","pulls_url":"https://api.github.com/repos/akerl/gemplate-test/pulls{/number}","milestones_url":"https://api.github.com/repos/akerl/gemplate-test/milestones{/number}","notifications_url":"https://api.github.com/repos/akerl/gemplate-test/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/akerl/gemplate-test/labels{/name}","releases_url":"https://api.github.com/repos/akerl/gemplate-test/releases{/id}","created_at":"2015-10-25T22:47:59Z","updated_at":"2015-10-25T22:47:59Z","pushed_at":"2015-10-25T22:47:59Z","git_url":"git://github.com/akerl/gemplate-test.git","ssh_url":"git@github.com:akerl/gemplate-test.git","clone_url":"https://github.com/akerl/gemplate-test.git","svn_url":"https://github.com/akerl/gemplate-test","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master","permissions":{"admin":true,"push":true,"pull":true},"network_count":0,"subscribers_count":1}'
147
+ http_version:
148
+ recorded_at: Sun, 25 Oct 2015 22:47:59 GMT
149
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,143 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://raw.githubusercontent.com/akerl/licenses/master/MIT.txt
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ Content-Security-Policy:
16
+ - default-src 'none'
17
+ X-Xss-Protection:
18
+ - 1; mode=block
19
+ X-Frame-Options:
20
+ - deny
21
+ X-Content-Type-Options:
22
+ - nosniff
23
+ Strict-Transport-Security:
24
+ - max-age=31536000
25
+ Content-Type:
26
+ - text/plain; charset=utf-8
27
+ Cache-Control:
28
+ - max-age=300
29
+ Content-Length:
30
+ - '1085'
31
+ Accept-Ranges:
32
+ - bytes
33
+ Date:
34
+ - Sun, 25 Oct 2015 22:50:44 GMT
35
+ Via:
36
+ - 1.1 varnish
37
+ Connection:
38
+ - keep-alive
39
+ X-Cache:
40
+ - MISS
41
+ X-Cache-Hits:
42
+ - '0'
43
+ Vary:
44
+ - Authorization,Accept-Encoding
45
+ Access-Control-Allow-Origin:
46
+ - "*"
47
+ Expires:
48
+ - Sun, 25 Oct 2015 22:55:44 GMT
49
+ Source-Age:
50
+ - '0'
51
+ body:
52
+ encoding: ASCII-8BIT
53
+ string: |+
54
+ The MIT License (MIT)
55
+
56
+ Copyright (c) CURRENT_YEAR FULL_NAME
57
+
58
+ Permission is hereby granted, free of charge, to any person obtaining a copy
59
+ of this software and associated documentation files (the "Software"), to deal
60
+ in the Software without restriction, including without limitation the rights
61
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
62
+ copies of the Software, and to permit persons to whom the Software is
63
+ furnished to do so, subject to the following conditions:
64
+
65
+ The above copyright notice and this permission notice shall be included in
66
+ all copies or substantial portions of the Software.
67
+
68
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
69
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
70
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
71
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
72
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
73
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
74
+ THE SOFTWARE.
75
+
76
+ http_version:
77
+ recorded_at: Sun, 25 Oct 2015 22:50:45 GMT
78
+ - request:
79
+ method: post
80
+ uri: https://api.github.com/user/repos
81
+ body:
82
+ encoding: UTF-8
83
+ string: '{"has_wiki":false,"name":"gemplate-test"}'
84
+ headers:
85
+ Accept:
86
+ - application/vnd.github.v3+json
87
+ User-Agent:
88
+ - Octokit Ruby Gem 4.1.1
89
+ Content-Type:
90
+ - application/json
91
+ Accept-Encoding:
92
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
93
+ response:
94
+ status:
95
+ code: 422
96
+ message: Unprocessable Entity
97
+ headers:
98
+ Server:
99
+ - GitHub.com
100
+ Date:
101
+ - Sun, 25 Oct 2015 22:50:44 GMT
102
+ Content-Type:
103
+ - application/json; charset=utf-8
104
+ Content-Length:
105
+ - '215'
106
+ Status:
107
+ - 422 Unprocessable Entity
108
+ X-Ratelimit-Limit:
109
+ - '5000'
110
+ X-Ratelimit-Remaining:
111
+ - '4873'
112
+ X-Ratelimit-Reset:
113
+ - '1445813888'
114
+ X-Oauth-Scopes:
115
+ - gist, repo, user
116
+ X-Accepted-Oauth-Scopes:
117
+ - public_repo, repo
118
+ X-Github-Media-Type:
119
+ - github.v3; format=json
120
+ X-Xss-Protection:
121
+ - 1; mode=block
122
+ X-Frame-Options:
123
+ - deny
124
+ Content-Security-Policy:
125
+ - default-src 'none'
126
+ Access-Control-Allow-Credentials:
127
+ - 'true'
128
+ Access-Control-Expose-Headers:
129
+ - ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,
130
+ X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
131
+ Access-Control-Allow-Origin:
132
+ - "*"
133
+ Strict-Transport-Security:
134
+ - max-age=31536000; includeSubdomains; preload
135
+ X-Content-Type-Options:
136
+ - nosniff
137
+ body:
138
+ encoding: UTF-8
139
+ string: '{"message":"Validation Failed","errors":[{"resource":"Repository","code":"custom","field":"name","message":"name
140
+ already exists on this account"}],"documentation_url":"https://developer.github.com/v3/repos/#create"}'
141
+ http_version:
142
+ recorded_at: Sun, 25 Oct 2015 22:50:45 GMT
143
+ recorded_with: VCR 2.9.3
@@ -1,6 +1,9 @@
1
1
  require 'spec_helper'
2
2
  require 'fileutils'
3
3
 
4
+ ROOT = Dir.pwd
5
+ TEST_GEM_NAME = 'gemplate-test'
6
+
4
7
  describe Gemplate do
5
8
  describe '#new' do
6
9
  it 'creates gem objects' do
@@ -11,67 +14,88 @@ describe Gemplate do
11
14
  describe Gem do
12
15
  let(:subject) do
13
16
  Gemplate::Gem.new(
14
- name: 'gemplate',
17
+ name: TEST_GEM_NAME,
15
18
  user: 'akerl',
16
19
  full_name: 'my_full_name',
17
20
  email: 'my_email@example.org',
18
- license: 'MIT'
21
+ license: 'MIT',
22
+ authfile: '../../spec/creds.yml'
19
23
  )
20
24
  end
21
25
 
22
- before(:all) do
23
- Dir.chdir '.test'
24
- FileUtils.rm_rf 'gemplate'
26
+ before(:each) do
27
+ Dir.chdir "#{ROOT}/.test"
28
+ FileUtils.rm_rf TEST_GEM_NAME
25
29
  end
26
- after(:each) { FileUtils.rm_rf 'gemplate' }
27
30
 
28
31
  describe '#create' do
29
32
  it 'makes a directory from the template' do
30
- subject.create
31
- expect(Dir.exist? 'gemplate').to be_truthy
33
+ VCR.use_cassette('subject_create') do
34
+ subject.create
35
+ end
36
+ expect(Dir.exist? TEST_GEM_NAME).to be_truthy
32
37
  end
33
38
 
34
39
  it 'raises an error if the directory already exists' do
35
- subject.create
36
- expect { subject.create }.to raise_error RuntimeError
40
+ VCR.use_cassette('subject_create') do
41
+ subject.create
42
+ expect { subject.create }.to raise_error RuntimeError
43
+ end
37
44
  end
38
45
 
39
46
  it 'adds a license file' do
40
- subject.create
41
- expect(File.exist? 'gemplate/LICENSE').to be_truthy
47
+ VCR.use_cassette('subject_create') do
48
+ subject.create
49
+ end
50
+ expect(File.exist? "#{TEST_GEM_NAME}/LICENSE").to be_truthy
42
51
  end
43
52
 
44
53
  it 'fails if you try to pull a non-existent license' do
45
- gem = Gemplate::Gem.new(
46
- name: 'gemplate',
47
- user: 'akerl',
48
- full_name: 'my_full_name',
49
- email: 'my_email@example.org',
50
- license: 'MIT-3'
51
- )
52
- expect { gem.create }.to raise_error ArgumentError
54
+ VCR.use_cassette('bad_license') do
55
+ gem = Gemplate::Gem.new(
56
+ name: TEST_GEM_NAME,
57
+ user: 'akerl',
58
+ full_name: 'my_full_name',
59
+ email: 'my_email@example.org',
60
+ license: 'MIT-3',
61
+ authfile: '../../spec/creds.yml'
62
+ )
63
+ expect { gem.create }.to raise_error ArgumentError
64
+ end
53
65
  end
54
66
 
55
67
  it 'replaces placeholders in files' do
56
- subject.create
57
- expect(File.read 'gemplate/README.md').to_not match(/^REPO_NAME/)
68
+ VCR.use_cassette('subject_create') do
69
+ subject.create
70
+ end
71
+ expect(
72
+ File.read "#{TEST_GEM_NAME}/README.md"
73
+ ).to_not match(/^REPO_NAME/)
58
74
  end
59
75
 
60
76
  it 'adjusts file names' do
61
- subject.create
62
- expect(File.exist? 'gemplate/gemplate.gemspec').to be_truthy
63
- expect(File.exist? 'gemplate/REPO_NAME.gemspec').to be_falsey
77
+ VCR.use_cassette('subject_create') do
78
+ subject.create
79
+ end
80
+ expect(
81
+ File.exist? "#{TEST_GEM_NAME}/#{TEST_GEM_NAME}.gemspec"
82
+ ).to be_truthy
83
+ expect(File.exist? "#{TEST_GEM_NAME}/REPO_NAME.gemspec").to be_falsey
64
84
  end
65
85
 
66
86
  it 'makes the git repo' do
67
- subject.create
68
- expect(Dir.exist? 'gemplate/.git').to be_truthy
87
+ VCR.use_cassette('subject_create') do
88
+ subject.create
89
+ end
90
+ expect(Dir.exist? "#{TEST_GEM_NAME}/.git").to be_truthy
69
91
  [
70
92
  /remote\.origin\.url/,
71
93
  /branch\.master\.remote=origin/,
72
94
  %r{branch\.master\.merge=refs\/heads\/master}
73
95
  ].each do |regex|
74
- expect(`git config -f gemplate/.git/config -l`).to match(regex)
96
+ expect(
97
+ `git config -f #{TEST_GEM_NAME}/.git/config -l`
98
+ ).to match(regex)
75
99
  end
76
100
  end
77
101
  end
data/spec/spec_helper.rb CHANGED
@@ -9,3 +9,15 @@ end
9
9
 
10
10
  require 'rspec'
11
11
  require 'gemplate'
12
+
13
+ require 'vcr'
14
+ VCR.configure do |c|
15
+ c.cassette_library_dir = 'spec/fixtures/cassettes'
16
+ c.hook_into :webmock
17
+ c.before_record do |i|
18
+ i.request.headers.delete 'Authorization'
19
+ %w(Etag X-Github-Request-Id X-Served-By).each do |header|
20
+ i.response.headers.delete header
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,12 @@
1
+ dependencies:
2
+ override:
3
+ - 'rvm-exec 1.9.3-p551 bundle install'
4
+ - 'rvm-exec 2.0.0-p645 bundle install'
5
+ - 'rvm-exec 2.1.6 bundle install'
6
+ - 'rvm-exec 2.2.2 bundle install'
7
+ test:
8
+ override:
9
+ - 'rvm-exec 1.9.3-p551 bundle exec rake'
10
+ - 'rvm-exec 2.0.0-p645 bundle exec rake'
11
+ - 'rvm-exec 2.1.6 bundle exec rake'
12
+ - 'rvm-exec 2.2.2 bundle exec rake'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemplate
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Les Aker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-21 00:00:00.000000000 Z
11
+ date: 2015-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rugged
@@ -38,6 +38,34 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.0.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: octoauth
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 1.3.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 1.3.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: octokit
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 4.1.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 4.1.0
41
69
  - !ruby/object:Gem::Dependency
42
70
  name: curb
43
71
  requirement: !ruby/object:Gem::Requirement
@@ -122,6 +150,34 @@ dependencies:
122
150
  - - "~>"
123
151
  - !ruby/object:Gem::Version
124
152
  version: 2.0.0
153
+ - !ruby/object:Gem::Dependency
154
+ name: webmock
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: 1.22.0
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: 1.22.0
167
+ - !ruby/object:Gem::Dependency
168
+ name: vcr
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: 2.9.2
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: 2.9.2
125
181
  description: Creates a basic repository layout for a new gem
126
182
  email: me@lesaker.org
127
183
  executables:
@@ -139,8 +195,13 @@ files:
139
195
  - README.md
140
196
  - Rakefile
141
197
  - bin/gemplate
198
+ - circle.yml
142
199
  - gemplate.gemspec
143
200
  - lib/gemplate.rb
201
+ - spec/creds.yml
202
+ - spec/fixtures/cassettes/bad_license.yml
203
+ - spec/fixtures/cassettes/subject_create.yml
204
+ - spec/fixtures/cassettes/subject_create_twice.yml
144
205
  - spec/gemplate_spec.rb
145
206
  - spec/spec_helper.rb
146
207
  - template/.gitignore
@@ -150,6 +211,7 @@ files:
150
211
  - template/README.md
151
212
  - template/REPO_NAME.gemspec
152
213
  - template/Rakefile
214
+ - template/circle.yml
153
215
  - template/lib/REPO_NAME.rb
154
216
  - template/spec/REPO_NAME_spec.rb
155
217
  - template/spec/spec_helper.rb
@@ -173,10 +235,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
235
  version: '0'
174
236
  requirements: []
175
237
  rubyforge_project:
176
- rubygems_version: 2.4.5
238
+ rubygems_version: 2.4.5.1
177
239
  signing_key:
178
240
  specification_version: 4
179
241
  summary: Bootstrap tool for making gems
180
242
  test_files:
243
+ - spec/creds.yml
244
+ - spec/fixtures/cassettes/bad_license.yml
245
+ - spec/fixtures/cassettes/subject_create.yml
246
+ - spec/fixtures/cassettes/subject_create_twice.yml
181
247
  - spec/gemplate_spec.rb
182
248
  - spec/spec_helper.rb