dido 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 150587bdec100ea05351ac2a4396e6ea9bd127c0
4
+ data.tar.gz: e0f9e9627e1248174265480efed7153e4ad74fd6
5
+ SHA512:
6
+ metadata.gz: 0b971df4c5510450bbed757adabd258e05c621ef24fe0c011c2bd0fedc7167c0f834a7efbd120c201d3d7b74c78c58a864358e28f2bffdfb31b86a861c7705ae
7
+ data.tar.gz: 31014ac6d36a4478a5860e8aa094c3ecccad65871a9f1ce9d4b1c5178817594f9e2e1b25ec96a93af1d4f52d4136a52742a1668cea9bf5c883460544083f00fc
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.3
4
+ before_install: gem install bundler -v 1.10.6
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Dido.gemspec ADDED
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'Dido/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "dido"
8
+ spec.version = Dido::VERSION
9
+ spec.authors = ["Pedro Piñera"]
10
+ spec.email = ["pedro@gitdo.com"]
11
+
12
+ spec.summary = %q{Dido is a command line tools for generating Swift libraries XCode projects (Carthage & CocoaPods support)}
13
+ spec.description = %q{Dido makes the creation of libraries faster thanks to a set of commands. It creates the project for you with your configuration and makes it ready to be integrated using CocoaPods or Carthage}
14
+ spec.homepage = "https://github.com/gitdo/dido"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ # spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.executables = ['dido.rb']
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_dependency "thor", "0.19.1"
24
+ spec.add_dependency "colorize", "0.7.7"
25
+
26
+ spec.add_development_dependency "bundler", "~> 1.10"
27
+ spec.add_development_dependency "rake", "~> 10.0"
28
+ spec.add_development_dependency "rspec"
29
+ spec.add_development_dependency "byebug"
30
+ end
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in Dido.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Pedro Piñera
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,62 @@
1
+ ![image](assets/header.png)
2
+
3
+ Dido
4
+ ===========
5
+
6
+ Dido is a command line tool written on Ruby that generates XCode Swift projects ready to start coding your library. Generated project is ready to be integrated with [Carthage](https://github.com/carthage/carthage), [CocoaPods](https://cocoapods.org) and integrate with TravisCI
7
+
8
+ ### Why?
9
+ Every time you start working on a new library you have to setup the project, create the frameworks, add the dependencies, add the configuration, ..., that every time. Could we automatize that? That's what Dido does. `CocoaPods` offers a similar tool but it's only CocoaPods compatible and this tool was also proposed for Carthage but didn't suite at all with the Carthage philosofy.
10
+
11
+
12
+ ## Installation
13
+
14
+ Add this line to your application's Gemfile:
15
+
16
+ ```ruby
17
+ gem 'Dido'
18
+ ```
19
+
20
+ And then execute:
21
+
22
+ $ bundle
23
+
24
+ Or install it yourself as:
25
+
26
+ $ gem install Dido
27
+
28
+ ## Usage
29
+
30
+ Using Dido is very simple. Once you have it installed you can create your library project with:
31
+
32
+ ```bash
33
+ dido lib MyLib --org-id=io.gitdo --org-name=GitDo
34
+ ```
35
+
36
+ The tool will create your project under `./MyLib`, open the `.xcodeproj` inside and start coding.
37
+
38
+ **I don't need tvOS/OSX/watchOS/iOS targets**
39
+ Then you can remove them from the project. Remove the **target** and the **scheme** and voila! :tada:
40
+
41
+ ## Thanks
42
+
43
+ - Special thanks to [CocoaPods](https://cocoapods.org) for its `pod lib create` tool which we inspired from.
44
+ - Also special thanks to [Carthage](https://github.com/carthage/carthage) also for its dependency management solution.
45
+
46
+ We encourage supporting both dependency management solutions in your libraries. Give developers the option to choose between them.
47
+
48
+ ## Development
49
+
50
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
51
+
52
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
53
+
54
+ ## Contributing
55
+
56
+ Bug reports and pull requests are welcome on GitHub at https://github.com/gitdoapp/Dido. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
57
+
58
+
59
+ ## License
60
+
61
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
62
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/assets/header.png ADDED
Binary file
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "Dido"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
data/exe/dido.rb ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "Dido"
4
+
5
+ Dido::App.start()
@@ -0,0 +1,21 @@
1
+ require 'set'
2
+
3
+ module Dido
4
+ module Entities
5
+
6
+ class Config
7
+
8
+ attr_reader :org_id
9
+ attr_reader :org_name
10
+ attr_reader :name
11
+
12
+ def initialize(name, org_id, org_name)
13
+ @name = name
14
+ @org_id = org_id
15
+ @org_name = org_name
16
+ end
17
+
18
+ end
19
+
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ module Dido
2
+ module Utils
3
+
4
+ class Builder
5
+
6
+ def initialize(path, config)
7
+ @path = path
8
+ @config = config
9
+ end
10
+
11
+ def test
12
+ puts `xcodebuild build -project ./#{@config.name}/#{@config.name}.xcodeproj -scheme "#{@config.name} iOS" ONLY_ACTIVE_ARCH=NO > /dev/null`
13
+ puts `xcodebuild build -project ./#{@config.name}/#{@config.name}.xcodeproj -scheme "#{@config.name} OSX" ONLY_ACTIVE_ARCH=NO > /dev/null`
14
+ puts `xcodebuild build -project ./#{@config.name}/#{@config.name}.xcodeproj -scheme "#{@config.name} tvOS" ONLY_ACTIVE_ARCH=NO > /dev/null`
15
+ puts `xcodebuild build -project ./#{@config.name}/#{@config.name}.xcodeproj -scheme "#{@config.name} watchOS" ONLY_ACTIVE_ARCH=NO > /dev/null`
16
+ end
17
+
18
+ end
19
+
20
+ end
21
+ end
@@ -0,0 +1,18 @@
1
+ module Dido
2
+ module Utils
3
+
4
+ class Carthage
5
+
6
+ def initialize(path, config)
7
+ @path = path
8
+ @config = config
9
+ end
10
+
11
+ def update
12
+ puts `carthage update ./#{@config.name}`
13
+ end
14
+
15
+ end
16
+
17
+ end
18
+ end
@@ -0,0 +1,20 @@
1
+ module Dido
2
+ module Utils
3
+
4
+ class Git
5
+
6
+ def clone_default_template(config)
7
+ clone("https://github.com/gitdoapp/dido-template.git", config.name)
8
+ end
9
+
10
+ private
11
+
12
+ def clone(url, name)
13
+ FileUtils.remove_dir(name) if File.exist?(name)
14
+ puts `git clone #{url} #{name}`
15
+ end
16
+
17
+ end
18
+
19
+ end
20
+ end
@@ -0,0 +1,50 @@
1
+ require "Dido/entities/config"
2
+ require 'find'
3
+
4
+ module Dido
5
+ module Utils
6
+
7
+ class Templater
8
+
9
+ def initialize(config)
10
+ @config = config
11
+ end
12
+
13
+ def adapt(path)
14
+ rename_directories(path)
15
+ rename_files(path)
16
+ end
17
+
18
+ private
19
+
20
+ def rename_directories(path)
21
+ rename = lambda { |path|
22
+ get_files(path).select{ |p| p.include?("{{NAME}}")}.first
23
+ }
24
+ to_rename = rename.call(path)
25
+ return unless to_rename
26
+ new_name = to_rename.gsub("{{NAME}}", @config.name)
27
+ File.rename(to_rename, new_name)
28
+ adapt(path)
29
+ end
30
+
31
+ def rename_files(path)
32
+ get_files(path).each do |file_path|
33
+ next if File.directory?(file_path)
34
+ next if file_path.include? ".git"
35
+ text = File.read(file_path)
36
+ new_contents = text.gsub("{{NAME}}", @config.name)
37
+ new_contents = new_contents.gsub("ORGID", @config.org_id)
38
+ new_contents = new_contents.gsub("ORGNAME", @config.org_name)
39
+ File.open(file_path, "w") {|file| file.puts new_contents }
40
+ end
41
+ end
42
+
43
+ def get_files(path)
44
+ Find.find(path)
45
+ end
46
+
47
+ end
48
+
49
+ end
50
+ end
@@ -0,0 +1,3 @@
1
+ module Dido
2
+ VERSION = "0.1.1"
3
+ end
data/lib/Dido.rb ADDED
@@ -0,0 +1,52 @@
1
+ require "Dido/version"
2
+ require "Dido/entities/config"
3
+ require "Dido/utils/git"
4
+ require "Dido/utils/templater"
5
+ require "Dido/utils/builder"
6
+ require "Dido/utils/carthage"
7
+ require "thor"
8
+ require "colorize"
9
+
10
+ module Dido
11
+
12
+ class App < Thor
13
+
14
+ desc "lib LIB_NAME", "create a lib with the provided name"
15
+ option :org_id, :type => :string, :required => true, :desc => "Framework organization identifier (e.g. io.GitDo)"
16
+ option :org_name, :type => :string, :required => true, :desc => "Framework organization name (e.g. GitDo)"
17
+ def lib(name)
18
+ config = Entities::Config.new(name, options[:org_id], options[:org_name])
19
+ clone_template(config)
20
+ update_template(config)
21
+ update_dependencies(config)
22
+ test_project(config)
23
+ end
24
+
25
+ private
26
+
27
+ def clone_template(config)
28
+ puts "> Clonning template".colorize(:green)
29
+ git = Utils::Git.new.clone_default_template(config)
30
+ end
31
+
32
+ def update_template(config)
33
+ puts "> Setting up for \"#{config.name}\"".colorize(:green)
34
+ templater = Utils::Templater.new(config)
35
+ templater.adapt("./#{config.name}")
36
+ end
37
+
38
+ def test_project(config)
39
+ puts "> Testing project...".colorize(:green)
40
+ builder = Utils::Builder.new("./#{config.name}", config)
41
+ builder.test
42
+ end
43
+
44
+ def update_dependencies(config)
45
+ puts "> Updating Carthage dependencies...".colorize(:green)
46
+ carthage = Utils::Carthage.new("./#{config.name}", config)
47
+ carthage.update
48
+ end
49
+
50
+ end
51
+
52
+ end
metadata ADDED
@@ -0,0 +1,152 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dido
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Pedro Piñera
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-11-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 0.19.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.19.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: colorize
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 0.7.7
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 0.7.7
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.10'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.10'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: byebug
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: Dido makes the creation of libraries faster thanks to a set of commands.
98
+ It creates the project for you with your configuration and makes it ready to be
99
+ integrated using CocoaPods or Carthage
100
+ email:
101
+ - pedro@gitdo.com
102
+ executables:
103
+ - dido.rb
104
+ extensions: []
105
+ extra_rdoc_files: []
106
+ files:
107
+ - ".gitignore"
108
+ - ".rspec"
109
+ - ".travis.yml"
110
+ - CODE_OF_CONDUCT.md
111
+ - Dido.gemspec
112
+ - Gemfile
113
+ - LICENSE.txt
114
+ - README.md
115
+ - Rakefile
116
+ - assets/header.png
117
+ - bin/console
118
+ - bin/setup
119
+ - exe/dido.rb
120
+ - lib/Dido.rb
121
+ - lib/Dido/entities/config.rb
122
+ - lib/Dido/utils/builder.rb
123
+ - lib/Dido/utils/carthage.rb
124
+ - lib/Dido/utils/git.rb
125
+ - lib/Dido/utils/templater.rb
126
+ - lib/Dido/version.rb
127
+ homepage: https://github.com/gitdo/dido
128
+ licenses:
129
+ - MIT
130
+ metadata: {}
131
+ post_install_message:
132
+ rdoc_options: []
133
+ require_paths:
134
+ - lib
135
+ required_ruby_version: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ required_rubygems_version: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
145
+ requirements: []
146
+ rubyforge_project:
147
+ rubygems_version: 2.4.5.1
148
+ signing_key:
149
+ specification_version: 4
150
+ summary: Dido is a command line tools for generating Swift libraries XCode projects
151
+ (Carthage & CocoaPods support)
152
+ test_files: []