shelltoad 0.4.4 → 0.4.5

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -5,10 +5,12 @@ gem "hoptoad-api"
5
5
 
6
6
  group :development do
7
7
  gem 'jeweler'
8
+ gem "ruby-debug"
8
9
  end
9
10
 
10
11
  group :test do
11
12
  gem 'rspec'
12
- gem 'fakeweb'
13
+ gem 'fakeweb', :require => 'fakeweb'
13
14
  gem "mocha"
15
+ gem "http_logger"
14
16
  end # do
@@ -1,6 +1,7 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
+ columnize (0.3.2)
4
5
  crack (0.1.8)
5
6
  diff-lcs (1.1.2)
6
7
  fakeweb (1.3.0)
@@ -9,12 +10,14 @@ GEM
9
10
  hoptoad-api (2.3.0)
10
11
  hashie (>= 0.2.0)
11
12
  httparty (>= 0.5.2)
13
+ http_logger (0.1.0)
12
14
  httparty (0.6.1)
13
15
  crack (= 0.1.8)
14
16
  jeweler (1.5.2)
15
17
  bundler (~> 1.0.0)
16
18
  git (>= 1.2.5)
17
19
  rake
20
+ linecache (0.43)
18
21
  mocha (0.9.12)
19
22
  rake (0.8.7)
20
23
  rspec (2.5.0)
@@ -25,6 +28,11 @@ GEM
25
28
  rspec-expectations (2.5.0)
26
29
  diff-lcs (~> 1.1.2)
27
30
  rspec-mocks (2.5.0)
31
+ ruby-debug (0.10.4)
32
+ columnize (>= 0.1)
33
+ ruby-debug-base (~> 0.10.4.0)
34
+ ruby-debug-base (0.10.4)
35
+ linecache (>= 0.3)
28
36
 
29
37
  PLATFORMS
30
38
  ruby
@@ -32,7 +40,9 @@ PLATFORMS
32
40
  DEPENDENCIES
33
41
  fakeweb
34
42
  hoptoad-api
43
+ http_logger
35
44
  jeweler
36
45
  mocha
37
46
  rake
38
47
  rspec
48
+ ruby-debug
data/Rakefile CHANGED
@@ -19,3 +19,6 @@ Jeweler::Tasks.new do |gemspec|
19
19
  gemspec.homepage = "http://github.com/railsware/shelltoad"
20
20
  gemspec.authors = ["Bogdan Gusiev"]
21
21
  end
22
+
23
+ task :default => :spec do
24
+ end
@@ -17,7 +17,8 @@ h3. Commands
17
17
  * errors, ers - list all unresolved errors, this is the default
18
18
  * error, er [number] - display information about given error. Shortcut: shelltoad [number]
19
19
  * resolve, rv [number] - mark error as resolved in Hoptoad
20
- * commit, ci [number] - do commit to vcs with the information on the specified error and mark error resolved in Hoptoad
20
+ * commit, ci [number] - do commit to git with the information on the specified error and mark error resolved in Hoptoad
21
+ ** -m, --message [MESSAGE] - adds aditional message to the one generated by shelltoad
21
22
  * open, op [number] - open error page in browser
22
23
 
23
24
  Shelltoad supports 'magicfind' in all commands:
@@ -46,7 +47,7 @@ ActiveRecord::StatementInvalid: PGError: ERROR: duplicate key value violates uni
46
47
  # Do changes you want
47
48
  $ git add .
48
49
  #only git is supported right now
49
- $ shelltoad commit 713
50
+ $ shelltoad commit -m "Fixed concurrent db queries problem for company_relations table" 713
50
51
  [dev 47f09ec] http://xxx.hoptoadapp.com//errors/4023713
51
52
  1 files changed, 1 insertions(+), 1 deletions(-)</code></pre>
52
53
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.4
1
+ 0.4.5
@@ -21,7 +21,7 @@ class Shelltoad
21
21
  output error.view
22
22
  end
23
23
  when "commit", "ci"
24
- commit(args.shift)
24
+ commit(*args)
25
25
  when "resolve", "rv"
26
26
  magic_find(args.shift) do |error|
27
27
  error.resolve!
@@ -57,9 +57,20 @@ class Shelltoad
57
57
  Shelltoad.output(*args)
58
58
  end
59
59
 
60
- def commit(id)
61
- magic_find(id) do |error|
62
- output error.commit!
60
+ def commit(*args)
61
+ opts = OptionParser.new do |opts|
62
+ opts.banner = "Do git commit with information from pivotal story"
63
+ opts.on("-m [MESSAGE]", "Add addional MESSAGE to comit") do |message|
64
+ @message = message
65
+ end
66
+ end
67
+ opts.parse!(args)
68
+
69
+ unless self.changes_staged?
70
+ raise Shelltoad::BaseException, "No changes staged with git."
71
+ end
72
+ magic_find(args.shift) do |error|
73
+ output error.commit!(@message)
63
74
  end
64
75
  end # commit(id, args)
65
76
 
@@ -71,6 +82,10 @@ class Shelltoad
71
82
  end
72
83
  end
73
84
 
85
+ def changes_staged?
86
+ !`git diff --staged`.empty?
87
+ end
88
+
74
89
  def display_help
75
90
  output <<-EOI
76
91
  Usage: shelltoad command [<args>]
@@ -59,6 +59,7 @@ class Shelltoad
59
59
  URI.parse("#{Configuration.secure? ? "https" : "http"}://#{Configuration.account}.hoptoadapp.com")
60
60
  end
61
61
 
62
+
62
63
  #
63
64
  # API
64
65
  #
