andhapp-decoct 1.4.4 → 1.5.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -1,29 +1,62 @@
1
- # Decoct: Quick start Sinatra with Rspec
1
+ Decoct: Quick start Sinatra with Rspec
2
+ =====================================
2
3
 
3
4
  Decoct is a simple gem that creates a sinatra app directory structure and hooks it up with Rspec.
4
5
 
5
- ## Installing
6
+ Installing
7
+ ---------
6
8
 
7
- # Install the gem:
8
- gem install andhapp-decoct -s http://gems.github.com (on Windows)
9
+ Install the gem: gem install andhapp-decoct -s http://gems.github.com (on Windows)
9
10
 
10
- ## Caveat
11
-
12
- The gem has only been tested on Windows and the reason that could be a problem is because it depends upon other
13
- gems to work properly. I have a workaround in my mind but it has not been implemented as yet.
11
+ Caveat
12
+ -------
14
13
 
15
- ## Dependencies
16
-
17
- The gem depends on the following libraries:
18
- * rspec
19
- * ZenTest
20
- * ruby-snarl
21
- * redgreen
22
- * rcov
14
+ The gem has only been tested on Windows and the reason that could be a problem is because it depends upon other
15
+ gems to work properly. I have a workaround in my mind but it has not been implemented as yet.
23
16
 
