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
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
|
2
|
+
|
|
3
|
+
describe 'XCRes::FileBuilder' do
|
|
4
|
+
|
|
5
|
+
def subject
|
|
6
|
+
XCRes::FileBuilder
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
before do
|
|
10
|
+
@builder = subject.new
|
|
11
|
+
@builder.logger = stub('Logger')
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
describe "#prepare_output_path!" do
|
|
15
|
+
# TODO: Mock fs
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
describe "#build" do
|
|
19
|
+
it 'should prepare output path' do
|
|
20
|
+
@builder.expects(:prepare_output_path!)
|
|
21
|
+
@builder.build
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
describe "#build_contents" do
|
|
26
|
+
it 'should call the given block' do
|
|
27
|
+
proc = Proc.new {}
|
|
28
|
+
proc.expects(:call)
|
|
29
|
+
@builder.build_contents &proc
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
it 'should pass a StringBuilder as first argument to the given block' do
|
|
33
|
+
@builder.build_contents do |builder|
|
|
34
|
+
builder.should.be.an.instance_of?(XCRes::StringBuilder)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
describe "#write_file_eventually" do
|
|
40
|
+
# TODO: Mock fs
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
describe "#write_file" do
|
|
44
|
+
# TODO: Mock fs
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
|
2
|
+
|
|
3
|
+
describe 'XCRes::ResourcesBuilder' do
|
|
4
|
+
|
|
5
|
+
def subject
|
|
6
|
+
XCRes::ResourcesBuilder
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
before do
|
|
10
|
+
@builder = subject.new
|
|
11
|
+
@builder.logger = stub('Logger')
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
describe "#initialize" do
|
|
15
|
+
it 'should set attribute documented to true' do
|
|
16
|
+
@builder.documented.should.be.true?
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
describe "#resources_constant_name" do
|
|
21
|
+
it 'should use the configured resources constant name' do
|
|
22
|
+
@builder.resources_constant_name = 'test'
|
|
23
|
+
@builder.resources_constant_name.should.be.eql?('test')
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it 'should fallback to the basename of the output path' do
|
|
27
|
+
@builder.output_path = 'test/R.m'
|
|
28
|
+
@builder.resources_constant_name.should.be.eql?('R')
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
describe '#add_section' do
|
|
33
|
+
it 'should raise if no items are given' do
|
|
34
|
+
-> {
|
|
35
|
+
@builder.add_section 'Test', nil
|
|
36
|
+
}.should.raise?(ArgumentError, 'No items are given!')
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it 'should not add keys, which are protected keywords' do
|
|
40
|
+
@builder.logger.expects(:warn).twice
|
|
41
|
+
@builder.add_section 'Test', {
|
|
42
|
+
'default' => 'Default.png',
|
|
43
|
+
'cat' => 'cat.gif',
|
|
44
|
+
'auto' => 'auto.jpg'
|
|
45
|
+
}
|
|
46
|
+
@builder.sections.should.be.eql?('Test' => { 'cat' => 'cat.gif' })
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
end
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
|
2
|
+
|
|
3
|
+
describe 'XCRes::StringBuilder' do
|
|
4
|
+
|
|
5
|
+
def subject
|
|
6
|
+
XCRes::StringBuilder
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
before do
|
|
10
|
+
@builder = subject.new
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe '#initialize' do
|
|
14
|
+
it 'should set indentation string' do
|
|
15
|
+
@builder.indentation_string.should.be.eql?(' ')
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it 'should set an empty result' do
|
|
19
|
+
@builder.result.should.be.not.nil?
|
|
20
|
+
@builder.result.should.be.empty?
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
describe '#write' do
|
|
25
|
+
it 'should add input to result' do
|
|
26
|
+
@builder.write 'test'
|
|
27
|
+
@builder.result.should.be.eql?('test')
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it 'should not add any separation' do
|
|
31
|
+
@builder.write 'foo'
|
|
32
|
+
@builder.write 'bar'
|
|
33
|
+
@builder.result.should.be.eql?('foobar')
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
describe '#writeln' do
|
|
38
|
+
it 'should write a new line' do
|
|
39
|
+
@builder.write '{'
|
|
40
|
+
@builder.writeln 'foo'
|
|
41
|
+
@builder.write '}'
|
|
42
|
+
@builder.result.should.be.eql?("{foo\n}")
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
it 'should write just a new line' do
|
|
46
|
+
@builder.writeln
|
|
47
|
+
@builder.result.should.be.eql?("\n")
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
describe '#section' do
|
|
52
|
+
it 'should write a section with increased indentation' do
|
|
53
|
+
@builder.writeln '{'
|
|
54
|
+
@builder.section do |b|
|
|
55
|
+
b.writeln 'c'
|
|
56
|
+
end
|
|
57
|
+
@builder.writeln '}'
|
|
58
|
+
@builder.result.should.be.eql?("{\n c\n}\n")
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
it 'should write a sub section with increased indentation' do
|
|
62
|
+
@builder.indentation_string = ' '
|
|
63
|
+
@builder.writeln 'a{'
|
|
64
|
+
@builder.section do |b|
|
|
65
|
+
b.writeln 'b{'
|
|
66
|
+
b.section do |b|
|
|
67
|
+
b.writeln 'c'
|
|
68
|
+
end
|
|
69
|
+
b.writeln '}b'
|
|
70
|
+
end
|
|
71
|
+
@builder.writeln '}a'
|
|
72
|
+
@builder.result.should.be.eql?("a{\n b{\n c\n }b\n}a\n")
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
|
2
|
+
|
|
3
|
+
describe 'XCRes::ProjectCommand' do
|
|
4
|
+
|
|
5
|
+
def subject
|
|
6
|
+
XCRes::ProjectCommand
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
before do
|
|
10
|
+
@cmd = subject.new('xcres', [], {})
|
|
11
|
+
@cmd.stubs(:project).returns(xcodeproj)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
describe '#application_targets' do
|
|
15
|
+
it 'should return the expected application target' do
|
|
16
|
+
@cmd.application_targets.count.should.eql? 1
|
|
17
|
+
target = @cmd.application_targets.first
|
|
18
|
+
target.should.be.an.instance_of?(Xcodeproj::Project::Object::PBXNativeTarget)
|
|
19
|
+
target.name.should.eql?('Example')
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
|
2
|
+
|
|
3
|
+
describe 'XCRes::FileHelper' do
|
|
4
|
+
|
|
5
|
+
def subject
|
|
6
|
+
Class.new.class_eval { include XCRes::FileHelper }.new
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe '#basename_without_ext' do
|
|
10
|
+
it 'should raise if the name is not given' do
|
|
11
|
+
-> { subject.basename_without_ext(nil) }.should.raise?(TypeError)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it 'should return the name itself if there is not extension' do
|
|
15
|
+
subject.basename_without_ext('dir/base').should.be.eql?('base')
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it 'should return the name without extension' do
|
|
19
|
+
subject.basename_without_ext('b/a.gif').should.be.eql?('a')
|
|
20
|
+
subject.basename_without_ext('b/A.bundle').should.be.eql?('A')
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
end
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
#encoding: utf-8
|
|
2
|
+
|
|
3
|
+
require File.expand_path('../spec_helper', __FILE__)
|
|
4
|
+
|
|
5
|
+
describe 'XCRes::LoggerSpec' do
|
|
6
|
+
|
|
7
|
+
def subject
|
|
8
|
+
XCRes::Logger
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
before do
|
|
12
|
+
@logger = subject.new
|
|
13
|
+
|
|
14
|
+
# Capture the STDOUT
|
|
15
|
+
@out = StringIO.new("")
|
|
16
|
+
$stdout = @out
|
|
17
|
+
def out
|
|
18
|
+
@out.string.chomp
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
after do
|
|
23
|
+
$stdout = STDOUT
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
describe '#initialize' do
|
|
27
|
+
it 'should set attribute colored to true by default' do
|
|
28
|
+
@logger.colored.should.be.true?
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it 'should set attribute verbose to false by default' do
|
|
32
|
+
@logger.verbose.should.be.false?
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it 'should set attribute silent to false by default' do
|
|
36
|
+
@logger.silent.should.be.false?
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it 'should set attribute indentation to an empty string by default' do
|
|
40
|
+
@logger.indentation.should.be.eql?('')
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
describe '#inform' do
|
|
45
|
+
it 'prints the message' do
|
|
46
|
+
@logger.inform '%s %s %s', 'a', 'b', 'c'
|
|
47
|
+
out.should.be.eql? 'a b c'
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it 'prints the message with indentation if set' do
|
|
51
|
+
@logger.indentation = ' '
|
|
52
|
+
@logger.inform 'attention'
|
|
53
|
+
out.should.be.eql? ' attention'
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
describe '#inform_colored' do
|
|
58
|
+
it 'works with string placeholders' do
|
|
59
|
+
@logger.inform_colored 'a %s c', :red, 'b'
|
|
60
|
+
out.should.be.eql? "\e[31ma \e[0m\e[31m\e[1mb\e[0m\e[0m\e[31m c\e[0m"
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
it 'works with multiple placeholders' do
|
|
64
|
+
@logger.inform_colored 'a %s c %s e', :red, 'b', 'd'
|
|
65
|
+
out.should.be.eql? "\e[31ma \e[0m\e[31m\e[1mb\e[0m\e[0m\e[31m c \e[0m\e[31m\e[1md\e[0m\e[0m\e[31m e\e[0m"
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
it 'works with integer number placeholders' do
|
|
69
|
+
@logger.inform_colored '%d', :red, 2
|
|
70
|
+
out.should.be.eql? "\e[31m\e[1m2\e[0m\e[0m"
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
it 'works with floating point number placeholders' do
|
|
74
|
+
@logger.inform_colored '%.5f', :red, 3.14159265359
|
|
75
|
+
out.should.be.eql? "\e[31m\e[1m3.14159\e[0m\e[0m"
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
it 'works with more complex placeholders' do
|
|
79
|
+
@logger.inform_colored '%1$#+10.d', :red, 1234
|
|
80
|
+
out.should.be.eql? "\e[31m\e[1m +1234\e[0m\e[0m"
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
it 'works with escaped percents' do
|
|
84
|
+
@logger.inform_colored '%%', :red
|
|
85
|
+
out.should.be.eql? "\e[31m%\e[0m"
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
it 'doesn\'t fail because of unescaped percents' do
|
|
89
|
+
-> {
|
|
90
|
+
@logger.inform_colored '%s', :red, '%'
|
|
91
|
+
}.should.not.raise?(ArgumentError)
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
describe '#log' do
|
|
96
|
+
it 'prints nothing by default' do
|
|
97
|
+
@logger.log 'test'
|
|
98
|
+
out.should.be.empty?
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
it 'prints the message in verbose mode' do
|
|
102
|
+
@logger.verbose = true
|
|
103
|
+
@logger.log 'test'
|
|
104
|
+
out.should.be.eql? "\e[35mⓋ test\e[0m"
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
describe '#success' do
|
|
109
|
+
it 'prints the message' do
|
|
110
|
+
@logger.success 'test'
|
|
111
|
+
out.should.be.eql? "\e[32m✓ test\e[0m"
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
describe '#warn' do
|
|
116
|
+
it 'prints the message' do
|
|
117
|
+
@logger.warn 'test'
|
|
118
|
+
out.should.be.eql? "\e[33m⚠ test\e[0m"
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
describe '#fail' do
|
|
123
|
+
it 'accepts a String as message' do
|
|
124
|
+
@logger.fail 'test'
|
|
125
|
+
out.should.be.eql? "\e[31m✗ test\e[0m"
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
it 'accepts an Exception as message' do
|
|
129
|
+
@logger.fail StandardError.new('test')
|
|
130
|
+
out.should.be.eql? "\e[31m✗ test\e[0m"
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
it 'prints the backtrace in verbose mode' do
|
|
134
|
+
@logger.verbose = true
|
|
135
|
+
exception = StandardError.new 'test'
|
|
136
|
+
exception.expects(backtrace: %w[a b])
|
|
137
|
+
@logger.fail exception
|
|
138
|
+
out.should.be.eql? "\e[31m✗ test\e[0m\n\e[35mⓋ Backtrace:\na\nb\e[0m"
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
|
2
|
+
|
|
3
|
+
describe 'XCRes::Section' do
|
|
4
|
+
|
|
5
|
+
def subject
|
|
6
|
+
XCRes::Section
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe '#initialize' do
|
|
10
|
+
it 'should initialize a new section without options' do
|
|
11
|
+
section = subject.new('Name', { 'a' => 'a.gif' })
|
|
12
|
+
section.name.should.be.eql?('Name')
|
|
13
|
+
section.items.should.be.eql?({ 'a' => 'a.gif' })
|
|
14
|
+
section.options.should.be.eql?({})
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it 'should initialize a new section with options' do
|
|
18
|
+
section = subject.new('Name', { 'a' => 'a.gif' }, { custom_flag: true })
|
|
19
|
+
section.name.should.be.eql?('Name')
|
|
20
|
+
section.items.should.be.eql?({ 'a' => 'a.gif' })
|
|
21
|
+
section.options.should.be.eql?({ custom_flag: true })
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
describe '#==' do
|
|
26
|
+
before do
|
|
27
|
+
@left = subject.new('Cats', 'cat' => 'cat.gif')
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it 'should be true for equal sections' do
|
|
31
|
+
(@left == subject.new('Cats', 'cat' => 'cat.gif')).should.be.true?
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it 'should be false if name is different' do
|
|
35
|
+
(@left == subject.new('Dog', 'cat' => 'cat.gif')).should.be.false?
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it 'should be false if items are different' do
|
|
39
|
+
(@left == subject.new('Cat', 'dog' => 'dog.gif')).should.be.false?
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it 'should be false if options are different' do
|
|
43
|
+
(@left == subject.new('Cat', { 'cat' => 'cat.gif' }, custom_flag: true)).should.be.false?
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
end
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
require File.expand_path('../spec_helper', __FILE__)
|
|
2
|
+
|
|
3
|
+
module XCAssetsSpec
|
|
4
|
+
describe 'XCRes::XCAssets::Bundle' do
|
|
5
|
+
|
|
6
|
+
def subject
|
|
7
|
+
Bundle
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
describe "::open" do
|
|
11
|
+
it 'should read the bundle at given path' do
|
|
12
|
+
subject.any_instance.expects(:read)
|
|
13
|
+
subject.open('.')
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe "#initialize" do
|
|
18
|
+
it 'should not require any arguments' do
|
|
19
|
+
-> { subject.new }.should.not.raise?
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
describe 'first argument' do
|
|
23
|
+
it 'should box it in Pathname and set it as attribute path' do
|
|
24
|
+
subject.new('.').path.should.be.eql?(Pathname('.'))
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it 'should set it as attribute path' do
|
|
28
|
+
subject.new(Pathname('.')).path.should.be.eql?(Pathname('.'))
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
it 'should initialize attribute resources with an empty array' do
|
|
33
|
+
subject.new.resources.should.be.eql?([])
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
describe "#read" do
|
|
38
|
+
before do
|
|
39
|
+
@bundle = subject.new(xcassets_fixture_path)
|
|
40
|
+
@bundle.read
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
it 'should set the resource paths' do
|
|
44
|
+
@bundle.resource_paths.should.be.eql? [
|
|
45
|
+
Pathname('AppIcon.appiconset'),
|
|
46
|
+
Pathname('Doge.imageset'),
|
|
47
|
+
Pathname('LaunchImage.launchimage'),
|
|
48
|
+
]
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
shared 'XCAssets resource' do
|
|
52
|
+
it 'should match the info' do
|
|
53
|
+
@res.info.should.be.eql?({ "version" => 1, "author" => "xcode" })
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
describe 'resources' do
|
|
58
|
+
describe 'AppIcon.appiconset' do
|
|
59
|
+
before { @res = @bundle.resources[0] }
|
|
60
|
+
|
|
61
|
+
behaves_like 'XCAssets resource'
|
|
62
|
+
|
|
63
|
+
it 'should match the path' do
|
|
64
|
+
@res.path.should.be.eql? Pathname('AppIcon.appiconset')
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
it 'should match the name' do
|
|
68
|
+
@res.name.should.be.eql? 'AppIcon'
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
it 'should match the type' do
|
|
72
|
+
@res.type.should.be.eql? 'appiconset'
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
it 'should match the images' do
|
|
76
|
+
@res.images.should.be.eql? [
|
|
77
|
+
ResourceImage.new(idiom: 'iphone', scale: 2, size: '29x29'),
|
|
78
|
+
ResourceImage.new(idiom: 'iphone', scale: 2, size: '40x40'),
|
|
79
|
+
ResourceImage.new(idiom: 'iphone', scale: 2, size: '60x60'),
|
|
80
|
+
]
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
describe 'Doge.imageset' do
|
|
85
|
+
before { @res = @bundle.resources[1] }
|
|
86
|
+
|
|
87
|
+
behaves_like 'XCAssets resource'
|
|
88
|
+
|
|
89
|
+
it 'should match the path' do
|
|
90
|
+
@res.path.should.be.eql? Pathname('Doge.imageset')
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
it 'should match the name' do
|
|
94
|
+
@res.name.should.be.eql? 'Doge'
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
it 'should match the type' do
|
|
98
|
+
@res.type.should.be.eql? 'imageset'
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
it 'should match the info' do
|
|
102
|
+
@res.info.should.be.eql?({ "version" => 1, "author" => "xcode" })
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
it 'should match the images' do
|
|
106
|
+
@res.images.should.be.eql? [
|
|
107
|
+
ResourceImage.new(idiom: 'universal', scale: 1, filename: 'doge.png'),
|
|
108
|
+
ResourceImage.new(idiom: 'universal', scale: 2, filename: 'doge@2x.png'),
|
|
109
|
+
]
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
describe 'LaunchImage.launchimage' do
|
|
114
|
+
before { @res = @bundle.resources[2] }
|
|
115
|
+
|
|
116
|
+
behaves_like 'XCAssets resource'
|
|
117
|
+
|
|
118
|
+
it 'should match the path' do
|
|
119
|
+
@res.path.should.be.eql? Pathname('LaunchImage.launchimage')
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
it 'should match the name' do
|
|
123
|
+
@res.name.should.be.eql? 'LaunchImage'
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
it 'should match the type' do
|
|
127
|
+
@res.type.should.be.eql? 'launchimage'
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
it 'should match the images' do
|
|
131
|
+
@res.images.should.be.eql? [
|
|
132
|
+
ResourceImage.new({
|
|
133
|
+
orientation: 'portrait',
|
|
134
|
+
idiom: 'iphone',
|
|
135
|
+
extent: 'full-screen',
|
|
136
|
+
minimum_system_version: '7.0',
|
|
137
|
+
scale: 2,
|
|
138
|
+
}),
|
|
139
|
+
ResourceImage.new({
|
|
140
|
+
orientation: 'portrait',
|
|
141
|
+
idiom: 'iphone',
|
|
142
|
+
extent: 'full-screen',
|
|
143
|
+
minimum_system_version: '7.0',
|
|
144
|
+
scale: 2,
|
|
145
|
+
subtype: 'retina4',
|
|
146
|
+
}),
|
|
147
|
+
]
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
end
|
|
154
|
+
end
|