@@ -84,12 +85,21 @@ class Shelltoad
84
85
  EOI
85
86
  end
86
87
 
87
- def commit!
88
- message = <<-EOI.gsub(/`/, "'")
89
- #{url.to_s}
90
88
 
91
- #{self.error_message}
92
- EOI
89
+ def commit!(custom_message)
90
+
91
+ message = ""
92
+ unless custom_message.nil? || custom_message.strip.empty?
93
+ message << custom_message + "\n"
94
+ message << "\n"
95
+ end
96
+ message << url.to_s + "\n"
97
+ if custom_message.nil? || custom_message.strip.empty?
98
+ message << "\n"
99
+ end
100
+ message << self.error_message + "\n"
101
+ message.gsub!(/`/, "'")
102
+
93
103
  output = `git commit -m "#{message}"`
94
104
  if $?.success?
95
105
  resolve!
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{shelltoad}
8
- s.version = "0.4.4"
8
+ s.version = "0.4.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Bogdan Gusiev"]
12
- s.date = %q{2011-04-28}
12
+ s.date = %q{2011-05-31}
13
13
  s.default_executable = %q{shelltoad}
14
14
  s.description = %q{
15
15
  }
@@ -53,15 +53,18 @@ Gem::Specification.new do |s|
53
53
  s.add_runtime_dependency(%q<rake>, [">= 0"])
54
54
  s.add_runtime_dependency(%q<hoptoad-api>, [">= 0"])
55
55
  s.add_development_dependency(%q<jeweler>, [">= 0"])
56
+ s.add_development_dependency(%q<ruby-debug>, [">= 0"])
56
57
  else
57
58
  s.add_dependency(%q<rake>, [">= 0"])
58
59
  s.add_dependency(%q<hoptoad-api>, [">= 0"])
59
60
  s.add_dependency(%q<jeweler>, [">= 0"])
61
+ s.add_dependency(%q<ruby-debug>, [">= 0"])
60
62
  end
61
63
  else
62
64
  s.add_dependency(%q<rake>, [">= 0"])
63
65
  s.add_dependency(%q<hoptoad-api>, [">= 0"])
64
66
  s.add_dependency(%q<jeweler>, [">= 0"])
67
+ s.add_dependency(%q<ruby-debug>, [">= 0"])
65
68
  end
66
69
  end
67
70
 
@@ -11,7 +11,7 @@ describe Shelltoad do
11
11
  subject { Shelltoad.run(*args) }
12
12
 
13
13
 
14
- [["error", TEST_ERROR], "errors", ["commit", TEST_ERROR], ["resolve", TEST_ERROR]].each do |command|
14
+ [["error", TEST_ERROR], "errors", ["resolve", TEST_ERROR]].each do |command|
15
15
  describe "command:#{command.inspect}" do
16
16
  let(:args) { Array(command) }
17
17
  it { should == 0 }
@@ -25,13 +25,35 @@ describe Shelltoad do
25
25
  Shelltoad::Configuration.stubs(:browser).returns("true")
26
26
  end
27
27
  it {should == 0}
28
-
28
+
29
29
  end
30
30
 
31
31
  describe "help commad" do
32
32
  let(:args) { "help" }
33
33
  it {should == 0}
34
34
  end
35
+
36
+ describe "commit command" do
37
+ subject { Shelltoad.run("commit", TEST_ERROR, *_args) }
38
+ before(:each) do
39
+ Shelltoad::Command.stubs(:changes_staged?).returns(_staged)
40
+ end
41
+
42
+ let(:_staged) { true }
43
+ let(:_args) { [] }
44
+ it { should == 0 }
45
+
46
+ context "when no changes staged in git" do
47
+ let(:_staged) { false }
48
+ it { should == 1 }
49
+ end
50
+
51
+ context "when -m argument specified" do
52
+ let(:_args) { ["-m", "My commit"]}
53
+ it {should == 0}
54
+ end
55
+
56
+ end
35
57
  end
36
58
 
37
59
  end
@@ -5,9 +5,29 @@ require "net/http"
5
5
  require 'rspec'
6
6
  require "mocha"
7
7
  require "fakeweb"
8
+ require "http_logger"
9
+
10
+
11
+ unless File.exists?(".shelltoadrc")
12
+ f = File.new(".shelltoadrc", "w")
13
+ f << YAML.dump(
14
+ "project" => "startdatelabs",
15
+ "key" => "123456",
16
+ "secure" => true
17
+ )
18
+ f.close
19
+
20
+ end
21
+
22
+
8
23
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__),'..','lib'))
9
24
  require "shelltoad"
10
25
 
26
+ require "fileutils"
27
+ require "logger"
28
+
29
+ FileUtils.rm_f("http.log")
30
+ Net::HTTP.logger = Logger.new("http.log")
11
31
 
12
32
  TEST_ERROR = 4040123
13
33
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shelltoad
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 4
10
- version: 0.4.4
9
+ - 5
10
+ version: 0.4.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Bogdan Gusiev
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-28 00:00:00 +03:00
18
+ date: 2011-05-31 00:00:00 +03:00
19
19
  default_executable: shelltoad
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -60,6 +60,20 @@ dependencies:
60
60
  version: "0"
61
61
  requirement: *id003
62
62
  type: :development
63
+ - !ruby/object:Gem::Dependency
64
+ prerelease: false
65
+ name: ruby-debug
66
+ version_requirements: &id004 !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ hash: 3
72
+ segments:
73
+ - 0
74
+ version: "0"
75
+ requirement: *id004
76
+ type: :development
63
77
  description: |
64
78
 
65
79