hackboxen 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -40,6 +40,10 @@ h3. Version 0.1.1
40
40
 
41
41
  * A hackbox __name__ is now separate from a dataset __protocol__. Namespaces are still shared for organizational purposes, but a protocol directory is no longer created for the output.
42
42
 
43
+ h3. Version 0.1.3
44
+
45
+ * The tasks @hb:endpoint@ and @hb:icss@ can now move multiple files, instead of just one.
46
+
43
47
  h3. Still Needing
44
48
 
45
49
  * Full spec coverage for the hackboxen library.
@@ -58,7 +58,7 @@ The hackbox output directory is where all of the data that a hackbox acquires, r
58
58
  ├── ripd
59
59
  │ └── bnc_download.zip
60
60
  └── env
61
- └── working_environment.json
61
+ └── working_config.json
62
62
  </code></pre>
63
63
 
64
64
  * @fixd/@: **(required)** See the output interface described below.
@@ -66,7 +66,7 @@ The hackbox output directory is where all of the data that a hackbox acquires, r
66
66
  * @rawd/@: **(optional)** This will contain all intermediate data processing outputs.
67
67
  * @ripd/@: **(required)** This will contain virginal downloaded source data adhering to the directory structure from which it was pulled.
68
68
  * @env/@: **(required)** This directory contains a file describing the environment in which the hackbox was run.
69
- ** @working_environment.json@: **(required)** All runtime config metadata used to generate the schema and output data.
69
+ ** @working_config.json@: **(required)** All runtime config metadata used to generate the schema and output data.
70
70
 
71
71
  Engine and output directories are generally created dynamically and are not meant to be archival.
72
72
 
@@ -124,9 +124,9 @@ The Hackboxen library depends on the following gems: "configliere":http://github
124
124
 
125
125
  h3. Creating a Hackbox
126
126
 
127
- Hackboxen comes with scaffold task that creates a template hackbox for you. Required arguments are @--namespace=@ and @--protocol=@. Optional arguments are @--targets=@.
127
+ Hackboxen comes with scaffold task that creates a template hackbox for you. Required arguments are @--namespace=@ and @--hackbox_name=@. Optional arguments are @--protocol=@ and @--targets=@. The @protocol@ will default to the @hackbox_name@ unless otherwise specified.
128
128
 
129
- <pre><code>hb-scaffold --namespace=foo.bar.baz --protocol=qux --targets=catalog,mysql
129
+ <pre><code>hb-scaffold --namespace=foo.bar.baz --hackbox_name=qux --targets=catalog,mysql
130
130
  </code></pre>
131
131
 
132
132
  This will create the following directories and files:
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{hackboxen}
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["kornypoet", "Ganglion", "bollacker"]
12
- s.date = %q{2011-07-08}
12
+ s.date = %q{2011-07-11}
13
13
  s.description = %q{A simple framework to assist in standardizing the data-munging input/output process.}
14
14
  s.email = %q{travis@infochimps.com}
15
15
  s.executables = ["hb-install", "hb-scaffold", "hb-runner"]
