easycompile 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +216 -0
  3. data/bin/easycompile +7 -0
  4. data/doc/DESIGN_DECISIONS.md +34 -0
  5. data/doc/README.gen +189 -0
  6. data/doc/todo/todo_for_the_easycompile_project.md +0 -0
  7. data/easycompile.gemspec +66 -0
  8. data/lib/easycompile/base/change_directory.rb +28 -0
  9. data/lib/easycompile/base/cmake.rb +53 -0
  10. data/lib/easycompile/base/colours.rb +88 -0
  11. data/lib/easycompile/base/commandline_arguments.rb +37 -0
  12. data/lib/easycompile/base/constants.rb +24 -0
  13. data/lib/easycompile/base/easycompile.rb +22 -0
  14. data/lib/easycompile/base/esystem.rb +59 -0
  15. data/lib/easycompile/base/gem.rb +35 -0
  16. data/lib/easycompile/base/help.rb +38 -0
  17. data/lib/easycompile/base/initialize.rb +33 -0
  18. data/lib/easycompile/base/menu.rb +140 -0
  19. data/lib/easycompile/base/meson_and_ninja.rb +36 -0
  20. data/lib/easycompile/base/misc.rb +1157 -0
  21. data/lib/easycompile/base/opn.rb +27 -0
  22. data/lib/easycompile/base/process_the_input.rb +107 -0
  23. data/lib/easycompile/base/remove.rb +77 -0
  24. data/lib/easycompile/base/reset.rb +140 -0
  25. data/lib/easycompile/base/run.rb +26 -0
  26. data/lib/easycompile/compile_as_appdir/compile_as_appdir.rb +45 -0
  27. data/lib/easycompile/constants/array_possible_archives.rb +45 -0
  28. data/lib/easycompile/constants/constants.rb +21 -0
  29. data/lib/easycompile/constants/file_and_directory_constants.rb +137 -0
  30. data/lib/easycompile/constants/misc.rb +23 -0
  31. data/lib/easycompile/constants/namespace.rb +16 -0
  32. data/lib/easycompile/constants/programs_directory.rb +46 -0
  33. data/lib/easycompile/easycompile/easycompile.rb +89 -0
  34. data/lib/easycompile/images/logo/EASYCOMPILE_LOGO.png +0 -0
  35. data/lib/easycompile/project/project.rb +29 -0
  36. data/lib/easycompile/requires/require_the_easycompile_project.rb +13 -0
  37. data/lib/easycompile/requires/require_the_toplevel_methods.rb +11 -0
  38. data/lib/easycompile/toplevel_methods/copy_file.rb +23 -0
  39. data/lib/easycompile/toplevel_methods/misc.rb +54 -0
  40. data/lib/easycompile/toplevel_methods/rinstall2.rb +29 -0
  41. data/lib/easycompile/version/version.rb +26 -0
  42. data/lib/easycompile/yaml/name_of_the_build_directory.yml +1 -0
  43. data/lib/easycompile.rb +5 -0
  44. data/test/testing_easycompile.rb +29 -0
  45. metadata +147 -0
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'easycompile/constants/programs_directory.rb'
6
+ # =========================================================================== #
7
+ module Easycompile
8
+
9
+ module Constants # === Easycompile::Constants
10
+
11
+ # ========================================================================= #
12
+ # === PROGRAMS_DIRECTORY
13
+ # ========================================================================= #
14
+ if ENV['MY_PROGRAMS']
15
+ PROGRAMS_DIRECTORY = ENV['MY_PROGRAMS'].to_s+'/'
16
+ else
17
+ PROGRAMS_DIRECTORY = '/home/Programs/'
18
+ end
19
+
20
+ end
21
+
22
+ # =========================================================================== #
23
+ # === @programs_directory
24
+ #
25
+ # This toplevel instance variable keeps track of the programs directory
26
+ # in use for easycompile.
27
+ # =========================================================================== #
28
+ @programs_directory = Constants::PROGRAMS_DIRECTORY
29
+
30
+ # =========================================================================== #
31
+ # === Easycompile.set_programs_directory
32
+ # =========================================================================== #
33
+ def self.set_programs_directory(i)
34
+ i = i.dup if i.frozen?
35
+ i << '/' unless i.end_with? '/'
36
+ @programs_directory = i
37
+ end
38
+
39
+ # =========================================================================== #
40
+ # === Easycompile.programs_directory?
41
+ # =========================================================================== #
42
+ def self.programs_directory?
43
+ @programs_directory
44
+ end; self.instance_eval { alias programs_dir? programs_directory? } # === Easycompile.programs_dir?
45
+
46
+ end
@@ -0,0 +1,89 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === Easycompile::Easycompile
6
+ #
7
+ # This will extract an archive, then compile into the given prefix,
8
+ # which defaults to /usr/ for this class.
9
+ # =========================================================================== #
10
+ require 'easycompile/base/easycompile.rb'
11
+
12
+ module Easycompile # === Easycompile::Easycompile
13
+
14
+ class Easycompile < Base
15
+
16
+ # ========================================================================= #
17
+ # === initialize
18
+ #
19
+ # We can use more advanced compile instructions such as:
20
+ #
21
+ # Easycompile::Easycompile.new(i, extract_to: EXTRACT_TO)
22
+ #
23
+ # The first argument is the name of the program in question.
24
+ # ========================================================================= #
25
+ def initialize(
26
+ i = nil,
27
+ run_already = true,
28
+ &block
29
+ )
30
+ set_prefix '/usr' # This is the default prefix anyway.
31
+ super(i, :dont_run_yet)
32
+ if run_already.is_a? Hash
33
+ set_hash(run_already) # Here the prefix can be overruled.
34
+ run_already = true
35
+ end
36
+ if i.is_a? Array
37
+ i = i.first
38
+ end
39
+ if i.end_with? '.yml'
40
+ i = return_yaml_file(i)
41
+ set_original_input(i)
42
+ end
43
+ # ======================================================================= #
44
+ # === Handle blocks next
45
+ # ======================================================================= #
46
+ if block_given?
47
+ yielded = yield
48
+ # ===================================================================== #
49
+ # === Handle Hashes next
50
+ # ===================================================================== #
51
+ if yielded.is_a? Hash
52
+ # =================================================================== #
53
+ # === { :prefix => :appdir }
54
+ #
55
+ # This is the default entry point for programs that are compiled
56
+ # via an AppDir prefix.
57
+ # =================================================================== #
58
+ if yielded.has_key? :prefix
59
+ set_prefix(
60
+ yielded[:prefix]
61
+ )
62
+ end
63
+ end
64
+ end
65
+ set_original_input(i)
66
+ run if run_already # Call the parent method.
67
+ end
68
+
69
+ # ========================================================================= #
70
+ # === Easycompile[]
71
+ # ========================================================================= #
72
+ def self.[](i)
73
+ new(i)
74
+ end
75
+
76
+ end
77
+
78
+ # =========================================================================== #
79
+ # === Easycompile.new
80
+ # =========================================================================== #
81
+ def self.new(i = ARGV)
82
+ ::Easycompile::Easycompile.new(i)
83
+ end
84
+
85
+ end
86
+
87
+ if __FILE__ == $PROGRAM_NAME
88
+ puts Easycompile::Easycompile.new(ARGV)
89
+ end # ecompile
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'easycompile/project/project.rb'
6
+ # =========================================================================== #
7
+ module Easycompile
8
+
9
+ # ========================================================================= #
10
+ # === Easycompile::PROJECT_BASE_DIRECTORY
11
+ # ========================================================================= #
12
+ PROJECT_BASE_DIRECTORY =
13
+ File.absolute_path("#{__dir__}/..")+'/'
14
+
15
+ # ========================================================================= #
16
+ # === Easycompile::PROJECT_BASE_DIR
17
+ #
18
+ # This is simply an "alias" to the above constant.
19
+ # ========================================================================= #
20
+ PROJECT_BASE_DIR = PROJECT_BASE_DIRECTORY
21
+
22
+ # ========================================================================= #
23
+ # === Easycompile.project_base_dir?
24
+ # ========================================================================= #
25
+ def self.project_base_dir?
26
+ PROJECT_BASE_DIRECTORY
27
+ end
28
+
29
+ end
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'easycompile/requires/require_the_easycompile_project.rb'
6
+ # =========================================================================== #
7
+ require 'easycompile/constants/constants.rb'
8
+ require 'easycompile/project/project.rb'
9
+ require 'easycompile/version/version.rb'
10
+ require 'easycompile/base/easycompile.rb'
11
+ require 'easycompile/requires/require_the_toplevel_methods.rb'
12
+ require 'easycompile/easycompile/easycompile.rb'
13
+ require 'easycompile/compile_as_appdir/compile_as_appdir.rb'
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'easycompile/requires/require_the_toplevel_methods.rb'
6
+ # =========================================================================== #
7
+ require 'easycompile/project/project.rb'
8
+
9
+ Dir["#{Easycompile.project_base_dir?}toplevel_methods/*.rb"].each {|this_file|
10
+ require "easycompile/toplevel_methods/#{File.basename(this_file)}"
11
+ }
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'easycompile/toplevel_methods/copy_file.rb'
6
+ # =========================================================================== #
7
+ module Easycompile
8
+
9
+ require 'fileutils'
10
+
11
+ # ========================================================================= #
12
+ # === Easycompile.copy_file
13
+ #
14
+ # The second argument to this method specifies the target-location
15
+ # where the file should be copied onto.
16
+ # ========================================================================= #
17
+ def self.copy_file(
18
+ from, to = Dir.pwd
19
+ )
20
+ FileUtils.cp(from, to)
21
+ end
22
+
23
+ end
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # Here we collect methods which are directly available on the module
6
+ # level of the project.
7
+ # =========================================================================== #
8
+ # require 'easycompile/toplevel_methods/misc.rb'
9
+ # =========================================================================== #
10
+ module Easycompile
11
+
12
+ require 'easycompile/constants/constants.rb'
13
+ # ========================================================================= #
14
+ # We wish to include these constants onto the toplevel module next.
15
+ # ========================================================================= #
16
+ include Easycompile::Constants
17
+
18
+ require 'easycompile/easycompile/easycompile.rb'
19
+ require 'easycompile/compile_as_appdir/compile_as_appdir.rb'
20
+ # ========================================================================= #
21
+ # === Easycompile.compile
22
+ #
23
+ # This method must be able to tap into CompileAsAppdir, as well
24
+ # as invoke Easycompile, so both .rb files are required here.
25
+ #
26
+ # If no input is given then a random entry will be fetched.
27
+ #
28
+ # Invocation example:
29
+ #
30
+ # Easycompile.compile('wv.yml', :appdir)
31
+ #
32
+ # ========================================================================= #
33
+ def self.compile(
34
+ i = nil, optional_compile_as_appdir = false
35
+ )
36
+ if i.nil?
37
+ i = try_to_randomly_fetch_an_archive_from_the_current_directory
38
+ end
39
+ case optional_compile_as_appdir
40
+ when :appdir
41
+ # ===================================================================== #
42
+ # Make it more explicit in this case.
43
+ # ===================================================================== #
44
+ optional_compile_as_appdir = true
45
+ end
46
+ if optional_compile_as_appdir
47
+ ::Easycompile::CompileAsAppdir[i]
48
+ else
49
+ ::Easycompile::Easycompile.new(i)
50
+ end
51
+ end; self.instance_eval { alias easycompile compile } # === Easycompile.easycompile
52
+ self.instance_eval { alias [] compile } # === Easycompile[]
53
+
54
+ end
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'easycompile/toplevel_methods/rinstall2.rb'
6
+ # =========================================================================== #
7
+ module Easycompile
8
+
9
+ require 'easycompile/constants/file_and_directory_constants.rb'
10
+ require 'easycompile/toplevel_methods/copy_file.rb'
11
+
12
+ # ========================================================================= #
13
+ # === Easycompile.rinstall2
14
+ #
15
+ # How to install ruby-stuff without gems, by using good oldschool
16
+ # setup.rb.
17
+ # ========================================================================= #
18
+ def self.rinstall2
19
+ copy_file ::Easycompile::Constants::LOCATION_OF_SETUP_RB,
20
+ Dir.pwd
21
+ esystem 'ruby setup.rb --quiet config'
22
+ esystem 'ruby setup.rb --quiet setup'
23
+ esystem 'ruby setup.rb --quiet install'
24
+ File.delete('setup.rb') if File.exist? 'setup.rb'
25
+ File.delete('InstalledFiles') if File.exist? 'InstalledFiles'
26
+ File.delete('.config') if File.exist? '.config'
27
+ end
28
+
29
+ end
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'easycompile/version/version.rb'
6
+ # =========================================================================== #
7
+ module Easycompile
8
+
9
+ # ========================================================================= #
10
+ # === VERSION
11
+ # ========================================================================= #
12
+ VERSION = '1.0.9'
13
+
14
+ # ========================================================================= #
15
+ # === LAST_UPDATE
16
+ # ========================================================================= #
17
+ LAST_UPDATE = '02.05.2022'
18
+
19
+ # ========================================================================= #
20
+ # === version?
21
+ # ========================================================================= #
22
+ def self.version?
23
+ Easycompile::VERSION
24
+ end
25
+
26
+ end
@@ -0,0 +1 @@
1
+ BUILD_DIRECTORY
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ require 'easycompile/requires/require_the_easycompile_project.rb'
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ require 'colours/colours_e_autoinclude.rb'
6
+ require 'easycompile'
7
+
8
+ # =========================================================================== #
9
+ # Denote which program to use.
10
+ # =========================================================================== #
11
+ _ = '/home/x/src/htop/htop-2.2.0.tar.xz'
12
+ _ = ARGV.first unless ARGV.empty? # Overrule if argument was given.
13
+
14
+ e
15
+ e 'Welcome to testing some components of the project called Easycompile.'
16
+ e
17
+ e 'The version in use is:'
18
+ e
19
+ e sfancy(" #{Easycompile.version?}")
20
+ e
21
+ e 'Next testing support for yaml files through '+
22
+ sfancy('Easycompile.compile("wv.yaml", :appdir)')+':'
23
+ Easycompile.compile('wv.yml', :appdir)
24
+ e 'Next testing app-dir compilation:'
25
+ Easycompile::CompileAsAppdir[_]
26
+ e "Next testing #{sfancy('Easycompile.compile(_)')}"
27
+ Easycompile.compile(_)
28
+ e 'Next testing support for yaml files:'
29
+ Easycompile.compile('wv.yml')
metadata ADDED
@@ -0,0 +1,147 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: easycompile
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.9
5
+ platform: ruby
6
+ authors:
7
+ - Robert A. Heiler
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-05-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: colours
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: opn
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: extracter
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
+ description: |2+
56
+
57
+ This project is called easycompile.
58
+
59
+ It allows you to compile a given source archive, such as a file
60
+ like "php-7.2.0.tar.xz". By default this will compile into the
61
+ prefix /usr/. In order for this to work, the file at hand
62
+ has to exist; in the case above, the file php-7.2.0.tar.xz
63
+ has to exist locally.
64
+
65
+ For more documentation, have a look at the link called
66
+ Documentation on the bottom right side of this webpage.
67
+
68
+ email: shevy@inbox.lt
69
+ executables:
70
+ - easycompile
71
+ extensions: []
72
+ extra_rdoc_files: []
73
+ files:
74
+ - README.md
75
+ - bin/easycompile
76
+ - doc/DESIGN_DECISIONS.md
77
+ - doc/README.gen
78
+ - doc/todo/todo_for_the_easycompile_project.md
79
+ - easycompile.gemspec
80
+ - lib/easycompile.rb
81
+ - lib/easycompile/base/change_directory.rb
82
+ - lib/easycompile/base/cmake.rb
83
+ - lib/easycompile/base/colours.rb
84
+ - lib/easycompile/base/commandline_arguments.rb
85
+ - lib/easycompile/base/constants.rb
86
+ - lib/easycompile/base/easycompile.rb
87
+ - lib/easycompile/base/esystem.rb
88
+ - lib/easycompile/base/gem.rb
89
+ - lib/easycompile/base/help.rb
90
+ - lib/easycompile/base/initialize.rb
91
+ - lib/easycompile/base/menu.rb
92
+ - lib/easycompile/base/meson_and_ninja.rb
93
+ - lib/easycompile/base/misc.rb
94
+ - lib/easycompile/base/opn.rb
95
+ - lib/easycompile/base/process_the_input.rb
96
+ - lib/easycompile/base/remove.rb
97
+ - lib/easycompile/base/reset.rb
98
+ - lib/easycompile/base/run.rb
99
+ - lib/easycompile/compile_as_appdir/compile_as_appdir.rb
100
+ - lib/easycompile/constants/array_possible_archives.rb
101
+ - lib/easycompile/constants/constants.rb
102
+ - lib/easycompile/constants/file_and_directory_constants.rb
103
+ - lib/easycompile/constants/misc.rb
104
+ - lib/easycompile/constants/namespace.rb
105
+ - lib/easycompile/constants/programs_directory.rb
106
+ - lib/easycompile/easycompile/easycompile.rb
107
+ - lib/easycompile/images/logo/EASYCOMPILE_LOGO.png
108
+ - lib/easycompile/project/project.rb
109
+ - lib/easycompile/requires/require_the_easycompile_project.rb
110
+ - lib/easycompile/requires/require_the_toplevel_methods.rb
111
+ - lib/easycompile/toplevel_methods/copy_file.rb
112
+ - lib/easycompile/toplevel_methods/misc.rb
113
+ - lib/easycompile/toplevel_methods/rinstall2.rb
114
+ - lib/easycompile/version/version.rb
115
+ - lib/easycompile/yaml/name_of_the_build_directory.yml
116
+ - test/testing_easycompile.rb
117
+ homepage: https://rubygems.org/gems/easycompile
118
+ licenses:
119
+ - GPL-2.0
120
+ metadata: {}
121
+ post_install_message: "\n You can run this project by issuing:\n\n ecompile\n\n
122
+ \ on the commandline.\n \n See\n\n ecompile --help\n\n for the available
123
+ options.\n\n"
124
+ rdoc_options: []
125
+ require_paths:
126
+ - lib
127
+ required_ruby_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: 2.5.8
132
+ required_rubygems_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: 3.3.12
137
+ requirements: []
138
+ rubygems_version: 3.3.12
139
+ signing_key:
140
+ specification_version: 4
141
+ summary: This project is called easycompile. It allows you to compile a given source
142
+ archive, such as a file like "php-7.2.0.tar.xz". By default this will compile into
143
+ the prefix /usr/. In order for this to work, the file at hand has to exist; in the
144
+ case above, the file php-7.2.0.tar.xz has to exist locally. For more documentation,
145
+ have a look at the link called Documentation on the bottom right side of this webpage.
146
+ test_files: []
147
+ ...