chozo 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.rbenv-version ADDED
@@ -0,0 +1 @@
1
+ 1.9.3-p286
data/.travis.yml CHANGED
@@ -1,5 +1,7 @@
1
1
  script: "bundle exec thor spec"
2
+ bundler_args: --without development
2
3
  language: ruby
3
4
  rvm:
4
5
  - 1.9.2
5
6
  - 1.9.3
7
+ - jruby-19mode
data/Gemfile CHANGED
@@ -1,3 +1,46 @@
1
- source 'https://rubygems.org'
1
+ source :rubygems
2
2
 
3
3
  gemspec
4
+
5
+ platforms :jruby do
6
+ gem 'json-jruby'
7
+ end
8
+
9
+ group :development do
10
+ gem 'yard'
11
+ gem 'spork'
12
+ gem 'guard'
13
+ gem 'guard-yard'
14
+ gem 'guard-rspec'
15
+ gem 'guard-spork', platforms: :ruby
16
+ gem 'coolline'
17
+ gem 'redcarpet'
18
+
19
+ require 'rbconfig'
20
+
21
+ if RbConfig::CONFIG['target_os'] =~ /darwin/i
22
+ gem 'growl', require: false
23
+ gem 'rb-fsevent', require: false
24
+
25
+ if `uname`.strip == 'Darwin' && `sw_vers -productVersion`.strip >= '10.8'
26
+ gem 'terminal-notifier-guard', '~> 1.5.3', require: false
27
+ end rescue Errno::ENOENT
28
+
29
+ elsif RbConfig::CONFIG['target_os'] =~ /linux/i
30
+ gem 'libnotify', '~> 0.7.1', require: false
31
+ gem 'rb-inotify', require: false
32
+
33
+ elsif RbConfig::CONFIG['target_os'] =~ /mswin|mingw/i
34
+ gem 'win32console', require: false
35
+ gem 'rb-notifu', '>= 0.0.4', require: false
36
+ gem 'wdm', require: false
37
+ end
38
+ end
39
+
40
+ group :test do
41
+ gem 'thor'
42
+ gem 'rake', '>= 0.9.2.2'
43
+ gem 'rspec'
44
+ gem 'fuubar'
45
+ gem 'json_spec'
46
+ end
data/Thorfile CHANGED
@@ -5,25 +5,28 @@ require 'bundler'
5
5
  require 'bundler/setup'
6
6
 
7
7
  require 'chozo'
8
- require 'thor/rake_compat'
9
8
 
10
9
  class Default < Thor
11
- include Thor::RakeCompat
12
- Bundler::GemHelper.install_tasks
13
-
14
- desc "build", "Build chozo-#{Chozo::VERSION}.gem into the pkg directory"
15
- def build
16
- Rake::Task["build"].execute
17
- end
10
+ unless jruby?
11
+ require 'thor/rake_compat'
12
+
13
+ include Thor::RakeCompat
14
+ Bundler::GemHelper.install_tasks
15
+
16
+ desc "build", "Build chozo-#{Chozo::VERSION}.gem into the pkg directory"
17
+ def build
18
+ Rake::Task["build"].execute
19
+ end
18
20
 
19
- desc "install", "Build and install chozo-#{Chozo::VERSION}.gem into system gems"
20
- def install
21
- Rake::Task["install"].execute
22
- end
21
+ desc "install", "Build and install chozo-#{Chozo::VERSION}.gem into system gems"
22
+ def install
23
+ Rake::Task["install"].execute
24
+ end
23
25
 
24
- desc "release", "Create tag v#{Chozo::VERSION} and build and push chozo-#{Chozo::VERSION}.gem to Rubygems"
25
- def release
26
- Rake::Task["release"].execute
26
+ desc "release", "Create tag v#{Chozo::VERSION} and build and push chozo-#{Chozo::VERSION}.gem to Rubygems"
27
+ def release
28
+ Rake::Task["release"].execute
29
+ end
27
30
  end
28
31
 
29
32
  class Spec < Thor
data/chozo.gemspec CHANGED
@@ -16,21 +16,7 @@ Gem::Specification.new do |s|
16
16
  s.version = Chozo::VERSION
17
17
  s.required_ruby_version = ">= 1.9.1"
18
18
 
19
- s.add_runtime_dependency 'activesupport'
20
- s.add_runtime_dependency 'activemodel'
19
+ s.add_runtime_dependency 'activesupport', '>= 3.2.0'
20
+ s.add_runtime_dependency 'activemodel', '>= 3.2.0'
21
21
  s.add_runtime_dependency 'multi_json', '>= 1.3.0'
