andhapp-decoct 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -0,0 +1,25 @@
1
+ # Decoct: Quick start Sinatra with Rspec
2
+
3
+ Decoct is a simple gem that creates a sinatra app directory structure and hooks it up with Rspec.
4
+
5
+ ## Installing
6
+
7
+ # Install the gem:
8
+ gem install andhapp-decoct -s http://gems.github.com (on Windows)
9
+
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 gems to work properly. I have a workaround in my mind but it has not been implemented as yet.
13
+
14
+
15
+ ## Dependencies
16
+
17
+ The gem depends on the following libraries:
18
+ * rspec
19
+ * ZenTest
20
+ * ruby-snarl
21
+ * redgreen
22
+ * rcov
23
+
24
+ Also, in order to use ruby-snarl you should have [Snarl][http://www.fullphat.net/index.php] installed on your machine. Snarl is a messaging system for windows. This would give you nice visual messages on the status of your tests. [Here's][http://thewebfellas.com/blog/2007/12/10/rspec-autotest-and-snarl-on-windows] a nice article if you would like to incorporate that into rails projects. Hence, the caveat above.
25
+
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :patch: 0
3
3
  :major: 1
4
- :minor: 1
4
+ :minor: 2
data/decoct.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{decoct}
5
- s.version = "1.1.0"
5
+ s.version = "1.2.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Anuj Dutta"]
@@ -27,10 +27,6 @@ Gem::Specification.new do |s|
27
27
  "lib/templates/spec/rcov.opts",
28
28
  "lib/templates/spec/spec.opts",
29
29
  "lib/templates/spec/spec_helper.rb",
30
- "test/templates/generic_app.rb",
31
- "test/templates/spec/rcov.opts",
32
- "test/templates/spec/spec.opts",
33
- "test/templates/spec/spec_helper.rb",
34
30
  "test/ts_script.rb"
35
31
  ]
36
32
  s.has_rdoc = true
@@ -40,8 +36,6 @@ Gem::Specification.new do |s|
40
36
  s.rubygems_version = %q{1.3.1}
41
37
  s.summary = %q{Its a simple gem which creates a project structure for sinatra to work with rspec, ZenTest, Snarl(on Windows), RedGreen, Rcov}
42
38
  s.test_files = [
43
- "test/templates/generic_app.rb",
44
- "test/templates/spec/spec_helper.rb",
45
39
  "test/ts_script.rb"
46
40
  ]
47
41
 
data/lib/dconstants.rb CHANGED
@@ -1,8 +1,9 @@
1
- module Dedoct
1
+ module Decoct
2
2
  module Dconstants
3
3
  LIB = 'lib'
4
4
  VIEWS = 'views'
5
5
  SPEC = 'spec'
6
6
  PUBLIC = 'public'
7
+ TEMPLATES = File.dirname(__FILE__) + "/../lib/templates/"
7
8
  end
8
9
  end
data/lib/dscript.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  require 'ftools'
2
2
  require File.dirname(__FILE__) + '/../lib/dconstants'
3
3
 
4
- module Dedoct
4
+ module Decoct
5
5
 
6
- include Dedoct::Dconstants
6
+ include Decoct::Dconstants
7
7
 
8
8
  # move the creation into a module and just include that module
9
9
  class Dscript
@@ -43,17 +43,17 @@ module Dedoct
43
43
  end
44
44
 
45
45
  def copy_autotest_file
46
- copy_file("templates/.autotest", "#{app_name}/.autotest")
46
+ copy_file(".autotest", "#{app_name}/.autotest")
47
47
  end
48
48
 
49
49
  def copy_rspec_files
50
- copy_file("templates/spec/spec.opts", "#{app_name}/spec/spec.opts")
51
- copy_file("templates/spec/rcov.opts", "#{app_name}/spec/rcov.opts")
52
- copy_file("templates/spec/spec_helper.rb", "#{app_name}/spec/spec_helper.rb")
50
+ copy_file("spec/spec.opts", "#{app_name}/spec/spec.opts")
51
+ copy_file("spec/rcov.opts", "#{app_name}/spec/rcov.opts")
52
+ copy_file("spec/spec_helper.rb", "#{app_name}/spec/spec_helper.rb")
53
53
  end
54
54
 
55
55
  def create_app_file
56
- copy_file("templates/generic_app.rb", "#{app_name}/#{app_name}.rb")
56
+ copy_file("generic_app.rb", "#{app_name}/#{app_name}.rb")
57
57
  end
58
58
 
59
59
  def create_app_dir
@@ -63,13 +63,15 @@ module Dedoct
63
63
  private
64
64
 
65
65
  def create_dir(value = '')
