development 1.0.7 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -9,3 +9,5 @@ Oops! Configuration-file enabling was commented out. So 1.0.3 is the first worki
9
9
  Fix for enabling by gemset.
10
10
  Directories can now specify either the directory the gem directory is in or the gem directory itself.
11
11
  We now support Bundler!
12
+ Removed all dependencies.
13
+
data/lib/development.rb CHANGED
@@ -1,6 +1,4 @@
1
1
 
2
- require 'array-unique'
3
-
4
2
  ###
5
3
  # Singleton that manages configurations and requires.
6
4
  #
@@ -21,7 +19,7 @@ module ::Development
21
19
  #
22
20
  def loaded?( gem_name )
23
21
 
24
- return @loaded_gems.include?( gem_name.to_sym )
22
+ return @loaded_gems.has_key?( gem_name.to_sym )
25
23
 
26
24
  end
27
25
 
@@ -100,7 +98,7 @@ module ::Development
100
98
  #
101
99
  def self.enabled_gems
102
100
 
103
- return @enabled_gems
101
+ return @enabled_gems.keys
104
102
 
105
103
  end
106
104
 
@@ -115,7 +113,7 @@ module ::Development
115
113
  #
116
114
  def self.disabled_gems
117
115
 
118
- return @disabled_gems
116
+ return @disabled_gems.keys
119
117
 
120
118
  end
121
119
 
@@ -185,15 +183,15 @@ module ::Development
185
183
  #
186
184
  ConfigurationFileName = '.development'
187
185
 
188
- @enabled_gems = ::Array::Unique.new
189
- @disabled_gems = ::Array::Unique.new
186
+ @enabled_gems = { }
187
+ @disabled_gems = { }
190
188
 
191
189
  @gemsets = { }
192
190
  @gem_locations = { }
193
191
 
194
- @general_load_paths = ::Array::Unique.new
192
+ @general_load_paths = [ ]
195
193
 
196
- @loaded_gems = ::Array::Unique.new
194
+ @loaded_gems = { }
197
195
 
198
196
  @named_directories = { }
199
197
  @locations = { }
@@ -524,9 +522,9 @@ module ::Development
524
522
  ###
525
523
  # Parse gem name list separated by optional comma and white space from expression.
526
524
  #
527
- # @param array
525
+ # @param hash
528
526
  #
529
- # Array to add parsed data to.
527
+ # Hash to add parsed data to.
530
528
  #
531
529
  # @param expression_string
532
530
  #
@@ -538,14 +536,14 @@ module ::Development
538
536
  #
539
537
  # @return [Development] Self.
540
538
  #
541
- def self.parse_gem_names_from_expression_string( array, expression_string, require_exist = false )
539
+ def self.parse_gem_names_from_expression_string( hash, expression_string, require_exist = false )
542
540
 
543
541
  while next_whitespace_index = expression_string =~ /\s/
544
- parse_gem_name_from_expression_string( array, expression_string, next_whitespace_index )
542
+ parse_gem_name_from_expression_string( hash, expression_string, next_whitespace_index )
545
543
  end
546
544
 
547
545
  # also slice till the end
548
- parse_gem_name_from_expression_string( array, expression_string, expression_string.length, require_exist )
546
+ parse_gem_name_from_expression_string( hash, expression_string, expression_string.length, require_exist )
549
547
 
550
548
  return self
551
549
 
@@ -558,9 +556,9 @@ module ::Development
558
556
  ###
559
557
  # Helper method to slice gem name from expression string and add or subtract from gemset.
560
558
  #
561
- # @param array
559
+ # @param hash
562
560
  #
563
- # Array to add parsed data to.
561
+ # Hash to add parsed data to.
564
562
  #
565
563
  # @param gemset
566
564
  #
@@ -580,7 +578,7 @@ module ::Development
580
578
  #
581
579
  # @return [Symbol] Parsed gem name.
582
580
  #
583
- def self.parse_gem_name_from_expression_string( array, expression_string, slice_to_index, require_exist = false )
581
+ def self.parse_gem_name_from_expression_string( hash, expression_string, slice_to_index, require_exist = false )
584
582
 
585
583
  gem_name = expression_string.slice!( 0, slice_to_index )
586
584
 
@@ -598,7 +596,7 @@ module ::Development
598
596
  gem_name.slice!( 0, 1 )
