sah 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +133 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/exe/sah +5 -0
- data/lib/sah/cli.rb +289 -0
- data/lib/sah/config.rb +34 -0
- data/lib/sah/version.rb +3 -0
- data/lib/sah.rb +5 -0
- data/sah.gemspec +32 -0
- metadata +185 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 41b1946117957d3bc0c54b7327114182d0604a03
|
4
|
+
data.tar.gz: 723bbe78ca21a25b56f34e09c8b9224b2f8996be
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 610875901e086fe034573e7aaf9099ac370f2d82d9cbace6b43b22bf8d7e422e86079999c6ab67075f1f4e636008a0b865408fd0128581d4b3daab26a9b82c54
|
7
|
+
data.tar.gz: ccf2e1217e1f0a818f8bf928aaa64fcdcd963fa13658d9d976551a07d1b08cd8a7fc2cb09329420f73d9aa2d734ab7907fef8d0a050d1f77b2a2be7f6941cb41
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 f440
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
# Sah
|
2
|
+
|
3
|
+
Sah is command line util for [Atlassian Stash](https://www.atlassian.com/software/stash).
|
4
|
+
|
5
|
+
This project was heavily inspired by the [hub](https://hub.github.com/).
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
gem install sah
|
10
|
+
|
11
|
+
## Configuration
|
12
|
+
|
13
|
+
git config [--global] sah.profile.default.user "f440"
|
14
|
+
git config [--global] sah.profile.default.password "freq440@gmail.com"
|
15
|
+
git config [--global] sah.profile.default.url "https://exmaple.com"
|
16
|
+
|
17
|
+
If you use multiple stash, define profile(s) and specify it.
|
18
|
+
|
19
|
+
git config [--global] sah.profile.my_company.user "jane"
|
20
|
+
git config [--global] sah.profile.my_company.password "jane@example.jp"
|
21
|
+
git config [--global] sah.profile.my_company.url "https://git@exmaple.jp"
|
22
|
+
|
23
|
+
sah SUB_COMMAND --profile my_company
|
24
|
+
or
|
25
|
+
export SAH_DEFAULT_PROFILE=my_company
|
26
|
+
sah SUB_COMMAND
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
### clone
|
31
|
+
|
32
|
+
sah clone PROJECT/REPO
|
33
|
+
> git clone ssh://git@example.com:7999/project/REPO
|
34
|
+
|
35
|
+
sah clone REPO
|
36
|
+
> git clone ssh://git@example.com:7999/~YOUR_NAME/ERPO
|
37
|
+
|
38
|
+
sah clone ~USERNAME/REPO
|
39
|
+
> git clone ssh://git@example.com:7999/~USERNAME/REPO
|
40
|
+
|
41
|
+
### create
|
42
|
+
|
43
|
+
sah create
|
44
|
+
# create repository
|
45
|
+
# repository name is same as the current repository
|
46
|
+
|
47
|
+
sah create --name REPO
|
48
|
+
# create repository at ~YOUR_NAME/REPO
|
49
|
+
|
50
|
+
sah create PROJECT
|
51
|
+
# create repository at PROJECT
|
52
|
+
# repository name is same as the current repository
|
53
|
+
|
54
|
+
### fork
|
55
|
+
|
56
|
+
sah fork
|
57
|
+
# fork from current repository to ~YOUR_NAME/REPO
|
58
|
+
# repository name is same as the origin's one
|
59
|
+
|
60
|
+
sah fork --name MY_FORKED_REPO
|
61
|
+
# fork from current repository to ~YOUR_NAME/MY_FORKED_REPO
|
62
|
+
|
63
|
+
sah fork PROJECT/REPO
|
64
|
+
# fork from PROJECT/REPO to ~YOUR_NAME/REPO
|
65
|
+
|
66
|
+
sah fork ~USERNAME/REPO
|
67
|
+
# fork from ~USERNAME/REPO to ~YOUR_NAME/REPO
|
68
|
+
|
69
|
+
## help
|
70
|
+
|
71
|
+
sah help [COMMAND]
|
72
|
+
# Describe available commands or one specific command
|
73
|
+
|
74
|
+
### project
|
75
|
+
|
76
|
+
sah project
|
77
|
+
# list projects
|
78
|
+
|
79
|
+
sah project PROJECT
|
80
|
+
# show project detail
|
81
|
+
|
82
|
+
### repository
|
83
|
+
|
84
|
+
sah repository PROJECT
|
85
|
+
# list repositories
|
86
|
+
|
87
|
+
sah repository PROJECT REPO
|
88
|
+
# show repository detail
|
89
|
+
|
90
|
+
### upstream
|
91
|
+
|
92
|
+
upstream
|
93
|
+
# show upstream information
|
94
|
+
|
95
|
+
upstream --add-remote [--fetch-pull-request] [--prevent-push]
|
96
|
+
# add upstream to remote settings
|
97
|
+
|
98
|
+
#### configutration
|
99
|
+
|
100
|
+
- `git config --global sah.config.upstream-fetch-pull-request true`
|
101
|
+
(the same as `--fetch-pull-request` option)
|
102
|
+
Setting this option to true will fetch all pull requests.
|
103
|
+
- `git config --global sah.config.upstream-prevent-push true`
|
104
|
+
(the same as `--prevent-push` option)
|
105
|
+
Setting this option to true will Prevent push to upstream repository.
|
106
|
+
|
107
|
+
### user
|
108
|
+
|
109
|
+
sah user
|
110
|
+
# list users
|
111
|
+
|
112
|
+
sah user USER
|
113
|
+
# show user detail
|
114
|
+
|
115
|
+
### version
|
116
|
+
|
117
|
+
sah version
|
118
|
+
# Display the version of this command
|
119
|
+
|
120
|
+
## Development
|
121
|
+
|
122
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. Run `bundle exec sah` to use the gem in this directory, ignoring other installed copies of this gem.
|
123
|
+
|
124
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
125
|
+
|
126
|
+
## Contributing
|
127
|
+
|
128
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/f440/sah.
|
129
|
+
|
130
|
+
## License
|
131
|
+
|
132
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
133
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "sah"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/exe/sah
ADDED
data/lib/sah/cli.rb
ADDED
@@ -0,0 +1,289 @@
|
|
1
|
+
require "sah"
|
2
|
+
require "thor"
|
3
|
+
require 'faraday'
|
4
|
+
require 'faraday_middleware'
|
5
|
+
require 'hirb'
|
6
|
+
require 'hirb-unicode'
|
7
|
+
|
8
|
+
module Sah
|
9
|
+
class API
|
10
|
+
attr_accessor :conn
|
11
|
+
|
12
|
+
def initialize(config)
|
13
|
+
@conn = Faraday.new(url: config.url) do |faraday|
|
14
|
+
faraday.response :json
|
15
|
+
# faraday.response :logger
|
16
|
+
faraday.adapter Faraday.default_adapter
|
17
|
+
faraday.basic_auth config.user, config.password
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def fork_repo(project, repo, name=nil)
|
22
|
+
body = {slug: repo}
|
23
|
+
body = body.merge(name: name) if name
|
24
|
+
|
25
|
+
res = @conn.post do |req|
|
26
|
+
req.url "/rest/api/1.0/projects/#{project}/repos/#{repo}"
|
27
|
+
req.headers['Content-Type'] = 'application/json'
|
28
|
+
req.body = body.to_json
|
29
|
+
end
|
30
|
+
if res.status != 201
|
31
|
+
puts res.body["errors"].first["message"]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def create_repo(project, repo)
|
36
|
+
res = @conn.post do |req|
|
37
|
+
req.url "/rest/api/1.0/projects/#{project}/repos"
|
38
|
+
req.headers['Content-Type'] = 'application/json'
|
39
|
+
req.body = {name: repo, scmId: "git", forkable: true}.to_json
|
40
|
+
end
|
41
|
+
if res.status != 201
|
42
|
+
puts res.body["errors"].first["message"]
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def list_project
|
47
|
+
res = @conn.get do |req|
|
48
|
+
req.url "/rest/api/1.0/projects"
|
49
|
+
req.params['limit'] = 1000
|
50
|
+
end
|
51
|
+
if res.status != 200
|
52
|
+
puts res.body["errors"].first["message"]
|
53
|
+
end
|
54
|
+
res.body["values"].sort_by{|e| e["id"].to_i }
|
55
|
+
end
|
56
|
+
|
57
|
+
def show_project(project)
|
58
|
+
res = @conn.get do |req|
|
59
|
+
req.url "/rest/api/1.0/projects/#{project}"
|
60
|
+
end
|
61
|
+
if res.status != 200
|
62
|
+
puts res.body["errors"].first["message"]
|
63
|
+
end
|
64
|
+
res.body
|
65
|
+
end
|
66
|
+
|
67
|
+
def list_user
|
68
|
+
res = @conn.get do |req|
|
69
|
+
req.url "/rest/api/1.0/users"
|
70
|
+
req.params['limit'] = 1000
|
71
|
+
end
|
72
|
+
if res.status != 200
|
73
|
+
puts res.body["errors"].first["message"]
|
74
|
+
end
|
75
|
+
users = res.body["values"].sort_by{|e| e["id"].to_i }
|
76
|
+
end
|
77
|
+
|
78
|
+
def show_user(user)
|
79
|
+
res = @conn.get do |req|
|
80
|
+
req.url "/rest/api/1.0/users/#{user}"
|
81
|
+
end
|
82
|
+
if res.status != 200
|
83
|
+
puts res.body["errors"].first["message"]
|
84
|
+
end
|
85
|
+
res.body
|
86
|
+
end
|
87
|
+
|
88
|
+
def list_repository(project)
|
89
|
+
res = @conn.get do |req|
|
90
|
+
req.url "/rest/api/1.0/projects/#{project}/repos"
|
91
|
+
req.params['limit'] = 1000
|
92
|
+
end
|
93
|
+
if res.status != 200
|
94
|
+
puts res.body["errors"].first["message"]
|
95
|
+
end
|
96
|
+
repositories = (res.body["values"] || []).sort_by{|e| e["id"].to_i }
|
97
|
+
end
|
98
|
+
|
99
|
+
def show_repository(project, repository)
|
100
|
+
res = @conn.get do |req|
|
101
|
+
req.url "/rest/api/1.0/projects/#{project}/repos/#{repository}"
|
102
|
+
end
|
103
|
+
if res.status != 200
|
104
|
+
puts res.body["errors"].first["message"]
|
105
|
+
end
|
106
|
+
res.body
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
class CLI < Thor
|
111
|
+
class_option :profile,
|
112
|
+
type: :string, default: (ENV["SAH_DEFAULT_PROFILE"] || :default),
|
113
|
+
desc: "Set a specific profile"
|
114
|
+
|
115
|
+
desc "clone REPOS", "Clone repository"
|
116
|
+
long_desc <<-LONG_DESCRIPTION
|
117
|
+
sah clone PROJECT/REPO
|
118
|
+
\x5> git clone ssh://git@example.com:7999/project/REPO
|
119
|
+
|
120
|
+
sah clone REPO
|
121
|
+
\x5> git clone ssh://git@example.com:7999/~YOUR_NAME/REPO
|
122
|
+
|
123
|
+
sah clone ~USERNAME/REPO
|
124
|
+
\x5> git clone ssh://git@example.com:7999/~USERNAME/REPO
|
125
|
+
LONG_DESCRIPTION
|
126
|
+
def clone(repos)
|
127
|
+
repository, project = repos.split("/").reverse
|
128
|
+
project ||= "~#{config.user}"
|
129
|
+
repo_info = api.show_repository(project, repository)
|
130
|
+
abort if repo_info.key?("errors")
|
131
|
+
remote_url =
|
132
|
+
repo_info["links"]["clone"].find{ |e| e["name"] == "ssh" }["href"]
|
133
|
+
system "git", "clone", remote_url
|
134
|
+
end
|
135
|
+
|
136
|
+
desc "create [PROJECT] [--name REPO_NAME]", "Create repository"
|
137
|
+
long_desc <<-LONG_DESCRIPTION
|
138
|
+
sah create
|
139
|
+
\x5# create repository
|
140
|
+
\x5# repository name is same as the current repository
|
141
|
+
|
142
|
+
sah create --name REPO
|
143
|
+
\x5# create repository at ~YOUR_NAME/REPO
|
144
|
+
|
145
|
+
sah create PROJECT
|
146
|
+
\x5# create repository at PROJECT
|
147
|
+
\x5# repository name is same as the current repository
|
148
|
+
LONG_DESCRIPTION
|
149
|
+
method_option :name, aliases: "-n", desc: "Set repository name"
|
150
|
+
def create(project=nil)
|
151
|
+
project ||= "~#{config.user}"
|
152
|
+
repo = (
|
153
|
+
options[:name] || File.basename(`git rev-parse --show-toplevel`).chomp
|
154
|
+
)
|
155
|
+
api.create_repo(project, repo)
|
156
|
+
end
|
157
|
+
|
158
|
+
desc "fork [REPO] [--name REPO_NAME]", "Fork repository"
|
159
|
+
long_desc <<-LONG_DESCRIPTION
|
160
|
+
sah fork
|
161
|
+
\x5# fork from current repository to ~YOUR_NAME/REPO
|
162
|
+
\x5# repository name is same as the origin's one
|
163
|
+
|
164
|
+
sah fork --name MY_FORKED_REPO
|
165
|
+
\x5# fork from current repository to ~YOUR_NAME/MY_FORKED_REPO
|
166
|
+
|
167
|
+
sah fork PROJECT/REPO
|
168
|
+
\x5# fork from PROJECT/REPO to ~YOUR_NAME/REPO
|
169
|
+
|
170
|
+
sah fork ~USERNAME/REPO
|
171
|
+
\x5# fork from ~USERNAME/REPO to ~YOUR_NAME/REPO
|
172
|
+
LONG_DESCRIPTION
|
173
|
+
method_option :name, aliases: "-n", desc: "Set repository name"
|
174
|
+
def fork(repos=nil)
|
175
|
+
if repos
|
176
|
+
project, repo = repos.split("/")
|
177
|
+
else
|
178
|
+
remote_url = `git config --get remote.origin.url`.chomp
|
179
|
+
remote_url.match %r%/([^/]+)/([^/]+?)(?:\.git)?$%
|
180
|
+
project, repo = $1, $2
|
181
|
+
end
|
182
|
+
api.fork_repo(project, repo, options[:name])
|
183
|
+
end
|
184
|
+
|
185
|
+
desc "project [PROJECT]", "Show project information"
|
186
|
+
long_desc <<-LONG_DESCRIPTION
|
187
|
+
sah project
|
188
|
+
\x5# list projects
|
189
|
+
|
190
|
+
sah project PROJECT
|
191
|
+
\x5# show project detail
|
192
|
+
LONG_DESCRIPTION
|
193
|
+
def project(project=nil)
|
194
|
+
if project.nil?
|
195
|
+
projects = api.list_project
|
196
|
+
puts Hirb::Helpers::AutoTable.render(projects, fields: %w(id key name description))
|
197
|
+
else
|
198
|
+
project = api.show_project(project)
|
199
|
+
puts Hirb::Helpers::AutoTable.render(project, headers: false)
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
desc "repository PROJECT[/REPOS]", "Show repository information"
|
204
|
+
long_desc <<-LONG_DESCRIPTION
|
205
|
+
sah repository PROJECT
|
206
|
+
\x5# list repositories
|
207
|
+
|
208
|
+
sah repository PROJECT/REPO
|
209
|
+
\x5# show repository detail
|
210
|
+
LONG_DESCRIPTION
|
211
|
+
def repository(repo)
|
212
|
+
project, repository = repo.split("/")
|
213
|
+
if repository.nil?
|
214
|
+
repositories = api.list_repository(project)
|
215
|
+
puts Hirb::Helpers::AutoTable.render(repositories, fields: %w(id slug name))
|
216
|
+
else
|
217
|
+
repository = api.show_repository(project, repository)
|
218
|
+
puts Hirb::Helpers::AutoTable.render(repository, headers: false)
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
desc "upstream [--add-remote [--fetch-pull-request] [--prevent-push]]",
|
223
|
+
"Show upstream information"
|
224
|
+
long_desc <<-LONG_DESCRIPTION
|
225
|
+
upstream
|
226
|
+
\x5# show upstream information
|
227
|
+
|
228
|
+
upstream --add-remote [--fetch-pull-request] [--prevent-push]
|
229
|
+
\x5# add upstream to remote settings
|
230
|
+
LONG_DESCRIPTION
|
231
|
+
method_option :"add-remote", desc: "Add a upstream repository to remote settings"
|
232
|
+
method_option :"fetch-pull-request", desc: "Fetch pull requests"
|
233
|
+
method_option :"prevent-push", desc: "Prevent push to upstream"
|
234
|
+
def upstream
|
235
|
+
remote_url = `git config --get remote.origin.url`.chomp
|
236
|
+
remote_url.match %r%/([^/]+)/([^/]+?)(?:\.git)?$%
|
237
|
+
project, repository = $1, $2
|
238
|
+
repo_info = api.show_repository(project, repository)
|
239
|
+
abort if repo_info.key?("errors")
|
240
|
+
upstream_url =
|
241
|
+
repo_info["origin"]["links"]["clone"].find{ |e| e["name"] == "ssh" }["href"]
|
242
|
+
if options[:"add-remote"]
|
243
|
+
system "git", "remote", "add", "upstream", upstream_url
|
244
|
+
if config.upstream_fetch_pull_request || options[:"fetch-pull-request"]
|
245
|
+
%x(git config --add remote.upstream.fetch \
|
246
|
+
'+refs/pull-requests/*:refs/remotes/upstream/pull-requests/*')
|
247
|
+
end
|
248
|
+
if config.upstream_prevent_push || options[:"prevent-push"]
|
249
|
+
%x(git remote set-url --push upstream "")
|
250
|
+
end
|
251
|
+
else
|
252
|
+
puts upstream_url
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
desc "user [USER]", "Show user information"
|
257
|
+
long_desc <<-LONG_DESCRIPTION
|
258
|
+
sah user
|
259
|
+
\x5# list users
|
260
|
+
|
261
|
+
sah user USER
|
262
|
+
\x5# show user detail
|
263
|
+
LONG_DESCRIPTION
|
264
|
+
def user(user=nil)
|
265
|
+
if user.nil?
|
266
|
+
users = api.list_user
|
267
|
+
puts Hirb::Helpers::AutoTable.render(users, fields: %w(id slug name displayName))
|
268
|
+
else
|
269
|
+
user = api.show_user(user)
|
270
|
+
puts Hirb::Helpers::AutoTable.render(user, headers: false)
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
desc "version", "Display the version of this command"
|
275
|
+
def version
|
276
|
+
puts VERSION
|
277
|
+
end
|
278
|
+
|
279
|
+
private
|
280
|
+
|
281
|
+
def config
|
282
|
+
@config ||= Config.new(options[:profile])
|
283
|
+
end
|
284
|
+
|
285
|
+
def api
|
286
|
+
@api ||= API.new(config)
|
287
|
+
end
|
288
|
+
end
|
289
|
+
end
|
data/lib/sah/config.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
module Sah
|
2
|
+
class Config
|
3
|
+
attr_accessor :user, :password, :url,
|
4
|
+
:upstream_fetch_pull_request, :upstream_prevent_push
|
5
|
+
|
6
|
+
def initialize(profile)
|
7
|
+
@user, @password, @url = nil, nil, nil
|
8
|
+
@upstream_fetch_pull_request = false
|
9
|
+
@upstream_prevent_push = false
|
10
|
+
|
11
|
+
profile_prefix = "sah\.profile\.#{profile}"
|
12
|
+
config_prefix = "sah\.config"
|
13
|
+
|
14
|
+
%x(git config --get-regex "^sah\.").each_line do |line|
|
15
|
+
case line
|
16
|
+
when /#{profile_prefix}\.user (.*)$/
|
17
|
+
@user = $1
|
18
|
+
when /#{profile_prefix}\.password (.*)$/
|
19
|
+
@password = $1
|
20
|
+
when /#{profile_prefix}\.url (.*)$/
|
21
|
+
@url = $1
|
22
|
+
when /#{config_prefix}\.upstream-fetch-pull-request (.*)$/
|
23
|
+
@upstream_fetch_pull_request = ($1 == "true")
|
24
|
+
when /#{config_prefix}\.upstream-prevent-push (.*)$/
|
25
|
+
@upstream_prevent_push = ($1 == "true")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
unless @user && @password && @url
|
30
|
+
abort "Invalid profile: #{profile}"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/sah/version.rb
ADDED
data/lib/sah.rb
ADDED
data/sah.gemspec
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'sah/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "sah"
|
8
|
+
spec.version = Sah::VERSION
|
9
|
+
spec.authors = ["f440"]
|
10
|
+
spec.email = ["freq440@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = "Command line util for atlassian stash"
|
13
|
+
spec.description = "Sah is command line util for Atlassian Stash."
|
14
|
+
spec.homepage = "https://github.com/f440/sah"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_dependency "thor", "~> 0.19.1"
|
23
|
+
spec.add_dependency "git", "~> 1.2.9.1"
|
24
|
+
spec.add_dependency "faraday", "~> 0.9.1"
|
25
|
+
spec.add_dependency "faraday_middleware", "~> 0.10.0"
|
26
|
+
spec.add_dependency "hirb", "~> 0.7.3"
|
27
|
+
spec.add_dependency 'hirb-unicode', "~> 0.0.5"
|
28
|
+
|
29
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
30
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
31
|
+
spec.add_development_dependency "minitest"
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,185 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sah
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- f440
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-09-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.19.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.19.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: git
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.2.9.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.2.9.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: faraday
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.9.1
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.9.1
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: faraday_middleware
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.10.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.10.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: hirb
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.7.3
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.7.3
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: hirb-unicode
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.0.5
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.0.5
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: bundler
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '1.10'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '1.10'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rake
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '10.0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '10.0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: minitest
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
description: Sah is command line util for Atlassian Stash.
|
140
|
+
email:
|
141
|
+
- freq440@gmail.com
|
142
|
+
executables:
|
143
|
+
- sah
|
144
|
+
extensions: []
|
145
|
+
extra_rdoc_files: []
|
146
|
+
files:
|
147
|
+
- ".gitignore"
|
148
|
+
- ".travis.yml"
|
149
|
+
- Gemfile
|
150
|
+
- LICENSE.txt
|
151
|
+
- README.md
|
152
|
+
- Rakefile
|
153
|
+
- bin/console
|
154
|
+
- bin/setup
|
155
|
+
- exe/sah
|
156
|
+
- lib/sah.rb
|
157
|
+
- lib/sah/cli.rb
|
158
|
+
- lib/sah/config.rb
|
159
|
+
- lib/sah/version.rb
|
160
|
+
- sah.gemspec
|
161
|
+
homepage: https://github.com/f440/sah
|
162
|
+
licenses:
|
163
|
+
- MIT
|
164
|
+
metadata: {}
|
165
|
+
post_install_message:
|
166
|
+
rdoc_options: []
|
167
|
+
require_paths:
|
168
|
+
- lib
|
169
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
175
|
+
requirements:
|
176
|
+
- - ">="
|
177
|
+
- !ruby/object:Gem::Version
|
178
|
+
version: '0'
|
179
|
+
requirements: []
|
180
|
+
rubyforge_project:
|
181
|
+
rubygems_version: 2.4.5.1
|
182
|
+
signing_key:
|
183
|
+
specification_version: 4
|
184
|
+
summary: Command line util for atlassian stash
|
185
|
+
test_files: []
|