MagicViper 0.1.3 → 0.1.45

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 87e75d53d6a8c57e28b395684c98a6fa3c319498
4
- data.tar.gz: 6a5850fe6dca1978ff7c6d875599fc1678181983
3
+ metadata.gz: b2f91755a8821aa28b8263197d846b76fc260c57
4
+ data.tar.gz: e4d6815be5005c9c37cac19196e5455547738dac
5
5
  SHA512:
6
- metadata.gz: 2d46ecc069d9748d8deb4abe8b873a84718e6928752b7c5e4e3163780ec26773cfb1672584edc8ae76072a1ceab36fdc6f1b70fa11ec898bc11dbf94f55e3825
7
- data.tar.gz: 63c8b38e8fd620a0d6af1c5c2c87819384a782c87be33060a441458008cc75ad10b3c7d890e18b5cc9749e4584a20e3dc8d375ea3bc484581273792098be5917
6
+ metadata.gz: 7d077b99ecdd5575b984017e5adf2225762dfa446ba58836712fa2fd54f7d554cf73d78a46b4f2af98744ea7e6b0dba235d63e37391e0fb9c09fc3d065167444
7
+ data.tar.gz: d33a2609d6fb436ec2f8a68e33388cb38d42e35b25294636e4d221e8c6b6c5027db69af7fdecd799fbb908c26f83d9e13a056049a847c24fbcf54810354e3424
data/.MagicViper.yml ADDED
@@ -0,0 +1,5 @@
1
+ ---
2
+ :project: Nilesh
3
+ :language: objc
4
+ :class_prefix: NN
5
+ :author: Nilesh
data/MagicViper.gemspec CHANGED
@@ -1,5 +1,5 @@
1
1
  # coding: utf-8
2
- lib = File.expand_path("../lib", __FILE__)
2
+ lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require "MagicViper/version"
5
5
 
@@ -8,21 +8,14 @@ Gem::Specification.new do |spec|
8
8
  spec.version = MagicViper::VERSION
9
9
  spec.authors = ["Nilesh Agrawal"]
10
10
  spec.email = ["nilesh.d.agrawal@gmail.com"]
11
-
12
11
  spec.summary = %q{Generates Objective C files for Viper Module Initialization.}
13
12
  spec.description = %q{Creates all the files and setup required for Viper Architecture in iOS.}
14
13
  spec.homepage = "https://github.com/ndagrawal"
15
14
  spec.licenses = "MIT"
16
- # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
17
- # to allow pushing to a single host or delete this section to allow pushing to any host.
18
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
19
- f.match(%r{^(test|spec|features)/})
20
- end
21
-
15
+ spec.files = `git ls-files -z`.split("\x0")
22
16
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
23
17
  spec.require_paths = ["lib"]
24
-
25
18
  spec.add_development_dependency "bundler", "~> 1.15"
26
19
  spec.add_development_dependency "rake", "~> 10.0"
27
- spec.add_development_dependency "thor", "~> 0.19.4"
20
+ spec.add_development_dependency "thor"
28
21
  end
data/bin/MagicViper CHANGED
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
-
3
2
  lib = File.expand_path(File.dirname(__FILE__) + '/../lib')
4
3
  $LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)
5
4
 
data/bin/console CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "bundler/setup"
4
4
  require "MagicViper"
5
-
5
+ require "thor"
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
8
8
 
@@ -1,4 +1,4 @@
1
- require 'MagicViper/module/module'
1
+ require 'magicviper/module/module'
2
2
  require 'yaml'
3
3
 
4
4
  module MagicViper
@@ -19,11 +19,20 @@ module MagicViper
19
19
  'AppDependencies.m' => 'Classes'
20
20
  }
21
21
 
22
+ BASE_FILES_SWIFT = {
23
+ 'AppDelegate.swift' => 'Classes',
24
+ 'AppDependencies.swift' => 'Classes'
25
+ }
26
+
22
27
  PROJECT_FILES_OBJC = {
23
28
  'RootWireframe.h' => 'Classes/Common/Wireframe',
24
29
  'RootWireframe.m' => 'Classes/Common/Wireframe'
25
30
  }
26
31
 
32
+ PROJECT_FILES_SWIFT = {
33
+ 'RootWireframe.swift' => 'Classes/Common/Wireframe'
34
+ }
35
+
27
36
  desc 'init', 'initializes VIPER project'
28
37
  def init
29
38
  config = invoke(:configure, [])
@@ -51,14 +60,15 @@ module MagicViper
51
60
  # Generate files
52
61
  base_files = case lang
53
62
  when 'objc' then BASE_FILES_OBJC
63
+ when 'swift' then BASE_FILES_SWIFT
54
64
  end
55
-
56
65
  base_files.each do |file_name, folder|
