xcres 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +33 -0
- data/.travis.yml +18 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +85 -0
- data/LICENSE.txt +22 -0
- data/README.md +181 -0
- data/Rakefile +58 -0
- data/bin/xcres +12 -0
- data/lib/xcres/analyzer/aggregate_analyzer.rb +48 -0
- data/lib/xcres/analyzer/analyzer.rb +141 -0
- data/lib/xcres/analyzer/resources_aggregate_analyzer.rb +27 -0
- data/lib/xcres/analyzer/resources_analyzer/base_resources_analyzer.rb +133 -0
- data/lib/xcres/analyzer/resources_analyzer/bundle_resources_analyzer.rb +68 -0
- data/lib/xcres/analyzer/resources_analyzer/loose_resources_analyzer.rb +39 -0
- data/lib/xcres/analyzer/resources_analyzer/xcassets_analyzer.rb +62 -0
- data/lib/xcres/analyzer/strings_analyzer.rb +255 -0
- data/lib/xcres/builder/file_builder.rb +61 -0
- data/lib/xcres/builder/resources_builder.rb +184 -0
- data/lib/xcres/builder/string_builder.rb +31 -0
- data/lib/xcres/command/build_command.rb +83 -0
- data/lib/xcres/command/command.rb +58 -0
- data/lib/xcres/command/install_command.rb +173 -0
- data/lib/xcres/command/main_command.rb +14 -0
- data/lib/xcres/command/project_command.rb +111 -0
- data/lib/xcres/command/version_command.rb +12 -0
- data/lib/xcres/helper/file_helper.rb +16 -0
- data/lib/xcres/logger.rb +148 -0
- data/lib/xcres/model/section.rb +43 -0
- data/lib/xcres/model/xcassets/bundle.rb +55 -0
- data/lib/xcres/model/xcassets/resource.rb +141 -0
- data/lib/xcres/model/xcassets/resource_image.rb +134 -0
- data/lib/xcres/version.rb +9 -0
- data/lib/xcres.rb +9 -0
- data/spec/fixtures/Example/Example/AppDelegate.h +15 -0
- data/spec/fixtures/Example/Example/AppDelegate.m +49 -0
- data/spec/fixtures/Example/Example/Example-Info.plist +38 -0
- data/spec/fixtures/Example/Example/Example-Prefix.pch +16 -0
- data/spec/fixtures/Example/Example/Images/doge.jpeg +0 -0
- data/spec/fixtures/Example/Example/Images/nyanCat.png +0 -0
- data/spec/fixtures/Example/Example/Images.xcassets/AppIcon.appiconset/Contents.json +23 -0
- data/spec/fixtures/Example/Example/Images.xcassets/Doge.imageset/Contents.json +18 -0
- data/spec/fixtures/Example/Example/Images.xcassets/Doge.imageset/doge.png +0 -0
- data/spec/fixtures/Example/Example/Images.xcassets/Doge.imageset/doge@2x.png +0 -0
- data/spec/fixtures/Example/Example/Images.xcassets/LaunchImage.launchimage/Contents.json +23 -0
- data/spec/fixtures/Example/Example/de.lproj/Localizable.strings +12 -0
- data/spec/fixtures/Example/Example/en.lproj/InfoPlist.strings +2 -0
- data/spec/fixtures/Example/Example/en.lproj/Localizable.strings +15 -0
- data/spec/fixtures/Example/Example/main.m +18 -0
- data/spec/fixtures/Example/Example.xcodeproj/project.pbxproj +449 -0
- data/spec/fixtures/Example/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- data/spec/fixtures/ExampleOSX/ExampleOSX/AppDelegate.h +15 -0
- data/spec/fixtures/ExampleOSX/ExampleOSX/AppDelegate.m +18 -0
- data/spec/fixtures/ExampleOSX/ExampleOSX/Base.lproj/MainMenu.xib +680 -0
- data/spec/fixtures/ExampleOSX/ExampleOSX/ExampleOSX-Info.plist +34 -0
- data/spec/fixtures/ExampleOSX/ExampleOSX/ExampleOSX-Prefix.pch +9 -0
- data/spec/fixtures/ExampleOSX/ExampleOSX/Images.xcassets/AppIcon.appiconset/Contents.json +58 -0
- data/spec/fixtures/ExampleOSX/ExampleOSX/en.lproj/Credits.rtf +29 -0
- data/spec/fixtures/ExampleOSX/ExampleOSX/en.lproj/InfoPlist.strings +2 -0
- data/spec/fixtures/ExampleOSX/ExampleOSX/main.m +14 -0
- data/spec/fixtures/ExampleOSX/ExampleOSX.xcodeproj/project.pbxproj +481 -0
- data/spec/fixtures/ExampleOSX/ExampleOSX.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- data/spec/fixtures/ExampleOSX/ExampleOSXTests/ExampleOSXTests-Info.plist +22 -0
- data/spec/fixtures/ExampleOSX/ExampleOSXTests/ExampleOSXTests.m +34 -0
- data/spec/fixtures/ExampleOSX/ExampleOSXTests/en.lproj/InfoPlist.strings +2 -0
- data/spec/integration/build/after/Example/Example/AppDelegate.h +15 -0
- data/spec/integration/build/after/Example/Example/AppDelegate.m +49 -0
- data/spec/integration/build/after/Example/Example/Example-Info.plist +38 -0
- data/spec/integration/build/after/Example/Example/Example-Prefix.pch +16 -0
- data/spec/integration/build/after/Example/Example/Icons.bundle/tab_bar/tabbar_list.png +0 -0
- data/spec/integration/build/after/Example/Example/Icons.bundle/tab_bar/tabbar_list@2x.png +0 -0
- data/spec/integration/build/after/Example/Example/Icons.bundle/tab_bar/tabbar_map.png +0 -0
- data/spec/integration/build/after/Example/Example/Icons.bundle/tab_bar/tabbar_map@2x.png +0 -0
- data/spec/integration/build/after/Example/Example/Images/doge.jpeg +0 -0
- data/spec/integration/build/after/Example/Example/Images/nyanCat.png +0 -0
- data/spec/integration/build/after/Example/Example/Images.xcassets/AppIcon.appiconset/Contents.json +23 -0
- data/spec/integration/build/after/Example/Example/Images.xcassets/Doge.imageset/Contents.json +18 -0
- data/spec/integration/build/after/Example/Example/Images.xcassets/Doge.imageset/doge.png +0 -0
- data/spec/integration/build/after/Example/Example/Images.xcassets/Doge.imageset/doge@2x.png +0 -0
- data/spec/integration/build/after/Example/Example/Images.xcassets/LaunchImage.launchimage/Contents.json +23 -0
- data/spec/integration/build/after/Example/Example/de.lproj/Localizable.strings +12 -0
- data/spec/integration/build/after/Example/Example/en.lproj/InfoPlist.strings +2 -0
- data/spec/integration/build/after/Example/Example/en.lproj/Localizable.strings +15 -0
- data/spec/integration/build/after/Example/Example/main.m +18 -0
- data/spec/integration/build/after/Example/Example.xcodeproj.yaml +168 -0
- data/spec/integration/build/after/R.h +39 -0
- data/spec/integration/build/after/R.m +29 -0
- data/spec/integration/build/after/execution_output.txt +19 -0
- data/spec/integration/build/before/Example/Example/AppDelegate.h +15 -0
- data/spec/integration/build/before/Example/Example/AppDelegate.m +49 -0
- data/spec/integration/build/before/Example/Example/Example-Info.plist +38 -0
- data/spec/integration/build/before/Example/Example/Example-Prefix.pch +16 -0
- data/spec/integration/build/before/Example/Example/Icons.bundle/tab_bar/tabbar_list.png +0 -0
- data/spec/integration/build/before/Example/Example/Icons.bundle/tab_bar/tabbar_list@2x.png +0 -0
- data/spec/integration/build/before/Example/Example/Icons.bundle/tab_bar/tabbar_map.png +0 -0
- data/spec/integration/build/before/Example/Example/Icons.bundle/tab_bar/tabbar_map@2x.png +0 -0
- data/spec/integration/build/before/Example/Example/Images/doge.jpeg +0 -0
- data/spec/integration/build/before/Example/Example/Images/nyanCat.png +0 -0
- data/spec/integration/build/before/Example/Example/Images.xcassets/AppIcon.appiconset/Contents.json +23 -0
- data/spec/integration/build/before/Example/Example/Images.xcassets/Doge.imageset/Contents.json +18 -0
- data/spec/integration/build/before/Example/Example/Images.xcassets/Doge.imageset/doge.png +0 -0
- data/spec/integration/build/before/Example/Example/Images.xcassets/Doge.imageset/doge@2x.png +0 -0
- data/spec/integration/build/before/Example/Example/Images.xcassets/LaunchImage.launchimage/Contents.json +23 -0
- data/spec/integration/build/before/Example/Example/de.lproj/Localizable.strings +12 -0
- data/spec/integration/build/before/Example/Example/en.lproj/InfoPlist.strings +2 -0
- data/spec/integration/build/before/Example/Example/en.lproj/Localizable.strings +15 -0
- data/spec/integration/build/before/Example/Example/main.m +18 -0
- data/spec/integration/build/before/Example/Example.xcodeproj/project.pbxproj +453 -0
- data/spec/integration/build/before/Example/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- data/spec/integration/build-keyword-clash/after/Example/Example/AppDelegate.h +15 -0
- data/spec/integration/build-keyword-clash/after/Example/Example/AppDelegate.m +49 -0
- data/spec/integration/build-keyword-clash/after/Example/Example/Default-568h@2x.png +0 -0
- data/spec/integration/build-keyword-clash/after/Example/Example/Default.png +0 -0
- data/spec/integration/build-keyword-clash/after/Example/Example/Default@2x.png +0 -0
- data/spec/integration/build-keyword-clash/after/Example/Example/Example-Info.plist +38 -0
- data/spec/integration/build-keyword-clash/after/Example/Example/Example-Prefix.pch +16 -0
- data/spec/integration/build-keyword-clash/after/Example/Example/Images.xcassets/AppIcon.appiconset/Contents.json +23 -0
- data/spec/integration/build-keyword-clash/after/Example/Example/en.lproj/InfoPlist.strings +2 -0
- data/spec/integration/build-keyword-clash/after/Example/Example/main.m +18 -0
- data/spec/integration/build-keyword-clash/after/Example/Example.xcodeproj.yaml +160 -0
- data/spec/integration/build-keyword-clash/after/R.h +15 -0
- data/spec/integration/build-keyword-clash/after/R.m +15 -0
- data/spec/integration/build-keyword-clash/after/execution_output.txt +14 -0
- data/spec/integration/build-keyword-clash/before/Example/Example/AppDelegate.h +15 -0
- data/spec/integration/build-keyword-clash/before/Example/Example/AppDelegate.m +49 -0
- data/spec/integration/build-keyword-clash/before/Example/Example/Default-568h@2x.png +0 -0
- data/spec/integration/build-keyword-clash/before/Example/Example/Default.png +0 -0
- data/spec/integration/build-keyword-clash/before/Example/Example/Default@2x.png +0 -0
- data/spec/integration/build-keyword-clash/before/Example/Example/Example-Info.plist +38 -0
- data/spec/integration/build-keyword-clash/before/Example/Example/Example-Prefix.pch +16 -0
- data/spec/integration/build-keyword-clash/before/Example/Example/Images.xcassets/AppIcon.appiconset/Contents.json +23 -0
- data/spec/integration/build-keyword-clash/before/Example/Example/en.lproj/InfoPlist.strings +2 -0
- data/spec/integration/build-keyword-clash/before/Example/Example/main.m +18 -0
- data/spec/integration/build-keyword-clash/before/Example/Example.xcodeproj/project.pbxproj +427 -0
- data/spec/integration/build-keyword-clash/before/Example/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- data/spec/integration/build-var-infoplist/after/Example/Example/AppDelegate.h +15 -0
- data/spec/integration/build-var-infoplist/after/Example/Example/AppDelegate.m +49 -0
- data/spec/integration/build-var-infoplist/after/Example/Example/Example-Info.plist +38 -0
- data/spec/integration/build-var-infoplist/after/Example/Example/Example-Prefix.pch +16 -0
- data/spec/integration/build-var-infoplist/after/Example/Example/Icons.bundle/tab_bar/tabbar_list.png +0 -0
- data/spec/integration/build-var-infoplist/after/Example/Example/Icons.bundle/tab_bar/tabbar_list@2x.png +0 -0
- data/spec/integration/build-var-infoplist/after/Example/Example/Icons.bundle/tab_bar/tabbar_map.png +0 -0
- data/spec/integration/build-var-infoplist/after/Example/Example/Icons.bundle/tab_bar/tabbar_map@2x.png +0 -0
- data/spec/integration/build-var-infoplist/after/Example/Example/Images/doge.jpeg +0 -0
- data/spec/integration/build-var-infoplist/after/Example/Example/Images/nyanCat.png +0 -0
- data/spec/integration/build-var-infoplist/after/Example/Example/Images.xcassets/AppIcon.appiconset/Contents.json +23 -0
- data/spec/integration/build-var-infoplist/after/Example/Example/Images.xcassets/Doge.imageset/Contents.json +18 -0
- data/spec/integration/build-var-infoplist/after/Example/Example/Images.xcassets/Doge.imageset/doge.png +0 -0
- data/spec/integration/build-var-infoplist/after/Example/Example/Images.xcassets/Doge.imageset/doge@2x.png +0 -0
- data/spec/integration/build-var-infoplist/after/Example/Example/Images.xcassets/LaunchImage.launchimage/Contents.json +23 -0
- data/spec/integration/build-var-infoplist/after/Example/Example/de.lproj/Localizable.strings +12 -0
- data/spec/integration/build-var-infoplist/after/Example/Example/en.lproj/InfoPlist.strings +2 -0
- data/spec/integration/build-var-infoplist/after/Example/Example/en.lproj/Localizable.strings +15 -0
- data/spec/integration/build-var-infoplist/after/Example/Example/main.m +18 -0
- data/spec/integration/build-var-infoplist/after/Example/Example.xcodeproj.yaml +168 -0
- data/spec/integration/build-var-infoplist/after/R.h +39 -0
- data/spec/integration/build-var-infoplist/after/R.m +29 -0
- data/spec/integration/build-var-infoplist/after/execution_output.txt +19 -0
- data/spec/integration/build-var-infoplist/before/Example/Example/AppDelegate.h +15 -0
- data/spec/integration/build-var-infoplist/before/Example/Example/AppDelegate.m +49 -0
- data/spec/integration/build-var-infoplist/before/Example/Example/Example-Info.plist +38 -0
- data/spec/integration/build-var-infoplist/before/Example/Example/Example-Prefix.pch +16 -0
- data/spec/integration/build-var-infoplist/before/Example/Example/Icons.bundle/tab_bar/tabbar_list.png +0 -0
- data/spec/integration/build-var-infoplist/before/Example/Example/Icons.bundle/tab_bar/tabbar_list@2x.png +0 -0
- data/spec/integration/build-var-infoplist/before/Example/Example/Icons.bundle/tab_bar/tabbar_map.png +0 -0
- data/spec/integration/build-var-infoplist/before/Example/Example/Icons.bundle/tab_bar/tabbar_map@2x.png +0 -0
- data/spec/integration/build-var-infoplist/before/Example/Example/Images/doge.jpeg +0 -0
- data/spec/integration/build-var-infoplist/before/Example/Example/Images/nyanCat.png +0 -0
- data/spec/integration/build-var-infoplist/before/Example/Example/Images.xcassets/AppIcon.appiconset/Contents.json +23 -0
- data/spec/integration/build-var-infoplist/before/Example/Example/Images.xcassets/Doge.imageset/Contents.json +18 -0
- data/spec/integration/build-var-infoplist/before/Example/Example/Images.xcassets/Doge.imageset/doge.png +0 -0
- data/spec/integration/build-var-infoplist/before/Example/Example/Images.xcassets/Doge.imageset/doge@2x.png +0 -0
- data/spec/integration/build-var-infoplist/before/Example/Example/Images.xcassets/LaunchImage.launchimage/Contents.json +23 -0
- data/spec/integration/build-var-infoplist/before/Example/Example/de.lproj/Localizable.strings +12 -0
- data/spec/integration/build-var-infoplist/before/Example/Example/en.lproj/InfoPlist.strings +2 -0
- data/spec/integration/build-var-infoplist/before/Example/Example/en.lproj/Localizable.strings +15 -0
- data/spec/integration/build-var-infoplist/before/Example/Example/main.m +18 -0
- data/spec/integration/build-var-infoplist/before/Example/Example.xcodeproj/project.pbxproj +453 -0
- data/spec/integration/build-var-infoplist/before/Example/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- data/spec/integration/help/after/execution_output.txt +18 -0
- data/spec/integration/help/before/.gitkeep +0 -0
- data/spec/integration/install/after/Example/Example/AppDelegate.h +15 -0
- data/spec/integration/install/after/Example/Example/AppDelegate.m +49 -0
- data/spec/integration/install/after/Example/Example/Example-Info.plist +38 -0
- data/spec/integration/install/after/Example/Example/Example-Prefix.pch +18 -0
- data/spec/integration/install/after/Example/Example/Images.xcassets/AppIcon.appiconset/Contents.json +23 -0
- data/spec/integration/install/after/Example/Example/Images.xcassets/LaunchImage.launchimage/Contents.json +23 -0
- data/spec/integration/install/after/Example/Example/Resources/R.h +19 -0
- data/spec/integration/install/after/Example/Example/Resources/R.m +17 -0
- data/spec/integration/install/after/Example/Example/en.lproj/InfoPlist.strings +2 -0
- data/spec/integration/install/after/Example/Example/main.m +18 -0
- data/spec/integration/install/after/Example/Example.xcodeproj/project.pbxproj +898 -0
- data/spec/integration/install/after/Example/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- data/spec/integration/install/after/Example/Example.xcodeproj.yaml +172 -0
- data/spec/integration/install/after/execution_output.txt +22 -0
- data/spec/integration/install/before/Example/Example/AppDelegate.h +15 -0
- data/spec/integration/install/before/Example/Example/AppDelegate.m +49 -0
- data/spec/integration/install/before/Example/Example/Example-Info.plist +38 -0
- data/spec/integration/install/before/Example/Example/Example-Prefix.pch +16 -0
- data/spec/integration/install/before/Example/Example/Images.xcassets/AppIcon.appiconset/Contents.json +23 -0
- data/spec/integration/install/before/Example/Example/Images.xcassets/LaunchImage.launchimage/Contents.json +23 -0
- data/spec/integration/install/before/Example/Example/en.lproj/InfoPlist.strings +2 -0
- data/spec/integration/install/before/Example/Example/main.m +18 -0
- data/spec/integration/install/before/Example/Example.xcodeproj/project.pbxproj +421 -0
- data/spec/integration/install/before/Example/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- data/spec/integration/install-again/after/Example/Example/AppDelegate.h +15 -0
- data/spec/integration/install-again/after/Example/Example/AppDelegate.m +49 -0
- data/spec/integration/install-again/after/Example/Example/Example-Info.plist +38 -0
- data/spec/integration/install-again/after/Example/Example/Example-Prefix.pch +18 -0
- data/spec/integration/install-again/after/Example/Example/Images.xcassets/AppIcon.appiconset/Contents.json +23 -0
- data/spec/integration/install-again/after/Example/Example/Images.xcassets/LaunchImage.launchimage/Contents.json +23 -0
- data/spec/integration/install-again/after/Example/Example/Resources/R.h +19 -0
- data/spec/integration/install-again/after/Example/Example/Resources/R.m +17 -0
- data/spec/integration/install-again/after/Example/Example/en.lproj/InfoPlist.strings +2 -0
- data/spec/integration/install-again/after/Example/Example/main.m +18 -0
- data/spec/integration/install-again/after/Example/Example.xcodeproj.yaml +172 -0
- data/spec/integration/install-again/after/execution_output.txt +23 -0
- data/spec/integration/install-again/before/Example/Example/AppDelegate.h +15 -0
- data/spec/integration/install-again/before/Example/Example/AppDelegate.m +49 -0
- data/spec/integration/install-again/before/Example/Example/Example-Info.plist +38 -0
- data/spec/integration/install-again/before/Example/Example/Example-Prefix.pch +18 -0
- data/spec/integration/install-again/before/Example/Example/Images.xcassets/AppIcon.appiconset/Contents.json +23 -0
- data/spec/integration/install-again/before/Example/Example/Images.xcassets/LaunchImage.launchimage/Contents.json +23 -0
- data/spec/integration/install-again/before/Example/Example/Resources/R.h +19 -0
- data/spec/integration/install-again/before/Example/Example/Resources/R.m +17 -0
- data/spec/integration/install-again/before/Example/Example/en.lproj/InfoPlist.strings +2 -0
- data/spec/integration/install-again/before/Example/Example/main.m +18 -0
- data/spec/integration/install-again/before/Example/Example.xcodeproj/project.pbxproj +898 -0
- data/spec/integration/install-again/before/Example/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- data/spec/integration/install-moved-supporting-files/after/Example/Example.xcodeproj.yaml +173 -0
- data/spec/integration/install-moved-supporting-files/after/Example/Supporting_Files/Example-Info.plist +38 -0
- data/spec/integration/install-moved-supporting-files/after/Example/Supporting_Files/Example-Prefix.pch +18 -0
- data/spec/integration/install-moved-supporting-files/after/Example/Supporting_Files/Resources/R.h +19 -0
- data/spec/integration/install-moved-supporting-files/after/Example/Supporting_Files/Resources/R.m +17 -0
- data/spec/integration/install-moved-supporting-files/after/Example/Supporting_Files/en.lproj/InfoPlist.strings +2 -0
- data/spec/integration/install-moved-supporting-files/after/Example/Supporting_Files/main.m +18 -0
- data/spec/integration/install-moved-supporting-files/after/Example/res/Images.xcassets/AppIcon.appiconset/Contents.json +23 -0
- data/spec/integration/install-moved-supporting-files/after/Example/res/Images.xcassets/LaunchImage.launchimage/Contents.json +23 -0
- data/spec/integration/install-moved-supporting-files/after/Example/src/AppDelegate.h +15 -0
- data/spec/integration/install-moved-supporting-files/after/Example/src/AppDelegate.m +49 -0
- data/spec/integration/install-moved-supporting-files/after/execution_output.txt +22 -0
- data/spec/integration/install-moved-supporting-files/before/Example/Example.xcodeproj/project.pbxproj +431 -0
- data/spec/integration/install-moved-supporting-files/before/Example/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- data/spec/integration/install-moved-supporting-files/before/Example/Supporting_Files/Example-Info.plist +38 -0
- data/spec/integration/install-moved-supporting-files/before/Example/Supporting_Files/Example-Prefix.pch +16 -0
- data/spec/integration/install-moved-supporting-files/before/Example/Supporting_Files/en.lproj/InfoPlist.strings +2 -0
- data/spec/integration/install-moved-supporting-files/before/Example/Supporting_Files/main.m +18 -0
- data/spec/integration/install-moved-supporting-files/before/Example/res/Images.xcassets/AppIcon.appiconset/Contents.json +23 -0
- data/spec/integration/install-moved-supporting-files/before/Example/res/Images.xcassets/LaunchImage.launchimage/Contents.json +23 -0
- data/spec/integration/install-moved-supporting-files/before/Example/src/AppDelegate.h +15 -0
- data/spec/integration/install-moved-supporting-files/before/Example/src/AppDelegate.m +49 -0
- data/spec/integration/install-no-supporting-files/after/Example/Example.xcodeproj.yaml +173 -0
- data/spec/integration/install-no-supporting-files/after/Example/Resources/R.h +19 -0
- data/spec/integration/install-no-supporting-files/after/Example/Resources/R.m +17 -0
- data/spec/integration/install-no-supporting-files/after/Example/Supporting_Files/Example-Info.plist +38 -0
- data/spec/integration/install-no-supporting-files/after/Example/Supporting_Files/Example-Prefix.pch +18 -0
- data/spec/integration/install-no-supporting-files/after/Example/Supporting_Files/en.lproj/InfoPlist.strings +2 -0
- data/spec/integration/install-no-supporting-files/after/Example/Supporting_Files/main.m +18 -0
- data/spec/integration/install-no-supporting-files/after/Example/res/Images.xcassets/AppIcon.appiconset/Contents.json +23 -0
- data/spec/integration/install-no-supporting-files/after/Example/res/Images.xcassets/LaunchImage.launchimage/Contents.json +23 -0
- data/spec/integration/install-no-supporting-files/after/Example/src/AppDelegate.h +15 -0
- data/spec/integration/install-no-supporting-files/after/Example/src/AppDelegate.m +49 -0
- data/spec/integration/install-no-supporting-files/after/execution_output.txt +23 -0
- data/spec/integration/install-no-supporting-files/before/Example/Example.xcodeproj/project.pbxproj +430 -0
- data/spec/integration/install-no-supporting-files/before/Example/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- data/spec/integration/install-no-supporting-files/before/Example/Supporting_Files/Example-Info.plist +38 -0
- data/spec/integration/install-no-supporting-files/before/Example/Supporting_Files/Example-Prefix.pch +16 -0
- data/spec/integration/install-no-supporting-files/before/Example/Supporting_Files/en.lproj/InfoPlist.strings +2 -0
- data/spec/integration/install-no-supporting-files/before/Example/Supporting_Files/main.m +18 -0
- data/spec/integration/install-no-supporting-files/before/Example/res/Images.xcassets/AppIcon.appiconset/Contents.json +23 -0
- data/spec/integration/install-no-supporting-files/before/Example/res/Images.xcassets/LaunchImage.launchimage/Contents.json +23 -0
- data/spec/integration/install-no-supporting-files/before/Example/src/AppDelegate.h +15 -0
- data/spec/integration/install-no-supporting-files/before/Example/src/AppDelegate.m +49 -0
- data/spec/integration/version/after/execution_output.txt +3 -0
- data/spec/integration/version/before/.gitkeep +0 -0
- data/spec/integration.rb +86 -0
- data/spec/spec_helper/xcodeproj_project_yaml.rb +26 -0
- data/spec/unit/analyzer/aggregate_analyzer_spec.rb +61 -0
- data/spec/unit/analyzer/analyzer_spec.rb +123 -0
- data/spec/unit/analyzer/resources_aggregate_analyzer_spec.rb +46 -0
- data/spec/unit/analyzer/resources_analyzer/base_resources_analyzer_spec.rb +126 -0
- data/spec/unit/analyzer/resources_analyzer/bundle_resources_analyzer_spec.rb +57 -0
- data/spec/unit/analyzer/resources_analyzer/loose_resources_analyzer_spec.rb +22 -0
- data/spec/unit/analyzer/strings_analyzer_spec.rb +99 -0
- data/spec/unit/builder/file_builder_spec.rb +46 -0
- data/spec/unit/builder/resources_builder_spec.rb +50 -0
- data/spec/unit/builder/string_builder_spec.rb +76 -0
- data/spec/unit/command/main_command_spec.rb +5 -0
- data/spec/unit/command/project_command_spec.rb +23 -0
- data/spec/unit/helper/file_helper_spec.rb +24 -0
- data/spec/unit/logger_spec.rb +142 -0
- data/spec/unit/model/section_spec.rb +47 -0
- data/spec/unit/model/xcassets/bundle_spec.rb +154 -0
- data/spec/unit/model/xcassets/resource_image_spec.rb +141 -0
- data/spec/unit/model/xcassets/resource_spec.rb +174 -0
- data/spec/unit/model/xcassets/spec_helper.rb +31 -0
- data/spec/unit/spec_helper.rb +17 -0
- data/xcres.gemspec +42 -0
- metadata +811 -0
data/lib/xcres/logger.rb
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
#encoding: utf-8
|
|
2
|
+
|
|
3
|
+
require 'colored'
|
|
4
|
+
|
|
5
|
+
# A Logger utility help class
|
|
6
|
+
#
|
|
7
|
+
class XCRes::Logger
|
|
8
|
+
|
|
9
|
+
# @return [Bool]
|
|
10
|
+
# if set to false, calls to #log will be ignored
|
|
11
|
+
# otherwise they will be printed, false by default.
|
|
12
|
+
attr_accessor :verbose
|
|
13
|
+
alias :verbose? verbose
|
|
14
|
+
|
|
15
|
+
# @return [Bool]
|
|
16
|
+
# if set to true, all log calls of all kinds will be ignored
|
|
17
|
+
# otherwise they will be printed, false by default.
|
|
18
|
+
attr_accessor :silent
|
|
19
|
+
alias :silent? silent
|
|
20
|
+
|
|
21
|
+
# @return [Bool]
|
|
22
|
+
# if set to true, ANSI colors will be used to color the output
|
|
23
|
+
# otherwise it will output plain text, true by default.
|
|
24
|
+
attr_accessor :colored
|
|
25
|
+
alias :colored? colored
|
|
26
|
+
|
|
27
|
+
# @return [String]
|
|
28
|
+
# the indentation of the output, empty string by default.
|
|
29
|
+
attr_accessor :indentation
|
|
30
|
+
|
|
31
|
+
# Initialize a new logger
|
|
32
|
+
#
|
|
33
|
+
def initialize
|
|
34
|
+
self.silent = false
|
|
35
|
+
self.verbose = false
|
|
36
|
+
self.colored = true
|
|
37
|
+
self.indentation = ''
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Prints a formatted message
|
|
41
|
+
#
|
|
42
|
+
# @param [String] message
|
|
43
|
+
# the message, which can have format placeholders
|
|
44
|
+
#
|
|
45
|
+
# @param [#to_s...] format_args
|
|
46
|
+
# will be passed as right hand side to the percent operator,
|
|
47
|
+
# which will fill the format placeholders used in the message
|
|
48
|
+
#
|
|
49
|
+
def inform message, *format_args
|
|
50
|
+
puts indentation + message % format_args unless silent?
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Prints a formatted message in a given color, and prints its arguments
|
|
54
|
+
# with bold font weight
|
|
55
|
+
#
|
|
56
|
+
# @param [String] message
|
|
57
|
+
# the message, which can have format placeholders
|
|
58
|
+
#
|
|
59
|
+
# @param [Symbol] color
|
|
60
|
+
# the color, String has to #respond_to? this
|
|
61
|
+
#
|
|
62
|
+
# @param [#to_s...] format_args
|
|
63
|
+
# will be passed as right hand side to the percent operator,
|
|
64
|
+
# which will fill the format placeholders used in the message
|
|
65
|
+
#
|
|
66
|
+
def inform_colored message, color, *format_args
|
|
67
|
+
if colored?
|
|
68
|
+
parts = message
|
|
69
|
+
.gsub(/%[\ +#]?\d*\.?\d*[a-z]/, "\0"+'\0'+"\0")
|
|
70
|
+
.split("\0")
|
|
71
|
+
.reject(&:empty?)
|
|
72
|
+
message = parts.map do |part|
|
|
73
|
+
if part[0] == '%' && part[1] != '%'
|
|
74
|
+
(part % format_args.shift).bold.gsub('%', '%%')
|
|
75
|
+
else
|
|
76
|
+
part
|
|
77
|
+
end
|
|
78
|
+
end.map(&color).join('')
|
|
79
|
+
end
|
|
80
|
+
inform message, *format_args
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# Print a log message of log level verbose
|
|
84
|
+
#
|
|
85
|
+
# @param [String] message
|
|
86
|
+
# the message, which can have format placeholders
|
|
87
|
+
#
|
|
88
|
+
# @param [#to_s...] format_args
|
|
89
|
+
# will be passed as right hand side to the percent operator,
|
|
90
|
+
# which will fill the format placeholders used in the message
|
|
91
|
+
#
|
|
92
|
+
def log message, *format_args
|
|
93
|
+
inform_colored 'Ⓥ' + ' ' + message, :magenta, *format_args if verbose?
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Print a log message to indicate success of an operation in green color
|
|
97
|
+
#
|
|
98
|
+
# @param [String] message
|
|
99
|
+
# the message, which can have format placeholders
|
|
100
|
+
#
|
|
101
|
+
# @param [#to_s...] format_args
|
|
102
|
+
# will be passed as right hand side to the percent operator,
|
|
103
|
+
# which will fill the format placeholders used in the message
|
|
104
|
+
#
|
|
105
|
+
def success message, *format_args
|
|
106
|
+
inform_colored '✓' + ' ' + message, :green, *format_args
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# Print a warning log message in yellow color
|
|
110
|
+
#
|
|
111
|
+
# @param [String] message
|
|
112
|
+
# the message, which can have format placeholders
|
|
113
|
+
#
|
|
114
|
+
# @param [#to_s...] format_args
|
|
115
|
+
# will be passed as right hand side to the percent operator,
|
|
116
|
+
# which will fill the format placeholders used in the message
|
|
117
|
+
#
|
|
118
|
+
def warn message, *format_args
|
|
119
|
+
inform_colored '⚠' + ' ' + message, :yellow, *format_args
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# Print a log message to indicate failure of an operation in red color
|
|
123
|
+
#
|
|
124
|
+
# @param [String|Exception] message
|
|
125
|
+
# The message, which can have format placeholders,
|
|
126
|
+
# can also be a kind of Exception, then its message would been
|
|
127
|
+
# used instead. The backtrace will be only printed, if the verbose
|
|
128
|
+
# mode is enabled.
|
|
129
|
+
#
|
|
130
|
+
# @param [#to_s...] format_args
|
|
131
|
+
# will be passed as right hand side to the percent operator,
|
|
132
|
+
# which will fill the format placeholders used in the message
|
|
133
|
+
#
|
|
134
|
+
def fail message, *format_args
|
|
135
|
+
exception = nil
|
|
136
|
+
if message.kind_of? Exception
|
|
137
|
+
exception = message
|
|
138
|
+
message = exception.message
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
inform_colored '✗' + ' ' + message, :red, *format_args
|
|
142
|
+
|
|
143
|
+
if verbose? && exception != nil
|
|
144
|
+
log "Backtrace:\n"+exception.backtrace.join("\n"), :red
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
module XCRes
|
|
2
|
+
class Section
|
|
3
|
+
|
|
4
|
+
# @return [String]
|
|
5
|
+
# the name / key of the section
|
|
6
|
+
attr_reader :name
|
|
7
|
+
|
|
8
|
+
# @return [Hash{String => String|Hash}]
|
|
9
|
+
# the items of the section
|
|
10
|
+
attr_reader :items
|
|
11
|
+
|
|
12
|
+
# @return [Hash]
|
|
13
|
+
# options of the section for serialization
|
|
14
|
+
attr_accessor :options
|
|
15
|
+
|
|
16
|
+
# Initialize a new section
|
|
17
|
+
#
|
|
18
|
+
# @param [String] name
|
|
19
|
+
# see #name
|
|
20
|
+
#
|
|
21
|
+
# @param [Hash] items
|
|
22
|
+
# see #items
|
|
23
|
+
#
|
|
24
|
+
# @param [Hash] options
|
|
25
|
+
# see #options
|
|
26
|
+
#
|
|
27
|
+
#
|
|
28
|
+
def initialize(name, items, options={})
|
|
29
|
+
@name = name
|
|
30
|
+
@items = items
|
|
31
|
+
@options = options
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def ==(other)
|
|
35
|
+
self.name == other.name \
|
|
36
|
+
&& self.items == other.items \
|
|
37
|
+
&& self.options == other.options
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
alias eql? ==
|
|
41
|
+
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
require 'xcres/model/xcassets/resource'
|
|
2
|
+
|
|
3
|
+
module XCRes::XCAssets
|
|
4
|
+
|
|
5
|
+
# Represents the whole asset catalog
|
|
6
|
+
#
|
|
7
|
+
class Bundle
|
|
8
|
+
|
|
9
|
+
# @return [Pathname]
|
|
10
|
+
#
|
|
11
|
+
attr_accessor :path
|
|
12
|
+
|
|
13
|
+
# @return [Array<Pathname>]
|
|
14
|
+
# the paths of the resources contained, relative to the container
|
|
15
|
+
# given by #path.
|
|
16
|
+
attr_accessor :resource_paths
|
|
17
|
+
|
|
18
|
+
# @return [Array<Resource>]
|
|
19
|
+
# the parsed resources
|
|
20
|
+
attr_accessor :resources
|
|
21
|
+
|
|
22
|
+
# Open a XCAssets collection at a given path
|
|
23
|
+
#
|
|
24
|
+
# @return [XCAssets::Bundle]
|
|
25
|
+
#
|
|
26
|
+
def self.open(path)
|
|
27
|
+
self.new(path).read
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Initialize a new file with given path
|
|
31
|
+
#
|
|
32
|
+
# @param [Pathname] path
|
|
33
|
+
# the location of the container
|
|
34
|
+
#
|
|
35
|
+
def initialize(path = nil)
|
|
36
|
+
@path = Pathname(path) unless path.nil?
|
|
37
|
+
@resources = []
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Read the resources from disk
|
|
41
|
+
#
|
|
42
|
+
# @return [XCAssets::Bundle]
|
|
43
|
+
#
|
|
44
|
+
def read
|
|
45
|
+
@resource_paths = Dir.chdir(path) do
|
|
46
|
+
Dir['*'].map { |p| Pathname(p) }
|
|
47
|
+
end
|
|
48
|
+
@resources = @resource_paths.map do |path|
|
|
49
|
+
Resource.new(self, path)
|
|
50
|
+
end
|
|
51
|
+
self
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
end
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
require 'xcres/helper/file_helper'
|
|
3
|
+
require 'xcres/model/xcassets/resource_image'
|
|
4
|
+
|
|
5
|
+
module XCRes::XCAssets
|
|
6
|
+
|
|
7
|
+
# Represents a single resource of an asset catalog
|
|
8
|
+
#
|
|
9
|
+
class Resource
|
|
10
|
+
include XCRes::FileHelper
|
|
11
|
+
|
|
12
|
+
# @return [XCAssets::Bundle]
|
|
13
|
+
# the whole bundle
|
|
14
|
+
attr_accessor :bundle
|
|
15
|
+
|
|
16
|
+
# @return [Pathname]
|
|
17
|
+
# the directory name
|
|
18
|
+
attr_accessor :path
|
|
19
|
+
|
|
20
|
+
# @return [Hash]
|
|
21
|
+
# file meta info
|
|
22
|
+
attr_accessor :info
|
|
23
|
+
|
|
24
|
+
# @return [Array<ResourceImage>]
|
|
25
|
+
# the images contained in this resource
|
|
26
|
+
attr_accessor :images
|
|
27
|
+
|
|
28
|
+
# Initialize a new resource
|
|
29
|
+
#
|
|
30
|
+
# @param [XCAssets:Bundle]
|
|
31
|
+
# the containing bundle
|
|
32
|
+
#
|
|
33
|
+
# @param [Pathname]
|
|
34
|
+
# see #path.
|
|
35
|
+
#
|
|
36
|
+
def initialize(bundle, path)
|
|
37
|
+
self.bundle = bundle
|
|
38
|
+
self.path = path
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Return the name of the resource
|
|
42
|
+
#
|
|
43
|
+
# @return [String]
|
|
44
|
+
#
|
|
45
|
+
def name
|
|
46
|
+
@name ||= basename_without_ext path
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Return the type of the resource,
|
|
50
|
+
# e.g. 'appiconset', 'imageset', 'launchimage'
|
|
51
|
+
#
|
|
52
|
+
# @return [String]
|
|
53
|
+
#
|
|
54
|
+
def type
|
|
55
|
+
@type ||= File.extname(path).sub(/^./, '')
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Lazy read the info, if not initialized
|
|
59
|
+
#
|
|
60
|
+
# @return [Hash]
|
|
61
|
+
#
|
|
62
|
+
def info
|
|
63
|
+
@info ||= read_info
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Lazy read the images, if not initialized
|
|
67
|
+
#
|
|
68
|
+
# @return [Array<XCAssets::ResourceImage>]
|
|
69
|
+
#
|
|
70
|
+
def images
|
|
71
|
+
@images ||= read_images
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Serialize to hash
|
|
75
|
+
#
|
|
76
|
+
# @return [Hash]
|
|
77
|
+
#
|
|
78
|
+
def to_hash
|
|
79
|
+
{
|
|
80
|
+
'images' => images.map(&:to_hash),
|
|
81
|
+
'info' => info,
|
|
82
|
+
}
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
protected
|
|
86
|
+
|
|
87
|
+
# The path of the Contents.json file
|
|
88
|
+
#
|
|
89
|
+
# @return [Pathname]
|
|
90
|
+
#
|
|
91
|
+
def json_path
|
|
92
|
+
bundle.path + path + 'Contents.json'
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Parse the Content.json file
|
|
96
|
+
#
|
|
97
|
+
# @return [Hash]
|
|
98
|
+
#
|
|
99
|
+
def parsed_contents
|
|
100
|
+
@hash ||= JSON.parse File.read(json_path)
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Deserialize #contents.
|
|
104
|
+
#
|
|
105
|
+
# @return [XCAssets::Resource]
|
|
106
|
+
#
|
|
107
|
+
def read
|
|
108
|
+
@info = read_info
|
|
109
|
+
@images = read_images
|
|
110
|
+
self
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Deserialize the file info from the #contents.
|
|
114
|
+
#
|
|
115
|
+
# @return [Hash]
|
|
116
|
+
#
|
|
117
|
+
def read_info
|
|
118
|
+
parsed_contents['info'] || {}
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Deserialize the images from the #contents.
|
|
122
|
+
#
|
|
123
|
+
# @return [Array<XCAssets::ResourceImage>]
|
|
124
|
+
#
|
|
125
|
+
def read_images
|
|
126
|
+
return [] if parsed_contents['images'].nil?
|
|
127
|
+
parsed_contents['images'].map do |img_hash|
|
|
128
|
+
ResourceImage.read(img_hash)
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def ==(other)
|
|
133
|
+
return false unless other.respond_to?(:to_hash)
|
|
134
|
+
self.to_hash == other.to_hash
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
alias eql? ==
|
|
138
|
+
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
end
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
require 'active_support/core_ext/string/inflections'
|
|
2
|
+
|
|
3
|
+
module XCRes::XCAssets
|
|
4
|
+
|
|
5
|
+
# Represents a single image of a resource in an asset catalog
|
|
6
|
+
#
|
|
7
|
+
class ResourceImage
|
|
8
|
+
|
|
9
|
+
# The known keys
|
|
10
|
+
KNOWN_KEYS = [
|
|
11
|
+
:filename,
|
|
12
|
+
:scale,
|
|
13
|
+
:orientation,
|
|
14
|
+
:size,
|
|
15
|
+
:idiom,
|
|
16
|
+
:subtype,
|
|
17
|
+
:extent,
|
|
18
|
+
:minimum_system_version
|
|
19
|
+
].freeze
|
|
20
|
+
|
|
21
|
+
# @return [Pathname]
|
|
22
|
+
# file name
|
|
23
|
+
attr_accessor :filename
|
|
24
|
+
|
|
25
|
+
# @return [Integer]
|
|
26
|
+
# scale of the image
|
|
27
|
+
attr_accessor :scale
|
|
28
|
+
|
|
29
|
+
# @return [Symbol]
|
|
30
|
+
# the orientation, e.g. 'portrait'
|
|
31
|
+
attr_accessor :orientation
|
|
32
|
+
|
|
33
|
+
# @return [String]
|
|
34
|
+
# the size, e.g. '29x29', '40x40'
|
|
35
|
+
attr_accessor :size
|
|
36
|
+
|
|
37
|
+
# @return [Symbol]
|
|
38
|
+
# the idiom, e.g. 'iphone'
|
|
39
|
+
attr_accessor :idiom
|
|
40
|
+
|
|
41
|
+
# @return [Symbol]
|
|
42
|
+
# the subtype, e.g. 'retina4'
|
|
43
|
+
attr_accessor :subtype
|
|
44
|
+
|
|
45
|
+
# @return [Symbol]
|
|
46
|
+
# the extent, e.g. 'full-screen'
|
|
47
|
+
attr_accessor :extent
|
|
48
|
+
|
|
49
|
+
# @return [String]
|
|
50
|
+
# the minimum system version, e.g. '7.0'
|
|
51
|
+
attr_accessor :minimum_system_version
|
|
52
|
+
|
|
53
|
+
# @return [Hash{Symbol => String}]
|
|
54
|
+
# further attributes, not mapped to a specific attribute
|
|
55
|
+
attr_accessor :attributes
|
|
56
|
+
|
|
57
|
+
# Read from hash
|
|
58
|
+
#
|
|
59
|
+
# @param [Hash]
|
|
60
|
+
# the hash to deserialize
|
|
61
|
+
#
|
|
62
|
+
# @return [ResourceImage]
|
|
63
|
+
#
|
|
64
|
+
def self.read(hash)
|
|
65
|
+
self.new.read(hash)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Initialize a new ResourceImage
|
|
69
|
+
#
|
|
70
|
+
# @param [Hash]
|
|
71
|
+
# the initial attribute values
|
|
72
|
+
#
|
|
73
|
+
def initialize(attributes={})
|
|
74
|
+
self.scale = attributes.delete('scale') unless attributes['scale'].nil?
|
|
75
|
+
|
|
76
|
+
KNOWN_KEYS.each do |key|
|
|
77
|
+
self.send "#{key}=".to_sym, attributes.delete(key)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
self.attributes = attributes
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# Read from hash
|
|
84
|
+
#
|
|
85
|
+
# @param [Hash]
|
|
86
|
+
# the hash to deserialize
|
|
87
|
+
#
|
|
88
|
+
# @return [ResourceImage]
|
|
89
|
+
#
|
|
90
|
+
def read(hash)
|
|
91
|
+
self.scale = hash.delete('scale').sub(/x$/, '').to_i unless hash['scale'].nil?
|
|
92
|
+
|
|
93
|
+
KNOWN_KEYS.each do |key|
|
|
94
|
+
value = hash.delete(key.to_s.dasherize)
|
|
95
|
+
next if value.nil?
|
|
96
|
+
self.send "#{key}=".to_sym, value
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
self.attributes = hash
|
|
100
|
+
|
|
101
|
+
return self
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Serialize to hash
|
|
105
|
+
#
|
|
106
|
+
# @return [Hash{String => String}]
|
|
107
|
+
#
|
|
108
|
+
def to_hash
|
|
109
|
+
hash = {}
|
|
110
|
+
|
|
111
|
+
hash['scale'] = "#{scale}x" unless scale.nil?
|
|
112
|
+
|
|
113
|
+
(KNOWN_KEYS - [:scale]).each do |key|
|
|
114
|
+
value = self.send(key)
|
|
115
|
+
hash[key.to_s.dasherize] = value.to_s unless value.nil?
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
attributes.each do |key, value|
|
|
119
|
+
hash[key.to_s] = value
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
hash
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
def ==(other)
|
|
126
|
+
return false unless other.respond_to?(:to_hash)
|
|
127
|
+
self.to_hash == other.to_hash
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
alias eql? ==
|
|
131
|
+
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
end
|
data/lib/xcres.rb
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
require 'pathname'
|
|
2
|
+
require 'active_support/core_ext/string/strip'
|
|
3
|
+
require 'active_support/core_ext/string/inflections'
|
|
4
|
+
require 'active_support/core_ext/array/conversions'
|
|
5
|
+
|
|
6
|
+
module XCRes
|
|
7
|
+
require 'xcres/version'
|
|
8
|
+
require 'xcres/command/main_command'
|
|
9
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//
|
|
2
|
+
// AppDelegate.h
|
|
3
|
+
// Example
|
|
4
|
+
//
|
|
5
|
+
// Created by Marius Rackwitz on 01.05.14.
|
|
6
|
+
// Copyright (c) 2014 XCRes. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import <UIKit/UIKit.h>
|
|
10
|
+
|
|
11
|
+
@interface AppDelegate : UIResponder <UIApplicationDelegate>
|
|
12
|
+
|
|
13
|
+
@property (strong, nonatomic) UIWindow *window;
|
|
14
|
+
|
|
15
|
+
@end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
//
|
|
2
|
+
// AppDelegate.m
|
|
3
|
+
// Example
|
|
4
|
+
//
|
|
5
|
+
// Created by Marius Rackwitz on 01.05.14.
|
|
6
|
+
// Copyright (c) 2014 XCRes. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import "AppDelegate.h"
|
|
10
|
+
|
|
11
|
+
@implementation AppDelegate
|
|
12
|
+
|
|
13
|
+
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
|
14
|
+
{
|
|
15
|
+
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
|
16
|
+
// Override point for customization after application launch.
|
|
17
|
+
self.window.backgroundColor = [UIColor whiteColor];
|
|
18
|
+
[self.window makeKeyAndVisible];
|
|
19
|
+
return YES;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
- (void)applicationWillResignActive:(UIApplication *)application
|
|
23
|
+
{
|
|
24
|
+
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
|
|
25
|
+
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
- (void)applicationDidEnterBackground:(UIApplication *)application
|
|
29
|
+
{
|
|
30
|
+
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
|
|
31
|
+
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
- (void)applicationWillEnterForeground:(UIApplication *)application
|
|
35
|
+
{
|
|
36
|
+
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
- (void)applicationDidBecomeActive:(UIApplication *)application
|
|
40
|
+
{
|
|
41
|
+
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
- (void)applicationWillTerminate:(UIApplication *)application
|
|
45
|
+
{
|
|
46
|
+
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>CFBundleDevelopmentRegion</key>
|
|
6
|
+
<string>en</string>
|
|
7
|
+
<key>CFBundleDisplayName</key>
|
|
8
|
+
<string>${PRODUCT_NAME}</string>
|
|
9
|
+
<key>CFBundleExecutable</key>
|
|
10
|
+
<string>${EXECUTABLE_NAME}</string>
|
|
11
|
+
<key>CFBundleIdentifier</key>
|
|
12
|
+
<string>io.github.xcres.${PRODUCT_NAME:rfc1034identifier}</string>
|
|
13
|
+
<key>CFBundleInfoDictionaryVersion</key>
|
|
14
|
+
<string>6.0</string>
|
|
15
|
+
<key>CFBundleName</key>
|
|
16
|
+
<string>${PRODUCT_NAME}</string>
|
|
17
|
+
<key>CFBundlePackageType</key>
|
|
18
|
+
<string>APPL</string>
|
|
19
|
+
<key>CFBundleShortVersionString</key>
|
|
20
|
+
<string>1.0</string>
|
|
21
|
+
<key>CFBundleSignature</key>
|
|
22
|
+
<string>????</string>
|
|
23
|
+
<key>CFBundleVersion</key>
|
|
24
|
+
<string>1.0</string>
|
|
25
|
+
<key>LSRequiresIPhoneOS</key>
|
|
26
|
+
<true/>
|
|
27
|
+
<key>UIRequiredDeviceCapabilities</key>
|
|
28
|
+
<array>
|
|
29
|
+
<string>armv7</string>
|
|
30
|
+
</array>
|
|
31
|
+
<key>UISupportedInterfaceOrientations</key>
|
|
32
|
+
<array>
|
|
33
|
+
<string>UIInterfaceOrientationPortrait</string>
|
|
34
|
+
<string>UIInterfaceOrientationLandscapeLeft</string>
|
|
35
|
+
<string>UIInterfaceOrientationLandscapeRight</string>
|
|
36
|
+
</array>
|
|
37
|
+
</dict>
|
|
38
|
+
</plist>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Prefix header
|
|
3
|
+
//
|
|
4
|
+
// The contents of this file are implicitly included at the beginning of every source file.
|
|
5
|
+
//
|
|
6
|
+
|
|
7
|
+
#import <Availability.h>
|
|
8
|
+
|
|
9
|
+
#ifndef __IPHONE_3_0
|
|
10
|
+
#warning "This project uses features only available in iOS SDK 3.0 and later."
|
|
11
|
+
#endif
|
|
12
|
+
|
|
13
|
+
#ifdef __OBJC__
|
|
14
|
+
#import <UIKit/UIKit.h>
|
|
15
|
+
#import <Foundation/Foundation.h>
|
|
16
|
+
#endif
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"images" : [
|
|
3
|
+
{
|
|
4
|
+
"idiom" : "iphone",
|
|
5
|
+
"size" : "29x29",
|
|
6
|
+
"scale" : "2x"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"idiom" : "iphone",
|
|
10
|
+
"size" : "40x40",
|
|
11
|
+
"scale" : "2x"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"idiom" : "iphone",
|
|
15
|
+
"size" : "60x60",
|
|
16
|
+
"scale" : "2x"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"info" : {
|
|
20
|
+
"version" : 1,
|
|
21
|
+
"author" : "xcode"
|
|
22
|
+
}
|
|
23
|
+
}
|