start_project 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,13 +4,17 @@ require 'open-uri'
4
4
  require 'zip/zip'
5
5
 
6
6
  module StartProject
7
+
8
+ # Manages the downloading and unzipping the file
7
9
  class Downloader
10
+ # Downloads the relevant zip and stores it in a file called temp.zip
8
11
  def self.download(source)
9
12
  open("temp.zip",'wb') do |fo|
10
13
  fo.print open(source).read
11
14
  end
12
15
  end
13
16
 
17
+ # Unzip the file into a directory specified in the intitial call to the app via the -n (--name option)
14
18
  def self.unzip_file (destination)
15
19
  orig_name = ""
16
20
  Zip::ZipFile.open("temp.zip") { |zip_file|
@@ -1,11 +1,14 @@
1
1
  require 'optparse'
2
2
  require 'yaml'
3
-
3
+ # This module encapsulates all the functionality in the module
4
+ # It has 3 classes
5
+ # * Options
6
+ # * Downloader
7
+ # * Runner
4
8
  module StartProject
9
+ # Read the arguments from the command line and parse them out
5
10
  class Options
6
11
 
7
- # Read the arguments from the command line and parse them out
8
-
9
12
  # project_uri stores the url of the framework
10
13
  attr_reader :project_uri
11
14
 
@@ -16,7 +19,6 @@ module StartProject
16
19
  attr_reader :frameworks
17
20
 
18
21
 
19
- # = initialize
20
22
  # Initializes the options object, loads the config.yaml that stores all the frameworks available
21
23
  # and sets a default framework: html5 boilerplate.
22
24
  # Finally, it calls the parse method.
@@ -50,6 +52,8 @@ module StartProject
50
52
 
51
53
  opts.on("-h", "--help", "Show this message") do
52
54
  puts opts
55
+ puts 'Available framework options are as follows:'
56
+ @frameworks.each_key{|key| puts key.to_s}
53
57
  exit
54
58
  end
55
59
 
@@ -1,11 +1,14 @@
1
1
  require 'start_project/downloader'
2
2
  require 'start_project/options'
3
3
  module StartProject
4
+ # The Runner class is the entry point to the app
4
5
  class Runner
6
+ # Reads the arguments from the command line and creates a new option object.
5
7
  def initialize(argv)
6
8
  @options = Options.new(argv)
7
9
  end
8
10
 
11
+ # The run method is called from the executable. Two static methods download and unzip_file are called, these are the main methods in the gem.
9
12
  def run
10
13
  Downloader.download(@options.project_uri)
11
14
  Downloader.unzip_file(@options.project_name)
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 7
9
- version: 0.0.7
8
+ - 8
9
+ version: 0.0.8
10
10
  platform: ruby
11
11
  authors:
12
12
  - Aonghus Flynn
@@ -29,17 +29,20 @@ dependencies:
29
29
  version: "0"
30
30
  type: :runtime
31
31
  version_requirements: *id001
32
- description: |
32
+ description: |+
33
33
  The start_project gem is a simple way of downloading the latest version of your favourite framework.
34
34
 
35
35
  It's very easy to use: simply install the gem as normal with gem install start_project and then run the command line tool ProjectStart --type {framework} --name {name of project} and it will pull the latest version of the framework and extract it to your machine with the name you provided.
36
36
 
37
- Currently, there are only 2 frameworks: html 5 boilerplate and bootstrap, but I'll be adding more in the future.
37
+ Currently, there are 5 frameworks: html 5 boilerplate, bootstrap, 960 grid, 320 and up, and mass
38
+ gs960
39
+ andup320
40
+ mass, but I'll be adding more in the future.
38
41
 
39
42
  You can fork the source on github here: https://github.com/aonghusflynn/ProjectStart
40
43
 
41
44
  You can find my blog here: http://www.aonghusflynn.com
42
-
45
+
43
46
  email: developer@aonghusflynn.com
44
47
  executables:
45
48
  - ProjectStart