shaman_cli 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +69 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/exe/shaman +42 -0
- data/lib/shaman/deploy.rb +50 -0
- data/lib/shaman/init.rb +13 -0
- data/lib/shaman/version.rb +3 -0
- data/lib/shaman.rb +17 -0
- data/shaman.gemspec +27 -0
- metadata +146 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c94de0c331acc16e159a2ac54c831bd45298972c
|
4
|
+
data.tar.gz: 12fbbb3dbe8f549a221c1c093c565f93fbe5cfd7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 155947f05c8cf1fab49c16186aca4655b9271f1f5ba7ee0d82dd7520f7a7bacac25649f2a48730841ccdfd4149e4e4e8d3ac8778837014d98b3b3f6081549034
|
7
|
+
data.tar.gz: 35132213066621f4f1b430044f04b4c8ec85ffea563e32dfed5dcf46f824a44114eea75817a6ae30bea900a188692bac2e248a8082f913da1de4e56c841c7f43
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Stjepan Hadjic
|
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,69 @@
|
|
1
|
+
# Shaman
|
2
|
+
|
3
|
+
Cli for integrating with labs.infinum.co
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Install it yourself as:
|
8
|
+
|
9
|
+
$ gem install shaman
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
### Init
|
14
|
+
|
15
|
+
$ shaman init
|
16
|
+
|
17
|
+
Initialize your project
|
18
|
+
|
19
|
+
Options:
|
20
|
+
-f, --file FILE Application file path
|
21
|
+
-t, --token TOKEN Environment token
|
22
|
+
-u, --user EMAIL Labs user email
|
23
|
+
|
24
|
+
Example of `.shaman.yml`
|
25
|
+
|
26
|
+
---
|
27
|
+
:release_path: spec/files/test.ipa
|
28
|
+
:environment_token: ZNkyGVgbnwMEU3L2Gx64o22h
|
29
|
+
:deployer_email: stjepan.hadjic@infinum.hr
|
30
|
+
|
31
|
+
Explanation:
|
32
|
+
|
33
|
+
`release_path` - this is the path to the release file
|
34
|
+
`environment_token` - This is a token you can find
|
35
|
+
[https://scr.infinum.co/stjepan_hadjic/Infinum_Labs_2016-02-23_17-14-08.png]
|
36
|
+
`deployer_email` - This is an email you use with your git commits. You will also need to add this to your labs account.
|
37
|
+
[https://scr.infinum.co/stjepan_hadjic/Infinum_Labs_2016-02-23_17-16-52.png]
|
38
|
+
|
39
|
+
### Deploy
|
40
|
+
|
41
|
+
This will deploy your relese file to labs with with configs from .shaman.yml
|
42
|
+
|
43
|
+
$ shaman deploy
|
44
|
+
|
45
|
+
Options:
|
46
|
+
-m, --message MESSAGE Changelog message
|
47
|
+
-f, --file FILE Release path
|
48
|
+
-p, --proguard FILE Add aditional proguard mapping
|
49
|
+
-t, --token TOKEN Use different environment token
|
50
|
+
-c, --config FILE Use different config file
|
51
|
+
-d, --deployer EMAIL Labs deployer email
|
52
|
+
-g, --git Use git for deployer email and message (overrides any manual settings!)
|
53
|
+
-C, --commit COMMIT which commit to use instead of HEAD
|
54
|
+
|
55
|
+
## Development
|
56
|
+
|
57
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
58
|
+
|
59
|
+
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).
|
60
|
+
|
61
|
+
## Contributing
|
62
|
+
|
63
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/shaman. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
64
|
+
|
65
|
+
|
66
|
+
## License
|
67
|
+
|
68
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
69
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "shaman"
|
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/shaman
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$LOAD_PATH << 'lib'
|
4
|
+
require 'rubygems'
|
5
|
+
require 'commander/import'
|
6
|
+
require 'shaman'
|
7
|
+
# require 'pry'
|
8
|
+
|
9
|
+
program :version, Shaman::VERSION
|
10
|
+
program :description, 'Shaman cli for labs'
|
11
|
+
program :help_formatter, :compact
|
12
|
+
|
13
|
+
command :init do |c|
|
14
|
+
c.syntax = 'shaman init [-f] [-t]'
|
15
|
+
c.description = 'Initialize your project'
|
16
|
+
c.option '-f', '--file FILE', String, 'Application file path'
|
17
|
+
c.option '-t', '--token TOKEN', String, 'Environment token'
|
18
|
+
c.option '-u', '--user EMAIL', String, 'Labs user email'
|
19
|
+
c.action do |_args, options|
|
20
|
+
Shaman::Init.init(options)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
command :deploy do |c|
|
25
|
+
c.syntax = 'shaman deploy'
|
26
|
+
c.description = 'Deploy a release'
|
27
|
+
c.option '-m', '--message MESSAGE', String, 'Changelog message'
|
28
|
+
c.option '-f', '--file FILE', String, 'Release path'
|
29
|
+
c.option '-p', '--proguard FILE', String, 'Add aditional proguard mapping'
|
30
|
+
c.option '-t', '--token TOKEN', String, 'Use different environment token'
|
31
|
+
c.option '-c', '--config FILE', String, 'Use different config file'
|
32
|
+
c.option '-d', '--deployer EMAIL', String, 'Labs deployer email'
|
33
|
+
c.option '-g', '--git', 'Use git for deployer email and message (overrides any manual settings!)'
|
34
|
+
c.option '-C', '--commit COMMIT', String, 'which commit to use instead of HEAD'
|
35
|
+
c.action do |_args, options|
|
36
|
+
begin
|
37
|
+
Shaman::Deploy.new(options).deploy
|
38
|
+
rescue => e
|
39
|
+
say_error e.message
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Shaman
|
2
|
+
class Deploy
|
3
|
+
attr_reader :options
|
4
|
+
|
5
|
+
def initialize(options)
|
6
|
+
@options = options
|
7
|
+
verify_options
|
8
|
+
end
|
9
|
+
|
10
|
+
def deploy
|
11
|
+
say_ok "Connecting to #{LABS_URL}/api/v1/releases"
|
12
|
+
say_ok "Sending #{deploy_options.to_yaml}"
|
13
|
+
response = HTTP.post("#{LABS_URL}/api/v1/releases", form: deploy_options)
|
14
|
+
response.code == 200 ? say_ok(response.body.to_s) : say_error(response.body.to_s)
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def deploy_options
|
20
|
+
@deploy_options ||= {
|
21
|
+
environment_token: options.token || config[:environment_token],
|
22
|
+
release: HTTP::FormData::File.new(options.file || config[:release_path]),
|
23
|
+
message: message || '',
|
24
|
+
deployer: deployer
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
def verify_options
|
29
|
+
deploy_options.each do |key, value|
|
30
|
+
fail "Please specify #{key}" if value.nil?
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def config
|
35
|
+
@config ||= YAML.load_file(options.config || PROJECT_CONFIG_PATH)
|
36
|
+
end
|
37
|
+
|
38
|
+
def gcommit
|
39
|
+
@gcommit ||= Git.open('.').gcommit(options.commit || 'HEAD')
|
40
|
+
end
|
41
|
+
|
42
|
+
def message
|
43
|
+
options.git ? gcommit.message : options.message || ask_editor(nil, 'vi')
|
44
|
+
end
|
45
|
+
|
46
|
+
def deployer
|
47
|
+
options.git ? gcommit.committer.email : options.deployer || config[:deployer_email]
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
data/lib/shaman/init.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
module Shaman
|
2
|
+
module Init
|
3
|
+
def self.init(options)
|
4
|
+
config = {
|
5
|
+
release_path: options.file || ask('Release path:'),
|
6
|
+
environment_token: options.token || ask('Environment token:'),
|
7
|
+
deployer_email: options.user || ask('Labs deployer email:')
|
8
|
+
}
|
9
|
+
File.open(PROJECT_CONFIG_PATH, 'w') { |f| f.write(YAML.dump(config)) }
|
10
|
+
say_ok '.shaman.yml created'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/shaman.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'http'
|
2
|
+
require 'git'
|
3
|
+
require 'yaml'
|
4
|
+
require 'shaman/init'
|
5
|
+
require 'shaman/deploy'
|
6
|
+
require 'shaman/version'
|
7
|
+
|
8
|
+
module Shaman
|
9
|
+
PROJECT_CONFIG_PATH = '.shaman.yml'
|
10
|
+
LABS_URL =
|
11
|
+
case ENV['SHAMAN_ENV']
|
12
|
+
when 'development' then 'http://localhost:3000'
|
13
|
+
when 'staging' then 'https://labs-staging.infinum.co'
|
14
|
+
else
|
15
|
+
'https://labs.infinum.co'
|
16
|
+
end
|
17
|
+
end
|
data/shaman.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'shaman/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'shaman_cli'
|
7
|
+
spec.version = Shaman::VERSION
|
8
|
+
spec.authors = ['Stjepan Hadjic']
|
9
|
+
spec.email = ['d4be4st@gmail.com']
|
10
|
+
|
11
|
+
spec.summary = 'Command tool for labs'
|
12
|
+
spec.description = 'Very cool command tool for infinum'
|
13
|
+
spec.homepage = 'http://www.infinum.co'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = 'exe'
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.10'
|
22
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
23
|
+
spec.add_development_dependency 'rspec'
|
24
|
+
spec.add_development_dependency 'pry-byebug'
|
25
|
+
spec.add_dependency 'http'
|
26
|
+
spec.add_dependency 'git'
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: shaman_cli
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Stjepan Hadjic
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-02-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry-byebug
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: http
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: git
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: Very cool command tool for infinum
|
98
|
+
email:
|
99
|
+
- d4be4st@gmail.com
|
100
|
+
executables:
|
101
|
+
- shaman
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- ".gitignore"
|
106
|
+
- ".rspec"
|
107
|
+
- ".travis.yml"
|
108
|
+
- CODE_OF_CONDUCT.md
|
109
|
+
- Gemfile
|
110
|
+
- LICENSE.txt
|
111
|
+
- README.md
|
112
|
+
- Rakefile
|
113
|
+
- bin/console
|
114
|
+
- bin/setup
|
115
|
+
- exe/shaman
|
116
|
+
- lib/shaman.rb
|
117
|
+
- lib/shaman/deploy.rb
|
118
|
+
- lib/shaman/init.rb
|
119
|
+
- lib/shaman/version.rb
|
120
|
+
- shaman.gemspec
|
121
|
+
homepage: http://www.infinum.co
|
122
|
+
licenses:
|
123
|
+
- MIT
|
124
|
+
metadata: {}
|
125
|
+
post_install_message:
|
126
|
+
rdoc_options: []
|
127
|
+
require_paths:
|
128
|
+
- lib
|
129
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
requirements: []
|
140
|
+
rubyforge_project:
|
141
|
+
rubygems_version: 2.4.5
|
142
|
+
signing_key:
|
143
|
+
specification_version: 4
|
144
|
+
summary: Command tool for labs
|
145
|
+
test_files: []
|
146
|
+
has_rdoc:
|