@@ -57,13 +57,14 @@ Gem::Specification.new do |s|
57
57
  s.homepage = %q{http://github.com/infochimps/hackboxen}
58
58
  s.licenses = ["MIT"]
59
59
  s.require_paths = ["lib"]
60
- s.rubygems_version = %q{1.6.2}
60
+ s.rubygems_version = %q{1.3.7}
61
61
  s.summary = %q{A simple framework to assist in standardizing the data-munging input/output process.}
62
62
  s.test_files = [
63
63
  "spec/install_spec.rb"
64
64
  ]
65
65
 
66
66
  if s.respond_to? :specification_version then
67
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
67
68
  s.specification_version = 3
68
69
 
69
70
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
@@ -3,11 +3,10 @@ module HackBoxen
3
3
 
4
4
  desc "Copy an endpoint.rb file to the output code directory if the endpoint exists"
5
5
  task :endpoint => ['hb:create_required_paths'] do
6
- endpoint = "#{WorkingConfig[:protocol]}_endpoint.rb"
7
- srcfile = File.join(path_to(:hb_engine), endpoint)
8
- if File.exists? srcfile
6
+ endpoints = Dir[File.join(path_to(:hb_engine), '**/*_endpoint.rb')]
7
+ endpoints.each do |srcfile|
9
8
  HackBoxen.current_fs.mkpath path_to(:code_dir)
10
- destfile = File.join(path_to(:code_dir), endpoint)
9
+ destfile = File.join(path_to(:code_dir), File.basename(srcfile))
11
10
  HackBoxen.current_fs.cp(srcfile, destfile)
12
11
  end
13
12
  end
@@ -3,11 +3,13 @@ module HackBoxen
3
3
 
4
4
  desc "Copy the Icss file to the output directory in the filesystem specified in the WorkingConfig"
5
5
  task :icss => ['hb:create_required_paths'] do
6
- icss_yaml = File.join(path_to(:hb_config), "#{WorkingConfig[:protocol]}.icss.yaml")
7
- if File.exists? icss_yaml
8
- icss = YAML.load(File.read icss_yaml)
9
- icss_json = File.join(path_to(:fixd_dir), "#{WorkingConfig[:protocol]}.icss.json")
10
- HackBoxen.current_fs.open(File.join(icss_json), 'w') { |f| f.puts icss.to_json }
6
+ icss_yamls = Dir[File.join(path_to(:hb_config), '**/*.icss.yaml')]
7
+ icss_yamls.each do |icss_yaml|
8
+ icss_hsh = YAML.load(File.read(icss_yaml))
9
+ if icss_hsh
10
+ icss_json = File.join(path_to(:fixd_dir), "#{icss_hsh['protocol']}.icss.json")
11
+ HackBoxen.current_fs.open(File.join(icss_json), 'w') { |f| f.puts icss_hsh.to_json }
12
+ end
11
13
  end
12
14
  end
13
15
 
@@ -7,17 +7,21 @@ machine_config = '/etc/hackbox/hackbox.yaml'
7
7
  install_config = File.join(ENV['HOME'], '.hackbox/hackbox.yaml')
8
8
 
9
9
  Settings.use :commandline, :config_file
10
- Settings.define :namespace, :required => true
11
- Settings.define :protocol, :required => true
12
- Settings.define :coderoot, :required => true
13
- Settings.define :targets, :default => 'catalog'
10
+ Settings.define :namespace, :required => true
11
+ Settings.define :hackbox_name, :required => true
12
+ Settings.define :protocol
13
+ Settings.define :coderoot, :required => true
14
+ Settings.define :targets, :default => 'catalog'
14
15
  Settings.read(machine_config) if File.exists? machine_config
15
16
  Settings.read(install_config) if File.exists? install_config
16
17
  Settings.resolve!
17
18
 
19
+ # Have the hackbox name be a default for the protocol if unspecified
20
+ Settings[:protocol] = Settings[:hackbox_name] unless Settings[:protocol]
21
+
18
22
  # Hackbox directories to be created
19
23
  coderoot = Settings[:coderoot]
20
- hackbox = File.join(coderoot, Settings[:namespace].gsub(/\./,'/'), Settings[:protocol])
24
+ hackbox = File.join(coderoot, Settings[:namespace].gsub(/\./,'/'), Settings[:hackbox_name])
21
25
  engine = File.join(hackbox, 'engine')
22
26
  config = File.join(hackbox, 'config')
23
27
 
@@ -34,12 +38,12 @@ templates = File.join(hb_lib_dir, 'lib/hackboxen/template')
34
38
 
35
39
  # Create a basic endpoint if apeyeye was specified as a target
36
40
  file endpoint, [:config] => engine do |t, args|
37
- HackBoxen::Template.new(File.join(templates, "endpoint.rb.erb"), endpoint, args[:config]).substitute!
41
+ HackBoxen::Template.new(File.join(templates, 'endpoint.rb.erb'), endpoint, args[:config]).substitute!
38
42
  end
39
43
 
40
44
  # Create a basic hackbox Rakefile
41
45
  file rakefile => hackbox do
42
- HackBoxen::Template.new(File.join(templates, "Rakefile.erb"), rakefile, {}).substitute!
46
+ HackBoxen::Template.new(File.join(templates, 'Rakefile.erb'), rakefile, {}).substitute!
43
47
  end
44
48
 
45
49
  # Create a basic executable hackbox main file
@@ -50,8 +54,12 @@ end
50
54
 
51
55
  # Create a basic config file
52
56
  file config_yml => config do
53
- basic_config = { 'namespace' => Settings[:namespace], 'protocol' => Settings[:protocol] }
54
- HackBoxen::Template.new(File.join(templates, "config.yaml.erb"), config_yml, basic_config).substitute!
57
+ basic_config = {
58
+ 'namespace' => Settings[:namespace],
59
+ 'ruby_version' => RUBY_VERSION,
60
+ 'hb_version' => Gem.source_index.find_name('swineherd').first.version.to_s
61
+ }
62
+ HackBoxen::Template.new(File.join(templates, 'config.yaml.erb'), config_yml, basic_config).substitute!
55
63
  end
56
64
 
57
65
  # Create a basic icss file
@@ -62,7 +70,7 @@ file icss_yml => config do
62
70
  'protocol' => Settings[:protocol],
63
71
  'targets' => targets
64
72
  }
