aipim-rails 0.0.168 → 0.0.169
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.
- checksums.yaml +4 -4
 - data/bin/aipim +1 -24
 - data/lib/aipim-rails/html.rb +2 -7
 - data/lib/aipim-rails/parser.rb +4 -15
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: b2c8f09713ca4089744e7c3a34a97ff4392ed351
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: eb2aafd15c7a6e88149e2b7bfd80bc068aa46299
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: d55c67b214d0f8a632cc169cb73b63b8cd30d3b302f109d6e1d479978024acbf0ddd143090c8eade2799a0a2302bc08ad574b91db088867404c4efaae15f9b34
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 83ab7b6ede7c69f4e5d20a4712eb53508135c482ef4fbad8073f45e49197012d7b0c4b6343b07d76fc22cd64f5ad51adda170cb03b2fbad1b9e8dd4a83f9452f
         
     | 
    
        data/bin/aipim
    CHANGED
    
    | 
         @@ -1,16 +1,12 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            #!/usr/bin/env ruby
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
2 
     | 
    
         
             
            require 'aipim-rails'
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
3 
     | 
    
         
             
            # root do aipim
         
     | 
| 
       6 
4 
     | 
    
         
             
            path = File.expand_path(File.dirname(__FILE__))+"/../"
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
5 
     | 
    
         
             
            # pegar o nome dos arquivos das features
         
     | 
| 
       9 
6 
     | 
    
         
             
            def get_files
         
     | 
| 
       10 
7 
     | 
    
         
             
            	files = []
         
     | 
| 
       11 
     | 
    
         
            -
            	ARGV.delete_at(0)
         
     | 
| 
       12 
8 
     | 
    
         
             
            	ARGV.each do |arg|
         
     | 
