riif 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. data/.gitignore +17 -0
  2. data/.rspec +2 -0
  3. data/.travis.yml +4 -0
  4. data/CHANGELOG.md +21 -0
  5. data/Gemfile +4 -0
  6. data/LICENSE.txt +22 -0
  7. data/README.md +157 -0
  8. data/Rakefile +6 -0
  9. data/lib/riif.rb +6 -0
  10. data/lib/riif/dsl/accnt.rb +15 -0
  11. data/lib/riif/dsl/base.rb +51 -0
  12. data/lib/riif/dsl/bud.rb +14 -0
  13. data/lib/riif/dsl/ctype.rb +9 -0
  14. data/lib/riif/dsl/cust.rb +51 -0
  15. data/lib/riif/dsl/emp.rb +31 -0
  16. data/lib/riif/dsl/invitem.rb +32 -0
  17. data/lib/riif/dsl/invmemo.rb +9 -0
  18. data/lib/riif/dsl/klass.rb +9 -0
  19. data/lib/riif/dsl/othername.rb +25 -0
  20. data/lib/riif/dsl/paymeth.rb +9 -0
  21. data/lib/riif/dsl/shipmeth.rb +10 -0
  22. data/lib/riif/dsl/spl.rb +29 -0
  23. data/lib/riif/dsl/terms.rb +13 -0
  24. data/lib/riif/dsl/timeact.rb +17 -0
  25. data/lib/riif/dsl/trns.rb +46 -0
  26. data/lib/riif/dsl/vend.rb +39 -0
  27. data/lib/riif/dsl/vtype.rb +9 -0
  28. data/lib/riif/iif.rb +38 -0
  29. data/lib/riif/rails/template_handler.rb +19 -0
  30. data/lib/riif/railtie.rb +16 -0
  31. data/lib/riif/version.rb +3 -0
  32. data/riif.gemspec +23 -0
  33. data/spec/fixtures/accnt.iif +2 -0
  34. data/spec/fixtures/bud.iif +2 -0
  35. data/spec/fixtures/ctype.iif +2 -0
  36. data/spec/fixtures/cust.iif +2 -0
  37. data/spec/fixtures/emp.iif +2 -0
  38. data/spec/fixtures/invitem.iif +2 -0
  39. data/spec/fixtures/invmemo.iif +2 -0
  40. data/spec/fixtures/klass.iif +2 -0
  41. data/spec/fixtures/othername.iif +2 -0
  42. data/spec/fixtures/paymeth.iif +2 -0
  43. data/spec/fixtures/shipmeth.iif +2 -0
  44. data/spec/fixtures/terms.iif +2 -0
  45. data/spec/fixtures/timeact.iif +2 -0
  46. data/spec/fixtures/trns.iif +7 -0
  47. data/spec/fixtures/vend.iif +2 -0
  48. data/spec/fixtures/vtype.iif +2 -0
  49. data/spec/riif/dsl/accnt_spec.rb +20 -0
  50. data/spec/riif/dsl/bud_spec.rb +21 -0
  51. data/spec/riif/dsl/ctype_spec.rb +17 -0
  52. data/spec/riif/dsl/cust_spec.rb +18 -0
  53. data/spec/riif/dsl/emp_spec.rb +23 -0
  54. data/spec/riif/dsl/invitem_spec.rb +19 -0
  55. data/spec/riif/dsl/invmemo_spec.rb +17 -0
  56. data/spec/riif/dsl/klass_spec.rb +18 -0
  57. data/spec/riif/dsl/othername_spec.rb +21 -0
  58. data/spec/riif/dsl/paymeth_spec.rb +17 -0
  59. data/spec/riif/dsl/shipmeth_spec.rb +17 -0
  60. data/spec/riif/dsl/terms_spec.rb +21 -0
  61. data/spec/riif/dsl/timeact_spec.rb +24 -0
  62. data/spec/riif/dsl/trns_spec.rb +49 -0
  63. data/spec/riif/dsl/vend_spec.rb +19 -0
  64. data/spec/riif/dsl/vtype_spec.rb +17 -0
  65. data/spec/spec_helper.rb +21 -0
  66. metadata +191 -0
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe Riif::DSL::Ctype do
4
+ let(:expected) { File.read('spec/fixtures/ctype.iif') }
5
+
6
+ let(:ctype) {
7
+ Riif::IIF.new.ctype do
8
+ row do
9
+ name 'Bar'
10
+ end
11
+ end
12
+ }
13
+
14
+ subject { ctype }
15
+
16
+ it { should eq expected }
17
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe Riif::DSL::Cust do
4
+ let(:expected) { File.read('spec/fixtures/cust.iif') }
5
+
6
+ let(:cust) {
7
+ Riif::IIF.new.cust do
8
+ row do
9
+ name 'Jun Lin'
10
+ phone1 '12312323242'
11
+ end
12
+ end
13
+ }
14
+
15
+ subject { cust }
16
+
17
+ it { should eq expected }
18
+ end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ describe Riif::DSL::Emp do
4
+
5
+ let(:expected) { File.read('spec/fixtures/emp.iif') }
6
+
7
+ let(:emp) {
8
+ Riif::IIF.new.emp do
9
+ row do
10
+ name 'Alfred'
11
+ init 'Master'
12
+ addr1 'Backer'
13
+ addr2 '37'
14
+ salutation 'Doctor'
15
+ end
16
+ end
17
+ }
18
+
19
+ subject { emp }
20
+
21
+ it { should eq expected }
22
+ end
23
+
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ describe Riif::DSL::Invitem do
4
+ let(:expected) { File.read('spec/fixtures/invitem.iif') }
5
+
6
+ let(:invitem) {
7
+ Riif::IIF.new.invitem do
8
+ row do
9
+ name 'invitem 1'
10
+ invitemtype 'INVENTORY'
11
+ dep_type 1
12
+ end
13
+ end
14
+ }
15
+
16
+ subject { invitem }
17
+
18
+ it { should eq expected }
19
+ end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe Riif::DSL::Invmemo do
4
+ let(:expected) { File.read('spec/fixtures/invmemo.iif') }
5
+
6
+ let(:invmemo) {
7
+ Riif::IIF.new.invmemo do
8
+ row do
9
+ name 'invmemo 1'
10
+ end
11
+ end
12
+ }
13
+
14
+ subject { invmemo }
15
+
16
+ it { should eq expected }
17
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe Riif::DSL::Klass do
4
+
5
+ let(:expected) { File.read('spec/fixtures/klass.iif') }
6
+
7
+ let(:klass) {
8
+ Riif::IIF.new.klass do
9
+ row do
10
+ name 'Foo'
11
+ end
12
+ end
13
+ }
14
+
15
+ subject { klass }
16
+
17
+ it { should eq expected }
18
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe Riif::DSL::Othername do
4
+
5
+ let(:expected) { File.read('spec/fixtures/othername.iif') }
6
+
7
+ let(:othername) {
8
+ Riif::IIF.new.othername do
9
+ row do
10
+ name 'Alfred'
11
+ baddr1 'Backer'
12
+ baddr2 '37'
13
+ faxnum '123'
14
+ end
15
+ end
16
+ }
17
+
18
+ subject { othername }
19
+
20
+ it { should eq expected }
21
+ end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe Riif::DSL::Paymeth do
4
+ let(:expected) { File.read('spec/fixtures/paymeth.iif') }
5
+
6
+ let(:paymeth) {
7
+ Riif::IIF.new.paymeth do
8
+ row do
9
+ name 'paymeth 1'
10
+ end
11
+ end
12
+ }
13
+
14
+ subject { paymeth }
15
+
16
+ it { should eq expected }
17
+ end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe Riif::DSL::Shipmeth do
4
+ let(:expected) { File.read('spec/fixtures/shipmeth.iif') }
5
+
6
+ let(:shipmeth) {
7
+ Riif::IIF.new.shipmeth do
8
+ row do
9
+ name 'shipmeth 1'
10
+ end
11
+ end
12
+ }
13
+
14
+ subject { shipmeth }
15
+
16
+ it { should eq expected }
17
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe Riif::DSL::Terms do
4
+ let(:expected) { File.read('spec/fixtures/terms.iif') }
5
+
6
+ let(:terms) {
7
+ Riif::IIF.new.terms do
8
+ row do
9
+ name 'terms 1'
10
+ duedays 10
11
+ discper 0.3
12
+ discdays 1
13
+ termstype 0
14
+ end
15
+ end
16
+ }
17
+
18
+ subject { terms }
19
+
20
+ it { should eq expected }
21
+ end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ describe Riif::DSL::Timeact do
4
+ let(:expected) { File.read('spec/fixtures/timeact.iif') }
5
+
6
+ let(:timeact) {
7
+ Riif::IIF.new.timeact do
8
+ row do
9
+ date '06/21/97'
10
+ job 'job 1'
11
+ emp 'Jun'
12
+ item 'item 1'
13
+ duration '13:40'
14
+ proj 'klass 1'
15
+ billingstatus 0
16
+ end
17
+ end
18
+ }
19
+
20
+ subject { timeact }
21
+
22
+ it { should eq expected }
23
+ end
24
+
@@ -0,0 +1,49 @@
1
+ require 'spec_helper'
2
+
3
+ describe Riif::DSL::Trns do
4
+
5
+ let(:expected) { File.read('spec/fixtures/trns.iif') }
6
+
7
+ let(:trns) {
8
+ Riif::IIF.new.trns do
9
+ row do
10
+ trnsid 123
11
+ trnstype 'INVOICE'
12
+ date '8/31/1988'
13
+ accnt 'Accounts Receivable'
14
+ name 'Customer'
15
+ amount 20
16
+ docnum 1
17
+ clear 'N'
18
+ toprint 'N'
19
+ addr1 'Baker'
20
+ addr2 'Customer'
21
+ end
22
+
23
+ spl do
24
+ row do
25
+ splid '777'
26
+ trnstype 'INVOICE'
27
+ date '8/31/1988'
28
+ accnt 'Income Account'
29
+ amount '-20'
30
+ clear 'N'
31
+ qnty '-2'
32
+ price 10
33
+ invitem 'Sales Item'
34
+ taxable 'N'
35
+ end
36
+ end
37
+
38
+ spl do
39
+ row do
40
+ splid '888'
41
+ end
42
+ end
43
+ end
44
+ }
45
+
46
+ subject { trns }
47
+
48
+ it { should eq expected }
49
+ end
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ describe Riif::DSL::Vend do
4
+ let(:expected) { File.read('spec/fixtures/vend.iif') }
5
+
6
+ let(:vend) {
7
+ Riif::IIF.new.vend do
8
+ row do
9
+ name 'Jun Lin'
10
+ phone1 '12312323242'
11
+ _1099 'Y'
12
+ end
13
+ end
14
+ }
15
+
16
+ subject { vend }
17
+
18
+ it { should eq expected }
19
+ end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe Riif::DSL::Vtype do
4
+ let(:expected) { File.read('spec/fixtures/vtype.iif') }
5
+
6
+ let(:vtype) {
7
+ Riif::IIF.new.vtype do
8
+ row do
9
+ name 'vtype 1'
10
+ end
11
+ end
12
+ }
13
+
14
+ subject { vtype }
15
+
16
+ it { should eq expected }
17
+ end
@@ -0,0 +1,21 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # Require this file using `require "spec_helper"` to ensure that it is only
4
+ # loaded once.
5
+ #
6
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
+
8
+ require 'bundler'
9
+ Bundler.require(:default, :development, :test)
10
+
11
+ RSpec.configure do |config|
12
+ config.treat_symbols_as_metadata_keys_with_true_values = true
13
+ config.run_all_when_everything_filtered = true
14
+ config.filter_run :focus
15
+
16
+ # Run specs in random order to surface order dependencies. If you find an
17
+ # order dependency and want to debug it, you can fix the order by providing
18
+ # the seed, which is printed after each run.
19
+ # --seed 1234
20
+ config.order = 'random'
21
+ end
metadata ADDED
@@ -0,0 +1,191 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: riif
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Jun Lin
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-12-03 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ version_requirements: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ none: false
21
+ name: pry
22
+ type: :development
23
+ prerelease: false
24
+ requirement: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ! '>='
27
+ - !ruby/object:Gem::Version
28
+ version: '0'
29
+ none: false
30
+ - !ruby/object:Gem::Dependency
31
+ version_requirements: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ! '>='
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ none: false
37
+ name: rspec
38
+ type: :development
39
+ prerelease: false
40
+ requirement: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ none: false
46
+ - !ruby/object:Gem::Dependency
47
+ version_requirements: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ! '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ none: false
53
+ name: awesome_print
54
+ type: :development
55
+ prerelease: false
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ! '>='
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ none: false
62
+ description: DSL to generate IIF file
63
+ email:
64
+ - linjunpop@gmail.com
65
+ executables: []
66
+ extensions: []
67
+ extra_rdoc_files: []
68
+ files:
69
+ - .gitignore
70
+ - .rspec
71
+ - .travis.yml
72
+ - CHANGELOG.md
73
+ - Gemfile
74
+ - LICENSE.txt
75
+ - README.md
76
+ - Rakefile
77
+ - lib/riif.rb
78
+ - lib/riif/dsl/accnt.rb
79
+ - lib/riif/dsl/base.rb
80
+ - lib/riif/dsl/bud.rb
81
+ - lib/riif/dsl/ctype.rb
82
+ - lib/riif/dsl/cust.rb
83
+ - lib/riif/dsl/emp.rb
84
+ - lib/riif/dsl/invitem.rb
85
+ - lib/riif/dsl/invmemo.rb
86
+ - lib/riif/dsl/klass.rb
87
+ - lib/riif/dsl/othername.rb
88
+ - lib/riif/dsl/paymeth.rb
89
+ - lib/riif/dsl/shipmeth.rb
90
+ - lib/riif/dsl/spl.rb
91
+ - lib/riif/dsl/terms.rb
92
+ - lib/riif/dsl/timeact.rb
93
+ - lib/riif/dsl/trns.rb
94
+ - lib/riif/dsl/vend.rb
95
+ - lib/riif/dsl/vtype.rb
96
+ - lib/riif/iif.rb
97
+ - lib/riif/rails/template_handler.rb
98
+ - lib/riif/railtie.rb
99
+ - lib/riif/version.rb
100
+ - riif.gemspec
101
+ - spec/fixtures/accnt.iif
102
+ - spec/fixtures/bud.iif
103
+ - spec/fixtures/ctype.iif
104
+ - spec/fixtures/cust.iif
105
+ - spec/fixtures/emp.iif
106
+ - spec/fixtures/invitem.iif
107
+ - spec/fixtures/invmemo.iif
108
+ - spec/fixtures/klass.iif
109
+ - spec/fixtures/othername.iif
110
+ - spec/fixtures/paymeth.iif
111
+ - spec/fixtures/shipmeth.iif
112
+ - spec/fixtures/terms.iif
113
+ - spec/fixtures/timeact.iif
114
+ - spec/fixtures/trns.iif
115
+ - spec/fixtures/vend.iif
116
+ - spec/fixtures/vtype.iif
117
+ - spec/riif/dsl/accnt_spec.rb
118
+ - spec/riif/dsl/bud_spec.rb
119
+ - spec/riif/dsl/ctype_spec.rb
120
+ - spec/riif/dsl/cust_spec.rb
121
+ - spec/riif/dsl/emp_spec.rb
122
+ - spec/riif/dsl/invitem_spec.rb
123
+ - spec/riif/dsl/invmemo_spec.rb
124
+ - spec/riif/dsl/klass_spec.rb
125
+ - spec/riif/dsl/othername_spec.rb
126
+ - spec/riif/dsl/paymeth_spec.rb
127
+ - spec/riif/dsl/shipmeth_spec.rb
128
+ - spec/riif/dsl/terms_spec.rb
129
+ - spec/riif/dsl/timeact_spec.rb
130
+ - spec/riif/dsl/trns_spec.rb
131
+ - spec/riif/dsl/vend_spec.rb
132
+ - spec/riif/dsl/vtype_spec.rb
133
+ - spec/spec_helper.rb
134
+ homepage: ''
135
+ licenses: []
136
+ post_install_message:
137
+ rdoc_options: []
138
+ require_paths:
139
+ - lib
140
+ required_ruby_version: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ! '>='
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
145
+ none: false
146
+ required_rubygems_version: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - ! '>='
149
+ - !ruby/object:Gem::Version
150
+ version: '0'
151
+ none: false
152
+ requirements: []
153
+ rubyforge_project:
154
+ rubygems_version: 1.8.23
155
+ signing_key:
156
+ specification_version: 3
157
+ summary: A simple DSL to generate iif file
158
+ test_files:
159
+ - spec/fixtures/accnt.iif
160
+ - spec/fixtures/bud.iif
161
+ - spec/fixtures/ctype.iif
162
+ - spec/fixtures/cust.iif
163
+ - spec/fixtures/emp.iif
164
+ - spec/fixtures/invitem.iif
165
+ - spec/fixtures/invmemo.iif
166
+ - spec/fixtures/klass.iif
167
+ - spec/fixtures/othername.iif
168
+ - spec/fixtures/paymeth.iif
169
+ - spec/fixtures/shipmeth.iif
170
+ - spec/fixtures/terms.iif
171
+ - spec/fixtures/timeact.iif
172
+ - spec/fixtures/trns.iif
173
+ - spec/fixtures/vend.iif
174
+ - spec/fixtures/vtype.iif
175
+ - spec/riif/dsl/accnt_spec.rb
176
+ - spec/riif/dsl/bud_spec.rb
177
+ - spec/riif/dsl/ctype_spec.rb
178
+ - spec/riif/dsl/cust_spec.rb
179
+ - spec/riif/dsl/emp_spec.rb
180
+ - spec/riif/dsl/invitem_spec.rb
181
+ - spec/riif/dsl/invmemo_spec.rb
182
+ - spec/riif/dsl/klass_spec.rb
183
+ - spec/riif/dsl/othername_spec.rb
184
+ - spec/riif/dsl/paymeth_spec.rb
185
+ - spec/riif/dsl/shipmeth_spec.rb
186
+ - spec/riif/dsl/terms_spec.rb
187
+ - spec/riif/dsl/timeact_spec.rb
188
+ - spec/riif/dsl/trns_spec.rb
189
+ - spec/riif/dsl/vend_spec.rb
190
+ - spec/riif/dsl/vtype_spec.rb
191
+ - spec/spec_helper.rb