empezar 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH << File.expand_path('../../lib', __FILE__)
4
+
5
+ require 'empezar'
6
+
7
+ Empezar::Scaffold.new ARGV.join(" "), "config/main.yaml"
@@ -15,6 +15,7 @@ Gem::Specification.new do |gem|
15
15
  gem.add_dependency 'symbolmatrix'
16
16
  gem.add_dependency 'discoverer'
17
17
  gem.add_dependency 'term-ansicolor'
18
+ gem.add_dependency 'fast'
18
19
 
19
20
  gem.add_development_dependency 'rspec'
20
21
  gem.add_development_dependency 'fast'
@@ -0,0 +1,18 @@
1
+ Feature: Configuration file scaffolding
2
+ In order to setup a project easily
3
+ As a developer using empezar conventions
4
+ I want to have a command line tool to create a
5
+ configuration file
6
+
7
+ @clean
8
+ Scenario: Creating a simple configuration file from a command
9
+ Given I have the configuration 'to.many:values to.see.it:work i:1337'
10
+ When I run `empezar` with that configuration
11
+ Then I should have a 'config/main.yaml' file with
12
+ """
13
+ to:
14
+ many: values
15
+ see:
16
+ it: work
17
+ i: 1337
18
+ """
@@ -0,0 +1,16 @@
1
+ Given /^I have the configuration '(.+?)'$/ do |smas|
2
+ @configuration = smas
3
+ end
4
+
5
+ When /^I run `(.+?)` with that configuration$/ do |command|
6
+ process = IO.popen "bin/#{command} #{@configuration} 2>&1"
7
+ @result = process.read
8
+ process.close
9
+ @code = $?.exitstatus
10
+ end
11
+
12
+ Then /^I should have a '(.+?)' file with$/ do |path, content|
13
+ @code.should == 0
14
+ File.should exist path
15
+ SymbolMatrix(path).should == SymbolMatrix(content)
16
+ end
@@ -3,10 +3,12 @@ require 'symbolmatrix'
3
3
  require 'discoverer'
4
4
  require 'term/ansicolor'
5
5
  require 'logger'
6
+ require 'fast/fast'
6
7
 
7
8
  require 'empezar/version'
8
9
  require 'empezar/exceptions'
9
10
  require 'empezar/configuration'
10
11
  require 'empezar/runner'
11
12
  require 'empezar/echoing_formatter'
12
- require 'empezar/log'
13
+ require 'empezar/log'
14
+ require 'empezar/scaffold'
@@ -0,0 +1,8 @@
1
+ module Empezar
2
+ class Scaffold
3
+ def initialize smas, path
4
+ Fast.file
5
+ .write path, SymbolMatrix.new(smas).to.yaml
6
+ end
7
+ end
8
+ end
@@ -1,3 +1,3 @@
1
1
  module Empezar
2
- VERSION = "0.3.1"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ describe Empezar::Scaffold do
4
+ describe 'initialize' do
5
+ before do
6
+ @file_descriptor = stub 'file descriptor'
7
+ @file_name = stub 'file name'
8
+ @smas = stub 'smas serialization'
9
+ @symbolmatrix = stub 'symbolmatrix'
10
+ @writer = stub 'writer'
11
+ @yaml_output = stub 'yaml output'
12
+ end
13
+
14
+ it 'should build a file with the YAML dump from the data' do
15
+ SymbolMatrix.should_receive(:new).with(@smas)
16
+ .and_return @symbolmatrix
17
+ @symbolmatrix.should_receive(:to).and_return @writer
18
+ @writer.should_receive(:yaml).and_return @yaml_output
19
+
20
+ Fast.should_receive(:file).and_return @file_descriptor
21
+
22
+ @file_descriptor.should_receive(:write)
23
+ .with(@file_name, @yaml_output)
24
+
25
+ Empezar::Scaffold.new @smas, @file_name
26
+ end
27
+ end
28
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: empezar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.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-12-20 00:00:00.000000000 Z
12
+ date: 2012-12-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: symbolmatrix
@@ -59,6 +59,22 @@ dependencies:
59
59
  - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: fast
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
62
78
  - !ruby/object:Gem::Dependency
63
79
  name: rspec
64
80
  requirement: !ruby/object:Gem::Requirement
@@ -111,7 +127,8 @@ description: A simple Ruby library to enforce a convention for configuration, lo
111
127
  and execution
112
128
  email:
113
129
  - xavierviacanel@gmail.com
114
- executables: []
130
+ executables:
131
+ - empezar
115
132
  extensions: []
116
133
  extra_rdoc_files: []
117
134
  files:
@@ -121,9 +138,12 @@ files:
121
138
  - LICENSE.txt
122
139
  - README.md
123
140
  - Rakefile
141
+ - bin/empezar
124
142
  - cucumber.yml
125
143
  - empezar.gemspec
144
+ - features/configuration_scaffolding.feature
126
145
  - features/starting_up.feature
146
+ - features/step_definitions/configuration_scaffolding_steps.rb
127
147
  - features/step_definitions/starting_up_steps.rb
128
148
  - features/support/env.rb
129
149
  - features/support/hooks.rb
@@ -134,6 +154,7 @@ files:
134
154
  - lib/empezar/log.rb
135
155
  - lib/empezar/run.rb
136
156
  - lib/empezar/runner.rb
157
+ - lib/empezar/scaffold.rb
137
158
  - lib/empezar/version.rb
138
159
  - sample/config/main.yaml
139
160
  - sample/script.rb
@@ -143,6 +164,7 @@ files:
143
164
  - spec/empezar/log_spec.rb
144
165
  - spec/empezar/run_spec.rb
145
166
  - spec/empezar/runner_spec.rb
167
+ - spec/empezar/scaffold_spec.rb
146
168
  - spec/log_spec.rb
147
169
  - spec/runner_spec.rb
148
170
  - spec/spec_helper.rb
@@ -172,7 +194,9 @@ specification_version: 3
172
194
  summary: A simple Ruby library to enforce a convention for configuration, logging
173
195
  and execution
174
196
  test_files:
197
+ - features/configuration_scaffolding.feature
175
198
  - features/starting_up.feature
199
+ - features/step_definitions/configuration_scaffolding_steps.rb
176
200
  - features/step_definitions/starting_up_steps.rb
177
201
  - features/support/env.rb
178
202
  - features/support/hooks.rb
@@ -182,6 +206,7 @@ test_files:
182
206
  - spec/empezar/log_spec.rb
183
207
  - spec/empezar/run_spec.rb
184
208
  - spec/empezar/runner_spec.rb
209
+ - spec/empezar/scaffold_spec.rb
185
210
  - spec/log_spec.rb
186
211
  - spec/runner_spec.rb
187
212
  - spec/spec_helper.rb