22
-
23
- s.add_development_dependency 'thor'
24
- s.add_development_dependency 'rake'
25
- s.add_development_dependency 'rspec'
26
- s.add_development_dependency 'fuubar'
27
- s.add_development_dependency 'spork'
28
- s.add_development_dependency 'yard'
29
- s.add_development_dependency 'guard'
30
- s.add_development_dependency 'guard-rspec'
31
- s.add_development_dependency 'guard-spork'
32
- s.add_development_dependency 'guard-yard'
33
- s.add_development_dependency 'coolline'
34
- s.add_development_dependency 'redcarpet'
35
- s.add_development_dependency 'json_spec'
36
22
  end
data/lib/chozo.rb CHANGED
@@ -1,8 +1,10 @@
1
- require 'active_support'
2
-
3
- require 'chozo/core_ext'
4
-
1
+ # @author Jamie Winsor <jamie@vialstudios.com>
5
2
  module Chozo
6
3
  autoload :Config, 'chozo/config'
7
4
  autoload :Errors, 'chozo/errors'
5
+ autoload :Platform, 'chozo/platform'
6
+ autoload :RubyEngine, 'chozo/ruby_engine'
8
7
  end
8
+
9
+ require 'chozo/core_ext'
10
+ require 'active_support/core_ext'
data/lib/chozo/config.rb CHANGED
@@ -2,6 +2,7 @@ require 'active_model'
2
2
  require 'chozo/errors'
3
3
 
4
4
  module Chozo
5
+ # @author Jamie Winsor <jamie@vialstudios.com>
5
6
  module Config
6
7
  autoload :JSON, 'chozo/config/json'
7
8
 
@@ -2,6 +2,7 @@ require 'multi_json'
2
2
 
3
3
  module Chozo
4
4
  module Config
5
+ # @author Jamie Winsor <jamie@vialstudios.com>
5
6
  module JSON
6
7
  extend ActiveSupport::Concern
7
8
  include Chozo::Config
@@ -0,0 +1,12 @@
1
+ require 'chozo/platform'
2
+ require 'chozo/ruby_engine'
3
+
4
+ module Kernel
5
+ include Chozo::Platform
6
+ include Chozo::RubyEngine
7
+ end
8
+
9
+ class Object
10
+ # Re-include since we updated the Kernel module
11
+ include Kernel
12
+ end
data/lib/chozo/errors.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Chozo
2
+ # @author Jamie Winsor <jamie@vialstudios.com>
2
3
  module Errors
3
4
  class ChozoError < StandardError; end
4
5
  class ConfigNotFound < ChozoError; end
@@ -0,0 +1,29 @@
1
+ require 'rbconfig'
2
+
3
+ module Chozo
4
+ # @author Jamie Winsor <jamie@vialstudios.com>
5
+ module Platform
6
+ module ClassMethods
7
+ # @return [Boolean]
8
+ def windows?
9
+ (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/) ? true : false
10
+ end
11
+
12
+ def osx?
13
+ (RbConfig::CONFIG['host_os'] =~ /darwin/) ? true : false
14
+ end
15
+
16
+ def linux?
17
+ (RbConfig::CONFIG['host_os'] =~ /linux/) ? true : false
18
+ end
19
+ end
20
+
21
+ class << self
22
+ def included(base)
23
+ base.send(:include, Platform::ClassMethods)
24
+ end
25
+ end
26
+
27
+ extend Platform::ClassMethods
28
+ end
29
+ end
@@ -0,0 +1,30 @@
1
+ module Chozo
2
+ # @author Jamie Winsor <jamie@vialstudios.com>
3
+ module RubyEngine
4
+ module ClassMethods
5
+ # @return [Boolean]
6
+ def jruby?
7
+ RUBY_ENGINE == 'jruby'
8
+ end
9
+
10
+ # @return [Boolean]
11
+ def mri?
12
+ RUBY_ENGINE == 'ruby'
13
+ end
14
+
15
+ # @return [Boolean]
16
+ def rubinius?
17
+ RUBY_ENGINE == 'rbx'
18
+ end
19
+ alias_method :rbx?, :rubinius?
20
+ end
21
+
22
+ class << self
23
+ def included(base)
24
+ base.send(:include, RubyEngine::ClassMethods)
25
+ end
26
+ end
27
+
28
+ extend RubyEngine::ClassMethods
29
+ end
30
+ end
data/lib/chozo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Chozo
2
- VERSION = "0.0.3"
2
+ VERSION = "0.1.0"
3
3
  end
