apispec 0.0.4 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,30 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ apispec (0.0.4)
5
+ RedCloth
6
+ coderay
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ RedCloth (4.2.9)
12
+ RedCloth (4.2.9-java)
13
+ coderay (1.0.9)
14
+ diff-lcs (1.2.2)
15
+ rspec (2.13.0)
16
+ rspec-core (~> 2.13.0)
17
+ rspec-expectations (~> 2.13.0)
18
+ rspec-mocks (~> 2.13.0)
19
+ rspec-core (2.13.1)
20
+ rspec-expectations (2.13.0)
21
+ diff-lcs (>= 1.1.3, < 2.0)
22
+ rspec-mocks (2.13.1)
23
+
24
+ PLATFORMS
25
+ java
26
+ ruby
27
+
28
+ DEPENDENCIES
29
+ apispec!
30
+ rspec
data/Rakefile CHANGED
@@ -1,9 +1,4 @@
1
- require "rubygems"
2
- require "spec/rake/spectask"
3
- Spec::Rake::SpecTask.new(:spec) do |t|
4
- t.spec_files = Dir.glob('spec/**/*_spec.rb')
5
- t.spec_opts << '--diff --format d'
6
- #t.rcov = true
7
- end
8
-
9
- task :default => :spec
1
+ require 'rspec/core/rake_task'
2
+ require 'bundler/gem_tasks'
3
+ RSpec::Core::RakeTask.new(:spec)
4
+ task :default => :spec
data/apispec.gemspec CHANGED
@@ -12,9 +12,9 @@ Gem::Specification.new do |s|
12
12
  s.description = "A documentation generator for http/rest"
13
13
 
14
14
  dependencies = [
15
- [:runtime, "RedCloth", "~> 4.2.7"],
16
- [:runtime, "coderay", "~> 0.9.7"],
17
- [:development, "rspec", "~> 2.1"],
15
+ [:runtime, "RedCloth"],
16
+ [:runtime, "coderay"],
17
+ [:development, "rspec"],
18
18
  ]
19
19
 
20
20
  s.files = Dir['**/*']
@@ -4,7 +4,7 @@ require "fileutils"
4
4
  class APISpec::Generator
5
5
  attr_reader :namespace, :logger
6
6
 
7
- def initialize(options)
7
+ def initialize(options = {})
8
8
  @options = options
9
9
  # logging
10
10
  @logger = Logger.new(STDOUT)
@@ -1,6 +1,3 @@
1
1
  module APISpec
2
- TINY = 4
3
- MINOR = 0
4
- MAJOR = 0
5
- VERSION = [MAJOR, MINOR, TINY].join(".")
2
+ VERSION = "0.1.0"
6
3
  end
@@ -3,26 +3,40 @@ require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
3
3
  EXAMPLE_DIR = File.expand_path(File.join(File.dirname(__FILE__), "..", "example"))
4
4
 
5
5
  describe APISpec::Generator do
6
- before(:each) do
7
- @generator = APISpec::Generator.new
8
- @generator.working_directory = EXAMPLE_DIR
9
- end
10
-
11
- it "should be possible to parse the example" do
12
- @generator.parse_files!
13
- end
6
+ let(:generator) { described_class.new :workspace => EXAMPLE_DIR }
14
7
 
15
- it "should be possible to parse the example" do
16
- @generator.parse_files!
17
- puts @generator.namespace.print_tree()
18
- end
8
+ context "parsed" do
9
+ before { generator.parse_files! }
10
+
11
+ context "#print_tree" do
12
+ let(:tree) { generator.namespace.print_tree() }
13
+ subject { tree }
14
+
15
+ it { should include('Namespace (Nodes: 6)') }
16
+ it { should include(' Namespace Account (Nodes: 7)') }
17
+ it { should include(' User => Object User') }
18
+ it { should include(' UserRest => Interface UserRest') }
19
+ it { should include(' firstname => Field firstname') }
20
+ it { should include(' id => Field id') }
21
+ it { should include(' lastname => Field lastname') }
22
+ it { should include(' login => Field login') }
23
+ it { should include(' password => Field password') }
24
+ it { should include(' Folder => Object Folder') }
25
+ it { should include(' FolderID => Field folder_id') }
26
+ it { should include(' Folders => Interface Folders') }
27
+ it { should include(' SystemCheck => Interface SystemCheck') }
28
+ it { should include(' UserID => Field X-User') }
29
+ end
19
30
 
20
- it "should be possible to find fields using there path" do
21
- @generator.parse_files!
22
- field = @generator.namespace.find_field("Header.X-User")
31
+ it "should be possible to find fields using there path" do
32
+ generator.namespace.find_field("Account.User").should_not be_nil
33
+ generator.namespace.find_field("Folder").should_not be_nil
34
+ generator.namespace.find_field("UserID").should_not be_nil
35
+ end
23
36
 