| 
       13 
     | 
    
         
            -
            		ls = %x[ls  
     | 
| 
      
 9 
     | 
    
         
            +
            		ls = %x[ls ../features].split("\n")
         
     | 
| 
       14 
10 
     | 
    
         
             
            		ls.each do |f|
         
     | 
| 
       15 
11 
     | 
    
         
             
            			f = f.split("/")
         
     | 
| 
       16 
12 
     | 
    
         
             
            			f.delete_at(0) if f[0] == "features"
         
     | 
| 
         @@ -91,23 +87,4 @@ elsif ARGV[0] == 'html' 
     | 
|
| 
       91 
87 
     | 
    
         
             
            	# geara o html das features
         
     | 
| 
       92 
88 
     | 
    
         
             
            	Html.features(features)
         
     | 
| 
       93 
89 
     | 
    
         | 
| 
       94 
     | 
    
         
            -
            # nao serve para nada!! é śó de DEBUG!!
         
     | 
| 
       95 
     | 
    
         
            -
            elsif ARGV[0] == 'parser'
         
     | 
| 
       96 
     | 
    
         
            -
            	files = get_files
         
     | 
| 
       97 
     | 
    
         
            -
            	files.each do |f|
         
     | 
| 
       98 
     | 
    
         
            -
            		puts "Tentando abrir arquivo #{f}"
         
     | 
| 
       99 
     | 
    
         
            -
            		feature = Parser.init(f)
         
     | 
| 
       100 
     | 
    
         
            -
            		puts "Feature name: #{feature[:feature_name]}"
         
     | 
| 
       101 
     | 
    
         
            -
            		puts "Feature description: "
         
     | 
| 
       102 
     | 
    
         
            -
            		feature[:feature_description].each {|t| puts t}
         
     | 
| 
       103 
     | 
    
         
            -
            		puts "Context name: #{feature[:context_name]}"
         
     | 
| 
       104 
     | 
    
         
            -
            		puts "Context description"
         
     | 
| 
       105 
     | 
    
         
            -
            		feature[:context_description].each {|t| puts t}
         
     | 
| 
       106 
     | 
    
         
            -
            		feature[:scenarios].each do |scenario|
         
     | 
| 
       107 
     | 
    
         
            -
            			puts "----------------------------------------------"
         
     | 
| 
       108 
     | 
    
         
            -
            			puts scenario[:name]
         
     | 
| 
       109 
     | 
    
         
            -
            			scenario[:steps].each {|step| puts step}
         
     | 
| 
       110 
     | 
    
         
            -
            		end
         
     | 
| 
       111 
     | 
    
         
            -
            	end
         
     | 
| 
       112 
     | 
    
         
            -
             
     | 
| 
       113 
90 
     | 
    
         
             
            end
         
     | 
    
        data/lib/aipim-rails/html.rb
    CHANGED
    
    | 
         @@ -59,7 +59,6 @@ module Html 
     | 
|
| 
       59 
59 
     | 
    
         | 
| 
       60 
60 
     | 
    
         
             
            		features.each_with_index do |feature, i| 
         
     | 
| 
       61 
61 
     | 
    
         
             
            			output = File.open("aipim/html/"+feature[:filename]+".html", "w")
         
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
62 
     | 
    
         
             
            			output.puts '
         
     | 
| 
       64 
63 
     | 
    
         
             
            <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
         
     | 
| 
       65 
64 
     | 
    
         
             
            <html>
         
     | 
| 
         @@ -113,12 +112,8 @@ module Html 
     | 
|
| 
       113 
112 
     | 
    
         
             
            		    </ul>
         
     | 
| 
       114 
113 
     | 
    
         
             
            		</div>
         
     | 
| 
       115 
114 
     | 
    
         | 
| 
       116 
     | 
    
         
            -
              		<div class="panel-footer scenario-screenshot"> 
     | 
| 
       117 
     | 
    
         
            -
             
     | 
| 
       118 
     | 
    
         
            -
              			output.puts '
         
     | 
| 
       119 
     | 
    
         
            -
              			<a href="../screenshots/'+feature[:filename]+'/'+scenario[:screenshot]+'"><img src="../screenshots/'+feature[:filename]+'/'+scenario[:screenshot]+'" /></a>'
         
     | 
| 
       120 
     | 
    
         
            -
              		end
         
     | 
| 
       121 
     | 
    
         
            -
              		output.puts '
         
     | 
| 
      
 115 
     | 
    
         
            +
              		<div class="panel-footer scenario-screenshot">
         
     | 
| 
      
 116 
     | 
    
         
            +
              			<a href="../screenshots/'+feature[:filename]+'/'+scenario[:screenshot]+'"><img src="../screenshots/'+feature[:filename]+'/'+scenario[:screenshot]+'" /></a>
         
     | 
| 
       122 
117 
     | 
    
         
             
              		</div>
         
     | 
| 
       123 
118 
     | 
    
         
             
            	</div>'
         
     | 
| 
       124 
119 
     | 
    
         | 
    
        data/lib/aipim-rails/parser.rb
    CHANGED
    
    | 
         @@ -2,18 +2,14 @@ require 'aipim-rails/parser_helper' 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            module Parser
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
            	# inicia o processo de parset
         
     | 
| 
       6 
5 
     | 
    
         
             
            	def self.init(filename)
         
     | 
| 
       7 
     | 
    
         
            -
            		 
     | 
| 
       8 
     | 
    
         
            -
            		parser(filename)
         
     | 
| 
      
 6 
     | 
    
         
            +
            		filename
         
     | 
| 
       9 
7 
     | 
    
         
             
            	end
         
     | 
| 
       10 
8 
     | 
    
         | 
| 
       11 
9 
     | 
    
         | 
| 
       12 
10 
     | 
    
         
             
            	def self.tag_screenshot(line,file,workset)
         
     | 
| 
       13 
     | 
    
         
            -
            		if line && ParserHelper.is_tag?(line)
         
     | 
| 
       14 
     | 
    
         
            -
            			 
     | 
| 
       15 
     | 
    
         
            -
            				workset[:screenshot] = true
         
     | 
| 
       16 
     | 
    
         
            -
            			end
         
     | 
| 
      
 11 
     | 
    
         
            +
            		if line && ParserHelper.is_tag?(line) && ParserHelper.is_screenshot?(line)
         
     | 
| 
      
 12 
     | 
    
         
            +
            			workset[:screenshot] = true
         
     | 
| 
       17 
13 
     | 
    
         
             
            			line = ParserHelper::read_line(file)
         
     | 
| 
       18 
14 
     | 
    
         
             
            		end
         
     | 
| 
       19 
15 
     | 
    
         
             
            		return line, workset
         
     | 
| 
         @@ -48,13 +44,11 @@ module Parser 
     | 
|
| 
       48 
44 
     | 
    
         
             
            			while ((line = ParserHelper::read_line(file)) && !ParserHelper.is_command?(line))
         
     | 
| 
       49 
45 
     | 
    
         
             
            				scenario_steps << line if !(line.gsub(" ", "") == "")
         
     | 
| 
       50 
46 
     | 
    
         
             
            			end
         
     | 
| 
       51 
     | 
    
         
            -
            			screenshot = nil
         
     | 
| 
       52 
47 
     | 
    
         
             
            			if workset[:screenshot]
         
     | 
| 
       53 
48 
     | 
    
         
             
            				screenshot = workset[:screenshots][workset[:screenshot_counter]].to_s
         
     | 
| 
       54 
49 
     | 
    
         
             
            				workset[:screenshot_counter] += 1
         
     | 
| 
       55 
50 
     | 
    
         
             
            				workset[:screenshot] = false
         
     | 
| 
       56 
51 
     | 
    
         
             
            			end
         
     | 
| 
       57 
     | 
    
         
            -
            			workset[:screenshot] = false
         
     | 
| 
       58 
52 
     | 
    
         
             
            			workset[:scenarios] << {name: scenario_name, steps: scenario_steps, screenshot: screenshot}
         
     | 
| 
       59 
53 
     | 
    
         
             
            		end
         
     | 
| 
       60 
54 
     | 
    
         
             
            		return line, workset
         
     | 
| 
         @@ -70,34 +64,29 @@ module Parser 
     | 
|
| 
       70 
64 
     | 
    
         
             
            	end
         
     | 
| 
       71 
65 
     | 
    
         | 
| 
       72 
66 
     | 
    
         
             
            	def self.parser(filename)
         
     | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
67 
     | 
    
         
             
            		# Read input
         
     | 
| 
       75 
68 
     | 
    
         
             
            		file = read_file(filename)
         
     | 
| 
       76 
69 
     | 
    
         | 
| 
       77 
70 
     | 
    
         
             
            		# Get screenshot files
         
     | 
| 
       78 
71 
     | 
    
         
             
            		screenshots = get_screenshot_files(filename)
         
     | 
| 
       79 
72 
     | 
    
         | 
| 
       80 
     | 
    
         
            -
            		# variaveis de trabalho
         
     | 
| 
       81 
73 
     | 
    
         
             
            		workset = {
         
     | 
| 
       82 
74 
     | 
    
         
             
            			screenshot: false,
         
     | 
| 
       83 
75 
     | 
    
         
             
            			screenshot_counter: 0,
         
     | 
| 
       84 
76 
     | 
    
         
             
            			screenshots: screenshots,
         
     | 
| 
       85 
     | 
    
         
            -
            			feature_name:  
     | 
| 
      
 77 
     | 
    
         
            +
            			feature_name: nil,
         
     | 
| 
       86 
78 
     | 
    
         
             
            			feature_description: [],
         
     | 
| 
       87 
79 
     | 
    
         
             
            			context_name: nil,
         
     | 
| 
       88 
80 
     | 
    
         
             
            			context_description: [],
         
     | 
| 
       89 
81 
     | 
    
         
             
            			scenarios: []
         
     | 
| 
       90 
82 
     | 
    
         
             
            		}
         
     | 
| 
       91 
83 
     | 
    
         | 
| 
       92 
     | 
    
         
            -
            		# esse codigo é q faz a magica
         
     | 
| 
       93 
84 
     | 
    
         
             
            		line = ParserHelper::read_line(file)
         
     | 
| 
       94 
85 
     | 
    
         
             
            		while (line)
         
     | 
| 
       95 
86 
     | 
    
         
             
            			line, workset = process_tags(line,file,workset)
         
     | 
| 
       96 
87 
     | 
    
         
             
            		end
         
     | 
| 
       97 
88 
     | 
    
         
             
            		file.close
         
     | 
| 
       98 
     | 
    
         
            -
            		# no final o workset vai estar com tudo que precisamos
         
     | 
| 
       99 
89 
     | 
    
         | 
| 
       100 
     | 
    
         
            -
            		# montar a feature com o qu eu tenho do workset
         
     | 
| 
       101 
90 
     | 
    
         
             
            		feature = {
         
     | 
| 
       102 
91 
     | 
    
         
             
            			feature_name: workset[:feature_name],
         
     | 
| 
       103 
92 
     | 
    
         
             
            			feature_description: workset[:feature_description],
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: aipim-rails
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.169
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Facta TI
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2014- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2014-12-12 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: cucumber-rails
         
     |