-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve support for OS X command line tools #194
Changes from all commits
afe7478
84115ea
e882c38
2e459fc
6d652a6
8201a3c
b133a82
48b3b85
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,8 @@ Pod::Spec.new do |s| | |
|
||
s.public_header_files = 'Lumberjack/**/*.h' | ||
|
||
s.default_subspec = 'Extensions' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Other projects skip the new subspec. |
||
|
||
s.subspec 'Core' do |ss| | ||
ss.source_files = 'Lumberjack/*.{h,m}' | ||
end | ||
|
@@ -30,4 +32,9 @@ Pod::Spec.new do |s| | |
ss.source_files = 'Lumberjack/Extensions/*.{h,m}' | ||
end | ||
|
||
s.subspec 'CLI' do |ss| | ||
ss.dependency 'CocoaLumberjack/Core' | ||
ss.source_files = 'Lumberjack/CLI/*.{h,m}' | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New subspec for OS X projects that don't use AppKit. |
||
|
||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// CLIColor.h | ||
// CocoaLumberjack | ||
// | ||
// Created by Ernesto Rivera on 2013/12/27. | ||
// | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
/** | ||
Simple NSColor replacement for CLI projects that don't link with AppKit | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Which is a simple NSColor replacement. |
||
*/ | ||
@interface CLIColor : NSObject | ||
|
||
+ (CLIColor *)colorWithCalibratedRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha; | ||
- (void)getRed:(CGFloat *)red green:(CGFloat *)green blue:(CGFloat *)blue alpha:(CGFloat *)alpha; | ||
|
||
@end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// CLIColor.m | ||
// CocoaLumberjack | ||
// | ||
// Created by Ernesto Rivera on 2013/12/27. | ||
// | ||
// | ||
|
||
#import "CLIColor.h" | ||
|
||
@implementation CLIColor | ||
{ | ||
CGFloat _red, _green, _blue, _alpha; | ||
} | ||
|
||
+(CLIColor *)colorWithCalibratedRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha | ||
{ | ||
CLIColor * color = [CLIColor new]; | ||
color->_red = red; | ||
color->_green = green; | ||
color->_blue = blue; | ||
color->_alpha = alpha; | ||
return color; | ||
} | ||
|
||
- (void)getRed:(CGFloat *)red green:(CGFloat *)green blue:(CGFloat *)blue alpha:(CGFloat *)alpha | ||
{ | ||
if (red) *red = _red; | ||
if (green) *green = _green; | ||
if (blue) *blue = _blue; | ||
if (alpha) *alpha = _alpha; | ||
} | ||
|
||
@end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
#import <Foundation/Foundation.h> | ||
#if TARGET_OS_IPHONE | ||
#import <UIKit/UIColor.h> | ||
#import <UIKit/UIColor.h> // iOS | ||
#elif !defined (COCOAPODS_POD_AVAILABLE_CocoaLumberjack_CLI) | ||
#import <AppKit/NSColor.h> // OS X with AppKit | ||
#else | ||
#import <AppKit/NSColor.h> | ||
#import "CLIColor.h" // OS X without AppKit | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TTY logger detects here if it should replace NSColor by CLIColor. |
||
#endif | ||
|
||
#import "DDLog.h" | ||
|
@@ -109,8 +111,10 @@ | |
**/ | ||
#if TARGET_OS_IPHONE | ||
- (void)setForegroundColor:(UIColor *)txtColor backgroundColor:(UIColor *)bgColor forFlag:(int)mask; | ||
#else | ||
#elif !defined (COCOAPODS_POD_AVAILABLE_CocoaLumberjack_CLI) | ||
- (void)setForegroundColor:(NSColor *)txtColor backgroundColor:(NSColor *)bgColor forFlag:(int)mask; | ||
#else | ||
- (void)setForegroundColor:(CLIColor *)txtColor backgroundColor:(CLIColor *)bgColor forFlag:(int)mask; | ||
#endif | ||
|
||
/** | ||
|
@@ -126,8 +130,10 @@ | |
**/ | ||
#if TARGET_OS_IPHONE | ||
- (void)setForegroundColor:(UIColor *)txtColor backgroundColor:(UIColor *)bgColor forFlag:(int)mask context:(int)ctxt; | ||
#else | ||
#elif !defined (COCOAPODS_POD_AVAILABLE_CocoaLumberjack_CLI) | ||
- (void)setForegroundColor:(NSColor *)txtColor backgroundColor:(NSColor *)bgColor forFlag:(int)mask context:(int)ctxt; | ||
#else | ||
- (void)setForegroundColor:(CLIColor *)txtColor backgroundColor:(CLIColor *)bgColor forFlag:(int)mask context:(int)ctxt; | ||
#endif | ||
|
||
/** | ||
|
@@ -144,6 +150,8 @@ | |
* UIColor *purple = [UIColor colorWithRed:(64/255.0) green:(0/255.0) blue:(128/255.0) alpha:1.0]; | ||
* #else | ||
* NSColor *purple = [NSColor colorWithCalibratedRed:(64/255.0) green:(0/255.0) blue:(128/255.0) alpha:1.0]; | ||
* | ||
* Note: For CLI OS X projects that don't link with AppKit use CLIColor objects instead | ||
* | ||
* [[DDTTYLogger sharedInstance] setForegroundColor:purple backgroundColor:nil forTag:PurpleTag]; | ||
* [DDLog addLogger:[DDTTYLogger sharedInstance]]; | ||
|
@@ -154,8 +162,10 @@ | |
**/ | ||
#if TARGET_OS_IPHONE | ||
- (void)setForegroundColor:(UIColor *)txtColor backgroundColor:(UIColor *)bgColor forTag:(id <NSCopying>)tag; | ||
#else | ||
#elif !defined (COCOAPODS_POD_AVAILABLE_CocoaLumberjack_CLI) | ||
- (void)setForegroundColor:(NSColor *)txtColor backgroundColor:(NSColor *)bgColor forTag:(id <NSCopying>)tag; | ||
#else | ||
- (void)setForegroundColor:(CLIColor *)txtColor backgroundColor:(CLIColor *)bgColor forTag:(id <NSCopying>)tag; | ||
#endif | ||
|
||
/** | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made sure not to break other usages.