Skip to content

Commit 3ec756d

Browse files
author
Karthikeya Udupa KM
authored
Merge pull request #31 from /issues/28-fix-code-base
Issues/28 fix code base
2 parents 73fa2d5 + 149c4e5 commit 3ec756d

File tree

74 files changed

+2931
-2950
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+2931
-2950
lines changed

.slather.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
coverage_service: cobertura_xml
2+
xcodeproj: SwiftyJSONAccelerator.xcodeproj
3+
scheme: SwiftyJSONAccelerator
4+
output_directory: build/slather/
5+
workspace: SwiftyJSONAccelerator.xcworkspace
6+
ignore:
7+
- SwiftyJSONAccelerator/External-Libraries/*
8+
- SwiftyJSONAccelerator/Storyboard/*
9+
- SwiftyJSONAccelerator/Application-Delegate/*
10+
- SwiftyJSONAccelerator/UI/*
11+
- Pods/*

.swiftlint.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
disabled_rules: # rule identifiers to exclude from running
2+
- line_length
3+
- function_body_length
4+
excluded: # paths to ignore during linting. Takes precedence over `included`.
5+
- SwiftyJSONAcceleratorTests
6+
- Pods
7+
- SwiftyJSONAccelerator/External-Libraries

.travis.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
language: objective-c
2+
cache:
3+
- bundler
4+
- cocoapods
5+
osx_image: xcode8.0
6+
xcode_workspace: SwiftyJSONAccelerator.xcworkspace
7+
xcode_scheme: SwiftyJSONAccelerator
8+
xcode_sdk: macosx10.11
9+
podfile: Podfile
10+
install:
11+
- bundle install
12+
- gem install cocoapods
13+
- ./install_swiftlint.sh
14+
before_script:
15+
- rm -rf Pods
16+
- rm -rf Podlock
17+
- bundle install
18+
- bundle exec pod install
19+
script:
20+
- xcodebuild -workspace SwiftyJSONAccelerator.xcworkspace -schee "SwiftyJSONAccelerator" test | tee xcodebuild.log | xcpretty -s
21+
- swiftlint
22+
after_success:
23+
- slather
24+
- bash <(curl -s https://codecov.io/bash) -f build/slather/cobertura.xml

Gemfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
source 'https://rubygems.org'
2+
3+
gem 'cocoapods'
4+
gem 'synx'
5+
gem 'xcpretty'
6+
gem 'slather'

Gemfile.lock

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
activesupport (4.2.6)
5+
i18n (~> 0.7)
6+
json (~> 1.7, >= 1.7.7)
7+
minitest (~> 5.1)
8+
thread_safe (~> 0.3, >= 0.3.4)
9+
tzinfo (~> 1.1)
10+
claide (1.0.0)
11+
clamp (0.6.5)
12+
cocoapods (1.0.1)
13+
activesupport (>= 4.0.2)
14+
claide (>= 1.0.0, < 2.0)
15+
cocoapods-core (= 1.0.1)
16+
cocoapods-deintegrate (>= 1.0.0, < 2.0)
17+
cocoapods-downloader (>= 1.0.0, < 2.0)
18+
cocoapods-plugins (>= 1.0.0, < 2.0)
19+
cocoapods-search (>= 1.0.0, < 2.0)
20+
cocoapods-stats (>= 1.0.0, < 2.0)
21+
cocoapods-trunk (>= 1.0.0, < 2.0)
22+
cocoapods-try (>= 1.0.0, < 2.0)
23+
colored (~> 1.2)
24+
escape (~> 0.0.4)
25+
fourflusher (~> 0.3.0)
26+
molinillo (~> 0.4.5)
27+
nap (~> 1.0)
28+
xcodeproj (>= 1.1.0, < 2.0)
29+
cocoapods-core (1.0.1)
30+
activesupport (>= 4.0.2)
31+
fuzzy_match (~> 2.0.4)
32+
nap (~> 1.0)
33+
cocoapods-deintegrate (1.0.0)
34+
cocoapods-downloader (1.0.0)
35+
cocoapods-plugins (1.0.0)
36+
nap
37+
cocoapods-search (1.0.0)
38+
cocoapods-stats (1.0.0)
39+
cocoapods-trunk (1.0.0)
40+
nap (>= 0.8, < 2.0)
41+
netrc (= 0.7.8)
42+
cocoapods-try (1.0.0)
43+
colored (1.2)
44+
colorize (0.7.7)
45+
escape (0.0.4)
46+
fourflusher (0.3.1)
47+
fuzzy_match (2.0.4)
48+
i18n (0.7.0)
49+
json (1.7.7)
50+
mini_portile2 (2.1.0)
51+
minitest (5.9.0)
52+
molinillo (0.4.5)
53+
nap (1.1.0)
54+
netrc (0.7.8)
55+
nokogiri (1.6.8)
56+
mini_portile2 (~> 2.1.0)
57+
pkg-config (~> 1.1.7)
58+
pkg-config (1.1.7)
59+
rouge (1.10.1)
60+
slather (2.2.1)
61+
clamp (~> 0.6)
62+
nokogiri (~> 1.6.3)
63+
xcodeproj (~> 1.1)
64+
synx (0.2.1)
65+
clamp (~> 0.6)
66+
colorize (~> 0.7)
67+
xcodeproj (~> 1.0)
68+
thread_safe (0.3.5)
69+
tzinfo (1.2.2)
70+
thread_safe (~> 0.1)
71+
xcodeproj (1.1.0)
72+
activesupport (>= 3)
73+
claide (>= 1.0.0, < 2.0)
74+
colored (~> 1.2)
75+
xcpretty (0.2.2)
76+
rouge (~> 1.8)
77+
78+
PLATFORMS
79+
ruby
80+
81+
DEPENDENCIES
82+
cocoapods
83+
slather
84+
synx
85+
xcpretty
86+
87+
BUNDLED WITH
88+
1.12.5

Makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
WORKSPACE = SwiftyJSONAccelerator.xcworkspace
2+
PROJECT = SwiftyJSONAccelerator.xcodeproj
3+
SCHEME = "SwiftyJSONAccelerator"
4+
5+
synxify:
6+
bundle exec synx $(PROJECT)
7+
8+
build:
9+
xcodebuild ONLY_ACTIVE_ARCH=NO -workspace $(WORKSPACE) -scheme $(SCHEME) -configuration Debug clean build | tee xcodebuild.log | xcpretty
10+
11+
citest:
12+
xcodebuild -workspace $(WORKSPACE) -scheme $(SCHEME) test | tee xcodebuild.log | xcpretty -s
13+
14+
test:
15+
rm -rf build
16+
xcodebuild ONLY_ACTIVE_ARCH=NO -workspace $(WORKSPACE) -scheme $(SCHEME) test | tee xcodebuild.log | xcpretty -s
17+
slather
18+
rm xcodebuild.log

Podfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
platform :osx, '10.10'
2+
use_frameworks!
3+
inhibit_all_warnings!
4+
5+
6+
target 'SwiftyJSONAccelerator' do
7+
pod 'SwiftyJSON'
8+
end
9+
10+
target 'SwiftyJSONAcceleratorTests' do
11+
pod 'SwiftyJSON'
12+
pod 'Nimble'
13+
end
14+
15+
post_install do |installer|
16+
installer.pods_project.targets.each do |target|
17+
puts target.name
18+
end
19+
end

README.md

Lines changed: 49 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,70 @@
1+
![Logo](https://raw.githubusercontent.com/insanoid/SwiftyJSONAccelerator/master/SwiftyJSONAccelerator/Assets.xcassets/AppIcon.appiconset/Icon_32x32%402x.png)
2+
13
# SwiftyJSONAccelerator
24

3-
**(Alpha v0.0.6)**
5+
[![Build
6+
Status](https://travis-ci.org/insanoid/SwiftyJSONAccelerator.svg?branch=master)](https://travis-ci.org/insanoid/SwiftyJSONAccelerator) [![codecov](https://codecov.io/gh/insanoid/SwiftyJSONAccelerator/branch/master/graph/badge.svg)](https://codecov.io/gh/insanoid/SwiftyJSONAccelerator)
47

5-
[Download the .app (v0.0.6)](https://github.com/insanoid/SwiftyJSONAccelerator/releases/download/v0.0.6/SwiftyJSONAccelerator.zip)
8+
** Version v1.0.0 Released! **
69

7-
![Logo](https://raw.githubusercontent.com/insanoid/SwiftyJSONAccelerator/master/SwiftyJSONAccelerator/Assets.xcassets/AppIcon.appiconset/Icon_32x32%402x.png)
10+
- Now generates **Swift 3** and the software itself is upgraded to Swift 3.
11+
- Unit tests and complete code coverage for file generation module.
12+
- Modular code to make adding support for other JSON mapping libraries simple.
13+
- Project upgraded with SwiftLint, Travis, CocoaPods etc.
14+
15+
[Download the .app (v1.0.0)](https://github.com/insanoid/SwiftyJSONAccelerator/releases/download/v1.0.0/SwiftyJSONAccelerator.zip)
816

917
A swift model generator like the Objective-C [JSONAccelerator](http://nerdery.com/json-accelerator). Formats and generates models for the given JSON and also breaks them into files making it easy to manage and share between several models.
1018

1119
The models that are generated depend on JSON object mapping libraries, currently the model can be generated to depend on any of the below mentioned mapping libraries:
1220

1321
- [SwiftyJSON](https://github.com/SwiftyJSON/SwiftyJSON)
14-
- [Hearst-DD/ObjectMapper](https://github.com/Hearst-DD/ObjectMapper) (Contributed by: [brendan09](https://github.com/brendan09))
22+
- [Hearst-DD/ObjectMapper](https://github.com/Hearst-DD/ObjectMapper)
1523

1624
Currently, the pattern is very similar to its Objective-C counterpart. It generates classes with following properties.
1725

18-
- Initalize with `JSON` (SwiftyJSON or ObjectMapper)
19-
- Initalize with `AnyObject`
26+
- Initalize with `JSON` (SwiftyJSON or ObjectMapper) or Initalize with `Any`
2027
- Optional `NSCoding` compliance.
21-
- Convert object to `NSDictionary`
22-
23-
![Preview](https://raw.githubusercontent.com/insanoid/SwiftyJSONAccelerator/master/preview.png)
28+
- Convert object to `Dictionary` for description printing.
29+
30+
![Preview](preview.png)
31+
32+
- Simple configurable interface for generation of file.
33+
- Each class in the JSON is generated as a file._
34+
35+
## Adding New Libraries
36+
37+
--------------------------------------------------------------------------------
38+
39+
- Add a new type in `JSONMappingLibrary` in [Constants.swift](SwiftyJSONAccelerator/Constants.swift).
40+
- Follow the examples in [Library-Extensions](SwiftyJSONAccelerator/Library-Extensions) and create a struct implementing`ModelFile`. Follow the other extensions for SwiftyJSON and ObjectMapper, they tell you what all you can replace based on your libraries specification.
41+
- Do the necessary UI changes for the dropdown.
42+
- Add tests for your library.
43+
44+
## Swift 2?
45+
46+
--------------------------------------------------------------------------------
47+
48+
[Download (v0.0.6)](https://github.com/insanoid/SwiftyJSONAccelerator/releases/download/v0.0.6/SwiftyJSONAccelerator.zip), the older version of the project, please keep in mind it is **no longer supported**.
49+
50+
## Todo
51+
52+
--------------------------------------------------------------------------------
53+
54+
There is a lot more to do, follow the [issues section](https://github.com/insanoid/SwiftyJSONAccelerator/issues), I usually try to follow up or keep the list updated with any new ideas which I plan to implement.
2455

25-
*Simple configurable interface for generation of file*
56+
- Build a CLI, useful in integrated with mocks and API documentations.
57+
- Creating a better UI for the application.
58+
- Adding support for better libraries mentioned [here](https://github.com/bwhiteley/JSONShootout).
2659

60+
## Contributions and Requests
2761

28-
![Preview](https://raw.githubusercontent.com/insanoid/SwiftyJSONAccelerator/master/preview_ii.png)
62+
--------------------------------------------------------------------------------
2963

30-
*Each class in the JSON is generated as a file.*
64+
Any suggestions regarding code quality of the app, generated code's quality, Swift related improvements and pull requests are all very welcome. Please make sure you submit the pull request to the next release branch and not the master branch.
3165

32-
## TODO
66+
## License
3367

34-
- Handle blank array a bit better.
35-
- Better User Interface and icon.
36-
- Generate both `struct` and `class`.
37-
- Support for further JSON object modelling libraries.
38-
- Add tests and integrate with Travis CI.
39-
- Create a Xcode plugin and a command line executor.
68+
--------------------------------------------------------------------------------
4069

41-
---
42-
Any suggestions regarding code quality of the app, generated code's quaility, Swift related improvements and pull requests are all very welcome.
70+
[MIT License](LICENSE) / [Karthikeya Udupa](https://karthikeya.co.uk)

0 commit comments

Comments
 (0)