snapci 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +25 -0
- data/.init.sh +15 -0
- data/.rbenv-gemsets +1 -0
- data/.rspec +2 -0
- data/.ruby-version +1 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +7 -0
- data/bin/rspec +16 -0
- data/bin/snap +8 -0
- data/lib/snap.rb +22 -0
- data/lib/snap/cli.rb +20 -0
- data/lib/snap/version.rb +3 -0
- data/snapci.gemspec +26 -0
- data/spec/snap_spec.rb +32 -0
- data/spec/spec_helper.rb +2 -0
- metadata +131 -0
data/.gitignore
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
23
|
+
.tags
|
24
|
+
.tags_sorted_by_file
|
25
|
+
vendor/bundle
|
data/.init.sh
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
BUNDLE_PATH=/tmp/.bundle-$(basename $(pwd))
|
4
|
+
export BUNDLE_JOBS="${BUNDLE_JOBS:=4}"
|
5
|
+
if [ ! -z "$SNAP_CI" ]
|
6
|
+
then
|
7
|
+
BUNDLE_PATH=$HOME/.bundle
|
8
|
+
fi
|
9
|
+
|
10
|
+
mkdir -p $BUNDLE_PATH
|
11
|
+
rm vendor/bundle
|
12
|
+
ln -sf $BUNDLE_PATH vendor/bundle
|
13
|
+
|
14
|
+
bundle install --path vendor/bundle --clean
|
15
|
+
bundle binstubs rspec-core
|
data/.rbenv-gemsets
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
snap-ci-cli
|
data/.rspec
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.0.0-p353
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 ThoughtWorks, Inc. (http://thoughtworks.com)
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Snap [![Build Status](https://snap-ci.com/snap-ci/snap-cli/branch/master/build_image)](https://snap-ci.com/snap-ci/snap-cli/branch/master)
|
2
|
+
|
3
|
+
This gem includes a command line client and ruby library to interface with [Snap-CI](https://snap-ci.com)
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'snap'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install snap
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it ( https://github.com/snap-ci/snap-cli/fork )
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/rspec
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'rspec' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('rspec-core', 'rspec')
|
data/bin/snap
ADDED
data/lib/snap.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require "snap/version"
|
2
|
+
require 'rubygems'
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
module Snap
|
6
|
+
class << self
|
7
|
+
attr_accessor :api_key
|
8
|
+
|
9
|
+
def configure(api_key, config_file=File.expand_path('~/.snap.yml'))
|
10
|
+
config = {
|
11
|
+
:api_key => api_key
|
12
|
+
}
|
13
|
+
File.open(config_file, 'w') do |f|
|
14
|
+
f.puts(config.to_yaml)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def init(config_file=File.expand_path('~/.snap.yml'))
|
19
|
+
self.api_key = YAML.load_file(config_file)[:api_key]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/snap/cli.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'thor'
|
2
|
+
|
3
|
+
module Snap
|
4
|
+
class CLI < Thor
|
5
|
+
include Thor::Actions
|
6
|
+
|
7
|
+
desc "configure [API_KEY]", "configure the CLI with your API key (https://snap-ci.com/settings/api_key)"
|
8
|
+
def configure(api_key=nil)
|
9
|
+
while api_key == nil || api_key.chomp.empty?
|
10
|
+
api_key = ask("What is your api key (will not echo): ", :echo => false)
|
11
|
+
puts
|
12
|
+
end
|
13
|
+
Snap.configure(api_key)
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.run(argv)
|
17
|
+
CLI.start
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/snap/version.rb
ADDED
data/snapci.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'snap/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "snapci"
|
8
|
+
spec.version = Snap::VERSION
|
9
|
+
spec.authors = ["Ketan Padegaonkar"]
|
10
|
+
spec.email = ["KetanPadegaonkar@gmail.com"]
|
11
|
+
spec.summary = %q{Snap CI Client. CLI and Ruby Library.}
|
12
|
+
spec.description = %q{Snap CI Client. CLI and Ruby Library.}
|
13
|
+
spec.homepage = "https://snap-ci.com/"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency 'thor'
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
spec.add_development_dependency "rspec"
|
26
|
+
end
|
data/spec/snap_spec.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Snap do
|
4
|
+
it 'has a version number' do
|
5
|
+
expect(Snap::VERSION).not_to be nil
|
6
|
+
end
|
7
|
+
|
8
|
+
describe ".configure and .initialize" do
|
9
|
+
before(:each) do
|
10
|
+
@config_file = File.expand_path('../snap.yml', __FILE__)
|
11
|
+
FileUtils.rm_rf @config_file
|
12
|
+
end
|
13
|
+
|
14
|
+
after(:each) do
|
15
|
+
FileUtils.rm_rf @config_file
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should configure a snap config file with api key" do
|
19
|
+
expect(File.exist?(@config_file)).to be false
|
20
|
+
Snap.configure('api-key', @config_file)
|
21
|
+
expect(File.exist?(@config_file)).to be true
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should initialize snap with the api key" do
|
25
|
+
Snap.configure('api-key', @config_file)
|
26
|
+
|
27
|
+
expect(Snap.api_key).to be nil
|
28
|
+
Snap.init(@config_file)
|
29
|
+
expect(Snap.api_key).to eq('api-key')
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: snapci
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Ketan Padegaonkar
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-06-17 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: thor
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: bundler
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '1.6'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '1.6'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rake
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rspec
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
description: Snap CI Client. CLI and Ruby Library.
|
79
|
+
email:
|
80
|
+
- KetanPadegaonkar@gmail.com
|
81
|
+
executables:
|
82
|
+
- rspec
|
83
|
+
- snap
|
84
|
+
extensions: []
|
85
|
+
extra_rdoc_files: []
|
86
|
+
files:
|
87
|
+
- .gitignore
|
88
|
+
- .init.sh
|
89
|
+
- .rbenv-gemsets
|
90
|
+
- .rspec
|
91
|
+
- .ruby-version
|
92
|
+
- Gemfile
|
93
|
+
- LICENSE.txt
|
94
|
+
- README.md
|
95
|
+
- Rakefile
|
96
|
+
- bin/rspec
|
97
|
+
- bin/snap
|
98
|
+
- lib/snap.rb
|
99
|
+
- lib/snap/cli.rb
|
100
|
+
- lib/snap/version.rb
|
101
|
+
- snapci.gemspec
|
102
|
+
- spec/snap_spec.rb
|
103
|
+
- spec/spec_helper.rb
|
104
|
+
homepage: https://snap-ci.com/
|
105
|
+
licenses:
|
106
|
+
- MIT
|
107
|
+
post_install_message:
|
108
|
+
rdoc_options: []
|
109
|
+
require_paths:
|
110
|
+
- lib
|
111
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
112
|
+
none: false
|
113
|
+
requirements:
|
114
|
+
- - ! '>='
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
|
+
none: false
|
119
|
+
requirements:
|
120
|
+
- - ! '>='
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0'
|
123
|
+
requirements: []
|
124
|
+
rubyforge_project:
|
125
|
+
rubygems_version: 1.8.21
|
126
|
+
signing_key:
|
127
|
+
specification_version: 3
|
128
|
+
summary: Snap CI Client. CLI and Ruby Library.
|
129
|
+
test_files:
|
130
|
+
- spec/snap_spec.rb
|
131
|
+
- spec/spec_helper.rb
|