65
- HackBoxen::Template.new(File.join(templates, "icss.yaml.erb"), icss_yml, basic_config).substitute!
73
+ HackBoxen::Template.new(File.join(templates, 'icss.yaml.erb'), icss_yml, basic_config).substitute!
66
74
  Rake::Task[endpoint].invoke(basic_config) if targets.include? 'apeyeye'
67
75
  end
68
76
 
@@ -13,7 +13,7 @@ task :get_data do
13
13
  #
14
14
  end
15
15
 
16
- task :default => ['hb:create_working_config', 'hb:icss', 'hb:endoint', :get_data, 'hb:init']
16
+ task :default => ['hb:create_working_config', 'hb:icss', 'hb:endpoint', :get_data, 'hb:init']
17
17
  #
18
18
  # hb:create_working_config makes establishes all required directories and serializes out all
19
19
  # configuration options into env/working_config.json. This task is required.
@@ -4,7 +4,11 @@
4
4
  # during the execution of a hackbox should be put in here.
5
5
  #
6
6
  namespace: <%= namespace %>
7
- protocol: <%= protocol %>
8
7
  filesystem_scheme: file
9
8
  under_consideration: true # This flag is set to true for initial publishing, then removed when fully complete
10
9
  update_frequency: monthly # How often the data is refreshed
10
+ requires:
11
+ language:
12
+ ruby: <%= ruby_version %>
13
+ gems:
14
+ - hackboxen: <%= hb_version %>
@@ -16,12 +16,13 @@ inputdir = ARGV[0]
16
16
  outputdir = ARGV[1]
17
17
 
18
18
  #
19
- # Ruby example: read in the working_environment.json file in env/ into a ruby hash
19
+ # Ruby example: read in the working_config.json file in env/ into a ruby hash
20
20
  # (same as a javascript associative array, a java hashmap, a python dictionary, etc)
21
21
  # called 'options' to access the configuration settings used to execute the Rakefile
22
22
  #
23
+ require 'rubygems'
23
24
  require 'json'
24
- options = JSON.parse(File.read(File.join(inputdir, "env", "working_environment.json")))
25
+ options = JSON.parse(File.read(File.join(inputdir, "env", "working_config.json")))
25
26
 
26
27
  #
27
28
  # If you require 'hackboxen' you can access the default paths utility method
metadata CHANGED
@@ -1,8 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hackboxen
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.1.2
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 3
10
+ version: 0.1.3
6
11
  platform: ruby
7
12
  authors:
8
13
  - kornypoet
@@ -12,84 +17,115 @@ autorequire:
12
17
  bindir: bin
13
18
  cert_chain: []
14
19
 
15
- date: 2011-07-08 00:00:00 -05:00
20
+ date: 2011-07-11 00:00:00 -05:00
16
21
  default_executable:
17
22
  dependencies:
18
23
  - !ruby/object:Gem::Dependency
19
- name: swineherd
20
24
  requirement: &id001 !ruby/object:Gem::Requirement
21
25
  none: false
22
26
  requirements:
23
27
  - - ">="
24
28
  - !ruby/object:Gem::Version
29
+ hash: 23
30
+ segments:
31
+ - 0
32
+ - 0
33
+ - 4
25
34
  version: 0.0.4