57
66
  template "templates/#{lang}/#{file_name}", "#{folder}/#{@project}#{file_name}"
58
67
  end
59
68
 
60
69
  project_files = case lang
61
70
  when 'objc' then PROJECT_FILES_OBJC
71
+ when 'swift' then PROJECT_FILES_SWIFT
62
72
  end
63
73
  project_files.each do |file_name, folder|
64
74
  template "templates/#{lang}/#{file_name}", "#{folder}/#{file_name}"
@@ -74,7 +84,7 @@ module MagicViper
74
84
  config = File.exists?(CONFIG_FILE) ? YAML.load_file(CONFIG_FILE) : {}
75
85
 
76
86
  project = ask("Project name [#{config[:project]}] ?")
77
- language = ask("Project language [#{config[:language]}] ?", :limited_to => ["objc", ""])
87
+ language = ask("Project language [#{config[:language]}] ?", :limited_to => ["objc", "swift", ""])
78
88
  class_prefix = ask("Class prefix [#{config[:class_prefix]}] ?")
79
89
  author = ask("Author [#{config[:author]}] ?")
80
90
 
@@ -86,7 +96,7 @@ module MagicViper
86
96
  File.open(CONFIG_FILE, 'w') do |f|
87
97
  f.write config.to_yaml
88
98
  end
89
-
99
+
90
100
  config
91
101
  end
92
102
  end
@@ -21,6 +21,7 @@ module MagicViper
21
21
  'Wireframe.m' => 'Wireframe'
22
22
  }
23
23
 
24
+
24
25
  MagicViper::Module.source_root(File.dirname(__FILE__))
25
26
 
26
27
  desc 'list', 'lists available VIPER modules'
@@ -33,7 +34,7 @@ module MagicViper
33
34
 
34
35
  desc 'create NAME', 'adds a new VIPER module with the specified name'
35
36
  def create(module_name)
36
- config = invoke('MagicViper:commands:configure', [])
37
+ config = invoke(:configure, [])
37
38
 
38
39
  @module = module_name
39
40
  @prefixed_module = config[:class_prefix] + @module
@@ -81,5 +82,30 @@ module MagicViper
81
82
  say "No such module: #{@module}"
82
83
  end
83
84
  end
85
+
86
+ # ----
87
+ # configuration
88
+ CONFIG_FILE = '.MagicViper.yml'
89
+
90
+ desc 'configure', 'configures project properties'
91
+ def configure
92
+ config = File.exists?(CONFIG_FILE) ? YAML.load_file(CONFIG_FILE) : {}
93
+
94
+ project = ask("Project name [#{config[:project]}] ?")
95
+ language = ask("Project language [#{config[:language]}] ?", :limited_to => ["objc", "swift", ""])
96
+ class_prefix = ask("Class prefix [#{config[:class_prefix]}] ?")
97
+ author = ask("Author [#{config[:author]}] ?")
98
+
99
+ config[:project] = project.empty? ? config[:project] || '' : project
100
+ config[:language] = language.empty? ? config[:language] || 'objc' : language
101
+ config[:class_prefix] = class_prefix.empty? ? config[:class_prefix] || '' : class_prefix
102
+ config[:author] = author.empty? ? config[:author] || '' : author
103
+
104
+ File.open(CONFIG_FILE, 'w') do |f|
105
+ f.write config.to_yaml
106
+ end
107
+
108
+ config
109
+ end
84
110
  end
85
111
  end
@@ -1,3 +1,3 @@
1
1
  module MagicViper
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.45"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: MagicViper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.45
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nilesh Agrawal
@@ -42,16 +42,16 @@ dependencies:
42
42
  name: thor
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
- version: 0.19.4
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
- version: 0.19.4
54
+ version: '0'
55
55
  description: Creates all the files and setup required for Viper Architecture in iOS.
56
56
  email:
57
57
  - nilesh.d.agrawal@gmail.com
@@ -62,16 +62,13 @@ executables:
62
62
  extensions: []
63
63
  extra_rdoc_files: []
64
64
  files:
65
+ - .MagicViper.yml
65
66
  - .gitignore
66
67
  - Gemfile
67
68
  - LICENSE
68
69
  - License.txt
69
- - MagicViper-0.1.0.gem
70
- - MagicViper-0.1.1.gem
71
- - MagicViper-0.1.2.gem
72
70
  - MagicViper.gemspec
73
71
  - README.md
74
- - Rakefile
75
72
  - bin/MagicViper
76
73
  - bin/console
77
74
  - bin/setup
data/MagicViper-0.1.0.gem DELETED
Binary file
data/MagicViper-0.1.1.gem DELETED
Binary file
data/MagicViper-0.1.2.gem DELETED
Binary file
data/Rakefile DELETED
@@ -1 +0,0 @@
1
- require "bundler/gem_tasks"