andhapp-decoct 1.4.1 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION.yml +1 -1
- data/decoct.gemspec +2 -2
- data/lib/dmeta.rb +28 -20
- data/lib/dscript.rb +4 -8
- data/test/ts_script.rb +3 -2
- metadata +2 -2
data/VERSION.yml
CHANGED
data/decoct.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{decoct}
|
5
|
-
s.version = "1.4.
|
5
|
+
s.version = "1.4.2"
|
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"]
|
9
|
-
s.date = %q{2009-04
|
9
|
+
s.date = %q{2009-05-04}
|
10
10
|
s.default_executable = %q{decoct}
|
11
11
|
s.description = %q{Sinatra Rspec project generator}
|
12
12
|
s.email = %q{anuj@andhapp.com}
|
data/lib/dmeta.rb
CHANGED
@@ -2,27 +2,35 @@ require 'ftools'
|
|
2
2
|
require File.dirname(__FILE__) + '/../lib/dconstants'
|
3
3
|
|
4
4
|
module Decoct
|
5
|
-
|
6
|
-
|
7
|
-
include Decoct::Dconstants
|
5
|
+
module Dmeta
|
8
6
|
|
9
|
-
|
10
|
-
File.copy(Dconstants::TEMPLATES + from, to)
|
11
|
-
end
|
7
|
+
include Decoct::Dconstants
|
12
8
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
end
|
21
|
-
end
|
9
|
+
def copy_file(from, to)
|
10
|
+
if from.is_a?(Array) && to.is_a?(Array)
|
11
|
+
from.each_index {|i| copy_file(from[i], to[i])}
|
12
|
+
else
|
13
|
+
File.copy(Dconstants::TEMPLATES + from, to)
|
14
|
+
end
|
15
|
+
end
|
22
16
|
|
23
|
-
|
24
|
-
|
25
|
-
|
17
|
+
module ClassMethods
|
18
|
+
def create_dir(name)
|
19
|
+
if name.is_a?(Array)
|
20
|
+
name.map {|x| create_dir(x)}
|
21
|
+
else
|
22
|
+
attr_reader name
|
23
|
+
define_method("create_#{name}") do
|
24
|
+
path = "#{app_name}/#{name}"
|
25
|
+
Dir.mkdir(path) if !test(?d, path)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
26
30
|
|
27
|
-
|
28
|
-
|
31
|
+
def self.included(host_class)
|
32
|
+
host_class.extend(ClassMethods)
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
data/lib/dscript.rb
CHANGED
@@ -8,10 +8,7 @@ module Decoct
|
|
8
8
|
|
9
9
|
attr_accessor :app_name
|
10
10
|
|
11
|
-
create_dir :lib
|
12
|
-
create_dir :spec
|
13
|
-
create_dir :views
|
14
|
-
create_dir :public
|
11
|
+
create_dir [:lib, :spec, :views, :public]
|
15
12
|
|
16
13
|
def initialize(app_name)
|
17
14
|
fail "app name cannot be nil or empty!!!" if app_name.eql?(nil) || app_name.empty?
|
@@ -38,10 +35,9 @@ module Decoct
|
|
38
35
|
end
|
39
36
|
|
40
37
|
def copy_rspec_files
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
copy_file("spec/app_spec.rb", "#{app_name}/spec/#{app_name}_spec.rb")
|
38
|
+
from = ["spec/spec.opts", "spec/rcov.opts", "spec/spec_helper.rb", "spec/app_spec.rb"]
|
39
|
+
to = ["#{app_name}/spec/spec.opts", "#{app_name}/spec/rcov.opts", "#{app_name}/spec/spec_helper.rb", "#{app_name}/spec/#{app_name}_spec.rb"]
|
40
|
+
copy_file(from, to)
|
45
41
|
end
|
46
42
|
|
47
43
|
def copy_app_file
|
data/test/ts_script.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
%
|
1
|
+
%w(test/unit redgreen shoulda rr fileutils).each{|x| require x}
|
2
|
+
require File.join(File.dirname(__FILE__), "..", 'lib', 'dscript')
|
2
3
|
|
3
4
|
class TestScript < Test::Unit::TestCase
|
4
5
|
|
5
6
|
def dir_in_app_folder
|
6
|
-
Dir.entries("epoxys").each {|x| [] << x if !File.directory?(x)}
|
7
|
+
Dir.entries("epoxys").each {|x| [] << x if !File.directory?(x)}
|
7
8
|
end
|
8
9
|
|
9
10
|
context "creating a brand new sinatra-rspec app" do
|
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
|
+
version: 1.4.2
|
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-04
|
12
|
+
date: 2009-05-04 00:00:00 -07:00
|
13
13
|
default_executable: decoct
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|