boson 1.2.3 → 1.2.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,6 @@
1
+ == 1.2.4
2
+ * Remove repo_index which has moved to boson-more
3
+
1
4
  == 1.2.3
2
5
  * Fix help command with no args
3
6
 
@@ -1,3 +1,3 @@
1
1
  module Boson
2
- VERSION = '1.2.3'
2
+ VERSION = '1.2.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boson
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.2.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-09 00:00:00.000000000 Z
12
+ date: 2012-06-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mocha
16
- requirement: &70264415462180 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: 0.10.4
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70264415462180
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 0.10.4
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: bacon
27
- requirement: &70264415461540 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: 1.1.0
33
38
  type: :development
34
39
  prerelease: false
35
- version_requirements: *70264415461540
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 1.1.0
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: mocha-on-bacon
38
- requirement: &70264415461100 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ! '>='
@@ -43,10 +53,15 @@ dependencies:
43
53
  version: '0'
44
54
  type: :development
45
55
  prerelease: false
46
- version_requirements: *70264415461100
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: bacon-bits
49
- requirement: &70264415460600 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
67
  - - ! '>='
@@ -54,10 +69,15 @@ dependencies:
54
69
  version: '0'
55
70
  type: :development
56
71
  prerelease: false
57
- version_requirements: *70264415460600
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
58
78
  - !ruby/object:Gem::Dependency
59
79
  name: bahia
60
- requirement: &70264415459800 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
61
81
  none: false
62
82
  requirements:
63
83
  - - ! '>='
@@ -65,7 +85,12 @@ dependencies:
65
85
  version: 0.5.0
66
86
  type: :development
67
87
  prerelease: false
68
- version_requirements: *70264415459800
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: 0.5.0
69
94
  description: Boson is a modular command/task framework. Thanks to its rich set of
70
95
  plugins, it differentiates itself from rake and thor by being usable from irb and
71
96
  the commandline, having optional automated views generated by hirb and allowing
@@ -90,7 +115,6 @@ files:
90
115
  - lib/boson/option_command.rb
91
116
  - lib/boson/option_parser.rb
92
117
  - lib/boson/options.rb
93
- - lib/boson/repo_index.rb
94
118
  - lib/boson/runner.rb
95
119
  - lib/boson/runner_library.rb
96
120
  - lib/boson/scientist.rb
@@ -140,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
164
  version: 1.3.6
141
165
  requirements: []
142
166
  rubyforge_project:
143
- rubygems_version: 1.8.11
167
+ rubygems_version: 1.8.24
144
168
  signing_key:
145
169
  specification_version: 3
146
170
  summary: A command/task framework similar to rake and thor that opens your ruby universe