66
- Dir.mkdir("#{app_name}/#{value}")
66
+ path = "#{app_name}/#{value}"
67
+ Dir.mkdir(path) if !test(?d, path)
67
68
  end
68
69
 
69
70
  def copy_file(from, to)
70
- File.copy(from, to)
71
+ File.copy(Dconstants::TEMPLATES + from, to)
71
72
  end
72
73
 
73
74
  end
74
75
 
75
76
  end
77
+
data/test/ts_script.rb CHANGED
@@ -6,9 +6,9 @@ class TestScript < Test::Unit::TestCase
6
6
  Dir.entries("epoxys").each {|x| [] << x if !File.directory?(x)}
7
7
  end
8
8
 
9
- context "creating sinatra app with rspec" do
9
+ context "creating a brand new sinatra-rspec app" do
10
10
  setup do
11
- @script = Dedoct::Dscript.new('epoxys')
11
+ @script = Decoct::Dscript.new('epoxys')
12
12
  @app_name = @script.app_name
13
13
  @script.create_app_dir
14
14
  end
@@ -75,13 +75,13 @@ class TestScript < Test::Unit::TestCase
75
75
  context "raise exception when app name is nil or empty" do
76
76
 
77
77
  should 'raise an error if there is no app_name is empty' do
78
- assert_raises(RuntimeError) {@script = Dedoct::Dscript.new('')}
78
+ assert_raises(RuntimeError) {Decoct::Dscript.new('')}
79
79
  end
80
80
 
81
81
  should 'raise an error if there is no app_name is nil' do
82
- assert_raises(RuntimeError) {@script = Dedoct::Dscript.new(nil)}
82
+ assert_raises(RuntimeError) {Decoct::Dscript.new(nil)}
83
83
  end
84
84
 
85
85
  end
86
-
86
+
87
87
  end
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.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anuj Dutta
@@ -83,10 +83,6 @@ files:
83
83
  - lib/templates/spec/rcov.opts
84
84
  - lib/templates/spec/spec.opts
85
85
  - lib/templates/spec/spec_helper.rb
86
- - test/templates/generic_app.rb
87
- - test/templates/spec/rcov.opts
88
- - test/templates/spec/spec.opts
89
- - test/templates/spec/spec_helper.rb
90
86
  - test/ts_script.rb
91
87
  has_rdoc: true
92
88
  homepage: http://github.com/andhapp/decoct
@@ -115,6 +111,4 @@ signing_key:
115
111
  specification_version: 2
116
112
  summary: Its a simple gem which creates a project structure for sinatra to work with rspec, ZenTest, Snarl(on Windows), RedGreen, Rcov
117
113
  test_files:
118
- - test/templates/generic_app.rb
119
- - test/templates/spec/spec_helper.rb
120
114
  - test/ts_script.rb
@@ -1,7 +0,0 @@
1
- $LOAD_PATH.unshift File.dirname(__FILE__) + '/../sinatra/lib'
2
-
3
- %w{rubygems sinatra}.each {|x| require x}
4
-
5
- get '/' do
6
- 'Congratulations!!! You have successfully installed decoct.'
7
- end
@@ -1,2 +0,0 @@
1
- --exclude "spec/*,gems/*"
2
- --rails
@@ -1,4 +0,0 @@
1
- --colour
2
- --format progress
3
- --loadby mtime
4
- --reverse
@@ -1,38 +0,0 @@
1
- # This file is copied to ~/spec when you run 'ruby script/generate rspec'
2
- # from the project root directory.
3
- require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
4
- require 'spec/autorun'
5
-
6
- Spec::Runner.configure do |config|
7
- # == Fixtures
8
- #
9
- # You can declare fixtures for each example_group like this:
10
- # describe "...." do
11
- # fixtures :table_a, :table_b
12
- #
13
- # Alternatively, if you prefer to declare them only once, you can
14
- # do so right here. Just uncomment the next line and replace the fixture
15
- # names with your fixtures.
16
- #
17
- # config.global_fixtures = :table_a, :table_b
18
- #
19
- # If you declare global fixtures, be aware that they will be declared
20
- # for all of your examples, even those that don't use them.
21
- #
22
- # You can also declare which fixtures to use (for example fixtures for test/fixtures):
23
- #
24
- # config.fixture_path = RAILS_ROOT + '/spec/fixtures/'
25
- #
26
- # == Mock Framework
27
- #
28
- # RSpec uses it's own mocking framework by default. If you prefer to
29
- # use mocha, flexmock or RR, uncomment the appropriate line:
30
- #
31
- # config.mock_with :mocha
32
- # config.mock_with :flexmock
33
- # config.mock_with :rr
34
- #
35
- # == Notes
36
- #
37
- # For more information take a look at Spec::Runner::Configuration and Spec::Runner
38
- end