gitit 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/.rspec +1 -0
- data/Gemfile +18 -0
- data/LICENSE.txt +20 -0
- data/README.md +29 -0
- data/README.rdoc +19 -0
- data/Rakefile +62 -0
- data/VERSION +1 -0
- data/features/gitit.feature +9 -0
- data/features/step_definitions/gitit_steps.rb +0 -0
- data/features/support/env.rb +13 -0
- data/gitit.gemspec +83 -0
- data/lib/ext/string.rb +53 -0
- data/lib/gitit.rb +9 -0
- data/lib/gitit/command_config.rb +37 -0
- data/lib/gitit/command_executor.rb +21 -0
- data/lib/gitit/git.rb +26 -0
- data/lib/gitit/repo.rb +36 -0
- data/lib/gitit/version.rb +3 -0
- data/spec/gitit_config_spec.rb +63 -0
- data/spec/gitit_spec.rb +68 -0
- data/spec/spec_helper.rb +17 -0
- metadata +180 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0af5b6d9a91123e7814a73265aa01afb2756d2bc
|
4
|
+
data.tar.gz: 7db29f517bb26137b22a47f915cbc4ad12165942
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 65796025e4492a5dcb284c6e2ea0277c431a2b6d74702a259ec6aa98f7147d834d77eb115af1bb22265ed9c549c75fc52b8faa0a8302716d76fcc274d28c3e32
|
7
|
+
data.tar.gz: 6622834fb44eda22915e9c6030801e5d6e0977311de9e62d77d85110a01eb81804df6648f705016519574940b0a71ac8e8348dcb350003f3cce0a63da72f2b81
|
data/.document
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
gem "kruptos", :require => "kruptos/blowfish"
|
7
|
+
gem "activesupport", :require => "base64"
|
8
|
+
|
9
|
+
# Add dependencies to develop your gem here.
|
10
|
+
# Include everything needed to run rake, tests, features, etc.
|
11
|
+
group :development do
|
12
|
+
gem "rspec"
|
13
|
+
gem "rdoc", ">= 3.12"
|
14
|
+
gem "cucumber", ">= 0"
|
15
|
+
gem "bundler", ">= 1.0.0"
|
16
|
+
gem "jeweler", ">= 1.8.4"
|
17
|
+
gem 'simplecov', :require => false, :group => :test
|
18
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2013 Bone Crusher
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Gitit
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'gitit'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install gitit
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
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 new Pull Request
|
data/README.rdoc
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
= gitit
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Contributing to gitit
|
6
|
+
|
7
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
8
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
9
|
+
* Fork the project.
|
10
|
+
* Start a feature/bugfix branch.
|
11
|
+
* Commit and push until you are happy with your contribution.
|
12
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2013 Bone Crusher. See LICENSE.txt for
|
18
|
+
further details.
|
19
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "gitit"
|
18
|
+
gem.homepage = "http://github.com/patbonecrusher/gitit"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{Ruby git wrapper for the command line thin}
|
21
|
+
gem.description = %Q{longer description of your gem}
|
22
|
+
gem.email = "pat@covenofchaos.com"
|
23
|
+
gem.authors = ["Bone Crusher"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rspec/core'
|
29
|
+
require 'rspec/core/rake_task'
|
30
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
31
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
32
|
+
spec.rspec_opts = Dir.glob("[0-9][0-9][0-9]_*").collect { |x| "-I#{x}" }
|
33
|
+
spec.rspec_opts << '--color -f d'
|
34
|
+
end
|
35
|
+
|
36
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
37
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
38
|
+
spec.rcov = true
|
39
|
+
end
|
40
|
+
|
41
|
+
RSpec::Core::RakeTask.new(:coverage) do |spec|
|
42
|
+
# add simplecov
|
43
|
+
ENV["COVERAGE"] = 'yes'
|
44
|
+
|
45
|
+
# run the specs
|
46
|
+
Rake::Task['spec'].execute
|
47
|
+
end
|
48
|
+
|
49
|
+
require 'cucumber/rake/task'
|
50
|
+
Cucumber::Rake::Task.new(:features)
|
51
|
+
|
52
|
+
task :default => :spec
|
53
|
+
|
54
|
+
require 'rdoc/task'
|
55
|
+
Rake::RDocTask.new do |rdoc|
|
56
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
57
|
+
|
58
|
+
rdoc.rdoc_dir = 'rdoc'
|
59
|
+
rdoc.title = "gitit #{version}"
|
60
|
+
rdoc.rdoc_files.include('README*')
|
61
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
62
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
File without changes
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
begin
|
3
|
+
Bundler.setup(:default, :development)
|
4
|
+
rescue Bundler::BundlerError => e
|
5
|
+
$stderr.puts e.message
|
6
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
7
|
+
exit e.status_code
|
8
|
+
end
|
9
|
+
|
10
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
|
11
|
+
require 'gitit'
|
12
|
+
|
13
|
+
require 'rspec/expectations'
|
data/gitit.gemspec
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "gitit"
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Bone Crusher"]
|
12
|
+
s.date = "2013-06-08"
|
13
|
+
s.description = "longer description of your gem"
|
14
|
+
s.email = "pat@covenofchaos.com"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.md",
|
18
|
+
"README.rdoc"
|
19
|
+
]
|
20
|
+
s.files = [
|
21
|
+
".document",
|
22
|
+
".rspec",
|
23
|
+
"Gemfile",
|
24
|
+
"LICENSE.txt",
|
25
|
+
"README.md",
|
26
|
+
"README.rdoc",
|
27
|
+
"Rakefile",
|
28
|
+
"VERSION",
|
29
|
+
"features/gitit.feature",
|
30
|
+
"features/step_definitions/gitit_steps.rb",
|
31
|
+
"features/support/env.rb",
|
32
|
+
"gitit.gemspec",
|
33
|
+
"lib/ext/string.rb",
|
34
|
+
"lib/gitit.rb",
|
35
|
+
"lib/gitit/command_config.rb",
|
36
|
+
"lib/gitit/command_executor.rb",
|
37
|
+
"lib/gitit/git.rb",
|
38
|
+
"lib/gitit/repo.rb",
|
39
|
+
"lib/gitit/version.rb",
|
40
|
+
"spec/gitit_config_spec.rb",
|
41
|
+
"spec/gitit_spec.rb",
|
42
|
+
"spec/spec_helper.rb"
|
43
|
+
]
|
44
|
+
s.homepage = "http://github.com/patbonecrusher/gitit"
|
45
|
+
s.licenses = ["MIT"]
|
46
|
+
s.require_paths = ["lib"]
|
47
|
+
s.rubygems_version = "2.0.3"
|
48
|
+
s.summary = "Ruby git wrapper for the command line thin"
|
49
|
+
|
50
|
+
if s.respond_to? :specification_version then
|
51
|
+
s.specification_version = 4
|
52
|
+
|
53
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
54
|
+
s.add_runtime_dependency(%q<kruptos>, [">= 0"])
|
55
|
+
s.add_runtime_dependency(%q<activesupport>, [">= 0"])
|
56
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
57
|
+
s.add_development_dependency(%q<rdoc>, [">= 3.12"])
|
58
|
+
s.add_development_dependency(%q<cucumber>, [">= 0"])
|
59
|
+
s.add_development_dependency(%q<bundler>, [">= 1.0.0"])
|
60
|
+
s.add_development_dependency(%q<jeweler>, [">= 1.8.4"])
|
61
|
+
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
62
|
+
else
|
63
|
+
s.add_dependency(%q<kruptos>, [">= 0"])
|
64
|
+
s.add_dependency(%q<activesupport>, [">= 0"])
|
65
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
66
|
+
s.add_dependency(%q<rdoc>, [">= 3.12"])
|
67
|
+
s.add_dependency(%q<cucumber>, [">= 0"])
|
68
|
+
s.add_dependency(%q<bundler>, [">= 1.0.0"])
|
69
|
+
s.add_dependency(%q<jeweler>, [">= 1.8.4"])
|
70
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
71
|
+
end
|
72
|
+
else
|
73
|
+
s.add_dependency(%q<kruptos>, [">= 0"])
|
74
|
+
s.add_dependency(%q<activesupport>, [">= 0"])
|
75
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
76
|
+
s.add_dependency(%q<rdoc>, [">= 3.12"])
|
77
|
+
s.add_dependency(%q<cucumber>, [">= 0"])
|
78
|
+
s.add_dependency(%q<bundler>, [">= 1.0.0"])
|
79
|
+
s.add_dependency(%q<jeweler>, [">= 1.8.4"])
|
80
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
data/lib/ext/string.rb
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
|
3
|
+
Bundler.require(:default)
|
4
|
+
|
5
|
+
class String
|
6
|
+
|
7
|
+
def encrypt(key = "Some random key")
|
8
|
+
blowfish = Kruptos::Blowfish.new(key)
|
9
|
+
|
10
|
+
String val = self
|
11
|
+
|
12
|
+
# pad the value to be 8 bytes aligned.
|
13
|
+
(8-(val.length % 8)).times { val += "\012" }
|
14
|
+
encodedString = Base64.encode64(val)
|
15
|
+
|
16
|
+
encryptedValue = ""
|
17
|
+
(
|
18
|
+
chunk = val.slice!(0,8)
|
19
|
+
encryptedValue += blowfish.encrypt_block(chunk)
|
20
|
+
) until val.empty?
|
21
|
+
|
22
|
+
return ::Base64.encode64(encryptedValue);
|
23
|
+
end
|
24
|
+
|
25
|
+
def decrypt(key = "Some random key")
|
26
|
+
blowfish = Kruptos::Blowfish.new(key)
|
27
|
+
value = ::Base64.decode64(self)
|
28
|
+
|
29
|
+
decryptedValue = ""
|
30
|
+
(
|
31
|
+
chunk = value.slice!(0,8)
|
32
|
+
decryptedValue += blowfish.decrypt_block(chunk)
|
33
|
+
) until value.empty?
|
34
|
+
|
35
|
+
(
|
36
|
+
decryptedValue = decryptedValue.chomp("\012")
|
37
|
+
) until (decryptedValue[decryptedValue.length-1] != "\012")
|
38
|
+
|
39
|
+
return decryptedValue
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
# String foo = "This is cool".encrypt("blablabla")
|
45
|
+
# puts foo => "WuwcAFdNWrtdn4SANiTxgg=="
|
46
|
+
# puts foo.decrypt("blablabla") => "This is cool"
|
47
|
+
# puts foo.decrypt("blablabla").length => 12
|
48
|
+
|
49
|
+
# String foo = "This is cool".encrypt
|
50
|
+
# puts foo
|
51
|
+
# puts foo.decrypt
|
52
|
+
# puts foo.decrypt.length
|
53
|
+
|
data/lib/gitit.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
require "gitit/command_executor"
|
3
|
+
|
4
|
+
Bundler.require(:default)
|
5
|
+
|
6
|
+
module Gitit
|
7
|
+
|
8
|
+
# ---------------------------------------------------------------------------
|
9
|
+
# ---------------------------------------------------------------------------
|
10
|
+
class Config
|
11
|
+
include CommandExecutor
|
12
|
+
|
13
|
+
# -------------------------------------------------------------------------
|
14
|
+
# -------------------------------------------------------------------------
|
15
|
+
def initialize(repo)
|
16
|
+
@repo = repo
|
17
|
+
end
|
18
|
+
|
19
|
+
# -------------------------------------------------------------------------
|
20
|
+
# -------------------------------------------------------------------------
|
21
|
+
def getValue(key, decrypt = false)
|
22
|
+
value = executeCommand("config --null --get #{key}")
|
23
|
+
value = value.slice!(0, value.length-1)
|
24
|
+
return value
|
25
|
+
end
|
26
|
+
|
27
|
+
# -------------------------------------------------------------------------
|
28
|
+
# -------------------------------------------------------------------------
|
29
|
+
def setValue(key, value)
|
30
|
+
val = value
|
31
|
+
executeCommand("config \"#{key}\" \"#{val}\"")
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
|
3
|
+
Bundler.require(:default)
|
4
|
+
|
5
|
+
module Gitit
|
6
|
+
|
7
|
+
module CommandExecutor
|
8
|
+
|
9
|
+
attr_reader :repo
|
10
|
+
|
11
|
+
def executeCommand(command)
|
12
|
+
gitCommand = ["git", command].join(" ")
|
13
|
+
result = `(cd #{@repo.location} && #{gitCommand})`
|
14
|
+
raise "failure running command" if $?.exitstatus != 0
|
15
|
+
return result
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
data/lib/gitit/git.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
require "gitit"
|
3
|
+
require "gitit/repo"
|
4
|
+
require "gitit/command_config"
|
5
|
+
|
6
|
+
Bundler.require(:default)
|
7
|
+
|
8
|
+
module Gitit
|
9
|
+
|
10
|
+
# ---------------------------------------------------------------------------
|
11
|
+
# ---------------------------------------------------------------------------
|
12
|
+
class Git
|
13
|
+
attr_reader :repo;
|
14
|
+
attr_reader :config;
|
15
|
+
|
16
|
+
# -------------------------------------------------------------------------
|
17
|
+
# -------------------------------------------------------------------------
|
18
|
+
def initialize(location)
|
19
|
+
@repo = Repo.new(location)
|
20
|
+
@config = Config.new(repo)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
|
data/lib/gitit/repo.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
require "gitit"
|
3
|
+
|
4
|
+
Bundler.require(:default)
|
5
|
+
|
6
|
+
module Gitit
|
7
|
+
|
8
|
+
# ---------------------------------------------------------------------------
|
9
|
+
# ---------------------------------------------------------------------------
|
10
|
+
class Repo
|
11
|
+
attr_reader :location;
|
12
|
+
|
13
|
+
# -------------------------------------------------------------------------
|
14
|
+
# -------------------------------------------------------------------------
|
15
|
+
def initialize(location)
|
16
|
+
raise "Invalid path specified" unless File.directory? location
|
17
|
+
@location = location
|
18
|
+
end
|
19
|
+
|
20
|
+
# -------------------------------------------------------------------------
|
21
|
+
# -------------------------------------------------------------------------
|
22
|
+
def valid?
|
23
|
+
commandres = `(cd #{@location} && git status 2&>/dev/null)`
|
24
|
+
return true unless $?.exitstatus != 0
|
25
|
+
return false
|
26
|
+
end
|
27
|
+
|
28
|
+
# -------------------------------------------------------------------------
|
29
|
+
# -------------------------------------------------------------------------
|
30
|
+
def init
|
31
|
+
raise "failed to create repo" if valid?
|
32
|
+
commandres = `(cd #{@location} && git init)`
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
#require "gitit"
|
3
|
+
|
4
|
+
module Gitit
|
5
|
+
|
6
|
+
describe Repo do
|
7
|
+
|
8
|
+
# -------------------------------------------------------------------------
|
9
|
+
# -------------------------------------------------------------------------
|
10
|
+
describe "#Config" do
|
11
|
+
|
12
|
+
KEY_NAME = "mytest.bla"
|
13
|
+
KEY_VALUE = "osd aas as dsaadk".force_encoding("UTF-8")
|
14
|
+
|
15
|
+
before(:each) do
|
16
|
+
FileUtils.mkpath TEST_REPO_PATH
|
17
|
+
@git = Git.new(TEST_REPO_PATH)
|
18
|
+
@git.repo.init
|
19
|
+
@config = @git.config
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "while not using encryption" do
|
23
|
+
it "will set the specified value successfully" do
|
24
|
+
lambda{@config.setValue(KEY_NAME, KEY_VALUE)}.should_not raise_error
|
25
|
+
end
|
26
|
+
|
27
|
+
it "will retrieve the specified value successfully" do
|
28
|
+
value = ""
|
29
|
+
lambda{@config.setValue(KEY_NAME, KEY_VALUE)}.should_not raise_error
|
30
|
+
lambda{value = @config.getValue(KEY_NAME)}.should_not raise_error
|
31
|
+
value.should eq KEY_VALUE
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "while using encryption" do
|
36
|
+
it "will encrypt and set the specified value successfully" do
|
37
|
+
lambda{@config.setValue(KEY_NAME, KEY_VALUE.encrypt)}.should_not raise_error
|
38
|
+
end
|
39
|
+
|
40
|
+
it "will store an encrypted value in the config" do
|
41
|
+
lambda{@config.setValue(KEY_NAME, KEY_VALUE.encrypt)}.should_not raise_error
|
42
|
+
|
43
|
+
value = ""
|
44
|
+
lambda{value = @config.getValue(KEY_NAME)}.should_not raise_error
|
45
|
+
value.should_not eq KEY_VALUE
|
46
|
+
end
|
47
|
+
|
48
|
+
it "will retrieve and decrypt the specified value from the config" do
|
49
|
+
lambda{@config.setValue(KEY_NAME, KEY_VALUE.encrypt)}.should_not raise_error
|
50
|
+
|
51
|
+
value = ""
|
52
|
+
lambda{value = @config.getValue(KEY_NAME).decrypt}.should_not raise_error
|
53
|
+
value.should eq KEY_VALUE
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
after(:each) do
|
58
|
+
FileUtils.rm_rf TEST_REPO_PATH
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
data/spec/gitit_spec.rb
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
module Gitit
|
4
|
+
|
5
|
+
describe Repo do
|
6
|
+
|
7
|
+
# -------------------------------------------------------------------------
|
8
|
+
# -------------------------------------------------------------------------
|
9
|
+
describe "#initialize" do
|
10
|
+
|
11
|
+
TMP_PATH = "/tmp/"
|
12
|
+
BAD_PATH = "/adsdsadasdsa"
|
13
|
+
TEST_REPO_PATH = "/tmp/test_git"
|
14
|
+
|
15
|
+
before(:each) do
|
16
|
+
end
|
17
|
+
|
18
|
+
it "will open fine given a valid repo" do
|
19
|
+
lambda{Git.new(Dir.pwd)}.should_not raise_error
|
20
|
+
end
|
21
|
+
|
22
|
+
it "will throw an error given an invalid repo" do
|
23
|
+
lambda{Git.new(BAD_PATH)}.should raise_error
|
24
|
+
end
|
25
|
+
|
26
|
+
it "will return true on valid repo" do
|
27
|
+
myRepo = Git.new(Dir.pwd).repo
|
28
|
+
myRepo.valid?.should eq true
|
29
|
+
end
|
30
|
+
|
31
|
+
it "will return false on invalid repo" do
|
32
|
+
myRepo = Git.new(TMP_PATH).repo
|
33
|
+
myRepo.valid?.should eq false
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
# -------------------------------------------------------------------------
|
39
|
+
# -------------------------------------------------------------------------
|
40
|
+
describe "#initNewRepo" do
|
41
|
+
|
42
|
+
before(:each) do
|
43
|
+
FileUtils.mkpath TEST_REPO_PATH
|
44
|
+
git = Git.new(TEST_REPO_PATH)
|
45
|
+
@myRepo = git.repo
|
46
|
+
end
|
47
|
+
|
48
|
+
it "will initialize a new repo on an existing folder" do
|
49
|
+
@myRepo.valid?.should eq false
|
50
|
+
lambda{@myRepo.init}.should_not raise_error
|
51
|
+
end
|
52
|
+
|
53
|
+
it "will fail to initialize a new repo on an existing folder already initialized" do
|
54
|
+
@myRepo.valid?.should eq false
|
55
|
+
lambda{@myRepo.init}.should_not raise_error
|
56
|
+
@myRepo.valid?.should eq true
|
57
|
+
lambda{@myRepo.init}.should raise_error
|
58
|
+
end
|
59
|
+
|
60
|
+
after(:each) do
|
61
|
+
FileUtils.rm_rf TEST_REPO_PATH
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
if ENV["COVERAGE"] == 'yes'
|
2
|
+
require 'simplecov'
|
3
|
+
SimpleCov.start
|
4
|
+
end
|
5
|
+
|
6
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
7
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
8
|
+
require 'rspec'
|
9
|
+
require 'gitit'
|
10
|
+
|
11
|
+
# Requires supporting files with custom matchers and macros, etc,
|
12
|
+
# in ./support/ and its subdirectories.
|
13
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
14
|
+
|
15
|
+
RSpec.configure do |config|
|
16
|
+
|
17
|
+
end
|
metadata
ADDED
@@ -0,0 +1,180 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gitit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Bone Crusher
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-06-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: kruptos
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '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: rdoc
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.12'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.12'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: cucumber
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
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: bundler
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 1.0.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 1.0.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: jeweler
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 1.8.4
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 1.8.4
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: simplecov
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
description: longer description of your gem
|
126
|
+
email: pat@covenofchaos.com
|
127
|
+
executables: []
|
128
|
+
extensions: []
|
129
|
+
extra_rdoc_files:
|
130
|
+
- LICENSE.txt
|
131
|
+
- README.md
|
132
|
+
- README.rdoc
|
133
|
+
files:
|
134
|
+
- .document
|
135
|
+
- .rspec
|
136
|
+
- Gemfile
|
137
|
+
- LICENSE.txt
|
138
|
+
- README.md
|
139
|
+
- README.rdoc
|
140
|
+
- Rakefile
|
141
|
+
- VERSION
|
142
|
+
- features/gitit.feature
|
143
|
+
- features/step_definitions/gitit_steps.rb
|
144
|
+
- features/support/env.rb
|
145
|
+
- gitit.gemspec
|
146
|
+
- lib/ext/string.rb
|
147
|
+
- lib/gitit.rb
|
148
|
+
- lib/gitit/command_config.rb
|
149
|
+
- lib/gitit/command_executor.rb
|
150
|
+
- lib/gitit/git.rb
|
151
|
+
- lib/gitit/repo.rb
|
152
|
+
- lib/gitit/version.rb
|
153
|
+
- spec/gitit_config_spec.rb
|
154
|
+
- spec/gitit_spec.rb
|
155
|
+
- spec/spec_helper.rb
|
156
|
+
homepage: http://github.com/patbonecrusher/gitit
|
157
|
+
licenses:
|
158
|
+
- MIT
|
159
|
+
metadata: {}
|
160
|
+
post_install_message:
|
161
|
+
rdoc_options: []
|
162
|
+
require_paths:
|
163
|
+
- lib
|
164
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
165
|
+
requirements:
|
166
|
+
- - '>='
|
167
|
+
- !ruby/object:Gem::Version
|
168
|
+
version: '0'
|
169
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
requirements: []
|
175
|
+
rubyforge_project:
|
176
|
+
rubygems_version: 2.0.3
|
177
|
+
signing_key:
|
178
|
+
specification_version: 4
|
179
|
+
summary: Ruby git wrapper for the command line thin
|
180
|
+
test_files: []
|