give 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm use 1.9.3@give --create
data/Gemfile ADDED
@@ -0,0 +1,17 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+ gem 'thor'
6
+ gem 'octokit', '0.5.1'
7
+ gem 'highline'
8
+ # Add dependencies to develop your gem here.
9
+ # Include everything needed to run rake, tests, features, etc.
10
+ group :development do
11
+ gem "rspec", "~> 2.7.0"
12
+ gem "yard", "~> 0.6.0"
13
+ gem "bundler", "~> 1.0.0"
14
+ gem "jeweler", "~> 1.6.4"
15
+ gem "rcov", ">= 0"
16
+ gem "reek", "~> 1.2.8"
17
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,65 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ addressable (2.2.6)
5
+ diff-lcs (1.1.3)
6
+ faraday (0.5.7)
7
+ addressable (~> 2.2.4)
8
+ multipart-post (~> 1.1.0)
9
+ rack (>= 1.1.0, < 2)
10
+ faraday_middleware (0.3.2)
11
+ faraday (~> 0.5.4)
12
+ git (1.2.5)
13
+ hashie (1.0.0)
14
+ highline (1.5.2)
15
+ jeweler (1.6.4)
16
+ bundler (~> 1.0)
17
+ git (>= 1.2.5)
18
+ rake
19
+ multi_json (0.0.5)
20
+ multi_xml (0.2.2)
21
+ multipart-post (1.1.4)
22
+ octokit (0.5.1)
23
+ addressable (~> 2.2.4)
24
+ faraday (~> 0.5.4)
25
+ faraday_middleware (~> 0.3.1)
26
+ hashie (~> 1.0.0)
27
+ multi_json (~> 0.0.5)
28
+ multi_xml (~> 0.2.0)
29
+ rack (1.3.5)
30
+ rake (0.9.2.2)
31
+ rcov (0.9.11)
32
+ reek (1.2.8)
33
+ ruby2ruby (~> 1.2)
34
+ ruby_parser (~> 2.0)
35
+ sexp_processor (~> 3.0)
36
+ rspec (2.7.0)
37
+ rspec-core (~> 2.7.0)
38
+ rspec-expectations (~> 2.7.0)
39
+ rspec-mocks (~> 2.7.0)
40
+ rspec-core (2.7.1)
41
+ rspec-expectations (2.7.0)
42
+ diff-lcs (~> 1.1.2)
43
+ rspec-mocks (2.7.0)
44
+ ruby2ruby (1.3.1)
45
+ ruby_parser (~> 2.0)
46
+ sexp_processor (~> 3.0)
47
+ ruby_parser (2.3.1)
48
+ sexp_processor (~> 3.0)
49
+ sexp_processor (3.0.9)
50
+ thor (0.14.6)
51
+ yard (0.6.8)
52
+
53
+ PLATFORMS
54
+ ruby
55
+
56
+ DEPENDENCIES
57
+ bundler (~> 1.0.0)
58
+ highline
59
+ jeweler (~> 1.6.4)
60
+ octokit (= 0.5.1)
61
+ rcov
62
+ reek (~> 1.2.8)
63
+ rspec (~> 2.7.0)
64
+ thor
65
+ yard (~> 0.6.0)
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 seenmyfate
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,49 @@
1
+ ## give
2
+ --------------
3
+ The aim of Give is to make contributing to open source projects on Github just that bit easier, by wrapping some simple commands around a common workflow.
4
+
5
+ ### Installation
6
+
7
+ gem install give
8
+
9
+ You must have set your git username and api token, if you not please follow [these instructions](http://help.github.com/set-your-user-name-email-and-github-token/)
10
+
11
+ ### Usage
12
+
13
+ You will need the name of the GitHub user, and the repository name for the project in question. In this example we'll the give gem itself.
14
+
15
+ First up, fork the project and check out your new copy of the repo with the `give setup` command.
16
+
17
+ give setup seenmyfate give
18
+
19
+ Next, create a feature branch to work in.
20
+
21
+ give start feature/my_awesome_feature
22
+
23
+ Commit away as usual, but be sure to keep your feature branch up to date with any new changes added to the forked repo by running `give update`
24
+
25
+ give update feature/my_awesome_feature
26
+
27
+ When the work is complete, push up the branch and send a pull request with `give finish`
28
+
29
+ give finish seenmyfate give feature/my_awesome_feature
30
+
31
+ You will be prompted to enter a title and body for the pull request.
32
+
33
+
34
+ ### Contributing to give
35
+ -----------------------------------
36
+
37
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
38
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
39
+ * Fork the project
40
+ * Start a feature/bugfix branch
41
+ * Commit and push until you are happy with your contribution
42
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
43
+ * 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.
44
+
45
+ #### Copyright
46
+
47
+ Copyright (c) 2011 Tom Clements. See LICENSE.txt for
48
+ further details.
49
+
data/Rakefile ADDED
@@ -0,0 +1,49 @@
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 = "give"
18
+ gem.homepage = "http://github.com/seenmyfate/give"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Makes contributing to open source projects on Github just that bit easier}
21
+ gem.description = %Q{The aim of Give is to make contributing to open source projects on Github just that bit easier, by wrapping some simple commands around a common workflow.}
22
+ gem.email = "seenmyfate@gmail.com"
23
+ gem.authors = ["seenmyfate"]
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
+ end
33
+
34
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
35
+ spec.pattern = 'spec/**/*_spec.rb'
36
+ spec.rcov = true
37
+ end
38
+
39
+ require 'reek/rake/task'
40
+ Reek::Rake::Task.new do |t|
41
+ t.fail_on_error = true
42
+ t.verbose = false
43
+ t.source_files = 'lib/**/*.rb'
44
+ end
45
+
46
+ task :default => :spec
47
+
48
+ require 'yard'
49
+ YARD::Rake::YardocTask.new
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.1
data/bin/give ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ require 'rubygems'
3
+ lib_dir = File.join(File.dirname(__FILE__), '..', 'lib')
4
+ $LOAD_PATH.unshift lib_dir if File.directory?(lib_dir)
5
+ require 'give'
6
+
7
+ Give::CLI.start
data/give.gemspec ADDED
@@ -0,0 +1,80 @@
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 = "give"
8
+ s.version = "0.1.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["seenmyfate"]
12
+ s.date = "2011-12-23"
13
+ s.description = "The aim of Give is to make contributing to open source projects on Github just that bit easier, by wrapping some simple commands around a common workflow."
14
+ s.email = "seenmyfate@gmail.com"
15
+ s.executables = ["give"]
16
+ s.extra_rdoc_files = [
17
+ "LICENSE.txt",
18
+ "README.md"
19
+ ]
20
+ s.files = [
21
+ ".document",
22
+ ".rspec",
23
+ ".rvmrc",
24
+ "Gemfile",
25
+ "Gemfile.lock",
26
+ "LICENSE.txt",
27
+ "README.md",
28
+ "Rakefile",
29
+ "VERSION",
30
+ "bin/give",
31
+ "give.gemspec",
32
+ "lib/commands.rb",
33
+ "lib/give.rb",
34
+ "spec/give_spec.rb",
35
+ "spec/reek_spec.rb",
36
+ "spec/spec_helper.rb"
37
+ ]
38
+ s.homepage = "http://github.com/seenmyfate/give"
39
+ s.licenses = ["MIT"]
40
+ s.require_paths = ["lib"]
41
+ s.rubygems_version = "1.8.10"
42
+ s.summary = "Makes contributing to open source projects on Github just that bit easier"
43
+
44
+ if s.respond_to? :specification_version then
45
+ s.specification_version = 3
46
+
47
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
48
+ s.add_runtime_dependency(%q<thor>, [">= 0"])
49
+ s.add_runtime_dependency(%q<octokit>, ["= 0.5.1"])
50
+ s.add_runtime_dependency(%q<highline>, [">= 0"])
51
+ s.add_development_dependency(%q<rspec>, ["~> 2.7.0"])
52
+ s.add_development_dependency(%q<yard>, ["~> 0.6.0"])
53
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
54
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
55
+ s.add_development_dependency(%q<rcov>, [">= 0"])
56
+ s.add_development_dependency(%q<reek>, ["~> 1.2.8"])
57
+ else
58
+ s.add_dependency(%q<thor>, [">= 0"])
59
+ s.add_dependency(%q<octokit>, ["= 0.5.1"])
60
+ s.add_dependency(%q<highline>, [">= 0"])
61
+ s.add_dependency(%q<rspec>, ["~> 2.7.0"])
62
+ s.add_dependency(%q<yard>, ["~> 0.6.0"])
63
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
64
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
65
+ s.add_dependency(%q<rcov>, [">= 0"])
66
+ s.add_dependency(%q<reek>, ["~> 1.2.8"])
67
+ end
68
+ else
69
+ s.add_dependency(%q<thor>, [">= 0"])
70
+ s.add_dependency(%q<octokit>, ["= 0.5.1"])
71
+ s.add_dependency(%q<highline>, [">= 0"])
72
+ s.add_dependency(%q<rspec>, ["~> 2.7.0"])
73
+ s.add_dependency(%q<yard>, ["~> 0.6.0"])
74
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
75
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
76
+ s.add_dependency(%q<rcov>, [">= 0"])
77
+ s.add_dependency(%q<reek>, ["~> 1.2.8"])
78
+ end
79
+ end
80
+
data/lib/commands.rb ADDED
@@ -0,0 +1,13 @@
1
+ #
2
+ # Command line wrappers
3
+ #
4
+ #
5
+ module Commands
6
+ def git(command)
7
+ `git #{command}`.chomp
8
+ end
9
+
10
+ def sh(command)
11
+ `#{command}`
12
+ end
13
+ end
data/lib/give.rb ADDED
@@ -0,0 +1,170 @@
1
+ #
2
+ # Give
3
+ #
4
+ # The aim of Give is to make contributing to open source projects on Github just that bit easier,
5
+ # by wrapping some simple commands around a common workflow.
6
+ #
7
+ ##
8
+ require 'commands'
9
+ require 'thor'
10
+ require 'octokit'
11
+ require 'highline/import'
12
+ module Give
13
+ #
14
+ # Give::CLI
15
+ #
16
+ # Command line interface provides the 4 commands,
17
+ # setup, start, update and finish
18
+ #
19
+ class CLI < Thor
20
+
21
+ desc "setup OWNER PROJECT", "Forks the project from the specified user/repo"
22
+ def setup(owner, project)
23
+ Give::Project.new(owner, project).fork
24
+ end
25
+
26
+ desc "start BRANCH", "Creates a new branch"
27
+ def start(branch)
28
+ Give::Repo.new(:branch => branch).checkout_branch
29
+ end
30
+
31
+ desc "update BRANCH", "Updates your master branch with upstream changes, then rebases your working branch"
32
+ def update(branch)
33
+ Give::Repo.new(:branch => branch).update
34
+ end
35
+
36
+ desc "finish OWNER PROJECT BRANCH", "Pushes up your working branch, then submits a pull request."
37
+ def finish(owner, project, branch)
38
+ local_repo = Give::Repo.new(:branch => branch)
39
+ local_repo.push
40
+ Give::Project.new(owner, project).send_pull_request(local_repo)
41
+ end
42
+
43
+ end
44
+
45
+ #
46
+ # Give::Project
47
+ #
48
+ # Wraps a remote repository
49
+ #
50
+ class Project
51
+ include Commands
52
+ attr_accessor :target_branch, :reference, :client, :user, :owner, :title
53
+ def initialize(owner, title, target_branch='master')
54
+ @owner, @title = owner, title
55
+ @target_branch = target_branch
56
+ @user = User.new
57
+ @client = Octokit::Client.new
58
+ end
59
+
60
+ def reference
61
+ @reference ||= [owner, title].join('/')
62
+ end
63
+
64
+ def fork
65
+ client.fork!(reference)
66
+ git("clone #{master}")
67
+ sh("cd #{title};git remote add upstream #{upstream}")
68
+ end
69
+
70
+ def send_pull_request(repo)
71
+ client.create_pull_request(reference, target_branch, head(repo),
72
+ request_title, request_body)
73
+ end
74
+
75
+ private
76
+
77
+ def head(repo)
78
+ [user.login, repo.branch].join(':')
79
+ end
80
+
81
+ def local_reference
82
+ [user.login, title].join('/')
83
+ end
84
+
85
+ def request_title
86
+ ask("Please enter a title - ")
87
+ end
88
+
89
+ def request_body
90
+ ask("Please enter a message - ")
91
+ end
92
+
93
+ def upstream
94
+ "git://github.com/#{reference}.git"
95
+ end
96
+
97
+ def master
98
+ "git@github.com:#{local_reference}.git"
99
+ end
100
+
101
+ end
102
+
103
+ #
104
+ # Give::User
105
+ #
106
+ # Essentially a github user,
107
+ # relies on username and token existing in gitconfig
108
+ # http://help.github.com/set-your-user-name-email-and-github-token/
109
+ #
110
+ class User
111
+ include Commands
112
+ attr_accessor :login, :token, :endpoint
113
+ def initialize(endpoint=github)
114
+ @login, @token, @endpoint = github_login, github_token, endpoint
115
+ configure
116
+ end
117
+
118
+ def configure
119
+ Octokit.configure do |conf|
120
+ conf.login = login
121
+ conf.token = token
122
+ conf.endpoint = endpoint
123
+ end
124
+ end
125
+
126
+ def github
127
+ "https://github.com"
128
+ end
129
+
130
+ def github_login
131
+ git('config --get-all github.user')
132
+ end
133
+
134
+ def github_token
135
+ git('config --get-all github.token')
136
+ end
137
+
138
+ end
139
+
140
+ #
141
+ # Give::Repo
142
+ #
143
+ # The local repository
144
+ #
145
+ #
146
+ class Repo
147
+ include Commands
148
+ attr_accessor :branch
149
+ def initialize(opts={})
150
+ @branch = opts.fetch(:branch, 'master')
151
+ end
152
+
153
+ def push
154
+ git("push origin #{branch}")
155
+ end
156
+
157
+ def update
158
+ git('fetch upstream')
159
+ git('checkout master')
160
+ git('pull upstream master')
161
+ git("checkout #{branch}")
162
+ git('rebase master')
163
+ end
164
+
165
+ def checkout_branch
166
+ git("checkout -b #{branch}")
167
+ end
168
+
169
+ end
170
+ end
data/spec/give_spec.rb ADDED
@@ -0,0 +1,203 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe Give::CLI do
4
+ let(:owner) { 'seenmyfate' }
5
+ let(:project) { 'give' }
6
+ let(:branch) { 'feaature/my_awesome_feature' }
7
+ let(:give) { Give::CLI.new }
8
+ let(:project) { stub }
9
+ let(:repo) { stub }
10
+
11
+ subject { Give::CLI.new }
12
+
13
+ context "#setup" do
14
+ it "sets up" do
15
+ Give::Project.should_receive(:new).with(owner, project).and_return(project)
16
+ project.should_receive(:fork)
17
+ subject.setup(owner, project)
18
+ end
19
+ end
20
+
21
+ context "#start" do
22
+ it "starts" do
23
+ Give::Repo.should_receive(:new).with(:branch => branch).and_return(repo)
24
+ repo.should_receive(:checkout_branch)
25
+ subject.start(branch)
26
+ end
27
+ end
28
+
29
+ context "#update" do
30
+ it "updates" do
31
+ Give::Repo.should_receive(:new).and_return(repo)
32
+ repo.should_receive(:update)
33
+ subject.update(branch)
34
+ end
35
+ end
36
+
37
+ context "#finish" do
38
+ it "finishes" do
39
+ Give::Repo.should_receive(:new).with(:branch => branch).and_return(repo)
40
+ repo.should_receive(:push)
41
+ Give::Project.should_receive(:new).with(owner, project).and_return(project)
42
+ project.should_receive(:send_pull_request)
43
+ subject.finish(owner, project, branch)
44
+ end
45
+ end
46
+ end
47
+
48
+ describe Give::Project do
49
+ let(:owner) { 'seenmyfate' }
50
+ let(:title) { 'give' }
51
+ let(:reference) { 'seenmyfate/give' }
52
+ let(:request_title) { 'awesome feature' }
53
+ let(:request_body) { 'is awesome' }
54
+ subject { Give::Project.new(owner, title) }
55
+
56
+ before do
57
+ Give::Project.any_instance.stub(:request_body).and_return request_body
58
+ Give::Project.any_instance.stub(:request_title).and_return request_title
59
+ end
60
+
61
+ context "#new" do
62
+
63
+ it "should have an owner" do
64
+ subject.owner.should eq owner
65
+ end
66
+
67
+ it "should have a title" do
68
+ subject.title.should eq title
69
+ end
70
+
71
+ it "should have a target branch" do
72
+ subject.target_branch.should eq 'master'
73
+ end
74
+
75
+ it "has a reference" do
76
+ subject.reference.should eq reference
77
+ end
78
+
79
+ it "should have a client" do
80
+ subject.client.should be_a Octokit::Client
81
+ end
82
+
83
+ it "should have a user" do
84
+ subject.user.should be_a Give::User
85
+ end
86
+
87
+ end
88
+
89
+ context "#fork" do
90
+
91
+ it "forks with octokit" do
92
+ subject.client.should_receive(:fork!).with(subject.reference)
93
+ subject.should_receive(:git).with('clone git@github.com:seenmyfate/give.git')
94
+ subject.should_receive(:sh).with('cd give;git remote add upstream git://github.com/seenmyfate/give.git')
95
+ subject.fork
96
+ end
97
+ end
98
+
99
+ context "#send_pull_request" do
100
+ let(:local_repo) { stub(:branch => 'my_awesome_feature') }
101
+ let(:title) { 'title' }
102
+ let(:body) { 'body' }
103
+ let(:local_ref) { 'seenmyfate:my_awesome_feature' }
104
+ let(:target_branch) { 'master' }
105
+
106
+ before do
107
+ subject.stub(:title).and_return(title)
108
+ subject.stub(:body).and_return(body)
109
+ end
110
+ it "sends a pull request with octokit" do
111
+ subject.client.should_receive(:create_pull_request).
112
+ with(subject.reference, target_branch, local_ref, request_title, request_body)
113
+
114
+ subject.send_pull_request(local_repo)
115
+ end
116
+ end
117
+ end
118
+
119
+
120
+ describe Give::User do
121
+ context "#new" do
122
+ let(:github_login) { 'user' }
123
+ let(:github_token) { 'supersecret' }
124
+ let(:endpoint) { 'https://github.com' }
125
+ subject { Give::User.new }
126
+
127
+ before do
128
+ Give::User.any_instance.stub(:github_login).and_return github_login
129
+ Give::User.any_instance.stub(:github_token).and_return github_token
130
+ end
131
+
132
+ it "should have a login" do
133
+ subject.login.should eq github_login
134
+ end
135
+
136
+ it "should have a token" do
137
+ subject.token.should eq github_token
138
+ end
139
+
140
+ it "should have an endpoint" do
141
+ subject.endpoint.should eq endpoint
142
+ end
143
+
144
+ it "should configure Octokit" do
145
+ Octokit.login.should eq github_login
146
+ Octokit.token.should eq github_token
147
+ Octokit.endpoint.should eq "https://github.com"
148
+ end
149
+ end
150
+ end
151
+
152
+ describe Give::Repo do
153
+
154
+ let(:branch) { 'feature/my_awesome_feature' }
155
+ context "#new" do
156
+
157
+ context "without a branch" do
158
+ subject { Give::Repo.new }
159
+
160
+ it "has master as the branch" do
161
+ subject.branch.should eq 'master'
162
+ end
163
+ end
164
+
165
+ context "with a branch" do
166
+ subject { Give::Repo.new(:branch => branch) }
167
+
168
+ it "has the branch" do
169
+ subject.branch.should eq branch
170
+ end
171
+ end
172
+
173
+ end
174
+
175
+ context "#update" do
176
+ subject { Give::Repo.new(:branch => branch) }
177
+
178
+ it "updates the branch" do
179
+ subject.should_receive(:git).with('fetch upstream')
180
+ subject.should_receive(:git).with('checkout master')
181
+ subject.should_receive(:git).with('pull upstream master')
182
+ subject.should_receive(:git).with("checkout #{branch}")
183
+ subject.should_receive(:git).with('rebase master')
184
+ subject.update
185
+ end
186
+ end
187
+
188
+ context "#branch" do
189
+ subject { Give::Repo.new(:branch => branch) }
190
+ it "creates a new branch" do
191
+ subject.should_receive(:git).with("checkout -b #{branch}")
192
+ subject.checkout_branch
193
+ end
194
+ end
195
+
196
+ context "#push" do
197
+ subject { Give::Repo.new(:branch => branch) }
198
+ it "creates a new branch" do
199
+ subject.should_receive(:git).with("push origin #{branch}")
200
+ subject.push
201
+ end
202
+ end
203
+ end
data/spec/reek_spec.rb ADDED
@@ -0,0 +1,8 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe Give do
4
+ it 'contains no code smells' do
5
+ pending "UtilityFunction Fail"
6
+ Dir['lib/*.rb'].should_not reek
7
+ end
8
+ end
@@ -0,0 +1,12 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'rspec'
4
+ require 'give'
5
+ require 'reek/spec'
6
+ # Requires supporting files with custom matchers and macros, etc,
7
+ # in ./support/ and its subdirectories.
8
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
9
+
10
+ RSpec.configure do |config|
11
+ config.include(Reek::Spec)
12
+ end
metadata ADDED
@@ -0,0 +1,167 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: give
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - seenmyfate
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-12-23 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: thor
16
+ requirement: &70223664224060 !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: *70223664224060
25
+ - !ruby/object:Gem::Dependency
26
+ name: octokit
27
+ requirement: &70223664222680 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - =
31
+ - !ruby/object:Gem::Version
32
+ version: 0.5.1
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70223664222680
36
+ - !ruby/object:Gem::Dependency
37
+ name: highline
38
+ requirement: &70223664221720 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *70223664221720
47
+ - !ruby/object:Gem::Dependency
48
+ name: rspec
49
+ requirement: &70223664218820 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 2.7.0
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *70223664218820
58
+ - !ruby/object:Gem::Dependency
59
+ name: yard
60
+ requirement: &70223664272340 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: 0.6.0
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *70223664272340
69
+ - !ruby/object:Gem::Dependency
70
+ name: bundler
71
+ requirement: &70223664266760 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ version: 1.0.0
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *70223664266760
80
+ - !ruby/object:Gem::Dependency
81
+ name: jeweler
82
+ requirement: &70223664296640 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ~>
86
+ - !ruby/object:Gem::Version
87
+ version: 1.6.4
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: *70223664296640
91
+ - !ruby/object:Gem::Dependency
92
+ name: rcov
93
+ requirement: &70223664348220 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ type: :development
100
+ prerelease: false
101
+ version_requirements: *70223664348220
102
+ - !ruby/object:Gem::Dependency
103
+ name: reek
104
+ requirement: &70223664346440 !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: 1.2.8
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: *70223664346440
113
+ description: The aim of Give is to make contributing to open source projects on Github
114
+ just that bit easier, by wrapping some simple commands around a common workflow.
115
+ email: seenmyfate@gmail.com
116
+ executables:
117
+ - give
118
+ extensions: []
119
+ extra_rdoc_files:
120
+ - LICENSE.txt
121
+ - README.md
122
+ files:
123
+ - .document
124
+ - .rspec
125
+ - .rvmrc
126
+ - Gemfile
127
+ - Gemfile.lock
128
+ - LICENSE.txt
129
+ - README.md
130
+ - Rakefile
131
+ - VERSION
132
+ - bin/give
133
+ - give.gemspec
134
+ - lib/commands.rb
135
+ - lib/give.rb
136
+ - spec/give_spec.rb
137
+ - spec/reek_spec.rb
138
+ - spec/spec_helper.rb
139
+ homepage: http://github.com/seenmyfate/give
140
+ licenses:
141
+ - MIT
142
+ post_install_message:
143
+ rdoc_options: []
144
+ require_paths:
145
+ - lib
146
+ required_ruby_version: !ruby/object:Gem::Requirement
147
+ none: false
148
+ requirements:
149
+ - - ! '>='
150
+ - !ruby/object:Gem::Version
151
+ version: '0'
152
+ segments:
153
+ - 0
154
+ hash: 3185771875769210881
155
+ required_rubygems_version: !ruby/object:Gem::Requirement
156
+ none: false
157
+ requirements:
158
+ - - ! '>='
159
+ - !ruby/object:Gem::Version
160
+ version: '0'
161
+ requirements: []
162
+ rubyforge_project:
163
+ rubygems_version: 1.8.10
164
+ signing_key:
165
+ specification_version: 3
166
+ summary: Makes contributing to open source projects on Github just that bit easier
167
+ test_files: []