git-gems 0.2.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -1
- data/README.md +2 -1
- data/Rakefile +4 -12
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/exe/git-gems +46 -0
- data/fixtures/Gemfile.template +3 -1
- data/git-gems.gemspec +5 -5
- data/lib/git/gems/cli.rb +1 -8
- data/lib/git/gems/version.rb +1 -1
- metadata +14 -15
- data/bin/git-gems +0 -9
- data/spec/lib/git/gems/cli_spec.rb +0 -123
- data/spec/spec_helper.rb +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0195e23b22a7901b04865a12a56d0619889e961a
|
4
|
+
data.tar.gz: 4794cd3551975b47229bdf1b54a23dc3a90b398b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e40b5940f0375a0e09c7d2c18d1ea3affb5b062d31a0528d0420895e8398c19284cf4f60249dc3d467f1ad69ac514c1cb4576a1f97de0556201041cc1ed68ec8
|
7
|
+
data.tar.gz: 46b1e10a9dee2b358d320caeff5092a88239fa2f0b521d4ba13d121d29f1421151be2791d3590fde3e36b68bf860fa5826a919b4b77847d6c82cc74c657ba06e
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/git-gems.svg)](http://badge.fury.io/rb/git-gems)
|
1
2
|
[![Build Status](https://travis-ci.org/magicdrive/ruby-git-gems.svg?branch=feature%2Frspec)](https://travis-ci.org/magicdrive/ruby-git-gems)
|
2
|
-
|
3
|
+
|
3
4
|
# Git::Gems
|
4
5
|
|
5
6
|
my bundler and git wrapper. (thor based)
|
data/Rakefile
CHANGED
@@ -1,16 +1,8 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
require "bundler/gem_tasks"
|
3
|
-
require
|
3
|
+
require 'rake/testtask'
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
begin
|
8
|
-
require 'rspec/core/rake_task'
|
9
|
-
require 'rspec'
|
10
|
-
require 'rr'
|
11
|
-
RSpec::Core::RakeTask.new(:spec) do |t|
|
12
|
-
t.rspec_opts = ['-c', '-f progress', '-r ./spec/spec_helper.rb']
|
13
|
-
t.pattern = 'spec/**/*_spec.rb'
|
14
|
-
end
|
15
|
-
rescue LoadError => e
|
5
|
+
Rake::TestTask.new do |t|
|
6
|
+
t.pattern = "spec/**/*_spec.rb"
|
16
7
|
end
|
8
|
+
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "git/gems"
|
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/git-gems
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
# conding: utf-8
|
3
|
+
|
4
|
+
#
|
5
|
+
# git-gems -- rubygem utililty: bundler and git wrapper
|
6
|
+
#
|
7
|
+
# Usage:
|
8
|
+
# git-gems bundler [OPTIONS] # do bundle install.
|
9
|
+
# git-gems exec [COMMAND] [OPTIONS] # do bundle exec .
|
10
|
+
# git-gems help [COMMAND] # Describe available commands or one specific command
|
11
|
+
# git-gems init # initilalize ruby project
|
12
|
+
# git-gems release [--version] [version_name] # taged release-tag
|
13
|
+
# git-gems update # update bundled gems
|
14
|
+
#
|
15
|
+
#
|
16
|
+
# Copyright (c) 2015 Hiroshi IKEGAMI
|
17
|
+
#
|
18
|
+
# MIT License
|
19
|
+
#
|
20
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
21
|
+
# a copy of this software and associated documentation files (the
|
22
|
+
# "Software"), to deal in the Software without restriction, including
|
23
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
24
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
25
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
26
|
+
# the following conditions:
|
27
|
+
#
|
28
|
+
# The above copyright notice and this permission notice shall be
|
29
|
+
# included in all copies or substantial portions of the Software.
|
30
|
+
#
|
31
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
32
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
33
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
34
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
35
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
36
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
37
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
38
|
+
#
|
39
|
+
|
40
|
+
|
41
|
+
require 'rubygems'
|
42
|
+
require File.expand_path('../lib/git/gems', File.dirname(__FILE__))
|
43
|
+
|
44
|
+
Git::Gems::CLI.start(ARGV)
|
45
|
+
|
46
|
+
__END__
|
data/fixtures/Gemfile.template
CHANGED
data/git-gems.gemspec
CHANGED
@@ -13,14 +13,14 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.homepage = "https://github.com/magicdrive/ruby-git-gems"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
|
-
spec.files = `git ls-files -z`.split("\x0")
|
17
|
-
spec.
|
18
|
-
spec.
|
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
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_runtime_dependency "thor", "~> 0.
|
21
|
+
spec.add_runtime_dependency "thor", "~> 0.0"
|
22
22
|
spec.add_runtime_dependency "bundler", "~> 1.0"
|
23
|
-
spec.add_development_dependency "
|
23
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
24
24
|
spec.add_development_dependency "pry"
|
25
25
|
spec.add_development_dependency "rake"
|
26
26
|
end
|
data/lib/git/gems/cli.rb
CHANGED
@@ -6,6 +6,7 @@ require 'thor'
|
|
6
6
|
module Git
|
7
7
|
module Gems
|
8
8
|
class CLI < Thor
|
9
|
+
|
9
10
|
class << self
|
10
11
|
def is_rackapp?
|
11
12
|
return File.exist?(File.expand_path("./config.ru"))
|
@@ -56,14 +57,6 @@ module Git
|
|
56
57
|
exec_cmd "git init"
|
57
58
|
end
|
58
59
|
|
59
|
-
option :version, :default => Time.now.strftime("%Y%m%d%H%M")
|
60
|
-
option :push, :type => :boolean
|
61
|
-
desc 'release [--version] [version_name]', 'taged release-tag'
|
62
|
-
def release
|
63
|
-
exec_cmd "git tag -a 'release-#{options[:version]}'"
|
64
|
-
exec_cmd "git push origin --tags" if options[:push]
|
65
|
-
end
|
66
|
-
|
67
60
|
desc 'update', 'update bundled gems'
|
68
61
|
def update(*args)
|
69
62
|
exec_cmd "bundle update #{args.join(%{ })}"
|
data/lib/git/gems/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-gems
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiroshi IKEGAMI
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: '0.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: '0.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,19 +39,19 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '5.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '5.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: pry
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,7 +94,9 @@ files:
|
|
94
94
|
- LICENSE.txt
|
95
95
|
- README.md
|
96
96
|
- Rakefile
|
97
|
-
- bin/
|
97
|
+
- bin/console
|
98
|
+
- bin/setup
|
99
|
+
- exe/git-gems
|
98
100
|
- fixtures/Gemfile.template
|
99
101
|
- fixtures/README.md.template
|
100
102
|
- fixtures/Rakefile.template
|
@@ -102,8 +104,6 @@ files:
|
|
102
104
|
- lib/git/gems.rb
|
103
105
|
- lib/git/gems/cli.rb
|
104
106
|
- lib/git/gems/version.rb
|
105
|
-
- spec/lib/git/gems/cli_spec.rb
|
106
|
-
- spec/spec_helper.rb
|
107
107
|
homepage: https://github.com/magicdrive/ruby-git-gems
|
108
108
|
licenses:
|
109
109
|
- MIT
|
@@ -124,10 +124,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
124
|
version: '0'
|
125
125
|
requirements: []
|
126
126
|
rubyforge_project:
|
127
|
-
rubygems_version: 2.
|
127
|
+
rubygems_version: 2.4.5
|
128
128
|
signing_key:
|
129
129
|
specification_version: 4
|
130
130
|
summary: 'rubygem utililty: bundler and git wrapper'
|
131
|
-
test_files:
|
132
|
-
|
133
|
-
- spec/spec_helper.rb
|
131
|
+
test_files: []
|
132
|
+
has_rdoc:
|
data/bin/git-gems
DELETED
@@ -1,123 +0,0 @@
|
|
1
|
-
describe Git::Gems::CLI do
|
2
|
-
context "success" do
|
3
|
-
|
4
|
-
before(:each) do
|
5
|
-
@instance = Git::Gems::CLI.new
|
6
|
-
end
|
7
|
-
|
8
|
-
describe "#install" do
|
9
|
-
it do
|
10
|
-
expect(capture(:stdout) {
|
11
|
-
@instance.invoke(:bundler, [], {})
|
12
|
-
}.strip).to eq("bundle install --path=./.bundle --binstubs=./.bundle/bin")
|
13
|
-
end
|
14
|
-
|
15
|
-
it do
|
16
|
-
expect(capture(:stdout) {
|
17
|
-
@instance.invoke(:bundler, [["--test", 'fuga']], {:path => "./hoge", :binstubs => "./binhoge"})
|
18
|
-
}.strip).to eq("bundle install --path=./hoge --binstubs=./binhoge --test fuga")
|
19
|
-
end
|
20
|
-
|
21
|
-
it do
|
22
|
-
expect(capture(:stdout) {
|
23
|
-
@instance.invoke(:bundler, [], {:"production" => true})
|
24
|
-
}.strip).to eq("bundle install --path=./.bundle --binstubs=./.bundle/bin --without development test")
|
25
|
-
end
|
26
|
-
|
27
|
-
it do
|
28
|
-
expect(capture(:stdout) {
|
29
|
-
@instance.invoke(:bundler, [], {:"no-path" => true})
|
30
|
-
}.strip).to eq("bundle install --binstubs=./.bundle/bin")
|
31
|
-
end
|
32
|
-
|
33
|
-
it do
|
34
|
-
expect(capture(:stdout) {
|
35
|
-
@instance.invoke(:bundler, [], {:"no-binstubs" => true})
|
36
|
-
}.strip).to eq("bundle install --path=./.bundle")
|
37
|
-
end
|
38
|
-
|
39
|
-
it do
|
40
|
-
expect(capture(:stdout) {
|
41
|
-
@instance.invoke(:bundler, [], {:"no-binstubs" => true, :"no-path" => true})
|
42
|
-
}.strip).to eq("bundle install")
|
43
|
-
end
|
44
|
-
|
45
|
-
it do
|
46
|
-
expect(capture(:stdout) {
|
47
|
-
@instance.invoke(:bundler, [], {path: "test", :"no-path" => true})
|
48
|
-
}.strip).to eq("bundle install --binstubs=./.bundle/bin")
|
49
|
-
end
|
50
|
-
|
51
|
-
it do
|
52
|
-
expect(capture(:stdout) {
|
53
|
-
@instance.invoke(:bundler, [], {binstubs: "test", :"no-binstubs" => true})
|
54
|
-
}.strip).to eq("bundle install --path=./.bundle")
|
55
|
-
end
|
56
|
-
|
57
|
-
it do
|
58
|
-
expect(capture(:stdout) {
|
59
|
-
@instance.invoke(:bundler, [], {binstubs: "test", :"no-path" => true})
|
60
|
-
}.strip).to eq("bundle install --binstubs=test")
|
61
|
-
end
|
62
|
-
|
63
|
-
it do
|
64
|
-
expect(capture(:stdout) {
|
65
|
-
@instance.invoke(:bundler, [], {path: "test", :"no-binstubs" => true})
|
66
|
-
}.strip).to eq("bundle install --path=test")
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
describe "#exec" do
|
71
|
-
it do
|
72
|
-
expect(capture(:stdout) {
|
73
|
-
@instance.invoke(:exec, ['test', ["--hoge", "bar"]], {})
|
74
|
-
}.strip).to eq("bundle exec test --hoge bar")
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
describe "#init" do
|
79
|
-
it do
|
80
|
-
expect(capture(:stdout) {
|
81
|
-
@instance.invoke(:init, [], {})
|
82
|
-
}).to eq(<<-STRING)
|
83
|
-
cp -a #{$project_path}/fixtures/Rakefile.template ./Rakefile
|
84
|
-
cp -a #{$project_path}/fixtures/Gemfile.template ./Gemfile
|
85
|
-
cp -a #{$project_path}/fixtures/README.md.template ./README.md
|
86
|
-
mkdir -p lib spec
|
87
|
-
touch lib/.keep spec/.keep
|
88
|
-
git init
|
89
|
-
STRING
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
describe "#release" do
|
94
|
-
it do
|
95
|
-
expect(capture(:stdout) {
|
96
|
-
@instance.invoke(:release, [], {})
|
97
|
-
}).to match(/git tag -a 'release-[0-9]{12}'/)
|
98
|
-
end
|
99
|
-
it do
|
100
|
-
expect(capture(:stdout) {
|
101
|
-
@instance.invoke(:release, [], {:version => 'hoge'})
|
102
|
-
}.strip).to eq("git tag -a 'release-hoge'")
|
103
|
-
end
|
104
|
-
it do
|
105
|
-
expect(capture(:stdout) {
|
106
|
-
@instance.invoke(:release, [], {:version => 'fuga', :push => true})
|
107
|
-
}).to eq(<<-STRING)
|
108
|
-
git tag -a 'release-fuga'
|
109
|
-
git push origin --tags
|
110
|
-
STRING
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
end
|
115
|
-
describe "#install" do
|
116
|
-
it do
|
117
|
-
expect(capture(:stdout) {
|
118
|
-
@instance.invoke(:release, [], {})
|
119
|
-
}).to eq('bundle update')
|
120
|
-
end
|
121
|
-
|
122
|
-
end
|
123
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# spec_helper file.
|
2
|
-
require File.expand_path('../lib/git/gems', File.dirname(__FILE__))
|
3
|
-
require 'stringio'
|
4
|
-
require 'pry'
|
5
|
-
|
6
|
-
def capture(stream)
|
7
|
-
begin
|
8
|
-
stream = stream.to_s
|
9
|
-
eval "$#{stream} = StringIO.new"
|
10
|
-
yield
|
11
|
-
result = eval("$#{stream}").string
|
12
|
-
ensure
|
13
|
-
eval("$#{stream} = #{stream.upcase}")
|
14
|
-
end
|
15
|
-
return result
|
16
|
-
end
|
17
|
-
|
18
|
-
|
19
|
-
class Git::Gems::CLI
|
20
|
-
private
|
21
|
-
def exec_cmd(command)
|
22
|
-
puts command
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
|
27
|
-
$project_path = "#{File.expand_path("../", File.dirname(__FILE__))}"
|
28
|
-
|
29
|
-
__END__
|