Permalink
Browse files

gems and bundler

  • Loading branch information...
1 parent 886613c commit f896bfce7031f55af57ea2b2b9d2538060cca446 @nofxx nofxx committed Feb 10, 2011
Showing with 117 additions and 49 deletions.
  1. +15 −0 Gemfile
  2. +56 −0 Gemfile.lock
  3. +31 −34 Rakefile
  4. +4 −4 lib/entidades/cliente.rb
  5. +9 −9 lib/entidades/endereco_emitente.rb
  6. +2 −2 lib/nfe-ruby.rb
View
15 Gemfile
@@ -0,0 +1,15 @@
+source "http://rubygems.org"
+# Required
+gem "em-http-request"
+gem "nokogiri"
+gem "redis"
+gem "resque"
+
+# Add dependencies to develop your gem here.
+# Include everything needed to run rake, tests, features, etc.
+group :development do
+ gem "rspec", "~> 2.3.0"
+ gem "bundler", "~> 1.0.0"
+ gem "jeweler", "~> 1.5.2"
+ gem "rcov", ">= 0"
+end
View
@@ -0,0 +1,56 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ addressable (2.2.4)
+ diff-lcs (1.1.2)
+ em-http-request (0.3.0)
+ addressable (>= 2.0.0)
+ escape_utils
+ eventmachine (>= 0.12.9)
+ escape_utils (0.2.0)
+ eventmachine (0.12.10)
+ git (1.2.5)
+ jeweler (1.5.2)
+ bundler (~> 1.0.0)
+ git (>= 1.2.5)
+ rake
+ json (1.4.6)
+ nokogiri (1.4.4)
+ rack (1.2.1)
+ rake (0.8.7)
+ rcov (0.9.9)
+ redis (2.1.1)
+ redis-namespace (0.10.0)
+ redis (< 3.0.0)
+ resque (1.13.0)
+ json (~> 1.4.6)
+ redis-namespace (>= 0.10.0)
+ sinatra (>= 0.9.2)
+ vegas (~> 0.1.2)
+ rspec (2.3.0)
+ rspec-core (~> 2.3.0)
+ rspec-expectations (~> 2.3.0)
+ rspec-mocks (~> 2.3.0)
+ rspec-core (2.3.1)
+ rspec-expectations (2.3.0)
+ diff-lcs (~> 1.1.2)
+ rspec-mocks (2.3.0)
+ sinatra (1.1.2)
+ rack (~> 1.1)
+ tilt (~> 1.2)
+ tilt (1.2.2)
+ vegas (0.1.8)
+ rack (>= 1.0.0)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ bundler (~> 1.0.0)
+ em-http-request
+ jeweler (~> 1.5.2)
+ nokogiri
+ rcov
+ redis
+ resque
+ rspec (~> 2.3.0)
View
@@ -1,46 +1,43 @@
require 'rubygems'
-require 'rake'
-
+require 'bundler'
begin
- require 'jeweler'
- Jeweler::Tasks.new do |gem|
- gem.name = "nfe-ruby"
- gem.summary = %Q{Implementacao NFEletronica}
- gem.description = %Q{TODO: longer description of your gem}
- gem.email = "viniciusgati@gmail.com"
- gem.homepage = "http://github.com/viniciusgati/nfe-ruby"
- gem.authors = ["Vinicius Gati"]
- gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
- end
- Jeweler::GemcutterTasks.new
-rescue LoadError
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
+ Bundler.setup(:default, :development)
+rescue Bundler::BundlerError => e
+ $stderr.puts e.message
+ $stderr.puts "Run `bundle install` to install missing gems"
+ exit e.status_code
end
+require 'rake'
-require 'rake/testtask'
-Rake::TestTask.new(:test) do |test|
- test.libs << 'lib' << 'test'
- test.pattern = 'test/**/test_*.rb'
- test.verbose = true
+require 'jeweler'
+Jeweler::Tasks.new do |gem|
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
+ gem.name = "nfe-ruby"
+ gem.homepage = "http://github.com/viniciusgati/nfe-ruby"
+ gem.license = "MIT"
+ gem.summary = %Q{NF-e Brasil}
+ gem.description = %Q{NF-e Brasil gem}
+ gem.email = "viniciusgati@gmail.com"
+ gem.authors = ["Vinicius Gati", "Marcos Piccinini"]
+ # Include your dependencies below. Runtime dependencies are required when using your gem,
+ # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
+ # gem.add_runtime_dependency 'jabber4r', '> 0.1'
+ # gem.add_development_dependency 'rspec', '> 1.2.3'
end
+Jeweler::RubygemsDotOrgTasks.new
-begin
- require 'rcov/rcovtask'
- Rcov::RcovTask.new do |test|
- test.libs << 'test'
- test.pattern = 'test/**/test_*.rb'
- test.verbose = true
- end
-rescue LoadError
- task :rcov do
- abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
- end
+require 'rspec/core'
+require 'rspec/core/rake_task'
+RSpec::Core::RakeTask.new(:spec) do |spec|
+ spec.pattern = FileList['spec/**/*_spec.rb']
end
-task :test => :check_dependencies
+RSpec::Core::RakeTask.new(:rcov) do |spec|
+ spec.pattern = 'spec/**/*_spec.rb'
+ spec.rcov = true
+end
-task :default => :test
+task :default => :spec
require 'rake/rdoctask'
Rake::RDocTask.new do |rdoc|
View
@@ -1,9 +1,9 @@
require 'configuracao/parametros'
-require 'active_model'
+#require 'active_model'
class Cliente
- include ActiveModel::Serializers::JSON
- include ActiveModel::Serializers::Xml
+ # include ActiveModel::Serializers::JSON
+# include ActiveModel::Serializers::Xml
# - Nome/Razão Social (obrigatorio)
@@ -70,4 +70,4 @@ def attributes#FIXME pensar em como pegar os atributos direto, isso se tiver jei
end
-end
+end
@@ -1,15 +1,15 @@
-require 'active_model/validations'
-require 'active_model/serialization'
+#require 'active_model/validations'
+#require 'active_model/serialization'
#TODO: usar validacoes sem usar active record
class EnderecoEmitente
- include ActiveModel::Validations
- include ActiveModel::Serializers::JSON
- include ActiveModel::Serializers::Xml
+ # include ActiveModel::Validations
+ # include ActiveModel::Serializers::JSON
+ # include ActiveModel::Serializers::Xml
- validates_length_of :xLgr, :nro, :xCpl, :xBairro, :xMun, :in => 2...60
- validates :CEP, :format => {:with => /[0-9]{8}/} #sem traços, somente numeros
- validates :fone, :format => {:with => /[0-9]{6,14}/} #DDD + número do telefone
+# validates_length_of :xLgr, :nro, :xCpl, :xBairro, :xMun, :in => 2...60
+# validates :CEP, :format => {:with => /[0-9]{8}/} #sem traços, somente numeros
+# validates :fone, :format => {:with => /[0-9]{6,14}/} #DDD + número do telefone
#cmun codUFIBGE
#UF TUFIBGE 9999999 para exterior
@@ -51,4 +51,4 @@ def attributes
'fone' => fone}}
end
-end
+end
View
@@ -18,5 +18,5 @@
x = EnderecoEmitente.new
puts
-puts x.to_xml
-puts
+#puts x.to_xml
+puts

0 comments on commit f896bfc

Please sign in to comment.