permutation-tools 0.2.1 → 0.2.3
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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/ext/hash.rb +6 -0
- data/lib/permutation-tools.rb +1 -0
- data/lib/tools/api.rb +1 -1
- data/lib/tools/config.rb +28 -36
- data/lib/tools/release.rb +17 -4
- data/permutation-tools.gemspec +24 -10
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8333c3a9db115f5e4b980e5c6c8eee9d0d57ace
|
4
|
+
data.tar.gz: bb9d9007ad703f2bbdb743b9187879133cc8ce52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca2af212bc9489b365dc21558d99a3d0137271a2d08d4046a94e32b19e52087b3de6697d9301adc9f6835be7cbfbf006a04563dae46f4ad3a4f17580f53e9157
|
7
|
+
data.tar.gz: 3ca20b7846f092dc048560ea854d481f6c1813c81477ad660ddff846716375bfc96ecf8f3a34aad157d024d5bc4edac54253fff046b63fc506b57a160a811ac4
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.3
|
data/lib/ext/hash.rb
ADDED
data/lib/permutation-tools.rb
CHANGED
data/lib/tools/api.rb
CHANGED
data/lib/tools/config.rb
CHANGED
@@ -5,48 +5,40 @@ module Permutation
|
|
5
5
|
REPOSITORY_CONFIG_FILE = File.join(Dir.pwd, '.permutation')
|
6
6
|
|
7
7
|
def account
|
8
|
-
Permutation::Config.read(ACCOUNT_CONFIG_FILE) ||
|
9
|
-
|
10
|
-
|
8
|
+
Permutation::Config.read(ACCOUNT_CONFIG_FILE) || init
|
9
|
+
end
|
10
|
+
|
11
|
+
def init
|
12
|
+
access_token = nil
|
13
|
+
json = {}
|
14
|
+
|
15
|
+
puts "Log In to Permutation"
|
16
|
+
email = ask("Email: ")
|
17
|
+
password = ask("Password: ") {|q| q.echo = false}
|
11
18
|
|
12
|
-
|
13
|
-
email = ask("Email: ")
|
14
|
-
password = ask("Password: ") {|q| q.echo = false}
|
19
|
+
response = Permutation::API.post '/api/session.json', { email: email, password: password }
|
15
20
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
json.merge! host: Permutation::API.host unless Permutation::API.host == Permutation::API::DEFAULT_HOST
|
21
|
+
if response.status == 201
|
22
|
+
session = response.body.slice("email","access_token")
|
23
|
+
json.merge! session
|
24
|
+
json.merge! host: Permutation::API.host unless Permutation::API.host == Permutation::API::DEFAULT_HOST
|
21
25
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
end
|
26
|
+
write(json, ACCOUNT_CONFIG_FILE)
|
27
|
+
json
|
28
|
+
else
|
29
|
+
puts
|
30
|
+
puts "Invalid login credentials"
|
31
|
+
exit
|
29
32
|
end
|
30
33
|
end
|
31
34
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
#
|
40
|
-
# repos = Permutation::API.get('/api/repositories.json', 'Access-Token' => account_config['access_token']).body
|
41
|
-
# if repo = repos['repositories'].detect{|repo| repo['name'] == repo_name}
|
42
|
-
# json.merge! 'repo' => repo['name']
|
43
|
-
# write(json, REPOSITORY_CONFIG_FILE)
|
44
|
-
# json
|
45
|
-
# else
|
46
|
-
# puts "Unable to find repo #{repo_name}"
|
47
|
-
# end
|
48
|
-
# end
|
49
|
-
# end
|
35
|
+
def host
|
36
|
+
if config = Permutation::Config.read(ACCOUNT_CONFIG_FILE)
|
37
|
+
config['host']
|
38
|
+
else
|
39
|
+
nil
|
40
|
+
end
|
41
|
+
end
|
50
42
|
end
|
51
43
|
|
52
44
|
|
data/lib/tools/release.rb
CHANGED
@@ -8,21 +8,26 @@ module Permutation
|
|
8
8
|
sha = `git rev-parse #{remote_branch}`
|
9
9
|
|
10
10
|
regex = /(git@github\.com|git@bitbucket\.org):(.*)\.git/
|
11
|
-
`git remote show origin | grep Fetch | cut -d: -f2-`.
|
11
|
+
repo_url = `git remote show origin | grep Fetch | cut -d: -f2-`.strip
|
12
|
+
repo_url.match(regex)
|
12
13
|
repo_name = $2
|
13
14
|
|
14
15
|
response = Permutation::API.post(
|
15
16
|
'/api/releases.json',
|
16
17
|
options.merge({
|
17
18
|
sha: sha,
|
19
|
+
repo_url: repo_url,
|
18
20
|
repo_name: repo_name
|
19
21
|
}),
|
20
22
|
{ 'Access-Token' => account_config['access_token'] }
|
21
23
|
)
|
22
24
|
|
23
25
|
if response.status == 201
|
24
|
-
response.body
|
25
|
-
|
26
|
+
release = response.body
|
27
|
+
if options[:force]
|
28
|
+
puts "Updated release #{release['version']} for #{release['repository']['name']}"
|
29
|
+
else
|
30
|
+
puts "Created release #{release['version']} for #{release['repository']['name']}"
|
26
31
|
end
|
27
32
|
elsif response.status == 401
|
28
33
|
puts "Unauthorized, please re-run permutation init"
|
@@ -31,7 +36,11 @@ module Permutation
|
|
31
36
|
puts "Repository #{repo_name} not found"
|
32
37
|
exit
|
33
38
|
else
|
34
|
-
|
39
|
+
if error = response.body
|
40
|
+
puts "Error: #{error['message']}"
|
41
|
+
else
|
42
|
+
puts "Error"
|
43
|
+
end
|
35
44
|
end
|
36
45
|
end
|
37
46
|
|
@@ -50,6 +59,10 @@ module Permutation
|
|
50
59
|
# options[:parent] = v
|
51
60
|
# end
|
52
61
|
|
62
|
+
opts.on("-f", "--force [VERSION]", "Iterate using the new release") do |v|
|
63
|
+
options[:force] = v
|
64
|
+
end
|
65
|
+
|
53
66
|
opts.on("-i", "--iterate [ITERATE]", "Iterate using the new release") do |v|
|
54
67
|
options[:iterate] = v
|
55
68
|
end
|
data/permutation-tools.gemspec
CHANGED
@@ -2,40 +2,47 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: permutation-tools 0.
|
5
|
+
# stub: permutation-tools 0.2.3 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
|
-
s.name = "permutation-
|
9
|
-
s.version = "0.2.
|
8
|
+
s.name = "permutation-tools"
|
9
|
+
s.version = "0.2.3"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Ian Hunter"]
|
14
|
-
s.date = "
|
14
|
+
s.date = "2015-08-24"
|
15
15
|
s.description = ""
|
16
|
-
s.email = "
|
16
|
+
s.email = "ianhunter@gmail.com"
|
17
17
|
s.executables = ["permutation"]
|
18
18
|
s.extra_rdoc_files = [
|
19
19
|
"LICENSE.txt",
|
20
|
-
"README.
|
20
|
+
"README.md"
|
21
21
|
]
|
22
22
|
s.files = [
|
23
|
-
".document",
|
24
23
|
"Gemfile",
|
25
24
|
"Gemfile.lock",
|
26
25
|
"LICENSE.txt",
|
27
|
-
"README.
|
26
|
+
"README.md",
|
28
27
|
"Rakefile",
|
29
28
|
"VERSION",
|
30
29
|
"bin/permutation",
|
30
|
+
"index.html",
|
31
|
+
"lib/ext/hash.rb",
|
32
|
+
"lib/ext/scraper.rb",
|
31
33
|
"lib/permutation-tools.rb",
|
34
|
+
"lib/tools/api.rb",
|
35
|
+
"lib/tools/config.rb",
|
36
|
+
"lib/tools/mirror.rb",
|
37
|
+
"lib/tools/release.rb",
|
38
|
+
"lib/tools/server.rb",
|
32
39
|
"permutation-tools.gemspec",
|
33
40
|
"test/helper.rb",
|
34
41
|
"test/test_permutation-tools.rb"
|
35
42
|
]
|
36
|
-
s.homepage = "http://github.com/permutation
|
43
|
+
s.homepage = "http://github.com/ihunter/permutation-tools"
|
37
44
|
s.licenses = ["MIT"]
|
38
|
-
s.rubygems_version = "2.
|
45
|
+
s.rubygems_version = "2.4.6"
|
39
46
|
s.summary = "Tools for working with Permutation"
|
40
47
|
|
41
48
|
if s.respond_to? :specification_version then
|
@@ -46,6 +53,8 @@ Gem::Specification.new do |s|
|
|
46
53
|
s.add_runtime_dependency(%q<highline>, [">= 0"])
|
47
54
|
s.add_runtime_dependency(%q<json>, [">= 0"])
|
48
55
|
s.add_runtime_dependency(%q<semantic>, [">= 0"])
|
56
|
+
s.add_runtime_dependency(%q<sinatra>, [">= 0"])
|
57
|
+
s.add_development_dependency(%q<byebug>, [">= 0"])
|
49
58
|
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
50
59
|
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
51
60
|
s.add_development_dependency(%q<bundler>, ["~> 1.0"])
|
@@ -56,6 +65,8 @@ Gem::Specification.new do |s|
|
|
56
65
|
s.add_dependency(%q<highline>, [">= 0"])
|
57
66
|
s.add_dependency(%q<json>, [">= 0"])
|
58
67
|
s.add_dependency(%q<semantic>, [">= 0"])
|
68
|
+
s.add_dependency(%q<sinatra>, [">= 0"])
|
69
|
+
s.add_dependency(%q<byebug>, [">= 0"])
|
59
70
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
60
71
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
61
72
|
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
@@ -67,6 +78,8 @@ Gem::Specification.new do |s|
|
|
67
78
|
s.add_dependency(%q<highline>, [">= 0"])
|
68
79
|
s.add_dependency(%q<json>, [">= 0"])
|
69
80
|
s.add_dependency(%q<semantic>, [">= 0"])
|
81
|
+
s.add_dependency(%q<sinatra>, [">= 0"])
|
82
|
+
s.add_dependency(%q<byebug>, [">= 0"])
|
70
83
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
71
84
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
72
85
|
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
@@ -74,3 +87,4 @@ Gem::Specification.new do |s|
|
|
74
87
|
s.add_dependency(%q<simplecov>, [">= 0"])
|
75
88
|
end
|
76
89
|
end
|
90
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: permutation-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian Hunter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -181,6 +181,7 @@ files:
|
|
181
181
|
- VERSION
|
182
182
|
- bin/permutation
|
183
183
|
- index.html
|
184
|
+
- lib/ext/hash.rb
|
184
185
|
- lib/ext/scraper.rb
|
185
186
|
- lib/permutation-tools.rb
|
186
187
|
- lib/tools/api.rb
|