citeproc-js 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,8 +1,10 @@
1
1
  source :rubygems
2
2
  gemspec
3
3
 
4
- group :test do
4
+ group :debug do
5
5
  gem 'ruby-debug', :platforms => [:ruby_18, :jruby]
6
6
  gem 'ruby-debug19', :require => 'ruby-debug', :platforms => [:ruby_19]
7
- gem 'therubyrhino', :require => 'rhino', :platforms => [:jruby]
8
7
  end
8
+
9
+ gem 'therubyrhino', '~>1.72', :require => 'rhino', :platforms => [:jruby]
10
+ gem 'johnson', '~>1.2', :platforms => [:ruby_18]
data/README.md CHANGED
@@ -7,6 +7,16 @@ thin Ruby wrapper around Frank G. Benett's awesome
7
7
  [citeproc-js](https://bitbucket.org/fbennett/citeproc-js/overview).
8
8
 
9
9
 
10
+ Requirements
11
+ ------------
12
+
13
+ In addition to the dependencies defined by the gem, please make sure to
14
+ your environment meets the following requirements depending on your platform;
15
+
16
+ * For Ruby 1.8.7, please install [johnson](https://github.com/jbarnette/johnson).
17
+ * For JRuby, please install [therubyrhino](https://github.com/cowboyd/therubyrhino).
18
+
19
+ Support for other platforms is still in development.
10
20
 
11
21
 
12
22
  License
@@ -1,11 +1,24 @@
1
1
 
2
- ENV['EXECJS_RUNTIME'] = 'RubyRhino'
2
+ require 'citeproc/js/compatibility'
3
+
4
+ ruby_18 do
5
+ ENV['EXECJS_RUNTIME'] = 'Johnson'
6
+ end
7
+
8
+ jruby do
9
+ ENV['EXECJS_RUNTIME'] = 'RubyRhino'
10
+ end
3
11
 
4
12
  if ENV['DEBUG']
5
13
  require 'ruby-debug'
6
14
  Debugger.start
7
15
  end
8
16
 
17
+ require 'multi_json'
18
+ require 'execjs'
19
+
20
+ require 'forwardable'
21
+
9
22
  require 'citeproc'
10
23
 
11
24
  require 'citeproc/js/version'
@@ -43,7 +43,7 @@ module CiteProc
43
43
  end
44
44
 
45
45
  def extend_name(file)
46
- file = File.extname(file).empty? ? [file, extension].compact.join('.') : file
46
+ file = File.extname(file).empty? ? [file, extension].compact.join : file
47
47
  file = file.start_with?(prefix.to_s) ? file : [prefix,file].join
48
48
  file
49
49
  end
@@ -54,13 +54,13 @@ module CiteProc
54
54
  class Style
55
55
  include Asset
56
56
  @root = '/usr/local/share/citation-style-language/styles'.freeze
57
- @extension = 'csl'.freeze
57
+ @extension = '.csl'.freeze
58
58
  end
59
59
 
60
60
  class Locale
61
61
  include Asset
62
62
  @root = '/usr/local/share/citation-style-language/locales'.freeze
63
- @extension = 'xml'.freeze
63
+ @extension = '.xml'.freeze
64
64
  @prefix = 'locales-'
65
65
  end
66
66
 
@@ -0,0 +1,14 @@
1
+ if RUBY_VERSION < '1.9'
2
+ $KCODE = 'U'
3
+ def ruby_18; yield; end
4
+ def ruby_19; false; end
5
+ else
6
+ def ruby_18; false; end
7
+ def ruby_19; yield; end
8
+ end
9
+
10
+ if RUBY_PLATFORM =~ /java/i
11
+ def jruby; yield; end
12
+ else
13
+ def jruby; false; end
14
+ end
@@ -1,7 +1,3 @@
1
- require 'multi_json'
2
- require 'execjs'
3
-
4
- require 'forwardable'
5
1
 
6
2
  module CiteProc
7
3
  module JS
@@ -1,5 +1,5 @@
1
1
  module CiteProc
2
2
  module JS
3
- VERSION = '0.0.1'.freeze
3
+ VERSION = '0.0.2'.freeze
4
4
  end
5
5
  end
@@ -20,9 +20,16 @@ module CiteProc
20
20
  describe 'Style' do
21
21
 
22
22
  before(:all) do
23
+ @default_root = Style.root
24
+ @default_extension = Style.extension
23
25
  Style.root = root
24
26
  Style.extension = extension
25
27
  end
28
+
29
+ after(:all) do
30
+ Style.root = @default_root
31
+ Style.extension = @default_extension
32
+ end
26
33
 
27
34
  describe '.load' do
28
35
 
@@ -54,13 +54,17 @@ module CiteProc
54
54
  end
55
55
 
56
56
  context 'when started' do
57
- before(:each) do
58
- subject.style = :apa
59
- subject.locales = :'en-US'
60
- subject.start
57
+ let(:subject) do
58
+ Engine.new do |e|
59
+ p = double(:processor)
60
+ p.stub(:options).and_return { Processor.defaults }
61
+ p.stub(:items).and_return { load_items('items') }
62
+ e.processor = p
63
+ e.style = :apa
64
+ e.locales = :'en-US'
65
+ e.start
66
+ end
61
67
  end
62
-
63
- after(:each) { subject.stop }
64
68
 
65
69
  describe '#processor_version' do
66
70
  it 'returns the citeproc-js version' do
metadata CHANGED
@@ -1,145 +1,183 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: citeproc-js
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 27
4
5
  prerelease:
5
- version: 0.0.1
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 2
10
+ version: 0.0.2
6
11
  platform: ruby
7
12
  authors:
8
- - Sylvester Keil
13
+ - Sylvester Keil
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
17
 
13
- date: 2011-08-08 00:00:00 +02:00
14
- default_executable:
18
+ date: 2011-08-09 00:00:00 Z
15
19
  dependencies:
16
- - !ruby/object:Gem::Dependency
17
- name: citeproc
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
20
- none: false
21
- requirements:
22
- - - ~>
23
- - !ruby/object:Gem::Version
24
- version: "0.0"
25
- type: :runtime
26
- version_requirements: *id001
27
- - !ruby/object:Gem::Dependency
28
- name: execjs
29
- prerelease: false
30
- requirement: &id002 !ruby/object:Gem::Requirement
31
- none: false
32
- requirements:
33
- - - ">="
34
- - !ruby/object:Gem::Version
35
- version: 1.2.4
36
- - - <
37
- - !ruby/object:Gem::Version
38
- version: 1.3.0
39
- type: :runtime
40
- version_requirements: *id002
41
- - !ruby/object:Gem::Dependency
42
- name: cucumber
43
- prerelease: false
44
- requirement: &id003 !ruby/object:Gem::Requirement
45
- none: false
46
- requirements:
47
- - - ">="
48
- - !ruby/object:Gem::Version
49
- version: 1.0.2
50
- type: :development
51
- version_requirements: *id003
52
- - !ruby/object:Gem::Dependency
53
- name: rspec
54
- prerelease: false
55
- requirement: &id004 !ruby/object:Gem::Requirement
56
- none: false
57
- requirements:
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- version: 2.6.0
61
- type: :development
62
- version_requirements: *id004
63
- - !ruby/object:Gem::Dependency
64
- name: watchr
65
- prerelease: false
66
- requirement: &id005 !ruby/object:Gem::Requirement
67
- none: false
68
- requirements:
69
- - - ">="
70
- - !ruby/object:Gem::Version
71
- version: "0.7"
72
- type: :development
73
- version_requirements: *id005
20
+ - !ruby/object:Gem::Dependency
21
+ name: citeproc
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ hash: 11
29
+ segments:
30
+ - 0
31
+ - 0
32
+ version: "0.0"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: execjs
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 23
44
+ segments:
45
+ - 1
46
+ - 2
47
+ - 4
48
+ version: 1.2.4
49
+ - - <
50
+ - !ruby/object:Gem::Version
51
+ hash: 27
52
+ segments:
53
+ - 1
54
+ - 3
55
+ - 0
56
+ version: 1.3.0
57
+ type: :runtime
58
+ version_requirements: *id002
59
+ - !ruby/object:Gem::Dependency
60
+ name: cucumber
61
+ prerelease: false
62
+ requirement: &id003 !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ hash: 19
68
+ segments:
69
+ - 1
70
+ - 0
71
+ - 2
72
+ version: 1.0.2
73
+ type: :development
74
+ version_requirements: *id003
75
+ - !ruby/object:Gem::Dependency
76
+ name: rspec
77
+ prerelease: false
78
+ requirement: &id004 !ruby/object:Gem::Requirement
79
+ none: false
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ hash: 23
84
+ segments:
85
+ - 2
86
+ - 6
87
+ - 0
88
+ version: 2.6.0
89
+ type: :development
90
+ version_requirements: *id004
91
+ - !ruby/object:Gem::Dependency
92
+ name: watchr
93
+ prerelease: false
94
+ requirement: &id005 !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ hash: 5
100
+ segments:
101
+ - 0
102
+ - 7
103
+ version: "0.7"
104
+ type: :development
105
+ version_requirements: *id005
74
106
  description: A citeproc engine based on the citeproc-js CSL (Citation Style Language) processor.
75
107
  email:
76
- - http://sylvester.keil.or.at
108
+ - http://sylvester.keil.or.at
77
109
  executables: []
78
110
 
79
111
  extensions: []
80
112
 
81
113
  extra_rdoc_files:
82
- - README.md
114
+ - README.md
83
115
  files:
84
- - .gitignore
85
- - .rspec
86
- - Gemfile
87
- - LICENSE
88
- - README.md
89
- - auto.watchr
90
- - citeproc-js.gemspec
91
- - lib/citeproc/js.rb
92
- - lib/citeproc/js/assets.rb
93
- - lib/citeproc/js/engine.rb
94
- - lib/citeproc/js/support/citeproc.js
95
- - lib/citeproc/js/support/system.js
96
- - lib/citeproc/js/support/xmldom.js
97
- - lib/citeproc/js/support/xmle4x.js
98
- - lib/citeproc/js/version.rb
99
- - spec/citeproc/js/assets_spec.rb
100
- - spec/citeproc/js/engine_spec.rb
101
- - spec/fixtures/items/items.json
102
- - spec/fixtures/locales/locales-en-US.xml
103
- - spec/fixtures/styles/apa.csl
104
- - spec/spec_helper.rb
105
- has_rdoc: true
116
+ - .gitignore
117
+ - .rspec
118
+ - Gemfile
119
+ - LICENSE
120
+ - README.md
121
+ - auto.watchr
122
+ - citeproc-js.gemspec
123
+ - lib/citeproc/js.rb
124
+ - lib/citeproc/js/assets.rb
125
+ - lib/citeproc/js/compatibility.rb
126
+ - lib/citeproc/js/engine.rb
127
+ - lib/citeproc/js/support/citeproc.js
128
+ - lib/citeproc/js/support/system.js
129
+ - lib/citeproc/js/support/xmldom.js
130
+ - lib/citeproc/js/support/xmle4x.js
131
+ - lib/citeproc/js/version.rb
132
+ - spec/citeproc/js/assets_spec.rb
133
+ - spec/citeproc/js/engine_spec.rb
134
+ - spec/fixtures/items/items.json
135
+ - spec/fixtures/locales/locales-en-US.xml
136
+ - spec/fixtures/styles/apa.csl
137
+ - spec/spec_helper.rb
106
138
  homepage: http://inukshuk.github.com/citeproc-js
107
139
  licenses:
108
- - AGPLv3
140
+ - AGPLv3
109
141
  post_install_message:
110
142
  rdoc_options:
111
- - --line-numbers
112
- - --inline-source
113
- - --title
114
- - "\"CiteProc-JS Rubygem\""
115
- - --main
116
- - README.md
117
- - --webcvs=http://github.com/inukshuk/citeproc-js/tree/master/
143
+ - --line-numbers
144
+ - --inline-source
145
+ - --title
146
+ - "\"CiteProc-JS Rubygem\""
147
+ - --main
148
+ - README.md
149
+ - --webcvs=http://github.com/inukshuk/citeproc-js/tree/master/
118
150
  require_paths:
119
- - lib
151
+ - lib
120
152
  required_ruby_version: !ruby/object:Gem::Requirement
121
153
  none: false
122
154
  requirements:
123
- - - ">="
124
- - !ruby/object:Gem::Version
125
- version: "0"
155
+ - - ">="
156
+ - !ruby/object:Gem::Version
157
+ hash: 3
158
+ segments:
159
+ - 0
160
+ version: "0"
126
161
  required_rubygems_version: !ruby/object:Gem::Requirement
127
162
  none: false
128
163
  requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- version: "0"
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ hash: 3
167
+ segments:
168
+ - 0
169
+ version: "0"
132
170
  requirements: []
133
171
 
134
172
  rubyforge_project:
135
- rubygems_version: 1.5.1
173
+ rubygems_version: 1.8.5
136
174
  signing_key:
137
175
  specification_version: 3
138
176
  summary: A citeproc engine based on citeproc-js.
139
177
  test_files:
140
- - spec/citeproc/js/assets_spec.rb
141
- - spec/citeproc/js/engine_spec.rb
142
- - spec/fixtures/items/items.json
143
- - spec/fixtures/locales/locales-en-US.xml
144
- - spec/fixtures/styles/apa.csl
145
- - spec/spec_helper.rb
178
+ - spec/citeproc/js/assets_spec.rb
179
+ - spec/citeproc/js/engine_spec.rb
180
+ - spec/fixtures/items/items.json
181
+ - spec/fixtures/locales/locales-en-US.xml
182
+ - spec/fixtures/styles/apa.csl
183
+ - spec/spec_helper.rb