26
35
  type: :runtime
36
+ name: swineherd
27
37
  prerelease: false
28
38
  version_requirements: *id001
29
39
  - !ruby/object:Gem::Dependency
30
- name: configliere
31
40
  requirement: &id002 !ruby/object:Gem::Requirement
32
41
  none: false
33
42
  requirements:
34
43
  - - "="
35
44
  - !ruby/object:Gem::Version
45
+ hash: 3
46
+ segments:
47
+ - 0
48
+ - 4
49
+ - 6
36
50
  version: 0.4.6
37
51
  type: :runtime
52
+ name: configliere
38
53
  prerelease: false
39
54
  version_requirements: *id002
40
55
  - !ruby/object:Gem::Dependency
41
- name: rake
42
56
  requirement: &id003 !ruby/object:Gem::Requirement
43
57
  none: false
44
58
  requirements:
45
59
  - - ">="
46
60
  - !ruby/object:Gem::Version
61
+ hash: 49
62
+ segments:
63
+ - 0
64
+ - 8
65
+ - 7
47
66
  version: 0.8.7
48
67
  type: :runtime
68
+ name: rake
49
69
  prerelease: false
50
70
  version_requirements: *id003
51
71
  - !ruby/object:Gem::Dependency
52
- name: shoulda
53
72
  requirement: &id004 !ruby/object:Gem::Requirement
54
73
  none: false
55
74
  requirements:
56
75
  - - ">="
57
76
  - !ruby/object:Gem::Version
77
+ hash: 3
78
+ segments:
79
+ - 0
58
80
  version: "0"
59
81
  type: :development
82
+ name: shoulda
60
83
  prerelease: false
61
84
  version_requirements: *id004
62
85
  - !ruby/object:Gem::Dependency
63
- name: bundler
64
86
  requirement: &id005 !ruby/object:Gem::Requirement
65
87
  none: false
66
88
  requirements:
67
89
  - - ~>
68
90
  - !ruby/object:Gem::Version
91
+ hash: 23
92
+ segments:
93
+ - 1
94
+ - 0
95
+ - 0
69
96
  version: 1.0.0
70
97
  type: :development
98
+ name: bundler
71
99
  prerelease: false
72
100
  version_requirements: *id005
73
101
  - !ruby/object:Gem::Dependency
74
- name: jeweler
75
102
  requirement: &id006 !ruby/object:Gem::Requirement
76
103
  none: false
77
104
  requirements:
78
105
  - - ~>
79
106
  - !ruby/object:Gem::Version
107
+ hash: 7
108
+ segments:
109
+ - 1
110
+ - 5
111
+ - 2
80
112
  version: 1.5.2
81
113
  type: :development
114
+ name: jeweler
82
115
  prerelease: false
83
116
  version_requirements: *id006
84
117
  - !ruby/object:Gem::Dependency
85
- name: rcov
86
118
  requirement: &id007 !ruby/object:Gem::Requirement
87
119
  none: false
88
120
  requirements:
89
121
  - - ">="
90
122
  - !ruby/object:Gem::Version
123
+ hash: 3
124
+ segments:
125
+ - 0
91
126
  version: "0"
92
127
  type: :development
128
+ name: rcov
93
129
  prerelease: false
94
130
  version_requirements: *id007
95
131
  description: A simple framework to assist in standardizing the data-munging input/output process.
@@ -153,7 +189,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
153
189
  requirements:
154
190
  - - ">="
155
191
  - !ruby/object:Gem::Version
156
- hash: 265087323753599067
192
+ hash: 3
157
193
  segments:
158
194
  - 0
159
195
  version: "0"
@@ -162,11 +198,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
162
198
  requirements:
163
199
  - - ">="
164
200
  - !ruby/object:Gem::Version
201
+ hash: 3
202
+ segments:
203
+ - 0
165
204
  version: "0"
166
205
  requirements: []
167
206
 
168
207
  rubyforge_project:
169
- rubygems_version: 1.6.2
208
+ rubygems_version: 1.3.7
170
209
  signing_key:
171
210
  specification_version: 3
172
211
  summary: A simple framework to assist in standardizing the data-munging input/output process.