599
597
  when '-'
600
598
  gem_name.slice!( 0, 1 )
601
- array.delete( gem_name.to_sym )
599
+ hash.delete( gem_name.to_sym )
602
600
  should_add = false
603
601
  else
604
602
  end
@@ -618,7 +616,7 @@ module ::Development
618
616
  end
619
617
 
620
618
  if should_add
621
- array.push( gem_name )
619
+ hash[ gem_name ] = true
622
620
  end
623
621
 
624
622
  expression_string.strip!
@@ -647,7 +645,7 @@ module ::Development
647
645
  gemset_name = gemset_name.to_sym
648
646
 
649
647
  unless gemset = @gemsets[ gemset_name ]
650
- @gemsets[ gemset_name ] = gemset = ::Array::Unique.new
648
+ @gemsets[ gemset_name ] = gemset = { }
651
649
  end
652
650
 
653
651
  return gemset
@@ -669,7 +667,13 @@ module ::Development
669
667
  #
670
668
  def self.gemset( gemset_name )
671
669
 
672
- return @gemsets[ gemset_name.to_sym ]
670
+ gemset_members = nil
671
+
672
+ if gemset = @gemsets[ gemset_name.to_sym ]
673
+ gemset_members = gemset.keys
674
+ end
675
+
676
+ return gemset_members
673
677
 
674
678
  end
675
679
 
@@ -699,14 +703,14 @@ module ::Development
699
703
  end
700
704
 
701
705
  unless directory_members = @locations[ directory_name ]
702
- @locations[ directory_name ] = directory_members = ::Array::Unique.new
706
+ @locations[ directory_name ] = directory_members = { }
703
707
  end
704
708
 
705
709
  parse_gem_names_from_expression_string( directory_members, expression_string )
706
710
 
707
- directory_members.each do |this_gem_or_gemset|
711
+ directory_members.each do |this_gem_or_gemset, true_value|
708
712
  if gemset = @gemsets[ this_gem_or_gemset ]
709
- gemset.each do |this_gem|
713
+ gemset.each do |this_gem, true_value|
710
714
  @gem_locations[ this_gem ] = directory_name
711
715
  end
712
716
  else
@@ -743,7 +747,7 @@ module ::Development
743
747
 
744
748
  gems = nil
745
749
  unless expression_string.empty?
746
- gems = ::Array::Unique.new
750
+ gems = { }
747
751
  parse_gem_names_from_expression_string( gems, expression_string )
748
752
  end
749
753
 
@@ -754,19 +758,19 @@ module ::Development
754
758
  if gems
755
759
  gems.each do |this_gem_or_gemset, true_value|
756
760
  if gemset = @gemsets[ this_gem_or_gemset ]
757
- gemset.each do |this_gem|
758
- @enabled_gems.push( this_gem )
761
+ gemset.each do |this_gem, true_value|
762
+ @enabled_gems[ this_gem ] = true
759
763
  @disabled_gems.delete( this_gem )
760
764
  end
761
765
  else
762
766
  this_gem = this_gem_or_gemset
763
- @enabled_gems.push( this_gem )
767
+ @enabled_gems[ this_gem ] = true
764
768
  @disabled_gems.delete( this_gem )
765
769
  end
766
770
  end
767
771
  else
768
772
  @disabled_gems.delete_if do |this_gem, true_value|
769
- @enabled_gems.push( this_gem )
773
+ @enabled_gems[ this_gem ] = true
770
774
  true
771
775
  end
772
776
  @enable_for_all = true
@@ -777,19 +781,19 @@ module ::Development
777
781
  if gems
778
782
  gems.each do |this_gem_or_gemset, true_value|
779
783
  if gemset = @gemsets[ this_gem_or_gemset ]
780
- gemset.each do |this_gem|
781
- @disabled_gems.push( this_gem )
784
+ gemset.each do |this_gem, true_value|
785
+ @disabled_gems[ this_gem ] = true
782
786
  @enabled_gems.delete( this_gem )
783
787
  end
784
788
  else
785
789
  this_gem = this_gem_or_gemset
786
- @disabled_gems.push( this_gem )
790
+ @disabled_gems[ this_gem ] = true
787
791
  @enabled_gems.delete( this_gem )
