moblues 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d306b405a86b2290eb6c2526748df8fe10a0f8b3
4
- data.tar.gz: b598e9094d9add99dc8255adb304ac42e07e7102
3
+ metadata.gz: c36abc1af5154b1816b202fe56210ff27c3bab41
4
+ data.tar.gz: fbb6b0c0cc21e59bc02ed710a4ba072e74fe7678
5
5
  SHA512:
6
- metadata.gz: 81b7c225fa7822b7030dcdab5088047bd7be37d5ca78d55e87c3f7a1b02e3edc1d9166036aa8e6645049bb935c7b432611829d9d0b11093c12f1f4432873deac
7
- data.tar.gz: 7aa8db60830f0cbb8d810c17901f1c8b0c9dc11b30088c48a9cc5bc2f10dab6d69c89f241779f216148ae5b243eb5b1ac99547d53d3b68c063ecbb5b413ee2e1
6
+ metadata.gz: 8a853abe6bed750daa4bd87b4c1fd79b7b51b34dfda63390407325485d5b74abfd03d1ed5c6d566dab5fe41b439d30267bfd386174b1e7f59026de2ef904184a
7
+ data.tar.gz: 738e69c5b6fc8216013ff86bcee9c7745597830a0ce9c4e8b5dbb14226c512a7904346e17c2623046fb1bbdbb04d4dd20734f80a15c057e23f271cfd50af7254
data/.travis.yml CHANGED
@@ -5,4 +5,4 @@ rvm:
5
5
  script: bundle exec rake spec
6
6
  addons:
7
7
  code_climate:
