konstruct 0.1.3

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: af3e952ba75ca52ec4b08bca0866b8faf59c9565
4
+ data.tar.gz: 05af5e6f2b8125923bd8327981511f2d47164a46
5
+ SHA512:
6
+ metadata.gz: 1ac3b71723a30ffeed0b01f57fc43dcdfb3db977dd85e692fb54eb6ac54f3082515e9845e3a9edae46a16fcf3bd4175faafe5e64cea30029d82968de238a48c5
7
+ data.tar.gz: 267db95e426754bb1692cd4afdcffd2e22ec9dbce03f3e186840022a9ef45b1800e139480eeb7c1ee746ea3f6e004c6ff1dc663d6280c32cae793e54af522b5e
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/
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at adrian.kirsten@traaidmark.com. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in konstruct.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Adrian Kirsten
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,46 @@
1
+ # Konstruct Cli - 0.1.3
2
+
3
+ The Konstruct Cli provides tools to make working with Konstruct painless and quick. You can access documentation, build a new project structure and scaffold a new site with simple to use commands.
4
+
5
+ ## Installation
6
+
7
+ You can install Konstruct Cli by running:
8
+
9
+ $ gem install konstruct
10
+
11
+ ## Usage
12
+
13
+ The Cli has a few very simple commands. If you get stuck simply `$ konstruct --help` for help. You can also get instructions for every command with `$ konstruct [COMMAND] --help`
14
+
15
+ ### Available Commands
16
+
17
+ #### Scaffold
18
+
19
+ This feature is coming soon.
20
+
21
+ #### Gulp
22
+
23
+ This feature is coming soon.
24
+
25
+ #### Skeleton
26
+
27
+ $ konstruct skeleton
28
+
29
+ The skeleton command builds a basic starter project template for common website projects. It builds common folders to ensure your project is tidy and organised.
30
+
31
+ #### Documentation
32
+
33
+ This feature is coming soon.
34
+
35
+ #### Stat
36
+
37
+ This feature is coming soon.
38
+
39
+ ## Contributing
40
+
41
+ Bug reports and pull requests are welcome on GitHub at https://github.com/konstruct/konstruct.cli. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
42
+
43
+ ## License
44
+
45
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
46
+
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "konstruct"
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/konstruct ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "konstruct"
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/konstruct.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'konstruct/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "konstruct"
8
+ spec.version = Konstruct::VERSION
9
+ spec.authors = ["Adrian Kirsten"]
10
+ spec.email = ["adrian.kirsten@traaidmark.com"]
11
+
12
+ spec.summary = "A set of tools to help you work with the Konstruct Framework."
13
+ spec.homepage = "https://github.com/konstruct/konstruct.cli"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split("\n")
17
+ spec.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
18
+ spec.require_paths = ['lib']
19
+
20
+ spec.add_dependency 'commander'
21
+ spec.add_dependency 'minigit'
22
+ spec.add_dependency 'paint'
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.11"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ end
@@ -0,0 +1,97 @@
1
+ # KONSTRUCT CLI [ KONSTRUCT MODULE ] ==================================================================================
2
+
3
+ # ====== INDEX =======================================================================================================
4
+ # ==
5
+ # == A. LOAD DEPENDENCIES
6
+ # == A. COMMAND MODULES
7
+ # ==
8
+ # ====== INDEX =======================================================================================================
9
+
10
+ # B. COMMANDER SCRIPT +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
11
+
12
+ module Cli
13
+
14
+ # B.1. GIT COMMANDS -----------------------------------------------------------------------------------------------
15
+
16
+ class Scaffold
17
+
18
+ # B.1.1. INTRODUCTION
19
+
20
+ def icon
21
+
22
+ puts ""
23
+ puts ""
24
+ puts Paint[' $III7IIIIIIIIIIIIIIIIIIIIIIIIII: ', "#de544b"]
25
+ puts Paint[' ZZZZZZ$7IIIIIIIIIIIIIIIIIIIIIIII ', "#de544b"]
26
+ puts Paint[' ZZZZZZZZZZZZ$7IIIIIIIIIIIIIIIIII ', "#de544b"]
27
+ puts Paint[' ZZZZZZZZZZZZZZZZZZZ$IIIIIIIIIIII~', "#de544b"]
28
+ puts Paint[' ZZZZZZZZZZZZZZZZZZZZZZZ:,:+IIIIII', "#de544b"]
29
+ puts Paint[' ZZZZZZZZZZZZZZZZZZZZZZ. :?', "#de544b"]
30
+ puts Paint[' I$ZZZZZZZZZZZZZZZZZZ7 ', "#de544b"]
31
+ puts Paint[' III$ZZZZZZZZZZZZZZZ~ ', "#de544b"]
32
+ puts Paint[' IIIII7ZZZZZZZZZZZZ ', "#de544b"]
33
+ puts Paint[' IIIIIII7ZZZZZZZZ$ ', "#de544b"]
34
+ puts Paint[' IIIIIIIIIIZZZZZ: ', "#de544b"]
35
+ puts Paint[' IIIIIIIIIIIIZI ', "#de544b"]
36
+ puts Paint[' IIIIIIIIIIIIII ', "#de544b"]
37
+ puts Paint[' IIIIIIIIIIIIIIII= ', "#de544b"]
38
+ puts Paint[' IIIIIIIIIIIIIIIII7= ', "#de544b"]
39
+ puts Paint[' IIIIIIIIIIIIIIIIIIII~ ', "#de544b"]
40
+ puts Paint[' IIIIIIIIIIIIIIIIIIIIII= ', "#de544b"]
41
+ puts Paint[' IIIIIIIIIIIIIIIIIIIIIII7~ ', "#de544b"]
42
+ puts Paint[' IIIIIIIIIIIIIIIIIIIIIIIIIII.. ', "#de544b"]
43
+ puts Paint[' IIIIIIIIIIIIIIIIIIIIIIIIIIII7 ', "#de544b"]
44
+ puts Paint[' IIIIIIIIIIIIIIIIIIIIIIIIIIIIIII,.', "#de544b"]
45
+ puts Paint[' IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII7', "#de544b"]
46
+ puts ""
47
+ puts ""
48
+
49
+ end
50
+
51
+ # B.1.1. END
52
+
53
+
54
+
55
+ # B.1.1. CHECK FOR EMPTY DIRECTORY
56
+
57
+
58
+
59
+ # B.1.1. END
60
+
61
+ # B.1.1. INSTALL SYSTEM FILES
62
+
63
+ def install_system
64
+
65
+ end
66
+
67
+ # B.1.1. END
68
+
69
+ # B.1.1. GET: SITE INFORMATION
70
+
71
+ # B.1.1. END
72
+
73
+ # B.1.1. DO: SCAFFOLD CHOSEN SITE
74
+
75
+ # B.1.1. END
76
+
77
+ # B.1.1. DO: CLEAN DIRECTORY
78
+
79
+ # B.1.1. END
80
+
81
+ # B.1.1. GET: INITIALISE GIT REPOSITORY?
82
+
83
+ # B.1.1. END
84
+
85
+ # B.1.1. DO: GIT REPO WORK
86
+
87
+ # B.1.1. END
88
+
89
+ end
90
+
91
+ # B.1. END --------------------------------------------------------------------------------------------------------
92
+
93
+ end
94
+
95
+ # B. END ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
96
+
97
+ # END OF FILE =========================================================================================================
@@ -0,0 +1,90 @@
1
+ # KONSTRUCT CLI [ KONSTRUCT MODULE ] ==================================================================================
2
+
3
+ # ====== INDEX =======================================================================================================
4
+ # ==
5
+ # == A. SKELETON PROJECT CREATOR
6
+ # ==
7
+ # ====== INDEX =======================================================================================================
8
+
9
+ # A. SKELETON PROJECT CREATOR +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
10
+
11
+ module Konstruct
12
+
13
+ class Cli
14
+
15
+ def skeleton(path)
16
+
17
+ # B.1. INITIALISE FUNCTIONS -------------------------------------------------------------------------------
18
+
19
+ msg = Util::Message.new()
20
+ fs = Util::FS.new()
21
+
22
+ # B.1. END ------------------------------------------------------------------------------------------------
23
+
24
+ msg.heading("CREATING SKELETON PROJECT STRUCTURE")
25
+
26
+ # B.2. IS YOUR DIRECTORY EMPTY? ---------------------------------------------------------------------------
27
+
28
+ puts fs.clear_directory(path)
29
+
30
+ # B.2. END ------------------------------------------------------------------------------------------------
31
+
32
+ # B.3. CREATE SKELETON ------------------------------------------------------------------------------------
33
+
34
+ # B.3.1. FOLDER STRUCTURE
35
+
36
+ structure = ['1--ci', '2--design', '3--working', '4--www']
37
+
38
+ # B.3.1. END
39
+
40
+ # B.3.2. CONFIRM BUILD
41
+
42
+ puts Paint["The following directory structure will be created for you:", "999999"]
43
+
44
+ puts ""
45
+
46
+ structure.each { |f|
47
+
48
+ puts Paint["-- #{ f }", "999999"]
49
+
50
+ }
51
+
52
+ puts ""
53
+
54
+ choice = choose("Do you want to install the structure above?", :yes, :no)
55
+
56
+ # B.3.2. END
57
+
58
+ # B.3.3. BUILD STRUCTURE
59
+
60
+ if choice == :yes
61
+
62
+ structure.each { |f|
63
+
64
+ Dir.mkdir "#{ path }/#{ f }"
65
+
66
+ }
67
+
68
+ msg.success('Successfully created your skeleton. Go do something awesome!')
69
+
70
+ exit(0)
71
+
72
+ else
73
+
74
+ exit(0)
75
+
76
+ end
77
+
78
+ # B.3.7. END
79
+
80
+ # B.3. END ------------------------------------------------------------------------------------------------
81
+
82
+ end
83
+
84
+ end
85
+
86
+ end
87
+
88
+ # B. END ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
89
+
90
+ # END OF FILE =========================================================================================================
data/lib/konstruct.rb ADDED
@@ -0,0 +1,86 @@
1
+ # KONSTRUCT CLI [ COMMANDER ] ========================================================================================
2
+
3
+ # ====== INDEX =======================================================================================================
4
+ # ==
5
+ # == A. LOAD DEPENDENCIES
6
+ # ==
7
+ # ====== INDEX =======================================================================================================
8
+
9
+ # A. LOAD DEPENDENCIES ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
10
+
11
+ # A.1. EXTERNAL DEPENDENCIES ------------------------------------------------------------------------------------------
12
+
13
+ require "konstruct/version"
14
+ require 'rubygems'
15
+ require 'commander/import'
16
+ require 'paint'
17
+
18
+ # A.1. END ------------------------------------------------------------------------------------------------------------
19
+
20
+ # A.2. INTERNAL DEPENDENCIES ------------------------------------------------------------------------------------------
21
+
22
+ #A.2.1. UTILITIES
23
+
24
+ require_relative 'utilities/artwork'
25
+ require_relative 'utilities/utils'
26
+
27
+ # A.2.2. CLI SCRIPTS
28
+
29
+ require_relative 'cli/scaffold'
30
+ require_relative 'cli/skeleton'
31
+
32
+ # A.2. END ------------------------------------------------------------------------------------------------------------
33
+
34
+ # A.3. INITIALISE DEPENDENCIES ----------------------------------------------------------------------------------------
35
+
36
+ art = Util::Art.new()
37
+ msg = Util::Message.new()
38
+ fs = Util::FS.new()
39
+ cli = Konstruct::Cli.new()
40
+
41
+ # A.3. END ------------------------------------------------------------------------------------------------------------
42
+
43
+ # A. END ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
44
+
45
+ # B. COMMANDER SCRIPT +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
46
+
47
+ # B.1. GLOBAL VARIABLES -----------------------------------------------------------------------------------------------
48
+
49
+ projectDir = Dir.pwd
50
+
51
+ # B.1. END ------------------------------------------------------------------------------------------------------------
52
+
53
+ # B.1. PROGRAM META ---------------------------------------------------------------------------------------------------
54
+
55
+ program :version, '0.1.0'
56
+ program :description, 'The Konstruct CLI provides scaffolding and other tools to help you get up and running quicker, and work faster.'
57
+
58
+ # B.1. END ------------------------------------------------------------------------------------------------------------
59
+
60
+ # B.3. COMMAND: SKELETON ----------------------------------------------------------------------------------------------
61
+
62
+ # -- DESCRIPTION: Scaffolds a skeleton project folder structure for you.
63
+
64
+ # -- USAGE: $ konstruct skeleton
65
+
66
+ command :skeleton do |c|
67
+
68
+ c.syntax = 'konstruct skeleton'
69
+ c.summary = 'Builds a skeleton project folder structure for you.'
70
+ c.description = 'Builds out a new global project file structure for you to get started with quickly.'
71
+ c.example 'Structure:', '[1--ci, 2--design, 3--working, 4--www]'
72
+ c.action do |args, options|
73
+
74
+ art.icon()
75
+
76
+ cli.skeleton(projectDir)
77
+
78
+ end
79
+
80
+ end
81
+
82
+ # B.3. END ------------------------------------------------------------------------------------------------------------
83
+
84
+ # B. END ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
85
+
86
+ # END OF FILE =========================================================================================================
@@ -0,0 +1,3 @@
1
+ module Konstruct
2
+ VERSION = "0.1.3"
3
+ end
@@ -0,0 +1,58 @@
1
+ # KONSTRUCT CLI [ UTILITIES ] =========================================================================================
2
+
3
+ # ====== INDEX =======================================================================================================
4
+ # ==
5
+ # == A. ARTWORK
6
+ # ==
7
+ # ====== INDEX =======================================================================================================
8
+
9
+ # A. ARTWORK ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
10
+
11
+ module Util
12
+
13
+ class Art
14
+
15
+ # B.1. GIT COMMANDS -------------------------------------------------------------------------------------------
16
+
17
+ def icon
18
+
19
+ puts ""
20
+ puts ""
21
+ puts Paint[' $III7IIIIIIIIIIIIIIIIIIIIIIIIII: ', "#de544b"]
22
+ puts Paint[' ZZZZZZ$7IIIIIIIIIIIIIIIIIIIIIIII ', "#de544b"]
23
+ puts Paint[' ZZZZZZZZZZZZ$7IIIIIIIIIIIIIIIIII ', "#de544b"]
24
+ puts Paint[' ZZZZZZZZZZZZZZZZZZZ$IIIIIIIIIIII~', "#de544b"]
25
+ puts Paint[' ZZZZZZZZZZZZZZZZZZZZZZZ:,:+IIIIII', "#de544b"]
26
+ puts Paint[' ZZZZZZZZZZZZZZZZZZZZZZ. :?', "#de544b"]
27
+ puts Paint[' I$ZZZZZZZZZZZZZZZZZZ7 ', "#de544b"]
28
+ puts Paint[' III$ZZZZZZZZZZZZZZZ~ ', "#de544b"]
29
+ puts Paint[' IIIII7ZZZZZZZZZZZZ ', "#de544b"]
30
+ puts Paint[' IIIIIII7ZZZZZZZZ$ ', "#de544b"]
31
+ puts Paint[' IIIIIIIIIIZZZZZ: ', "#de544b"]
32
+ puts Paint[' IIIIIIIIIIIIZI ', "#de544b"]
33
+ puts Paint[' IIIIIIIIIIIIII ', "#de544b"]
34
+ puts Paint[' IIIIIIIIIIIIIIII= ', "#de544b"]
35
+ puts Paint[' IIIIIIIIIIIIIIIII7= ', "#de544b"]
36
+ puts Paint[' IIIIIIIIIIIIIIIIIIII~ ', "#de544b"]
37
+ puts Paint[' IIIIIIIIIIIIIIIIIIIIII= ', "#de544b"]
38
+ puts Paint[' IIIIIIIIIIIIIIIIIIIIIII7~ ', "#de544b"]
39
+ puts Paint[' IIIIIIIIIIIIIIIIIIIIIIIIIII.. ', "#de544b"]
40
+ puts Paint[' IIIIIIIIIIIIIIIIIIIIIIIIIIII7 ', "#de544b"]
41
+ puts Paint[' IIIIIIIIIIIIIIIIIIIIIIIIIIIIIII,.', "#de544b"]
42
+ puts Paint[' IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII7', "#de544b"]
43
+ puts ""
44
+ puts ""
45
+ puts Paint[' GO BUILD SOMETHING AWESOME!', "#999999"]
46
+ puts ""
47
+
48
+ end
49
+
50
+ # B.1. END ----------------------------------------------------------------------------------------------------
51
+
52
+ end
53
+
54
+ end
55
+
56
+ # A. END ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
57
+
58
+ # END OF FILE =========================================================================================================
@@ -0,0 +1,42 @@
1
+ # KONSTRUCT CLI [ COMMAND MODULE ] ====================================================================================
2
+
3
+ # ====== INDEX =======================================================================================================
4
+ # ==
5
+ # == A. LOAD DEPENDENCIES
6
+ # == A. COMMAND MODULES
7
+ # ==
8
+ # ====== INDEX =======================================================================================================
9
+
10
+ # A. LOAD DEPENDENCIES ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
11
+
12
+ require 'minigit'
13
+
14
+ # A. END ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
15
+
16
+ # B. COMMANDER SCRIPT +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
17
+
18
+ module Command
19
+
20
+ # B.1. GIT COMMANDS -----------------------------------------------------------------------------------------------
21
+
22
+ class Git
23
+
24
+ # B.1.1. GIT CLONE
25
+
26
+ def clone(repository, path)
27
+
28
+ MiniGit.git :clone, repository, path
29
+
30
+ end
31
+
32
+ # B.1.1. END
33
+
34
+ end
35
+
36
+ # B.1. END --------------------------------------------------------------------------------------------------------
37
+
38
+ end
39
+
40
+ # B. END ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
41
+
42
+ # END OF FILE =========================================================================================================
@@ -0,0 +1,162 @@
1
+ # KONSTRUCT CLI [ UTILITY MODULE ] ====================================================================================
2
+
3
+ # ====== INDEX =======================================================================================================
4
+ # ==
5
+ # == A. LOAD DEPENDENCIES
6
+ # == B. UTILITY MODULES
7
+ # ==
8
+ # ====== INDEX =======================================================================================================
9
+
10
+ # A. LOAD DEPENDENCIES ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
11
+
12
+
13
+
14
+ # A. END ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
15
+
16
+ # B. UTILITIES ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
17
+
18
+ module Util
19
+
20
+ # B.1. MESSAGES ---------------------------------------------------------------------------------------------------
21
+
22
+ class Message
23
+
24
+ # B.1.1. WARNING MESSAGE
25
+
26
+ def warning(msg)
27
+
28
+ puts ""
29
+ puts Paint["WARNING:", :yellow]
30
+ puts Paint[msg, :yellow]
31
+ puts ""
32
+
33
+ end
34
+
35
+ # B.1.1. END
36
+
37
+ # B.1.2. SUCCESS MESSAGE
38
+
39
+ def success(msg)
40
+
41
+ puts ""
42
+ puts Paint["SUCCESS:", :green]
43
+ puts Paint[msg, :green]
44
+ puts ""
45
+
46
+ end
47
+
48
+ # B.1.2. END
49
+
50
+ # B.1.3. ERROR MESSAGE
51
+
52
+ def error(msg)
53
+
54
+ puts ""
55
+ puts Paint["ERROR:", :red]
56
+ puts Paint[msg, :red]
57
+ puts ""
58
+
59
+ exit 1
60
+
61
+ end
62
+
63
+ # B.1.3. END
64
+
65
+ # B.1.4. HEADING
66
+
67
+ def heading(msg)
68
+
69
+ puts Paint["----------------------------------------------------------------------------", :cyan]
70
+
71
+ puts Paint["--", :cyan]
72
+ puts Paint["-- #{ msg }", :cyan]
73
+ puts Paint["--", :cyan]
74
+
75
+ puts Paint["----------------------------------------------------------------------------", :cyan]
76
+
77
+ puts ""
78
+
79
+ end
80
+
81
+ # B.1.4. END
82
+
83
+ end
84
+
85
+ # B.1. END --------------------------------------------------------------------------------------------------------
86
+
87
+ # B.2. FILE SYSTEM ------------------------------------------------------------------------------------------------
88
+
89
+ class FS
90
+
91
+ # B.2.1. CHECK FOR EMPTY DIRECTORY
92
+
93
+ def isEmpty(path)
94
+
95
+ if Dir.entries(path).length > 2
96
+
97
+ result = true
98
+
99
+ else
100
+
101
+ result = false
102
+
103
+ end
104
+
105
+ end
106
+
107
+ # B.2.1. END
108
+
109
+ # B.2.2. CLEAR THE ENTIRE DIRECTORY
110
+
111
+ def clear_directory(path)
112
+
113
+ msg = Util::Message.new()
114
+
115
+ if isEmpty(path)
116
+
117
+ msg.warning("Your directory isn't empty! Konstruct can only be installed in an empty directory.");
118
+
119
+ puts Paint["----------------------------------------------------------------------------", :yellow]
120
+
121
+ puts ""
122
+ puts Paint["DIRECTORY LISTING: #{path}", :yellow]
123
+ puts ""
124
+ puts Paint[Dir.entries(path), :yellow]
125
+ puts ""
126
+
127
+ puts Paint["----------------------------------------------------------------------------", :yellow]
128
+
129
+ puts ""
130
+
131
+ choice = choose("Do you want to clear your working directory?", :yes, :no)
132
+
133
+ if choice == :yes
134
+
135
+ toClear = "#{path}/*"
136
+
137
+ FileUtils.rm_rf(Dir.glob(toClear))
138
+
139
+ msg.success("Working directory cleared: #{path}")
140
+
141
+ else
142
+
143
+ msg.error("Konstruct can only be installed in an empty directory.")
144
+ exit(1)
145
+
146
+ end
147
+
148
+ end
149
+
150
+ end
151
+
152
+ # B.2.2. END
153
+
154
+ end
155
+
156
+ # B.2. END --------------------------------------------------------------------------------------------------------
157
+
158
+ end
159
+
160
+ # B. END ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
161
+
162
+ # END OF FILE =========================================================================================================
metadata ADDED
@@ -0,0 +1,134 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: konstruct
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.3
5
+ platform: ruby
6
+ authors:
7
+ - Adrian Kirsten
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-01-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: commander
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: minigit
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: paint
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.11'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.11'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '10.0'
83
+ description:
84
+ email:
85
+ - adrian.kirsten@traaidmark.com
86
+ executables:
87
+ - console
88
+ - konstruct
89
+ - setup
90
+ extensions: []
91
+ extra_rdoc_files: []
92
+ files:
93
+ - ".gitignore"
94
+ - CODE_OF_CONDUCT.md
95
+ - Gemfile
96
+ - LICENSE.txt
97
+ - README.md
98
+ - Rakefile
99
+ - bin/console
100
+ - bin/konstruct
101
+ - bin/setup
102
+ - konstruct.gemspec
103
+ - lib/cli/scaffold.rb
104
+ - lib/cli/skeleton.rb
105
+ - lib/konstruct.rb
106
+ - lib/konstruct/version.rb
107
+ - lib/utilities/artwork.rb
108
+ - lib/utilities/commands.rb
109
+ - lib/utilities/utils.rb
110
+ homepage: https://github.com/konstruct/konstruct.cli
111
+ licenses:
112
+ - MIT
113
+ metadata: {}
114
+ post_install_message:
115
+ rdoc_options: []
116
+ require_paths:
117
+ - lib
118
+ required_ruby_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ required_rubygems_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ requirements: []
129
+ rubyforge_project:
130
+ rubygems_version: 2.4.6
131
+ signing_key:
132
+ specification_version: 4
133
+ summary: A set of tools to help you work with the Konstruct Framework.
134
+ test_files: []