data/spec/spec_helper.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  require 'rubygems'
2
2
  require 'bundler'
3
- require 'spork'
3
+ require 'chozo/core_ext'
4
4
 
5
- Spork.prefork do
5
+ def setup_rspec
6
6
  require 'rspec'
7
7
  require 'json_spec'
8
8
 
@@ -23,6 +23,17 @@ Spork.prefork do
23
23
  end
24
24
  end
25
25
 
26
- Spork.each_run do
26
+ if mri? && ENV['CI'] != 'true'
27
+ require 'spork'
28
+
29
+ Spork.prefork do
30
+ setup_rspec
31
+ end
32
+
33
+ Spork.each_run do
34
+ require 'chozo'
35
+ end
36
+ else
27
37
  require 'chozo'
38
+ setup_rspec
28
39
  end
@@ -0,0 +1,67 @@
1
+ require 'spec_helper'
2
+
3
+ describe Chozo::Platform do
4
+ subject { Chozo::Platform }
5
+
6
+ before(:each) do
7
+ @original = RbConfig::CONFIG['host_os']
8
+ end
9
+
10
+ after(:each) do
11
+ RbConfig::CONFIG['host_os'] = @original
12
+ end
13
+
14
+ describe "::windows?" do
15
+ it "returns true when 'host_os' config matches mswin" do
16
+ RbConfig::CONFIG['host_os'] = 'mswin'
17
+
18
+ subject.should be_windows
19
+ end
20
+
21
+ it "returns true when 'host_os' config matches mingw" do
22
+ RbConfig::CONFIG['host_os'] = 'mingw'
23
+
24
+ subject.should be_windows
25
+ end
26
+
27
+ it "returns true when 'host_os' config matches cygwin" do
28
+ RbConfig::CONFIG['host_os'] = 'cygwin'
29
+
30
+ subject.should be_windows
31
+ end
32
+
33
+ it "returns false when 'host_os' config does not match windows" do
34
+ RbConfig::CONFIG['host_os'] = 'darwin11.3.0'
35
+
36
+ subject.should_not be_windows
37
+ end
38
+ end
39
+
40
+ describe "::osx?" do
41
+ it "returns false when 'host_os' config does not match darwin" do
42
+ RbConfig::CONFIG['host_os'] = 'mingw'
43
+
44
+ subject.should_not be_osx
45
+ end
46
+
47
+ it "returns true when 'host_os' config matches darwin" do
48
+ RbConfig::CONFIG['host_os'] = 'darwin'
49
+
50
+ subject.should be_osx
51
+ end
52
+ end
53
+
54
+ describe "::linux?" do
55
+ it "returns false when 'host_os' config does not match linux" do
56
+ RbConfig::CONFIG['host_os'] = 'mingw'
57
+
58
+ subject.should_not be_linux
59
+ end
60
+
61
+ it "returns true when 'host_os' config matches linux" do
62
+ RbConfig::CONFIG['host_os'] = 'linux'
63
+
64
+ subject.should be_linux
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,47 @@
1
+ require 'spec_helper'
2
+
3
+ describe Chozo::RubyEngine do
4
+ subject { Chozo::RubyEngine }
5
+
6
+ describe "::jruby?" do
7
+ it "returns true if RUBY_ENGINE equals 'jruby'" do
8
+ stub_const("RUBY_ENGINE", "jruby")
9
+
10
+ subject.should be_jruby
11
+ end
12
+
13
+ it "returns false if RUBY_ENGINE does not equal 'jruby'" do
14
+ stub_const("RUBY_ENGINE", "ruby")
15
+
16
+ subject.should_not be_jruby
17
+ end
18
+ end
19
+
20
+ describe "::mri?" do
21
+ it "returns true if RUBY_ENGINE equals 'ruby'" do
22
+ stub_const("RUBY_ENGINE", "ruby")
23
+
24
+ subject.should be_mri
25
+ end
26
+
27
+ it "returns false if RUBY_ENGINE does not equal 'ruby'" do
28
+ stub_const("RUBY_ENGINE", "jruby")
29
+
30
+ subject.should_not be_mri
31
+ end
32
+ end
33
+
34
+ describe "::rubinius?" do
35
+ it "returns true if RUBY_ENGINE equals 'rbx'" do
36
+ stub_const("RUBY_ENGINE", "rbx")
37
+
38
+ subject.should be_rubinius
39
+ end
40
+
41
+ it "returns false if RUBY_ENGINE does not equal 'rbx'" do
42
+ stub_const("RUBY_ENGINE", "jruby")
43
+
44
+ subject.should_not be_rubinius
45
+ end
46
+ end
47
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chozo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-11 00:00:00.000000000 Z
12
+ date: 2012-10-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: '0'
21
+ version: 3.2.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
- version: '0'
29
+ version: 3.2.0
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: activemodel
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -34,7 +34,7 @@ dependencies:
34
34
  requirements:
35
35
  - - ! '>='
36
36
  - !ruby/object:Gem::Version
37
- version: '0'
37
+ version: 3.2.0
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,7 +42,7 @@ dependencies:
42
42
  requirements:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
- version: '0'
45
+ version: 3.2.0
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: multi_json
48
48
  requirement: !ruby/object:Gem::Requirement
@@ -59,214 +59,6 @@ dependencies:
59
59
  - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: 1.3.0
62
- - !ruby/object:Gem::Dependency
63
- name: thor
64
- requirement: !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
67
- - - ! '>='
68
- - !ruby/object:Gem::Version
69
- version: '0'
70
- type: :development
71
- prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ! '>='
76
- - !ruby/object:Gem::Version
77
- version: '0'
78
- - !ruby/object:Gem::Dependency
79
- name: rake
80
- requirement: !ruby/object:Gem::Requirement
81
- none: false
82
- requirements:
83
- - - ! '>='
84
- - !ruby/object:Gem::Version
85
- version: '0'
86
- type: :development
87
- prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ! '>='
92
- - !ruby/object:Gem::Version
93
- version: '0'
94
- - !ruby/object:Gem::Dependency
95
- name: rspec
96
- requirement: !ruby/object:Gem::Requirement
97
- none: false
98
- requirements:
99
- - - ! '>='
100
- - !ruby/object:Gem::Version
101
- version: '0'
102
- type: :development
103
- prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
- requirements:
107
- - - ! '>='
108
- - !ruby/object:Gem::Version
109
- version: '0'
110
- - !ruby/object:Gem::Dependency
111
- name: fuubar
112
- requirement: !ruby/object:Gem::Requirement
113
- none: false
114
- requirements:
115
- - - ! '>='
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
- requirements:
123
- - - ! '>='
124
- - !ruby/object:Gem::Version
125
- version: '0'
126
- - !ruby/object:Gem::Dependency
127
- name: spork
128
- requirement: !ruby/object:Gem::Requirement
129
- none: false
130
- requirements:
131
- - - ! '>='
132
- - !ruby/object:Gem::Version
133
- version: '0'
134
- type: :development
135
- prerelease: false
136
- version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
- requirements:
139
- - - ! '>='
140
- - !ruby/object:Gem::Version
141
- version: '0'
142
- - !ruby/object:Gem::Dependency
143
- name: yard
144
- requirement: !ruby/object:Gem::Requirement
145
- none: false
146
- requirements:
147
- - - ! '>='
148
- - !ruby/object:Gem::Version
149
- version: '0'
150
- type: :development
151
- prerelease: false
152
- version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
- requirements:
155
- - - ! '>='
156
- - !ruby/object:Gem::Version
157
- version: '0'
158
- - !ruby/object:Gem::Dependency
159
- name: guard
160
- requirement: !ruby/object:Gem::Requirement
161
- none: false
162
- requirements:
163
- - - ! '>='
164
- - !ruby/object:Gem::Version
165
- version: '0'
166
- type: :development
167
- prerelease: false
168
- version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
- requirements:
171
- - - ! '>='
172
- - !ruby/object:Gem::Version
173
- version: '0'
174
- - !ruby/object:Gem::Dependency
175
- name: guard-rspec
176
- requirement: !ruby/object:Gem::Requirement
177
- none: false
178
- requirements:
179
- - - ! '>='
180
- - !ruby/object:Gem::Version
181
- version: '0'
182
- type: :development
183
- prerelease: false
184
- version_requirements: !ruby/object:Gem::Requirement
185
- none: false
186
- requirements:
187
- - - ! '>='
188
- - !ruby/object:Gem::Version
189
- version: '0'
190
- - !ruby/object:Gem::Dependency
191
- name: guard-spork
192
- requirement: !ruby/object:Gem::Requirement
193
- none: false
194
- requirements:
195
- - - ! '>='
196
- - !ruby/object:Gem::Version
197
- version: '0'
198
- type: :development
199
- prerelease: false
200
- version_requirements: !ruby/object:Gem::Requirement
201
- none: false
202
- requirements:
203
- - - ! '>='
204
- - !ruby/object:Gem::Version
205
- version: '0'
206
- - !ruby/object:Gem::Dependency
207
- name: guard-yard
208
- requirement: !ruby/object:Gem::Requirement
209
- none: false
210
- requirements:
211
- - - ! '>='
212
- - !ruby/object:Gem::Version
213
- version: '0'
214
- type: :development
215
- prerelease: false
216
- version_requirements: !ruby/object:Gem::Requirement
217
- none: false
218
- requirements:
219
- - - ! '>='
220
- - !ruby/object:Gem::Version
221
- version: '0'
222
- - !ruby/object:Gem::Dependency
223
- name: coolline
224
- requirement: !ruby/object:Gem::Requirement
225
- none: false
226
- requirements:
227
- - - ! '>='
228
- - !ruby/object:Gem::Version
229
- version: '0'
230
- type: :development
231
- prerelease: false
232
- version_requirements: !ruby/object:Gem::Requirement
233
- none: false
234
- requirements:
235
- - - ! '>='
236
- - !ruby/object:Gem::Version
237
- version: '0'
238
- - !ruby/object:Gem::Dependency
239
- name: redcarpet
240
- requirement: !ruby/object:Gem::Requirement
241
- none: false
242
- requirements:
243
- - - ! '>='
244
- - !ruby/object:Gem::Version
245
- version: '0'
246
- type: :development
247
- prerelease: false
248
- version_requirements: !ruby/object:Gem::Requirement
249
- none: false
250
- requirements:
251
- - - ! '>='
252
- - !ruby/object:Gem::Version
253
- version: '0'
254
- - !ruby/object:Gem::Dependency
255
- name: json_spec
256
- requirement: !ruby/object:Gem::Requirement
257
- none: false
258
- requirements:
259
- - - ! '>='
260
- - !ruby/object:Gem::Version
261
- version: '0'
262
- type: :development
263
- prerelease: false
264
- version_requirements: !ruby/object:Gem::Requirement
265
- none: false
266
- requirements:
267
- - - ! '>='
268
- - !ruby/object:Gem::Version
269
- version: '0'
270
62
  description: A collection of supporting libraries and Ruby core extensions