24
- Also, in order to use ruby-snarl you should have [Snarl](http://www.fullphat.net/index.php) installed on
25
- your machine.
26
- Snarl is a messaging system for windows. This would give you nice visual messages on the status of your tests.
27
- [Here's](http://thewebfellas.com/blog/2007/12/10/rspec-autotest-and-snarl-on-windows) a nice article if you
28
- would like to incorporate that into rails projects. Hence, the caveat above.
29
17
 
18
+ Dependencies
19
+ -----------
20
+
21
+ The gem depends on the following libraries:
22
+
23
+ * rspec
24
+ * ZenTest
25
+ * ruby-snarl
26
+ * redgreen
27
+ * rcov
28
+
29
+ Also, in order to use ruby-snarl you should have [Snarl][snarl] installed on
30
+ your machine.
31
+ Snarl is a messaging system for windows. This would give you nice visual messages on the status of your tests.
32
+ [Here's][here] a nice article if you
33
+ would like to incorporate that into rails projects. Hence, the caveat above.
34
+
35
+
36
+ Usage
37
+ ----
38
+
39
+ Assuming that you have installed the gem. Use the command line and go to the directory where you would like to create
40
+ the new project and run the following command:
41
+
42
+ decoct {project-name}
43
+
44
+ This would create a sinatra project with all the rspec dependencies. If a directory with the same name exists it will
45
+ overwrite it. Just go into the directory on your command line and run the following command:
46
+
47
+ set RSPEC=true autotest
48
+
49
+ and finally run the following command:
50
+
51
+ autotest
52
+
53
+
54
+ Issues
55
+ -----
56
+
57
+ I have spotted one existing issue with it and it is documented here:
58
+ [Decoct - Issue1][issue].
59
+
60
+ [snarl]: http://www.fullphat.net/index.php
61
+ [here]: http://thewebfellas.com/blog/2007/12/10/rspec-autotest-and-snarl-on-windows
62
+ [issue]: http://github.com/andhapp/decoct/issues
data/Rakefile CHANGED
@@ -6,18 +6,17 @@ begin
6
6
  require 'jeweler'
7
7
  Jeweler::Tasks.new do |gem|
8
8
  gem.name = "decoct"
9
- gem.summary = "Its a simple gem which creates a project structure for sinatra to work with rspec, ZenTest, Snarl(on Windows), RedGreen, Rcov"
9
+ gem.summary = "Its a simple gem which creates a project structure for sinatra to work with rspec, ZenTest, Growl, RedGreen, Rcov"
10
10
  gem.email = "anuj@andhapp.com"
11
11
  gem.homepage = "http://github.com/andhapp/decoct"
12
12
  gem.description = "Sinatra Rspec project generator"
13
13
  gem.authors = ["Anuj Dutta"]
14
- gem.files.include %w(lib/templates/.autotest)
14
+ gem.files.include %w(lib/icons/*.*)
15
15
  gem.add_dependency 'rspec'
16
16
  gem.add_dependency 'ZenTest'
17
- gem.add_dependency 'ruby-snarl'
17
+ gem.add_dependency 'growl'
18
18
  gem.add_dependency 'redgreen'
19
19
  gem.add_dependency 'rcov'
20
- gem.add_dependency 'win32console'
21
20
  end
22
21
  rescue LoadError
23
22
  puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :patch: 4
3
3
  :major: 1
4
- :minor: 4
4
+ :minor: 5
data/decoct.gemspec CHANGED
@@ -1,71 +1,69 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- Gem::Specification.new do |s|
4
- s.name = %q{decoct}
5
- s.version = "1.4.4"
6
-
7
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
- s.authors = ["Anuj Dutta"]
9
- s.date = %q{2009-05-04}
10
- s.default_executable = %q{decoct}
11
- s.description = %q{Sinatra Rspec project generator}
12
- s.email = %q{anuj@andhapp.com}
13
- s.executables = ["decoct"]
14
- s.extra_rdoc_files = [
15
- "README.markdown"
16
- ]
17
- s.files = [
18
- "README.markdown",
19
- "Rakefile",
20
- "VERSION.yml",
21
- "bin/decoct",
22
- "decoct.gemspec",
23
- "lib/dconstants.rb",
24
- "lib/dmeta.rb",
25
- "lib/dscript.rb",
26
- "lib/templates/.autotest",
27
- "lib/templates/generic_app.rb",
28
- "lib/templates/spec/app_spec.rb",
29
- "lib/templates/spec/rcov.opts",
30
- "lib/templates/spec/spec.opts",
31
- "lib/templates/spec/spec_helper.rb",
32
- "test/ts_script.rb"
33
- ]
34
- s.has_rdoc = true
35
- s.homepage = %q{http://github.com/andhapp/decoct}
36
- s.rdoc_options = ["--charset=UTF-8"]
37
- s.require_paths = ["lib"]
38
- s.rubygems_version = %q{1.3.1}
39
- s.summary = %q{Its a simple gem which creates a project structure for sinatra to work with rspec, ZenTest, Snarl(on Windows), RedGreen, Rcov}
40
- s.test_files = [
41
- "test/ts_script.rb"
42
- ]
43
-
44
- if s.respond_to? :specification_version then
45
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
46
- s.specification_version = 2
47
-
48
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
49
- s.add_runtime_dependency(%q<rspec>, [">= 0"])
50
- s.add_runtime_dependency(%q<ZenTest>, [">= 0"])
51
- s.add_runtime_dependency(%q<ruby-snarl>, [">= 0"])
52
- s.add_runtime_dependency(%q<redgreen>, [">= 0"])
53
- s.add_runtime_dependency(%q<rcov>, [">= 0"])
54
- s.add_runtime_dependency(%q<win32console>, [">= 0"])
55
- else
56
- s.add_dependency(%q<rspec>, [">= 0"])
57
- s.add_dependency(%q<ZenTest>, [">= 0"])
58
- s.add_dependency(%q<ruby-snarl>, [">= 0"])
59
- s.add_dependency(%q<redgreen>, [">= 0"])
60
- s.add_dependency(%q<rcov>, [">= 0"])
61
- s.add_dependency(%q<win32console>, [">= 0"])
62
- end
63
- else
64
- s.add_dependency(%q<rspec>, [">= 0"])
65
- s.add_dependency(%q<ZenTest>, [">= 0"])
66
- s.add_dependency(%q<ruby-snarl>, [">= 0"])
67
- s.add_dependency(%q<redgreen>, [">= 0"])
68
- s.add_dependency(%q<rcov>, [">= 0"])
69
- s.add_dependency(%q<win32console>, [">= 0"])
70
- end
71
- end
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{decoct}
5
+ s.version = "1.5.4"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Anuj Dutta"]
9
+ s.date = %q{2009-07-05}
10
+ s.default_executable = %q{decoct}
11
+ s.description = %q{Sinatra Rspec project generator}
12
+ s.email = %q{anuj@andhapp.com}
13
+ s.executables = ["decoct"]
14
+ s.extra_rdoc_files = [
15
+ "README.markdown"
16
+ ]
17
+ s.files = [
18
+ "README.markdown",
19
+ "Rakefile",
20
+ "VERSION.yml",
21
+ "bin/decoct",
22
+ "decoct.gemspec",
23
+ "lib/dconstants.rb",
24
+ "lib/dmeta.rb",
25
+ "lib/dscript.rb",
26
+ "lib/templates/.autotest",
27
+ "lib/templates/generic_app.rb",
28
+ "lib/templates/icons/fail.png",
29
+ "lib/templates/icons/ok.png",
30
+ "lib/templates/spec/app_spec.rb",
31
+ "lib/templates/spec/rcov.opts",
32
+ "lib/templates/spec/spec.opts",
33
+ "lib/templates/spec/spec_helper.rb",
34
+ "test/ts_script.rb"
35
+ ]
36
+ s.homepage = %q{http://github.com/andhapp/decoct}
37
+ s.rdoc_options = ["--charset=UTF-8"]
38
+ s.require_paths = ["lib"]
39
+ s.rubygems_version = %q{1.3.4}
40
+ s.summary = %q{Its a simple gem which creates a project structure for sinatra to work with rspec, ZenTest, Growl, RedGreen, Rcov}
41
+ s.test_files = [
42
+ "test/ts_script.rb"
43
+ ]
44
+
45
+ if s.respond_to? :specification_version then
46
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
47
+ s.specification_version = 3
48
+
49
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
50
+ s.add_runtime_dependency(%q<rspec>, [">= 0"])
51
+ s.add_runtime_dependency(%q<ZenTest>, [">= 0"])
52
+ s.add_runtime_dependency(%q<growl>, [">= 0"])
53
+ s.add_runtime_dependency(%q<redgreen>, [">= 0"])
54
+ s.add_runtime_dependency(%q<rcov>, [">= 0"])
55
+ else
56
+ s.add_dependency(%q<rspec>, [">= 0"])
57
+ s.add_dependency(%q<ZenTest>, [">= 0"])
58
+ s.add_dependency(%q<growl>, [">= 0"])
59
+ s.add_dependency(%q<redgreen>, [">= 0"])
60
+ s.add_dependency(%q<rcov>, [">= 0"])
61
+ end
62
+ else
63
+ s.add_dependency(%q<rspec>, [">= 0"])
64
+ s.add_dependency(%q<ZenTest>, [">= 0"])
65
+ s.add_dependency(%q<growl>, [">= 0"])
66
+ s.add_dependency(%q<redgreen>, [">= 0"])
67
+ s.add_dependency(%q<rcov>, [">= 0"])
68
+ end
69
+ end
data/lib/dscript.rb CHANGED
@@ -8,7 +8,7 @@ module Decoct
8
8
 
9
9
  attr_accessor :app_name
10
10
 
11
- create_dir [:lib, :spec, :views, :public]
11
+ create_dir [:lib, :spec, :views, :public, :icons]
12
12
 
13
13
  def initialize(app_name)
14
14
  fail "app name cannot be nil or empty!!!" if app_name.eql?(nil) || app_name.empty?
@@ -21,9 +21,11 @@ module Decoct
21
21
  create_spec
22
22
  create_views
23
23
  create_public
24
+ create_icons
24
25
  copy_autotest_file
25
26
  copy_rspec_files
26
27
  copy_app_file
28
+ copy_icons
27
29
  end
28
30
 
29
31
  def create_app_dir
@@ -33,7 +35,7 @@ module Decoct
33
35
  def copy_autotest_file
34
36
  copy_file(".autotest", "#{app_name}#{File::SEPARATOR}.autotest")
35
37
  end
36
-
38
+
37
39
  def copy_rspec_files
38
40
  from = ["spec#{File::SEPARATOR}spec.opts", "spec#{File::SEPARATOR}rcov.opts", "spec#{File::SEPARATOR}spec_helper.rb", "spec#{File::SEPARATOR}app_spec.rb"]
39
41
  to = ["#{app_name}#{File::SEPARATOR}spec#{File::SEPARATOR}spec.opts", "#{app_name}#{File::SEPARATOR}spec#{File::SEPARATOR}rcov.opts", "#{app_name}#{File::SEPARATOR}spec#{File::SEPARATOR}spec_helper.rb", "#{app_name}#{File::SEPARATOR}spec#{File::SEPARATOR}#{app_name}_spec.rb"]
@@ -44,6 +46,12 @@ module Decoct
44
46
  copy_file("generic_app.rb", "#{app_name}#{File::SEPARATOR}#{app_name}.rb")
45
47
  end
46
48
 
49
+ def copy_icons
50
+ from = ["icons#{File::SEPARATOR}fail.png", "icons#{File::SEPARATOR}ok.png"]
51
+ to = [ "#{app_name}#{File::SEPARATOR}icons#{File::SEPARATOR}fail.png", "#{app_name}#{File::SEPARATOR}icons#{File::SEPARATOR}ok.png"]
52
+ copy_file(from, to)
53
+ end
54
+
47
55
  end
48
56
 
49
57
  end
@@ -1,2 +1,16 @@
1
- require 'autotest/redgreen'
2
- require 'autotest/snarl'
1
+ module Autotest::Growl
2
+ def self.growl title, msg, img, pri=0, stick=""
3
+ system "growlnotify -n autotest --image #{img} -p #{pri} -m #{msg.inspect} #{title} #{stick}"
4
+ end
5
+
6
+ Autotest.add_hook :ran_command do |at|
7
+ puts "at: '#{at.results}'"
8
+ output = at.results.slice(/(\d+)\s.*specifications?,\s(\d+)\s.*failures?/)
9
+ puts "out: #{output}"
10
+ if output =~ /[1-9]\sfailures?/
11
+ growl "Test Results", "#{output}", '../icons/fail.png', 2 #, "-s"
12
+ else
13
+ growl "Test Results", "#{output}", '../icons/ok.png'
14
+ end
15
+ end
16
+ end
Binary file
Binary file
data/test/ts_script.rb CHANGED
@@ -1,4 +1,4 @@
1
- %w(test/unit redgreen shoulda rr fileutils).each{|x| require x}
1
+ %w(rubygems redgreen test/unit shoulda fileutils).each{|x| require x}
2
2
  require File.join(File.dirname(__FILE__), "..", 'lib', 'dscript')
3
3
 
4
4
  class TestScript < Test::Unit::TestCase
@@ -54,7 +54,14 @@ class TestScript < Test::Unit::TestCase
54
54
  @script.copy_app_file
55
55
  assert File.exists?("#{@app_name}#{File::SEPARATOR}#{@app_name}.rb")
56
56
  end
57
-
57
+
58
+ should 'copy the icons' do
59
+ @script.create_icons
60
+ @script.copy_icons
61
+ assert File.exists?("#{@app_name}#{File::SEPARATOR}icons#{File::SEPARATOR}fail.png")
62
+ assert File.exists?("#{@app_name}#{File::SEPARATOR}icons#{File::SEPARATOR}ok.png")
63
+ end
64
+
58
65
  teardown do
59
66
  FileUtils.rmtree @app_name
60
67
  end
@@ -63,11 +70,11 @@ class TestScript < Test::Unit::TestCase
63
70
 
64
71
  context "raise exception when app name is nil or empty" do
65
72
 
66
- should 'raise an error if there is no app_name is empty' do
73
+ should 'raise an error if there is app_name is empty' do
67
74
  assert_raises(RuntimeError) {Decoct::Dscript.new('')}
68
75
  end
69
76
 
70
- should 'raise an error if there is no app_name is nil' do
77
+ should 'raise an error if there is app_name is nil' do
71
78
  assert_raises(RuntimeError) {Decoct::Dscript.new(nil)}
72
79
  end
73
80
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: andhapp-decoct
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.4
4
+ version: 1.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anuj Dutta
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-04 00:00:00 -07:00
12
+ date: 2009-07-05 00:00:00 -07:00
13
13
  default_executable: decoct
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: "0"
34
34
  version:
35
35
  - !ruby/object:Gem::Dependency
36
- name: ruby-snarl
36
+ name: growl
37
37
  type: :runtime
38
38
  version_requirement:
39
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -62,16 +62,6 @@ dependencies:
62
62
  - !ruby/object:Gem::Version
63
63
  version: "0"
64
64
  version:
65
- - !ruby/object:Gem::Dependency
66
- name: win32console
67
- type: :runtime
68
- version_requirement:
69
- version_requirements: !ruby/object:Gem::Requirement
70
- requirements:
71
- - - ">="
72
- - !ruby/object:Gem::Version
73
- version: "0"
74
- version:
75
65
  description: Sinatra Rspec project generator
76
66
  email: anuj@andhapp.com
77
67
  executables:
@@ -91,12 +81,14 @@ files:
91
81
  - lib/dscript.rb
92
82
  - lib/templates/.autotest
93
83
  - lib/templates/generic_app.rb
84
+ - lib/templates/icons/fail.png
85
+ - lib/templates/icons/ok.png
94
86
  - lib/templates/spec/app_spec.rb
95
87
  - lib/templates/spec/rcov.opts
96
88
  - lib/templates/spec/spec.opts
97
89
  - lib/templates/spec/spec_helper.rb
98
90
  - test/ts_script.rb
99
- has_rdoc: true
91
+ has_rdoc: false
100
92
  homepage: http://github.com/andhapp/decoct
101
93
  post_install_message:
102
94
  rdoc_options:
@@ -120,7 +112,7 @@ requirements: []
120
112
  rubyforge_project:
121
113
  rubygems_version: 1.2.0
122
114
  signing_key:
123
- specification_version: 2
124
- summary: Its a simple gem which creates a project structure for sinatra to work with rspec, ZenTest, Snarl(on Windows), RedGreen, Rcov
115
+ specification_version: 3
116
+ summary: Its a simple gem which creates a project structure for sinatra to work with rspec, ZenTest, Growl, RedGreen, Rcov
125
117
  test_files:
126
118
  - test/ts_script.rb