24
- field = @generator.namespace.find_field("Header.Quota.X-QuotaSize")
25
- # ...
26
- field = @generator.namespace.find_field("Mail.attachments")
37
+ it "raises error if something is already definded" do
38
+ expect { generator.parse_files! }.to \
39
+ raise_error(APISpec::Namespace::AlreadyDefinedError)
40
+ end
27
41
  end
28
- end
42
+ end
data/spec/spec_helper.rb CHANGED
@@ -1 +1,20 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), "..", "lib", "apispec"))
1
+ $:.unshift(File.expand_path("../../lib", __FILE__))
2
+ require "apispec"
3
+
4
+ # This file was generated by the `rspec --init` command. Conventionally, all
5
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
6
+ # Require this file using `require "spec_helper"` to ensure that it is only
7
+ # loaded once.
8
+ #
9
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
10
+ RSpec.configure do |config|
11
+ config.treat_symbols_as_metadata_keys_with_true_values = true
12
+ config.run_all_when_everything_filtered = true
13
+ config.filter_run :focus
14
+
15
+ # Run specs in random order to surface order dependencies. If you find an
16
+ # order dependency and want to debug it, you can fix the order by providing
17
+ # the seed, which is printed after each run.
18
+ # --seed 1234
19
+ config.order = 'random'
20
+ end
metadata CHANGED
@@ -1,85 +1,78 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: apispec
3
- version: !ruby/object:Gem::Version
4
- hash: 23
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 4
10
- version: 0.0.4
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Vincent Landgraf
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-09-28 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2013-04-12 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: RedCloth
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 57
29
- segments:
30
- - 4
31
- - 2
32
- - 7
33
- version: 4.2.7
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
34
22
  type: :runtime
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: coderay
38
23
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
40
25
  none: false
41
- requirements:
42
- - - ~>
43
- - !ruby/object:Gem::Version
44
- hash: 53
45
- segments:
46
- - 0
47
- - 9
48
- - 7
49
- version: 0.9.7
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: coderay
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
50
38
  type: :runtime
51
- version_requirements: *id002
52
- - !ruby/object:Gem::Dependency
53
- name: rspec
54
39
  prerelease: false
55
- requirement: &id003 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
56
41
  none: false
57
- requirements:
58
- - - ~>
59
- - !ruby/object:Gem::Version
60
- hash: 1
61
- segments:
62
- - 2
63
- - 1
64
- version: "2.1"
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
65
54
  type: :development
66
- version_requirements: *id003
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
67
62
  description: A documentation generator for http/rest
68
63
  email: vilandgr+github@googlemail.com
69
- executables:
64
+ executables:
70
65
  - apispec
71
66
  extensions: []
72
-
73
67
  extra_rdoc_files: []
74
-
75
- files:
76
- - apispec-0.0.2.gem
77
- - apispec-0.0.3.gem
68
+ files:
78
69
  - apispec.gemspec
79
70
  - bin/apispec
80
71
  - example/datagram/user.json
81
72
  - example/example.rb
82
73
  - example/user.rb
74
+ - Gemfile
75
+ - Gemfile.lock
83
76
  - lib/apispec/example.rb
84
77
  - lib/apispec/field.rb
85
78
  - lib/apispec/generator.rb
@@ -116,38 +109,29 @@ files:
116
109
  - templates/resource.html.erb
117
110
  homepage: http://github.com/threez/apispec/
118
111
  licenses: []
119
-
120
112
  post_install_message:
121
113
  rdoc_options: []
122
-
123
- require_paths:
114
+ require_paths:
124
115
  - lib
125
- required_ruby_version: !ruby/object:Gem::Requirement
116
+ required_ruby_version: !ruby/object:Gem::Requirement
126
117
  none: false
127
- requirements:
128
- - - ">="
129
- - !ruby/object:Gem::Version
130
- hash: 3
131
- segments:
132
- - 0
133
- version: "0"
134
- required_rubygems_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ! '>='
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ required_rubygems_version: !ruby/object:Gem::Requirement
135
123
  none: false
136
- requirements:
137
- - - ">="
138
- - !ruby/object:Gem::Version
139
- hash: 3
140
- segments:
141
- - 0
142
- version: "0"
124
+ requirements:
125
+ - - ! '>='
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
143
128
  requirements: []
144
-
145
129
  rubyforge_project:
146
- rubygems_version: 1.8.10
130
+ rubygems_version: 1.8.24
147
131
  signing_key:
148
132
  specification_version: 3
149
133
  summary: A ruby based http/rest documentation generator
150
- test_files:
134
+ test_files:
151
135
  - spec/dsl/example_spec.rb
152
136
  - spec/dsl/field_spec.rb
153
137
  - spec/dsl/interface_spec.rb
@@ -156,3 +140,4 @@ test_files:
156
140
  - spec/dsl/resource_spec.rb
157
141
  - spec/generator_spec.rb
158
142
  - spec/spec_helper.rb
143
+ has_rdoc:
data/apispec-0.0.2.gem DELETED
Binary file
data/apispec-0.0.3.gem DELETED
Binary file