@@ -1,135 +0,0 @@
1
- require 'digest/md5'
2
- module Boson
3
- # This class provides an index for commands and libraries of a given a Repo.
4
- # When this index updates, it detects library files whose md5 hash have changed and reindexes them.
5
- # The index is stored with Marshal at config/index.marshal (relative to a Repo's root directory).
6
- # Since the index is marshaled, putting lambdas/procs in it will break it.If an index gets corrupted,
7
- # simply delete it and next time Boson needs it, the index will be recreated.
8
-
9
- class RepoIndex
10
- attr_reader :libraries, :commands, :repo
11
- def initialize(repo)
12
- @repo = repo
13
- end
14
-
15
- # Updates the index.
16
- def update(options={})
17
- libraries_to_update = !exists? ? repo.all_libraries : options[:libraries] || changed_libraries
18
- read_and_transfer(libraries_to_update)
19
- if options[:verbose]
20
- puts !exists? ? "Generating index for all #{libraries_to_update.size} libraries. Patience ... is a bitch" :
21
- (libraries_to_update.empty? ? "No libraries indexed" :
22
- "Indexing the following libraries: #{libraries_to_update.join(', ')}")
23
- end
24
- Manager.failed_libraries = []
25
- unless libraries_to_update.empty?
26
- Manager.load(libraries_to_update, options.merge(:index=>true))
27
- unless Manager.failed_libraries.empty?
28
- $stderr.puts("Error: These libraries failed to load while indexing: #{Manager.failed_libraries.join(', ')}")
29
- end
30
- end
31
- write(Manager.failed_libraries)
32
- end
33
-
34
- # Reads and initializes index.
35
- def read
36
- return if @read
37
- @libraries, @commands, @lib_hashes = exists? ?
38
- File.open(marshal_file, 'rb') do |f|
39
- f.flock(File::LOCK_EX)
40
- Marshal.load(f)
41
- end : [[], [], {}]
42
- delete_stale_libraries_and_commands
43
- set_command_namespaces
44
- @read = true
45
- end
46
-
47
- # Writes/saves current index to config/index.marshal.
48
- def write(failed_libraries=[])
49
- latest = latest_hashes
50
- failed_libraries.each {|e| latest.delete(e) }
51
- save_marshal_index Marshal.dump([Boson.libraries, Boson.commands, latest])
52
- end
53
-
54
- #:stopdoc:
55
- def read_and_transfer(ignored_libraries=[])
56
- read
57
- existing_libraries = (Boson.libraries.map {|e| e.name} + ignored_libraries).uniq
58
- libraries_to_add = @libraries.select {|e| !existing_libraries.include?(e.name)}
59
- Boson.libraries += libraries_to_add
60
- # depends on saved commands being correctly associated with saved libraries
61
- Boson.commands += libraries_to_add.map {|e| e.command_objects(e.commands, @commands) }.flatten
62
- end
63
-
64
- def exists?
65
- File.exists? marshal_file
66
- end
67
-
68
- def save_marshal_index(marshal_string)
69
- binmode = defined?(File::BINARY) ? File::BINARY : 0
70
- rdwr_access = File::RDWR | File::CREAT | binmode
71
- # To protect the file truncing with a lock we cannot use the 'wb' options.
72
- # The w option truncates the file before calling the File.open block
73
- File.open(marshal_file, rdwr_access) do |f|
74
- f.flock(File::LOCK_EX)
75
- f.truncate 0
76
- f.write(marshal_string)
77
- end
78
- end
79
-
80
- def delete_stale_libraries_and_commands
81
- cached_libraries = @lib_hashes.keys
82
- libs_to_delete = @libraries.select {|e| !cached_libraries.include?(e.name) && e.is_a?(FileLibrary) }
83
- names_to_delete = libs_to_delete.map {|e| e.name }
84
- libs_to_delete.each {|e| @libraries.delete(e) }
85
- @commands.delete_if {|e| names_to_delete.include? e.lib }
86
- end
87
-
88
- # set namespaces for commands
89
- def set_command_namespaces
90
- lib_commands = @commands.inject({}) {|t,e| (t[e.lib] ||= []) << e; t }
91
- namespace_libs = @libraries.select {|e| e.namespace(e.indexed_namespace) }
92
- namespace_libs.each {|lib|
93
- (lib_commands[lib.name] || []).each {|e| e.namespace = lib.namespace }
94
- }
95
- end
96
-
97
- def namespaces
98
- nsps = @libraries.map {|e| e.namespace }.compact
99
- nsps.delete(false)
100
- nsps
101
- end
102
-
103
- def all_main_methods
104
- @commands.reject {|e| e.namespace }.map {|e| [e.name, e.alias]}.flatten.compact + namespaces
105
- end
106
-
107
- def marshal_file
108
- File.join(repo.config_dir, 'index.marshal')
109
- end
110
-
111
- def find_library(command, object=false)
112
- read
113
- namespace_command = command.split(NAMESPACE)[0]
114
- if (lib = @libraries.find {|e| e.namespace == namespace_command })
115
- object ? lib : lib.name
116
- elsif (cmd = Command.find(command, @commands))
117
- object ? @libraries.find {|e| e.name == cmd.lib} : cmd.lib
118
- end
119
- end
120
-
121
- def changed_libraries
122
- read
123
- latest_hashes.select {|lib, hash| @lib_hashes[lib] != hash}.map {|e| e[0]}
124
- end
125
-
126
- def latest_hashes
127
- repo.all_libraries.inject({}) {|h, e|
128
- lib_file = FileLibrary.library_file(e, repo.dir)
129
- h[e] = Digest::MD5.hexdigest(File.read(lib_file)) if File.exists?(lib_file)
130
- h
131
- }
132
- end
133
- #:startdoc:
134
- end
135
- end