271
63
  email:
272
64
  - jamie@vialstudios.com
@@ -275,6 +67,7 @@ extensions: []
275
67
  extra_rdoc_files: []
276
68
  files:
277
69
  - .gitignore
70
+ - .rbenv-version
278
71
  - .travis.yml
279
72
  - Gemfile
280
73
  - Guardfile
@@ -287,7 +80,10 @@ files:
287
80
  - lib/chozo/config/json.rb
288
81
  - lib/chozo/core_ext.rb
289
82
  - lib/chozo/core_ext/hash.rb
83
+ - lib/chozo/core_ext/kernel.rb
290
84
  - lib/chozo/errors.rb
85
+ - lib/chozo/platform.rb
86
+ - lib/chozo/ruby_engine.rb
291
87
  - lib/chozo/version.rb
292
88
  - spec/shared_examples/chozo/config.rb
293
89
  - spec/spec_helper.rb
@@ -295,6 +91,8 @@ files:
295
91
  - spec/unit/chozo/config/json_spec.rb
296
92
  - spec/unit/chozo/config_spec.rb
297
93
  - spec/unit/chozo/core_ext/hash_spec.rb
94
+ - spec/unit/chozo/platform_spec.rb
95
+ - spec/unit/chozo/ruby_engine_spec.rb
298
96
  homepage: https://github.com/reset/chozo
299
97
  licenses: []
300
98
  post_install_message:
@@ -315,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
315
113
  version: '0'
316
114
  segments:
317
115
  - 0
318
- hash: -1213851817618954320
116
+ hash: 3399825819985301824
319
117
  requirements: []
320
118
  rubyforge_project:
321
119
  rubygems_version: 1.8.23
@@ -329,4 +127,5 @@ test_files:
329
127
  - spec/unit/chozo/config/json_spec.rb
330
128
  - spec/unit/chozo/config_spec.rb
331
129
  - spec/unit/chozo/core_ext/hash_spec.rb
332
- has_rdoc:
130
+ - spec/unit/chozo/platform_spec.rb
131
+ - spec/unit/chozo/ruby_engine_spec.rb