8
- repo_token: 97374e550763cfe3be1c90ba93d9ea9e5b4ea47e1dead9b554f5f4a18b3a6f75
8
+ repo_token: 2d867bb364165eacb9d95cee24b1aa1ab831ef4beaaff0f100025cf9574f02c1
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Moblues [![Build Status](https://magnum.travis-ci.com/garriguv/moblues.svg?token=GCky67DnySmgxHiFqjq3&branch=master)](https://magnum.travis-ci.com/garriguv/moblues) [![Code Climate](https://codeclimate.com/repos/547ac5cfe30ba05abc1d6329/badges/3c5aba53610a96394d9f/gpa.svg)](https://codeclimate.com/repos/547ac5cfe30ba05abc1d6329/feed) [![Test Coverage](https://codeclimate.com/repos/547ac5cfe30ba05abc1d6329/badges/3c5aba53610a96394d9f/coverage.svg)](https://codeclimate.com/repos/547ac5cfe30ba05abc1d6329/feed)
1
+ # Moblues [![Gem Version](https://badge.fury.io/rb/moblues.svg)](http://badge.fury.io/rb/moblues) [![Build Status](https://travis-ci.org/garriguv/moblues.svg)](https://travis-ci.org/garriguv/moblues) [![Code Climate](https://codeclimate.com/github/garriguv/moblues/badges/gpa.svg)](https://codeclimate.com/github/garriguv/moblues) [![Test Coverage](https://codeclimate.com/github/garriguv/moblues/badges/coverage.svg)](https://codeclimate.com/github/garriguv/moblues)
2
2
 
3
3
  Generates files for entities defined in a Core Data model. Inspired by [mogenerator](https://github.com/rentzsch/mogenerator).
4
4
 
data/lib/moblues/cli.rb CHANGED
@@ -9,18 +9,7 @@ module Moblues
9
9
  option :human, :required => true, :desc => 'Path where the human files will be stored'
10
10
  option :machine, :required => true, :desc => 'Path where the machine files will be stored'
11
11
  def generate
12
- mkdir([options[:human], options[:machine]])
13
- reader = Moblues::Reader::Model.new
14
- generator = Moblues::Generator::Model.new(human_dir: options[:human], machine_dir: options[:machine])
15
- entities = reader.model(options[:model])
16
- generator.generate(entities)
17
- end
18
-
19
- private
20
- def mkdir(dirs)
21
- dirs.each do |dir|
22
- Dir.mkdir(dir) unless Dir.exists?(dir)
23
- end
12
+ Moblues.generate(options[:model], options[:human], options[:machine])
24
13
  end
25
14
  end
26
15
  end
@@ -1,3 +1,3 @@
1
1
  module Moblues
2
- VERSION = '0.0.1'
2
+ VERSION = '0.1.0'
3
3
  end
data/lib/moblues.rb CHANGED
@@ -2,3 +2,22 @@ require 'moblues/version'
2
2
  require 'moblues/data_model'
3
3
  require 'moblues/reader'
4
4
  require 'moblues/generator'
5
+
6
+ module Moblues
7
+ extend self
8
+
9
+ def generate(model, human_dir, machine_dir)
10
+ mkdir([human_dir, machine_dir])
11
+ reader = Moblues::Reader::Model.new
12
+ generator = Moblues::Generator::Model.new(human_dir: human_dir, machine_dir: machine_dir)
13
+ entities = reader.model(model)
14
+ generator.generate(entities)
15
+ end
16
+
17
+ private
18
+ def mkdir(dirs)
19
+ dirs.each do |dir|
20
+ Dir.mkdir(dir) unless Dir.exists?(dir)
21
+ end
22
+ end
23
+ end
@@ -28,20 +28,8 @@ describe Moblues::CLI do
28
28
  context 'when options given' do
29
29
  let(:options) { %w{--model=model/path --human=human/path --machine=machine/path} }
30
30
 
31
- let(:model_reader) { double(Moblues::Reader::Model) }
32
- let(:model_generator) { double(Moblues::Generator::Model) }
33
- let(:entities) { [build(:entity)] }
34
-
35
- before do
36
- allow(Moblues::Reader::Model).to receive(:new) { model_reader }
37
- allow(Moblues::Generator::Model).to receive(:new) { model_generator }
38
- end
39
-
40
31
  it 'created the directories reads the model and generates the files' do
41
- expect(Dir).to receive(:mkdir).with('human/path').once
42
- expect(Dir).to receive(:mkdir).with('machine/path').once
43
- expect(model_reader).to receive(:model).with('model/path').once { entities }
44
- expect(model_generator).to receive(:generate).with(entities).once
32
+ expect(Moblues).to receive(:generate).with('model/path', 'human/path', 'machine/path').once
45
33
 
46
34
  perform
47
35
  end
File without changes
File without changes
File without changes
@@ -0,0 +1,32 @@
1
+ require 'spec_helper'
2
+ require 'moblues'
3
+
4
+ describe Moblues do
5
+ subject { described_class }
6
+
7
+ describe '#generate' do
8
+ let(:options) { %w{--model=model/path --human=human/path --machine=machine/path} }
9
+
10
+ let(:model) { 'model/path' }
11
+ let(:human) { 'human/path' }
12
+ let(:machine) { 'machine/path' }
13
+
14
+ let(:model_reader) { double(Moblues::Reader::Model) }
15
+ let(:model_generator) { double(Moblues::Generator::Model) }
16
+ let(:entities) { [build(:entity)] }
17
+
18
+ before do
19
+ allow(Moblues::Reader::Model).to receive(:new) { model_reader }
20
+ allow(Moblues::Generator::Model).to receive(:new) { model_generator }
21
+ end
22
+
23
+ it 'created the directories reads the model and generates the files' do
24
+ expect(Dir).to receive(:mkdir).with('human/path').once
25
+ expect(Dir).to receive(:mkdir).with('machine/path').once
26
+ expect(model_reader).to receive(:model).with('model/path').once { entities }
27
+ expect(model_generator).to receive(:generate).with(entities).once
28
+
29
+ subject.generate(model, human, machine)
30
+ end
31
+ end
32
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moblues
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vincent Garrigues
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-02 00:00:00.000000000 Z
11
+ date: 2014-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -153,19 +153,20 @@ files:
153
153
  - lib/moblues/version.rb
154
154
  - moblues.gemspec
155
155
  - spec/features/moblues_spec.rb
156
- - spec/moblues/cli_spec.rb
157
- - spec/moblues/data_model/attribute_spec.rb
158
- - spec/moblues/data_model/entity_spec.rb
159
- - spec/moblues/data_model/relationship_spec.rb
160
- - spec/moblues/generator/human_spec.rb
161
- - spec/moblues/generator/machine_spec.rb
162
- - spec/moblues/generator/model_spec.rb
163
- - spec/moblues/reader/attribute_spec.rb
164
- - spec/moblues/reader/entity_spec.rb
165
- - spec/moblues/reader/model_spec.rb
166
- - spec/moblues/reader/relationship_spec.rb
167
- - spec/moblues/reader/type_spec.rb
168
- - spec/moblues/utils/model_resolver_spec.rb
156
+ - spec/lib/moblues/cli_spec.rb
157
+ - spec/lib/moblues/data_model/attribute_spec.rb
158
+ - spec/lib/moblues/data_model/entity_spec.rb
159
+ - spec/lib/moblues/data_model/relationship_spec.rb
160
+ - spec/lib/moblues/generator/human_spec.rb
161
+ - spec/lib/moblues/generator/machine_spec.rb
162
+ - spec/lib/moblues/generator/model_spec.rb
163
+ - spec/lib/moblues/reader/attribute_spec.rb
164
+ - spec/lib/moblues/reader/entity_spec.rb
165
+ - spec/lib/moblues/reader/model_spec.rb
166
+ - spec/lib/moblues/reader/relationship_spec.rb
167
+ - spec/lib/moblues/reader/type_spec.rb
168
+ - spec/lib/moblues/utils/model_resolver_spec.rb
169
+ - spec/moblues_spec.rb
169
170
  - spec/resources/Model.xcdatamodeld/.xccurrentversion
170
171
  - spec/resources/Model.xcdatamodeld/Model 2.xcdatamodel/contents
171
172
  - spec/resources/Model.xcdatamodeld/Model.xcdatamodel/contents
@@ -231,19 +232,20 @@ specification_version: 4
231
232
  summary: Generates Objective-C files for entities defined in a Core Data model
232
233
  test_files:
233
234
  - spec/features/moblues_spec.rb
234
- - spec/moblues/cli_spec.rb
235
- - spec/moblues/data_model/attribute_spec.rb
236
- - spec/moblues/data_model/entity_spec.rb
237
- - spec/moblues/data_model/relationship_spec.rb
238
- - spec/moblues/generator/human_spec.rb
239
- - spec/moblues/generator/machine_spec.rb
240
- - spec/moblues/generator/model_spec.rb
241
- - spec/moblues/reader/attribute_spec.rb
242
- - spec/moblues/reader/entity_spec.rb
243
- - spec/moblues/reader/model_spec.rb
244
- - spec/moblues/reader/relationship_spec.rb
245
- - spec/moblues/reader/type_spec.rb
246
- - spec/moblues/utils/model_resolver_spec.rb
235
+ - spec/lib/moblues/cli_spec.rb
236
+ - spec/lib/moblues/data_model/attribute_spec.rb
237
+ - spec/lib/moblues/data_model/entity_spec.rb
238
+ - spec/lib/moblues/data_model/relationship_spec.rb
239
+ - spec/lib/moblues/generator/human_spec.rb
240
+ - spec/lib/moblues/generator/machine_spec.rb
241
+ - spec/lib/moblues/generator/model_spec.rb
242
+ - spec/lib/moblues/reader/attribute_spec.rb
243
+ - spec/lib/moblues/reader/entity_spec.rb
244
+ - spec/lib/moblues/reader/model_spec.rb
245
+ - spec/lib/moblues/reader/relationship_spec.rb
246
+ - spec/lib/moblues/reader/type_spec.rb
247
+ - spec/lib/moblues/utils/model_resolver_spec.rb
248
+ - spec/moblues_spec.rb
247
249
  - spec/resources/Model.xcdatamodeld/.xccurrentversion
248
250
  - spec/resources/Model.xcdatamodeld/Model 2.xcdatamodel/contents
249
251
  - spec/resources/Model.xcdatamodeld/Model.xcdatamodel/contents