788
792
  end
789
793
  end
790
794
  else
791
795
  @enabled_gems.delete_if do |this_gem, true_value|
792
- @disabled_gems.push( this_gem )
796
+ @disabled_gems[ this_gem ] = true
793
797
  true
794
798
  end
795
799
  @enable_for_all = false
@@ -888,11 +892,12 @@ module ::Development
888
892
 
889
893
  gem_name = gem_name_or_path.to_s
890
894
 
891
- if @loaded_gems.include?( gem_name.to_sym )
895
+ if @loaded_gems.has_key?( gem_name.to_sym )
892
896
  did_load = false
893
897
  else
894
898
  # ensure we have 'gem-subname' rather than 'gem/subname'
895
899
  # we really just need one or the other consistently
900
+ gem_name = gem_name.gsub( '/', '-' )
896
901
  gem_directory_name = gem_name.gsub( '/', '-' )
897
902
 
898
903
  # look for gem name in enabled gems/gemsets
@@ -906,13 +911,13 @@ module ::Development
906
911
  if gem_name_in_load_path?( load_path, gem_directory_name )
907
912
 
908
913
  load_gem_in_path( load_path, gem_directory_name )
909
- @loaded_gems.push( gem_name.to_sym )
914
+ @loaded_gems[ gem_name.to_sym ] = true
910
915
  did_load = true
911
916
 
912
917
  elsif gem_name_at_load_path?( load_path, gem_directory_name )
913
918
 
914
919
  load_gem_at_path( load_path, gem_directory_name )
915
- @loaded_gems.push( gem_name.to_sym )
920
+ @loaded_gems[ gem_name.to_sym ] = true
916
921
  did_load = true
917
922
 
918
923
  end
@@ -927,7 +932,7 @@ module ::Development
927
932
  # look for gem name at load path
928
933
  if gem_name_at_load_path?( this_load_path, gem_name )
929
934
  load_gem_at_path( this_load_path, gem_name )
930
- @loaded_gems.push( gem_name.to_sym )
935
+ @loaded_gems[ gem_name.to_sym ] = true
931
936
  did_load = true
932
937
  end
933
938
 
@@ -132,7 +132,7 @@ describe ::Development do
132
132
  ::Development.directory( :named_path ).should == ::File.expand_path( '~/path/to/somewhere' )
133
133
 
134
134
  ::Development.parse_general_directory_or_location_expression( '@named_path some_gem, some_other_gem' )
135
- ::Development.location( :named_path ).should == [ :some_gem, :some_other_gem ]
135
+ ::Development.location( :named_path ).should == { :some_gem => true, :some_other_gem => true }
136
136
 
137
137
  ::Development.parse_general_directory_or_location_expression( '@named_path/path/to/somewhere' )
138
138
  ::Development.general_load_paths.include?( ::File.expand_path( '~/path/to/somewhere/path/to/somewhere' ) ).should == true
@@ -290,9 +290,9 @@ describe ::Development do
290
290
  ::Development.directory( :hooked_objects ).should == ::File.expand_path( '~/Projects/rp/ruby/hooked_objects' )
291
291
  ::Development.directory( :compositing_objects ).should == ::File.expand_path( '~/Projects/rp/ruby/compositing_objects' )
292
292
 
293
- ::Development.location( :hooked_objects ).should == [ :hooked_objects ]
294
- ::Development.location( :compositing_objects ).should == [ :compositing_objects ]
295
- ::Development.location( :ridiculous_power ).should == [ :ridiculous_power ]
293
+ ::Development.location( :hooked_objects ).should == { :hooked_objects => true }
294
+ ::Development.location( :compositing_objects ).should == { :compositing_objects => true }
295
+ ::Development.location( :ridiculous_power ).should == { :ridiculous_power => true }
296
296
 
297
297
  ::Development.enabled_gems.should == [ ]
298
298
  ::Development.enabled_for_all?.should == true
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: development
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,24 +9,8 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-09 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: array-unique
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: '0'
12
+ date: 2012-07-10 00:00:00.000000000 Z
13
+ dependencies: []
30
14
  description: Sometimes problems in one gem under development only appear in the context
31
15
  of use in another gem. In these contexts it can be difficult to discern the particular
32
16
  problem case without diving into the code. When gems are nested in multiple levels