-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
1,908 additions
and
1,557 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,10 +12,10 @@ import ( | |
func main() { | ||
app := cli.NewApp() | ||
app.Name = appname | ||
app.Author = "tanaike [ https://github.com/tanaikech/ggsrun ] " | ||
app.Author = "Tanaike [ https://github.com/tanaikech/ggsrun ] " | ||
app.Email = "[email protected]" | ||
app.Usage = "Executes Google Apps Script (GAS) on Google and Feeds Back Results." | ||
app.Version = "1.3.1" | ||
app.Version = "1.3.2" | ||
app.Commands = []cli.Command{ | ||
{ | ||
Name: "exe1", | ||
|
@@ -221,6 +221,14 @@ func main() { | |
Name: "backup, b", | ||
Usage: "Backup project with project ID you set as a file.", | ||
}, | ||
cli.BoolFlag{ | ||
Name: "rearrange, r", | ||
Usage: "Interactively rearrange scripts in project using your terminal.", | ||
}, | ||
cli.StringFlag{ | ||
Name: "rearrangewithfile, rf", | ||
Usage: "Rearrange scripts in project using a file.", | ||
}, | ||
cli.BoolFlag{ | ||
Name: "jsonparser, j", | ||
Usage: "Display results by JSON parser", | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
ggsrun | ||
===== | ||
|
||
<a name="TOP"></a> | ||
# Update History | ||
|
||
## ggsrun | ||
* v1.0.0 (April 24, 2017) | ||
|
||
Initial release. | ||
|
||
* v1.1.0 (April 28, 2017) | ||
|
||
1. Added a command for updating existing project on Google Drive. The detail information is [here](help/README.md#Update_Project). | ||
2. Added "TotalElapsedTime" for Show File List and Search Files. | ||
3. Some modifications. | ||
|
||
* v1.2.0 (May 19, 2017) | ||
|
||
1. Added a command for retrieving revision files on Google Drive. The detail information is [here](help/README.md#RevisionFile). | ||
2. Some modifications. | ||
|
||
* v1.2.1 (May 28, 2017) | ||
|
||
1. ggsrun.cfg got be able to be read using the environment variable. | ||
- If the environment variable (**``GGSRUN_CFG_PATH``**) is set, ggsrun.cfg is read using it. | ||
- If it is not set, ggsrun.cfg is read from the current working directory. This is as has been the way until now. | ||
- This is the response for some requests. | ||
- This incofmation was added to [here](help/README.md#environmentvariable). | ||
|
||
* v1.2.2 (July 12, 2017) | ||
|
||
1. For Google Docs (spreadsheet, document, slide and drawing), since I noticed that the revision files would not be able to be retrieved using Drive API v3, I modified this using new workaround. | ||
- The new workaround is to use Drive API v2. ``drive.revisions.get`` of Drive API v2 can retrieve not only the revision list, but also the export links. I thought of the use of the export links. This became the new workaround. | ||
- For the files except for Google Docs, the revision files can be retrieved using Drive API v3. | ||
- The usage is [here](help/README.md#RevisionFile). | ||
|
||
I don't know when this workaround will not be able to be used. But if this could not be used, I would like to investigate of other method. | ||
|
||
* v1.3.0 (August 30, 2017) | ||
|
||
1. From this version, [container-bound scripts](https://developers.google.com/apps-script/guides/bound) can be downloaded. The container-bound script is the script created at the script editor on Google Sheets, Docs, or Forms file. The usage is [here](help/README.md#DownloadBoundScript). | ||
- In order to download container-bound scripts, the project ID of container-bound scripts is required. The project ID can be retrieved as follows. | ||
- Open the project. And please operate follows using click. | ||
- -> File | ||
- -> Project properties | ||
- -> Get Script ID (**This is the project ID.**) | ||
1. When a project is downloaded, the filename of HTML file had become ``.gs``. This bug was modified. | ||
|
||
* v1.3.1 (September 15, 2017) | ||
|
||
1. Recently, when scripts on local PC is uploaded to Google Drive as a new project, the time to create on Google became a bit long. (I think that this is due to Google Update.) Under this situation, when the script is uploaded, the timeout error occurs while the new project is created using the script. So the time until timeout of fetch was modified from 10 seconds to 30 seconds. By this, when the script is uploaded, no error occurs and the information of the created project is shown. | ||
- You can create a new project on Google Drive using scripts on local PC. The sample command is ``ggsrun u -f sample.gs1,sample2.gs,sample3.html -pn newprojectname`` | ||
|
||
* v1.3.2 (October 20, 2017) | ||
|
||
1. Updated ggsrun's Install manual (README.md). Since I thought that the manual became too complicated, I separated it to [the simple version](https://github.com/tanaikech/ggsrun/) and [the detail version](https://github.com/tanaikech/ggsrun/help). And also , recently, since Google's specification was updated, about how to deploy API executable and enable APIs for ggsrun's Install manual were updated. | ||
1. From this version, scripts in a project can be rearranged. The rearrangement can be done by interactively on your terminal and/or a configuration file. The usage is [here](help/README.md#rearrangescripts) | ||
- For rearranging scripts, there is one important point. **When scripts in a project is rearranged, version history of scripts is reset once. So if you don't want to reset the version history, before rearranging, please copy the project.** By copying project, the project before rearranging is saved. | ||
|
||
## Server | ||
* v1.0.0 (April 24, 2017) | ||
|
||
Initial release. | ||
|
||
[TOP](#TOP) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
// Package main (scriptrearrange.go) : | ||
// These methods are for rearranging scripts in a project. | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"strconv" | ||
"strings" | ||
"time" | ||
|
||
"github.com/briandowns/spinner" | ||
rearrange "github.com/tanaikech/go-rearrange" | ||
) | ||
|
||
// rearrangeByTerminal : Rearranging scripts in a project using go-rearrange. | ||
func (e *ExecutionContainer) rearrangeByTerminal() { | ||
var baseProject Project | ||
baseProject = *e.Project | ||
var scripts []string | ||
for _, f := range e.Project.Files { | ||
scripts = append(scripts, f.Name) | ||
} | ||
changedIndx, _, err := rearrange.Do(scripts, 3, false, true) | ||
if err != nil { | ||
fmt.Fprintf(os.Stderr, "Error: %v\n", err) | ||
os.Exit(1) | ||
} | ||
var input string | ||
fmt.Printf("## Please be careful.\n") | ||
fmt.Printf("## When the script is rearranged, the revision of script is reset once.\n") | ||
fmt.Printf("Reflect the rearranged result? [y or n] ... ") | ||
if _, err := fmt.Scan(&input); err != nil { | ||
fmt.Fprintf(os.Stderr, "Error: %v\n", err) | ||
os.Exit(1) | ||
} | ||
if input == "y" { | ||
s := spinner.New([]string{"/", "|", "\\", "|"}, 100*time.Millisecond) | ||
s.UpdateSpeed(200 * time.Millisecond) | ||
fmt.Printf("Please wait a moment...") | ||
s.Start() | ||
e.rearrange(baseProject, changedIndx) | ||
s.Stop() | ||
fmt.Printf("\n") | ||
return | ||
} else { | ||
e.Msg = append(e.Msg, "Scripts of project were NOT rearranged.") | ||
return | ||
} | ||
} | ||
|
||
// rearrange : Rearranging scripts in a project using a configuration file. | ||
func (e *ExecutionContainer) rearrangeByFile(data []string) { | ||
var baseProject Project | ||
baseProject = *e.Project | ||
var temp []string | ||
dupChk := map[string]bool{} | ||
for _, e := range data { | ||
if !dupChk[e] { | ||
dupChk[e] = true | ||
temp = append(temp, e) | ||
} | ||
} | ||
if len(temp) == len(data) { | ||
if len(e.Project.Files) == len(data) { | ||
cn := 0 | ||
for i, e := range e.Project.Files { | ||
if e.Name == data[i] { | ||
cn += 1 | ||
} | ||
} | ||
if cn != len(e.Project.Files) { | ||
cn = 0 | ||
var changedIndx []string | ||
for _, f := range data { | ||
for i, g := range e.Project.Files { | ||
if g.Name == f { | ||
cn += 1 | ||
changedIndx = append(changedIndx, strconv.Itoa(i)) | ||
} | ||
} | ||
} | ||
if cn == len(e.Project.Files) { | ||
e.rearrange(baseProject, changedIndx) | ||
return | ||
} else { | ||
e.Msg = append(e.Msg, "Error: Script names of inputted file are different for script names in project.") | ||
return | ||
} | ||
} else { | ||
e.Msg = append(e.Msg, "Error: Order of inputted file are the same to the order in project.") | ||
return | ||
} | ||
} else { | ||
e.Msg = append(e.Msg, "Error: Number of script names of inputted file are different for number of scripts in project.") | ||
return | ||
} | ||
} else { | ||
e.Msg = append(e.Msg, "Error: There are duplicated names in script names of inputted file.") | ||
return | ||
} | ||
} | ||
|
||
// rearrange : Main method for rearranging scripts. | ||
func (e *ExecutionContainer) rearrange(baseProject Project, changedIndx []string) { | ||
var temp1 Project | ||
const layout = "20060102_150405_" | ||
t := time.Now() | ||
dummyScript := &File{ | ||
Name: "Dummy_" + t.Format(layout) + t.AddDate(0, 0, 2).Weekday().String(), | ||
Source: "// This is a dummy.", | ||
Type: "server_js", | ||
} | ||
temp1.Files = append(temp1.Files, *dummyScript) | ||
e.Project = &temp1 | ||
e.projectUpdate() | ||
var temp2 Project | ||
for i, e := range changedIndx { | ||
idx, _ := strconv.Atoi(e) | ||
temp2.Files = append(temp2.Files, baseProject.Files[idx]) | ||
temp2.Files[i].ID = "" | ||
} | ||
e.Project = &temp2 | ||
e.projectUpdate() | ||
var from, to []string | ||
for i, f := range e.Project.Files { | ||
from = append(from, baseProject.Files[i].Name) | ||
to = append(to, f.Name) | ||
} | ||
msg := fmt.Sprintf("Scripts in project were rearranged from [%s] to [%s].", strings.Join(from, ", "), strings.Join(to, ", ")) | ||
e.Msg = []string{msg} | ||
} |