flip_the_switch 0.3.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 +146 -0
- data/.rspec +1 -0
- data/.travis.yml +13 -0
- data/CHANGELOG.md +14 -0
- data/Classes/FlipTheSwitch/FlipTheSwitch.h +9 -0
- data/Classes/FlipTheSwitch/FlipTheSwitch.m +88 -0
- data/Example/.gitignore +2 -0
- data/Example/Colors-iOS/AppDelegateiOS.h +3 -0
- data/Example/Colors-iOS/AppDelegateiOS.m +4 -0
- data/Example/Colors-iOS/Base.lproj/Main_iPhone.storyboard +76 -0
- data/Example/Colors-iOS/Colors-iOS-Info.plist +49 -0
- data/Example/Colors-iOS/Colors-iOS-Prefix.pch +16 -0
- data/Example/Colors-iOS/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
- data/Example/Colors-iOS/Images.xcassets/LaunchImage.launchimage/Contents.json +51 -0
- data/Example/Colors-iOS/ViewControlleriOS.h +2 -0
- data/Example/Colors-iOS/ViewControlleriOS.m +78 -0
- data/Example/Colors-iOS/main.m +8 -0
- data/Example/Colors.xcodeproj/project.pbxproj +358 -0
- data/Example/Colors.xcodeproj/xcshareddata/xcschemes/Colors-iOS.xcscheme +77 -0
- data/Example/Podfile +4 -0
- data/Example/Rakefile +23 -0
- data/Example/features.yml +2 -0
- data/FlipTheSwitch.podspec +16 -0
- data/Gemfile +17 -0
- data/Guardfile.example +15 -0
- data/LICENSE +21 -0
- data/README.md +104 -0
- data/Rakefile +35 -0
- data/Tests/FlipTheSwitchSpec-Mac/Features.plist +8 -0
- data/Tests/FlipTheSwitchSpec-Mac/FlipTheSwitchSpec-Mac-Info.plist +22 -0
- data/Tests/FlipTheSwitchSpec-Mac/FlipTheSwitchSpec-Mac-Prefix.pch +13 -0
- data/Tests/FlipTheSwitchSpec-iOS/Features.plist +8 -0
- data/Tests/FlipTheSwitchSpec-iOS/FlipTheSwitchSpec-iOS-Info.plist +22 -0
- data/Tests/FlipTheSwitchSpec-iOS/FlipTheSwitchSpec-iOS-Prefix.pch +14 -0
- data/Tests/FlipTheSwitchSpec.xcodeproj/project.pbxproj +605 -0
- data/Tests/FlipTheSwitchSpec.xcodeproj/xcshareddata/xcschemes/FlipTheSwitchSpec-Mac.xcscheme +75 -0
- data/Tests/FlipTheSwitchSpec.xcodeproj/xcshareddata/xcschemes/FlipTheSwitchSpec-iOS.xcscheme +75 -0
- data/Tests/Podfile +15 -0
- data/Tests/Rakefile +22 -0
- data/Tests/Spec/Classes/FlipTheSwitch/FlipTheSwitchSpec.m +88 -0
- data/Tests/Spec/Helpers/GcovTestObserver.h +4 -0
- data/Tests/Spec/Helpers/GcovTestObserver.m +12 -0
- data/bin/flip-the-switch +4 -0
- data/flip_the_switch.gemspec +17 -0
- data/lib/flip_the_switch/cli.rb +61 -0
- data/lib/flip_the_switch/errors.rb +12 -0
- data/lib/flip_the_switch/generator/base.rb +13 -0
- data/lib/flip_the_switch/generator/category.rb +71 -0
- data/lib/flip_the_switch/generator/header.h.erb +11 -0
- data/lib/flip_the_switch/generator/implementation.m.erb +26 -0
- data/lib/flip_the_switch/generator/plist.rb +17 -0
- data/lib/flip_the_switch/generator.rb +3 -0
- data/lib/flip_the_switch/reader/yaml.rb +39 -0
- data/lib/flip_the_switch/reader.rb +1 -0
- data/lib/flip_the_switch.rb +3 -0
- data/spec/flip_the_switch/cli_spec.rb +81 -0
- data/spec/flip_the_switch/generator/category_spec.rb +44 -0
- data/spec/flip_the_switch/generator/plist_spec.rb +19 -0
- data/spec/flip_the_switch/reader/yaml_spec.rb +43 -0
- data/spec/resources/ExpectedFeatures.plist +10 -0
- data/spec/resources/expected_header.h +16 -0
- data/spec/resources/expected_implementation.m +46 -0
- data/spec/resources/invalid_layout/features.yml +4 -0
- data/spec/resources/invalid_type/features.yml +7 -0
- data/spec/resources/real/features.yml +2 -0
- data/spec/spec_helper.rb +15 -0
- metadata +166 -0
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe FlipTheSwitch::Reader::Yaml do
|
4
|
+
subject(:reader) { described_class.new(input) }
|
5
|
+
|
6
|
+
context 'when given a real file' do
|
7
|
+
let(:input) { 'spec/resources/real' }
|
8
|
+
|
9
|
+
it 'reads the enabled/disabled states of the features' do
|
10
|
+
expect(subject.feature_states).to eql('enabled_feature' => true, 'disabled_feature' => false)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
context 'when given a non-existent file' do
|
15
|
+
let(:input) { 'spec/resources/non-existent' }
|
16
|
+
|
17
|
+
specify do
|
18
|
+
expect {
|
19
|
+
subject.feature_states
|
20
|
+
}.to raise_error(FlipTheSwitch::Error::UnreadableFile)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'when given an invalid file type' do
|
25
|
+
let(:input) { 'spec/resources/invalid_type' }
|
26
|
+
|
27
|
+
specify do
|
28
|
+
expect {
|
29
|
+
subject.feature_states
|
30
|
+
}.to raise_error(FlipTheSwitch::Error::InvalidFile)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'when given an invalid file layout' do
|
35
|
+
let(:input) { 'spec/resources/invalid_layout' }
|
36
|
+
|
37
|
+
specify do
|
38
|
+
expect {
|
39
|
+
subject.feature_states
|
40
|
+
}.to raise_error(FlipTheSwitch::Error::InvalidFile)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
+
<plist version="1.0">
|
4
|
+
<dict>
|
5
|
+
<key>disabled_feature</key>
|
6
|
+
<false/>
|
7
|
+
<key>enabled_feature</key>
|
8
|
+
<true/>
|
9
|
+
</dict>
|
10
|
+
</plist>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
/* AUTO-GENERATED. DO NOT ALTER */
|
2
|
+
#import <FlipTheSwitch/FlipTheSwitch.h>
|
3
|
+
|
4
|
+
@interface FlipTheSwitch (Features)
|
5
|
+
|
6
|
+
+ (BOOL)isFirstFeatureEnabled;
|
7
|
+
+ (void)enableFirstFeature;
|
8
|
+
+ (void)disableFirstFeature;
|
9
|
+
+ (void)setFirstFeatureEnabled:(BOOL)enabled;
|
10
|
+
|
11
|
+
+ (BOOL)isSecondFeatureEnabled;
|
12
|
+
+ (void)enableSecondFeature;
|
13
|
+
+ (void)disableSecondFeature;
|
14
|
+
+ (void)setSecondFeatureEnabled:(BOOL)enabled;
|
15
|
+
|
16
|
+
@end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
/* AUTO-GENERATED. DO NOT ALTER */
|
2
|
+
#import "FlipTheSwitch+Features.h"
|
3
|
+
|
4
|
+
@implementation FlipTheSwitch (Features)
|
5
|
+
|
6
|
+
+ (BOOL)isFirstFeatureEnabled
|
7
|
+
{
|
8
|
+
return [[FlipTheSwitch sharedInstance] isFeatureEnabled:@"first_feature"];
|
9
|
+
}
|
10
|
+
|
11
|
+
+ (void)enableFirstFeature
|
12
|
+
{
|
13
|
+
[[FlipTheSwitch sharedInstance] enableFeature:@"first_feature"];
|
14
|
+
}
|
15
|
+
|
16
|
+
+ (void)disableFirstFeature
|
17
|
+
{
|
18
|
+
[[FlipTheSwitch sharedInstance] disableFeature:@"first_feature"];
|
19
|
+
}
|
20
|
+
|
21
|
+
+ (void)setFirstFeatureEnabled:(BOOL)enabled
|
22
|
+
{
|
23
|
+
[[FlipTheSwitch sharedInstance] setFeature:@"first_feature" enabled:enabled];
|
24
|
+
}
|
25
|
+
|
26
|
+
+ (BOOL)isSecondFeatureEnabled
|
27
|
+
{
|
28
|
+
return [[FlipTheSwitch sharedInstance] isFeatureEnabled:@"second_feature"];
|
29
|
+
}
|
30
|
+
|
31
|
+
+ (void)enableSecondFeature
|
32
|
+
{
|
33
|
+
[[FlipTheSwitch sharedInstance] enableFeature:@"second_feature"];
|
34
|
+
}
|
35
|
+
|
36
|
+
+ (void)disableSecondFeature
|
37
|
+
{
|
38
|
+
[[FlipTheSwitch sharedInstance] disableFeature:@"second_feature"];
|
39
|
+
}
|
40
|
+
|
41
|
+
+ (void)setSecondFeatureEnabled:(BOOL)enabled
|
42
|
+
{
|
43
|
+
[[FlipTheSwitch sharedInstance] setFeature:@"second_feature" enabled:enabled];
|
44
|
+
}
|
45
|
+
|
46
|
+
@end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
require 'spork'
|
4
|
+
require 'codeclimate-test-reporter'
|
5
|
+
|
6
|
+
CodeClimate::TestReporter.start
|
7
|
+
|
8
|
+
Spork.prefork do
|
9
|
+
require 'rspec'
|
10
|
+
end
|
11
|
+
|
12
|
+
Spork.each_run do
|
13
|
+
require 'flip_the_switch'
|
14
|
+
require 'flip_the_switch/cli'
|
15
|
+
end
|
metadata
ADDED
@@ -0,0 +1,166 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: flip_the_switch
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Michael England
|
8
|
+
- Rob Siwek
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-07-01 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: activesupport
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ~>
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '3.2'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ~>
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '3.2'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: thor
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ~>
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0.19'
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ~>
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0.19'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: plist
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ~>
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '3.1'
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ~>
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '3.1'
|
56
|
+
description:
|
57
|
+
email:
|
58
|
+
- mg.england@gmail.com
|
59
|
+
- rob@robsiwek.com
|
60
|
+
executables:
|
61
|
+
- flip-the-switch
|
62
|
+
extensions: []
|
63
|
+
extra_rdoc_files: []
|
64
|
+
files:
|
65
|
+
- .gitignore
|
66
|
+
- .rspec
|
67
|
+
- .travis.yml
|
68
|
+
- CHANGELOG.md
|
69
|
+
- Classes/FlipTheSwitch/FlipTheSwitch.h
|
70
|
+
- Classes/FlipTheSwitch/FlipTheSwitch.m
|
71
|
+
- Example/.gitignore
|
72
|
+
- Example/Colors-iOS/AppDelegateiOS.h
|
73
|
+
- Example/Colors-iOS/AppDelegateiOS.m
|
74
|
+
- Example/Colors-iOS/Base.lproj/Main_iPhone.storyboard
|
75
|
+
- Example/Colors-iOS/Colors-iOS-Info.plist
|
76
|
+
- Example/Colors-iOS/Colors-iOS-Prefix.pch
|
77
|
+
- Example/Colors-iOS/Images.xcassets/AppIcon.appiconset/Contents.json
|
78
|
+
- Example/Colors-iOS/Images.xcassets/LaunchImage.launchimage/Contents.json
|
79
|
+
- Example/Colors-iOS/ViewControlleriOS.h
|
80
|
+
- Example/Colors-iOS/ViewControlleriOS.m
|
81
|
+
- Example/Colors-iOS/main.m
|
82
|
+
- Example/Colors.xcodeproj/project.pbxproj
|
83
|
+
- Example/Colors.xcodeproj/xcshareddata/xcschemes/Colors-iOS.xcscheme
|
84
|
+
- Example/Podfile
|
85
|
+
- Example/Rakefile
|
86
|
+
- Example/features.yml
|
87
|
+
- FlipTheSwitch.podspec
|
88
|
+
- Gemfile
|
89
|
+
- Guardfile.example
|
90
|
+
- LICENSE
|
91
|
+
- README.md
|
92
|
+
- Rakefile
|
93
|
+
- Tests/FlipTheSwitchSpec-Mac/Features.plist
|
94
|
+
- Tests/FlipTheSwitchSpec-Mac/FlipTheSwitchSpec-Mac-Info.plist
|
95
|
+
- Tests/FlipTheSwitchSpec-Mac/FlipTheSwitchSpec-Mac-Prefix.pch
|
96
|
+
- Tests/FlipTheSwitchSpec-iOS/Features.plist
|
97
|
+
- Tests/FlipTheSwitchSpec-iOS/FlipTheSwitchSpec-iOS-Info.plist
|
98
|
+
- Tests/FlipTheSwitchSpec-iOS/FlipTheSwitchSpec-iOS-Prefix.pch
|
99
|
+
- Tests/FlipTheSwitchSpec.xcodeproj/project.pbxproj
|
100
|
+
- Tests/FlipTheSwitchSpec.xcodeproj/xcshareddata/xcschemes/FlipTheSwitchSpec-Mac.xcscheme
|
101
|
+
- Tests/FlipTheSwitchSpec.xcodeproj/xcshareddata/xcschemes/FlipTheSwitchSpec-iOS.xcscheme
|
102
|
+
- Tests/Podfile
|
103
|
+
- Tests/Rakefile
|
104
|
+
- Tests/Spec/Classes/FlipTheSwitch/FlipTheSwitchSpec.m
|
105
|
+
- Tests/Spec/Helpers/GcovTestObserver.h
|
106
|
+
- Tests/Spec/Helpers/GcovTestObserver.m
|
107
|
+
- bin/flip-the-switch
|
108
|
+
- flip_the_switch.gemspec
|
109
|
+
- lib/flip_the_switch.rb
|
110
|
+
- lib/flip_the_switch/cli.rb
|
111
|
+
- lib/flip_the_switch/errors.rb
|
112
|
+
- lib/flip_the_switch/generator.rb
|
113
|
+
- lib/flip_the_switch/generator/base.rb
|
114
|
+
- lib/flip_the_switch/generator/category.rb
|
115
|
+
- lib/flip_the_switch/generator/header.h.erb
|
116
|
+
- lib/flip_the_switch/generator/implementation.m.erb
|
117
|
+
- lib/flip_the_switch/generator/plist.rb
|
118
|
+
- lib/flip_the_switch/reader.rb
|
119
|
+
- lib/flip_the_switch/reader/yaml.rb
|
120
|
+
- spec/flip_the_switch/cli_spec.rb
|
121
|
+
- spec/flip_the_switch/generator/category_spec.rb
|
122
|
+
- spec/flip_the_switch/generator/plist_spec.rb
|
123
|
+
- spec/flip_the_switch/reader/yaml_spec.rb
|
124
|
+
- spec/resources/ExpectedFeatures.plist
|
125
|
+
- spec/resources/expected_header.h
|
126
|
+
- spec/resources/expected_implementation.m
|
127
|
+
- spec/resources/invalid_layout/features.yml
|
128
|
+
- spec/resources/invalid_type/features.yml
|
129
|
+
- spec/resources/real/features.yml
|
130
|
+
- spec/spec_helper.rb
|
131
|
+
homepage: https://github.com/michaelengland/FlipTheSwitch
|
132
|
+
licenses:
|
133
|
+
- MIT
|
134
|
+
metadata: {}
|
135
|
+
post_install_message:
|
136
|
+
rdoc_options: []
|
137
|
+
require_paths:
|
138
|
+
- lib
|
139
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - '>='
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '0'
|
144
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
145
|
+
requirements:
|
146
|
+
- - '>='
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: '0'
|
149
|
+
requirements: []
|
150
|
+
rubyforge_project:
|
151
|
+
rubygems_version: 2.1.11
|
152
|
+
signing_key:
|
153
|
+
specification_version: 4
|
154
|
+
summary: A simple library to help enabling/disabling features on iOS/Mac applications.
|
155
|
+
test_files:
|
156
|
+
- spec/flip_the_switch/cli_spec.rb
|
157
|
+
- spec/flip_the_switch/generator/category_spec.rb
|
158
|
+
- spec/flip_the_switch/generator/plist_spec.rb
|
159
|
+
- spec/flip_the_switch/reader/yaml_spec.rb
|
160
|
+
- spec/resources/ExpectedFeatures.plist
|
161
|
+
- spec/resources/expected_header.h
|
162
|
+
- spec/resources/expected_implementation.m
|
163
|
+
- spec/resources/invalid_layout/features.yml
|
164
|
+
- spec/resources/invalid_type/features.yml
|
165
|
+
- spec/resources/real/features.yml
|
166
|
+
- spec/spec_helper.rb
|