andhapp-decoct 1.3.0 → 1.4.0
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 +4 -2
 - data/lib/dmeta.rb +28 -0
 - data/lib/dscript.rb +13 -37
 - data/lib/templates/spec/app_spec.rb +13 -0
 - data/test/ts_script.rb +3 -15
 - metadata +4 -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. 
     | 
| 
      
 5 
     | 
    
         
            +
              s.version = "1.4.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"]
         
     | 
| 
       9 
     | 
    
         
            -
              s.date = %q{2009-04- 
     | 
| 
      
 9 
     | 
    
         
            +
              s.date = %q{2009-04-24}
         
     | 
| 
       10 
10 
     | 
    
         
             
              s.default_executable = %q{decoct}
         
     | 
| 
       11 
11 
     | 
    
         
             
              s.description = %q{Sinatra Rspec project generator}
         
     | 
| 
       12 
12 
     | 
    
         
             
              s.email = %q{anuj@andhapp.com}
         
     | 
| 
         @@ -21,9 +21,11 @@ Gem::Specification.new do |s| 
     | 
|
| 
       21 
21 
     | 
    
         
             
                "bin/decoct",
         
     | 
| 
       22 
22 
     | 
    
         
             
                "decoct.gemspec",
         
     | 
| 
       23 
23 
     | 
    
         
             
                "lib/dconstants.rb",
         
     | 
| 
      
 24 
     | 
    
         
            +
                "lib/dmeta.rb",
         
     | 
| 
       24 
25 
     | 
    
         
             
                "lib/dscript.rb",
         
     | 
| 
       25 
26 
     | 
    
         
             
                "lib/templates/.autotest",
         
     | 
| 
       26 
27 
     | 
    
         
             
                "lib/templates/generic_app.rb",
         
     | 
| 
      
 28 
     | 
    
         
            +
                "lib/templates/spec/app_spec.rb",
         
     | 
| 
       27 
29 
     | 
    
         
             
                "lib/templates/spec/rcov.opts",
         
     | 
| 
       28 
30 
     | 
    
         
             
                "lib/templates/spec/spec.opts",
         
     | 
| 
       29 
31 
     | 
    
         
             
                "lib/templates/spec/spec_helper.rb",
         
     | 
    
        data/lib/dmeta.rb
    ADDED
    
    | 
         @@ -0,0 +1,28 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'ftools'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/../lib/dconstants'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            module Decoct
         
     | 
| 
      
 5 
     | 
    
         
            +
              module Dmeta
         
     | 
| 
      
 6 
     | 
    
         
            +
                
         
     | 
| 
      
 7 
     | 
    
         
            +
                include Decoct::Dconstants
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                def copy_file(from, to)
         
     | 
| 
      
 10 
     | 
    
         
            +
                  File.copy(Dconstants::TEMPLATES + from, to)    
         
     | 
| 
      
 11 
     | 
    
         
            +
                end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                module ClassMethods
         
     | 
| 
      
 14 
     | 
    
         
            +
                  def create_dir(name)
         
     | 
| 
      
 15 
     | 
    
         
            +
                    attr_reader name
         
     | 
| 
      
 16 
     | 
    
         
            +
                    define_method("create_#{name}") do
         
     | 
| 
      
 17 
     | 
    
         
            +
                      path = "#{app_name}/#{name}"
         
     | 
| 
      
 18 
     | 
    
         
            +
                      Dir.mkdir(path) if !test(?d, path)  
         
     | 
| 
      
 19 
     | 
    
         
            +
                    end
         
     | 
| 
      
 20 
     | 
    
         
            +
                  end
         
     | 
| 
      
 21 
     | 
    
         
            +
                end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                def self.included(host_class)
         
     | 
| 
      
 24 
     | 
    
         
            +
                  host_class.extend(ClassMethods)
         
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
              end
         
     | 
| 
      
 28 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/dscript.rb
    CHANGED
    
    | 
         @@ -1,14 +1,17 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require ' 
     | 
| 
       2 
     | 
    
         
            -
            require File.dirname(__FILE__) + '/../lib/dconstants'
         
     | 
| 
      
 1 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/../lib/dmeta'
         
     | 
| 
       3 
2 
     | 
    
         | 
| 
       4 
3 
     | 
    
         
             
            module Decoct
         
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
                include Decoct::Dconstants
         
     | 
| 
       7 
4 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
                # move the creation into a module and just include that module
         
     | 
| 
       9 
5 
     | 
    
         
             
                class Dscript
         
     | 
| 
       10 
6 
     | 
    
         | 
| 
      
 7 
     | 
    
         
            +
                  include Decoct::Dmeta
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
       11 
9 
     | 
    
         
             
                  attr_accessor :app_name
         
     | 
| 
      
 10 
     | 
    
         
            +
                  
         
     | 
| 
      
 11 
     | 
    
         
            +
                  create_dir :lib 
         
     | 
| 
      
 12 
     | 
    
         
            +
                  create_dir :spec
         
     | 
| 
      
 13 
     | 
    
         
            +
                  create_dir :views
         
     | 
| 
      
 14 
     | 
    
         
            +
                  create_dir :public
         
     | 
| 
       12 
15 
     | 
    
         | 
| 
       13 
16 
     | 
    
         
             
                  def initialize(app_name)
         
     | 
| 
       14 
17 
     | 
    
         
             
                    fail "app name cannot be nil or empty!!!" if app_name.eql?(nil) || app_name.empty?
         
     | 
| 
         @@ -23,25 +26,13 @@ module Decoct 
     | 
|
| 
       23 
26 
     | 
    
         
             
                    create_public
         
     | 
| 
       24 
27 
     | 
    
         
             
                    copy_autotest_file
         
     | 
| 
       25 
28 
     | 
    
         
             
                    copy_rspec_files
         
     | 
| 
       26 
     | 
    
         
            -
                     
     | 
| 
      
 29 
     | 
    
         
            +
                    copy_app_file
         
     | 
| 
       27 
30 
     | 
    
         
             
                  end
         
     | 
| 
       28 
31 
     | 
    
         | 
| 
       29 
     | 
    
         
            -
                  def  
     | 
| 
       30 
     | 
    
         
            -
                     
     | 
| 
       31 
     | 
    
         
            -
                  end
         
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
                  def create_spec
         
     | 
| 
       34 
     | 
    
         
            -
                    create_dir(Dconstants::SPEC)  
         
     | 
| 
       35 
     | 
    
         
            -
                  end
         
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
                  def create_views
         
     | 
| 
       38 
     | 
    
         
            -
                    create_dir(Dconstants::VIEWS)  
         
     | 
| 
      
 32 
     | 
    
         
            +
                  def create_app_dir
         
     | 
| 
      
 33 
     | 
    
         
            +
                    Dir.mkdir("#{app_name}") if !test(?d, "#{app_name}")
         
     | 
| 
       39 
34 
     | 
    
         
             
                  end
         
     | 
| 
       40 
35 
     | 
    
         | 
| 
       41 
     | 
    
         
            -
                  def create_public
         
     | 
| 
       42 
     | 
    
         
            -
                    create_dir(Dconstants::PUBLIC)  
         
     | 
| 
       43 
     | 
    
         
            -
                  end
         
     | 
| 
       44 
     | 
    
         
            -
                  
         
     | 
| 
       45 
36 
     | 
    
         
             
                  def copy_autotest_file
         
     | 
| 
       46 
37 
     | 
    
         
             
                    copy_file(".autotest", "#{app_name}/.autotest") 
         
     | 
| 
       47 
38 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -50,28 +41,13 @@ module Decoct 
     | 
|
| 
       50 
41 
     | 
    
         
             
                    copy_file("spec/spec.opts", "#{app_name}/spec/spec.opts")
         
     | 
| 
       51 
42 
     | 
    
         
             
                    copy_file("spec/rcov.opts", "#{app_name}/spec/rcov.opts")
         
     | 
| 
       52 
43 
     | 
    
         
             
                    copy_file("spec/spec_helper.rb", "#{app_name}/spec/spec_helper.rb")
         
     | 
| 
      
 44 
     | 
    
         
            +
                    copy_file("spec/app_spec.rb", "#{app_name}/spec/#{app_name}_spec.rb")  
         
     | 
| 
       53 
45 
     | 
    
         
             
                  end
         
     | 
| 
       54 
46 
     | 
    
         | 
| 
       55 
     | 
    
         
            -
                  def  
     | 
| 
      
 47 
     | 
    
         
            +
                  def copy_app_file
         
     | 
| 
       56 
48 
     | 
    
         
             
                    copy_file("generic_app.rb", "#{app_name}/#{app_name}.rb")        
         
     | 
| 
       57 
49 
     | 
    
         
             
                  end
         
     | 
| 
       58 
50 
     | 
    
         | 
| 
       59 
     | 
    
         
            -
                  def create_app_dir
         
     | 
| 
       60 
     | 
    
         
            -
                    create_dir          
         
     | 
| 
       61 
     | 
    
         
            -
                  end
         
     | 
| 
       62 
     | 
    
         
            -
                  
         
     | 
| 
       63 
     | 
    
         
            -
                  private
         
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
                  def create_dir(value = '')
         
     | 
| 
       66 
     | 
    
         
            -
                    path = "#{app_name}/#{value}"
         
     | 
| 
       67 
     | 
    
         
            -
                    Dir.mkdir(path) if !test(?d, path) 
         
     | 
| 
       68 
     | 
    
         
            -
                  end
         
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
                  def copy_file(from, to)
         
     | 
| 
       71 
     | 
    
         
            -
                    File.copy(Dconstants::TEMPLATES + from, to)
         
     | 
| 
       72 
     | 
    
         
            -
                  end
         
     | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
51 
     | 
    
         
             
                end
         
     | 
| 
       75 
52 
     | 
    
         | 
| 
       76 
53 
     | 
    
         
             
            end
         
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
         @@ -0,0 +1,13 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            %w{spec spec/interop/test sinatra/test}.each {|x| require x}
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            set :environment, :test
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            describe 'App' do
         
     | 
| 
      
 6 
     | 
    
         
            +
              include Sinatra::Test
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
              it "should pick the spec files for autotest and display error messages with snarl" do
         
     | 
| 
      
 9 
     | 
    
         
            +
                get '/'
         
     | 
| 
      
 10 
     | 
    
         
            +
                response.should be_ok
         
     | 
| 
      
 11 
     | 
    
         
            +
                response.body.should == 'It works!!!'
         
     | 
| 
      
 12 
     | 
    
         
            +
              end
         
     | 
| 
      
 13 
     | 
    
         
            +
            end
         
     | 
    
        data/test/ts_script.rb
    CHANGED
    
    | 
         @@ -18,41 +18,29 @@ class TestScript < Test::Unit::TestCase 
     | 
|
| 
       18 
18 
     | 
    
         
             
                end
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
20 
     | 
    
         
             
                should 'create a directory called lib' do
         
     | 
| 
       21 
     | 
    
         
            -
                  initial_num_of_dir = dir_in_app_folder().size() 
         
     | 
| 
       22 
21 
     | 
    
         
             
                  @script.create_lib
         
     | 
| 
       23 
     | 
    
         
            -
                  final_num_of_dir = dir_in_app_folder().size()
         
     | 
| 
       24 
     | 
    
         
            -
                  assert_equal final_num_of_dir, initial_num_of_dir + 1
         
     | 
| 
       25 
22 
     | 
    
         
             
                  assert_not_nil dir_in_app_folder.index("lib") 
         
     | 
| 
       26 
23 
     | 
    
         
             
                end
         
     | 
| 
       27 
24 
     | 
    
         | 
| 
       28 
25 
     | 
    
         
             
                should 'create a directory called spec and copy the rspec files' do
         
     | 
| 
       29 
     | 
    
         
            -
                  initial_num_of_dir = dir_in_app_folder().size() 
         
     | 
| 
       30 
26 
     | 
    
         
             
                  @script.create_spec
         
     | 
| 
       31 
     | 
    
         
            -
                  final_num_of_dir = dir_in_app_folder().size()
         
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
27 
     | 
    
         
             
                  @script.copy_rspec_files
         
     | 
| 
       34 
28 
     | 
    
         | 
| 
       35 
29 
     | 
    
         
             
                  assert File.exists?("#{@app_name}/spec/spec.opts")
         
     | 
| 
       36 
30 
     | 
    
         
             
                  assert File.exists?("#{@app_name}/spec/rcov.opts")
         
     | 
| 
       37 
31 
     | 
    
         
             
                  assert File.exists?("#{@app_name}/spec/spec_helper.rb")
         
     | 
| 
      
 32 
     | 
    
         
            +
                  assert File.exists?("#{@app_name}/spec/#{@app_name}_spec.rb")
         
     | 
| 
       38 
33 
     | 
    
         | 
| 
       39 
     | 
    
         
            -
                  assert_equal final_num_of_dir, initial_num_of_dir + 1
         
     | 
| 
       40 
34 
     | 
    
         
             
                  assert_not_nil dir_in_app_folder.index("spec") 
         
     | 
| 
       41 
35 
     | 
    
         
             
                end
         
     | 
| 
       42 
36 
     | 
    
         | 
| 
       43 
37 
     | 
    
         
             
                should 'create a directory called views' do
         
     | 
| 
       44 
     | 
    
         
            -
                  initial_num_of_dir = dir_in_app_folder().size() 
         
     | 
| 
       45 
38 
     | 
    
         
             
                  @script.create_views
         
     | 
| 
       46 
     | 
    
         
            -
                  final_num_of_dir = dir_in_app_folder().size() 
         
     | 
| 
       47 
     | 
    
         
            -
                  assert_equal final_num_of_dir, initial_num_of_dir + 1
         
     | 
| 
       48 
39 
     | 
    
         
             
                  assert_not_nil dir_in_app_folder.index("views")
         
     | 
| 
       49 
40 
     | 
    
         
             
                end
         
     | 
| 
       50 
41 
     | 
    
         | 
| 
       51 
42 
     | 
    
         
             
                should 'create a directory called public' do
         
     | 
| 
       52 
     | 
    
         
            -
                  initial_num_of_dir = dir_in_app_folder().size() 
         
     | 
| 
       53 
43 
     | 
    
         
             
                  @script.create_public
         
     | 
| 
       54 
     | 
    
         
            -
                  final_num_of_dir = dir_in_app_folder().size() 
         
     | 
| 
       55 
     | 
    
         
            -
                  assert_equal final_num_of_dir, initial_num_of_dir + 1
         
     | 
| 
       56 
44 
     | 
    
         
             
                  assert_not_nil dir_in_app_folder.index("public")
         
     | 
| 
       57 
45 
     | 
    
         
             
                end
         
     | 
| 
       58 
46 
     | 
    
         | 
| 
         @@ -61,8 +49,8 @@ class TestScript < Test::Unit::TestCase 
     | 
|
| 
       61 
49 
     | 
    
         
             
                  assert File.exists?("#{@app_name}/.autotest")
         
     | 
| 
       62 
50 
     | 
    
         
             
                end
         
     | 
| 
       63 
51 
     | 
    
         | 
| 
       64 
     | 
    
         
            -
                should ' 
     | 
| 
       65 
     | 
    
         
            -
                  @script. 
     | 
| 
      
 52 
     | 
    
         
            +
                should 'copy the app file' do
         
     | 
| 
      
 53 
     | 
    
         
            +
                  @script.copy_app_file
         
     | 
| 
       66 
54 
     | 
    
         
             
                  assert File.exists?("#{@app_name}/#{@app_name}.rb")
         
     | 
| 
       67 
55 
     | 
    
         
             
                end
         
     | 
| 
       68 
56 
     | 
    
         | 
    
        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 
     | 
    
         
            +
              version: 1.4.0
         
     | 
| 
       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-04-24 00:00:00 -07:00
         
     | 
| 
       13 
13 
     | 
    
         
             
            default_executable: decoct
         
     | 
| 
       14 
14 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       15 
15 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
         @@ -77,9 +77,11 @@ files: 
     | 
|
| 
       77 
77 
     | 
    
         
             
            - bin/decoct
         
     | 
| 
       78 
78 
     | 
    
         
             
            - decoct.gemspec
         
     | 
| 
       79 
79 
     | 
    
         
             
            - lib/dconstants.rb
         
     | 
| 
      
 80 
     | 
    
         
            +
            - lib/dmeta.rb
         
     | 
| 
       80 
81 
     | 
    
         
             
            - lib/dscript.rb
         
     | 
| 
       81 
82 
     | 
    
         
             
            - lib/templates/.autotest
         
     | 
| 
       82 
83 
     | 
    
         
             
            - lib/templates/generic_app.rb
         
     | 
| 
      
 84 
     | 
    
         
            +
            - lib/templates/spec/app_spec.rb
         
     | 
| 
       83 
85 
     | 
    
         
             
            - lib/templates/spec/rcov.opts
         
     | 
| 
       84 
86 
     | 
    
         
             
            - lib/templates/spec/spec.opts
         
     | 
| 
       85 
87 
     | 
    
         
             
            - lib/templates/spec/spec_helper.rb
         
     |